diff --git a/convo.py b/convo.py index 6d6ebf3..a74c9a5 100644 --- a/convo.py +++ b/convo.py @@ -405,7 +405,6 @@ class PesterText(QtGui.QTextEdit): if event.modifiers() == QtCore.Qt.ControlModifier: QtGui.QApplication.clipboard().setText(url) else: - if not unicode(url).startswith("http"): url = "http://" + url QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode)) QtGui.QTextEdit.mousePressEvent(self, event) def mouseMoveEvent(self, event): diff --git a/menus.py b/menus.py index ec38778..3cda998 100644 --- a/menus.py +++ b/menus.py @@ -1466,6 +1466,11 @@ class PesterUserlist(QtGui.QDialog): self.setStyleSheet(self.theme["main/defaultwindow/style"]) self.resize(200, 600) + self.searchbox = QtGui.QLineEdit(self) + #self.searchbox.setStyleSheet(theme["convo/input/style"]) # which style is better? + self.searchbox.setPlaceholderText("Search") + self.connect(self.searchbox, QtCore.SIGNAL("textChanged(QString)"), self, QtCore.SLOT("updateUsers()")) + self.label = QtGui.QLabel("USERLIST") self.userarea = RightClickList(self) self.userarea.setStyleSheet(self.theme["main/chums/style"]) @@ -1487,6 +1492,7 @@ class PesterUserlist(QtGui.QDialog): layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(self.label) + layout_0.addWidget(self.searchbox) layout_0.addWidget(self.userarea) layout_0.addWidget(self.ok) @@ -1505,9 +1511,10 @@ class PesterUserlist(QtGui.QDialog): names = self.mainwindow.namesdb["#pesterchum"] self.userarea.clear() for n in names: - item = QtGui.QListWidgetItem(n) - item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) - self.userarea.addItem(item) + if str(self.searchbox.text()) == "" or n.lower().find(str(self.searchbox.text()).lower()) != -1: + item = QtGui.QListWidgetItem(n) + item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) + self.userarea.addItem(item) self.userarea.sortItems() @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) def updateUserPresent(self, handle, channel, update): @@ -1518,7 +1525,8 @@ class PesterUserlist(QtGui.QDialog): elif update == "left" and c == "#pesterchum": self.delUser(h) elif update == "join" and c == "#pesterchum": - self.addUser(h) + if str(self.searchbox.text()) == "" or n.lower().find(str(self.searchbox.text()).lower()) != -1: + self.addUser(h) def addUser(self, name): item = QtGui.QListWidgetItem(name) item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) diff --git a/parsetools.py b/parsetools.py index 002d428..ec6eedd 100644 --- a/parsetools.py +++ b/parsetools.py @@ -12,7 +12,7 @@ _ctag_begin = re.compile(r'(?i)') _gtag_begin = re.compile(r'(?i)') _ctag_end = re.compile(r'(?i)') _ctag_rgb = re.compile(r'\d+,\d+,\d+') -_urlre = re.compile(r"(?i)https?://[^\s]+") +_urlre = re.compile(r"(?i)(?:^|(?<=\s))(?:(?:https?|ftp)://|magnet:)[^\s]+") _url2re = re.compile(r"(?i)www\.[^\s]+") _memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)") _handlere = re.compile(r"(\s|^)(@[A-Za-z0-9_]+)") @@ -128,6 +128,9 @@ class hyperlink(object): return "[url]%s[/url]" % (self.string) else: return self.string +class hyperlink_lazy(hyperlink): + def __init__(self, string): + self.string = "http://" + string class imagelink(object): def __init__(self, string, img): self.string = string @@ -183,7 +186,7 @@ def lexMessage(string): (colorEnd, _ctag_end), (formatBegin, _format_begin), (formatEnd, _format_end), (imagelink, _imgre), - (hyperlink, _urlre), (hyperlink, _url2re), + (hyperlink, _urlre), (hyperlink_lazy, _url2re), (memolex, _memore), (chumhandlelex, _handlere), (smiley, _smilere)]