Sort memo user list alphabetically, ops and voices first
This commit is contained in:
parent
fd6f267180
commit
7ab14cdc2d
1 changed files with 15 additions and 0 deletions
15
memos.py
15
memos.py
|
@ -558,6 +558,17 @@ class PesterMemo(PesterConvo):
|
||||||
icon = PesterIcon(self.mainwindow.theme["memos/voice/icon"])
|
icon = PesterIcon(self.mainwindow.theme["memos/voice/icon"])
|
||||||
item.setIcon(icon)
|
item.setIcon(icon)
|
||||||
self.userlist.addItem(item)
|
self.userlist.addItem(item)
|
||||||
|
self.sortUsers()
|
||||||
|
|
||||||
|
def sortUsers(self):
|
||||||
|
users = []
|
||||||
|
listing = self.userlist.item(0)
|
||||||
|
while listing is not None:
|
||||||
|
users.append(self.userlist.takeItem(0))
|
||||||
|
listing = self.userlist.item(0)
|
||||||
|
users.sort(key=lambda x: ((0 if x.op else 1), (0 if x.voice else 1), x.text()))
|
||||||
|
for u in users:
|
||||||
|
self.userlist.addItem(u)
|
||||||
|
|
||||||
def timeUpdate(self, handle, cmd):
|
def timeUpdate(self, handle, cmd):
|
||||||
window = self.mainwindow
|
window = self.mainwindow
|
||||||
|
@ -764,6 +775,7 @@ class PesterMemo(PesterConvo):
|
||||||
self.userlist.optionsMenu.addAction(self.opAction)
|
self.userlist.optionsMenu.addAction(self.opAction)
|
||||||
self.userlist.optionsMenu.addAction(self.voiceAction)
|
self.userlist.optionsMenu.addAction(self.voiceAction)
|
||||||
self.userlist.optionsMenu.addAction(self.banuserAction)
|
self.userlist.optionsMenu.addAction(self.banuserAction)
|
||||||
|
self.sortUsers()
|
||||||
elif update == "-o":
|
elif update == "-o":
|
||||||
self.mainwindow.channelNames.emit(self.channel)
|
self.mainwindow.channelNames.emit(self.channel)
|
||||||
if self.mainwindow.config.opvoiceMessages():
|
if self.mainwindow.config.opvoiceMessages():
|
||||||
|
@ -798,6 +810,7 @@ class PesterMemo(PesterConvo):
|
||||||
self.userlist.optionsMenu.removeAction(self.opAction)
|
self.userlist.optionsMenu.removeAction(self.opAction)
|
||||||
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
||||||
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
||||||
|
self.sortUsers()
|
||||||
elif update == "+v":
|
elif update == "+v":
|
||||||
if self.mainwindow.config.opvoiceMessages():
|
if self.mainwindow.config.opvoiceMessages():
|
||||||
chum = PesterProfile(h)
|
chum = PesterProfile(h)
|
||||||
|
@ -824,6 +837,7 @@ class PesterMemo(PesterConvo):
|
||||||
if not c.op:
|
if not c.op:
|
||||||
icon = PesterIcon(self.mainwindow.theme["memos/voice/icon"])
|
icon = PesterIcon(self.mainwindow.theme["memos/voice/icon"])
|
||||||
c.setIcon(icon)
|
c.setIcon(icon)
|
||||||
|
self.sortUsers()
|
||||||
elif update == "-v":
|
elif update == "-v":
|
||||||
if self.mainwindow.config.opvoiceMessages():
|
if self.mainwindow.config.opvoiceMessages():
|
||||||
chum = PesterProfile(h)
|
chum = PesterProfile(h)
|
||||||
|
@ -853,6 +867,7 @@ class PesterMemo(PesterConvo):
|
||||||
else:
|
else:
|
||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
c.setIcon(icon)
|
c.setIcon(icon)
|
||||||
|
self.sortUsers()
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def addChumSlot(self):
|
def addChumSlot(self):
|
||||||
|
|
Loading…
Reference in a new issue