Update online numbers on drag-drop
This commit is contained in:
parent
668a87af7e
commit
b1fb029e66
1 changed files with 28 additions and 25 deletions
|
@ -568,6 +568,8 @@ class chumArea(RightClickTree):
|
||||||
self.mainwindow.chumdb.setGroup(chumLabel.chum.handle, group)
|
self.mainwindow.chumdb.setGroup(chumLabel.chum.handle, group)
|
||||||
self.takeItem(chumLabel)
|
self.takeItem(chumLabel)
|
||||||
self.addItem(chumLabel)
|
self.addItem(chumLabel)
|
||||||
|
if self.mainwindow.config.showOnlineNumbers():
|
||||||
|
self.showOnlineNumbers()
|
||||||
|
|
||||||
def chumoptionsmenu(self):
|
def chumoptionsmenu(self):
|
||||||
self.optionsMenu = self.chumoptions
|
self.optionsMenu = self.chumoptions
|
||||||
|
@ -651,31 +653,32 @@ class chumArea(RightClickTree):
|
||||||
if self.openGroups[i]:
|
if self.openGroups[i]:
|
||||||
child_1.setExpanded(True)
|
child_1.setExpanded(True)
|
||||||
def showOnlineNumbers(self):
|
def showOnlineNumbers(self):
|
||||||
self.hideOnlineNumbers()
|
if hasattr(self, 'groups'):
|
||||||
totals = {'Chums': 0}
|
self.hideOnlineNumbers()
|
||||||
online = {'Chums': 0}
|
totals = {'Chums': 0}
|
||||||
for g in self.groups:
|
online = {'Chums': 0}
|
||||||
totals[str(g)] = 0
|
for g in self.groups:
|
||||||
online[str(g)] = 0
|
totals[str(g)] = 0
|
||||||
for c in self.chums:
|
online[str(g)] = 0
|
||||||
yes = c.mood.name() != "offline"
|
for c in self.chums:
|
||||||
if c.group == "Chums":
|
yes = c.mood.name() != "offline"
|
||||||
totals[str(c.group)] = totals[str(c.group)]+1
|
if c.group == "Chums":
|
||||||
if yes:
|
totals[str(c.group)] = totals[str(c.group)]+1
|
||||||
online[str(c.group)] = online[str(c.group)]+1
|
if yes:
|
||||||
elif c.group in totals:
|
online[str(c.group)] = online[str(c.group)]+1
|
||||||
totals[str(c.group)] = totals[str(c.group)]+1
|
elif c.group in totals:
|
||||||
if yes:
|
totals[str(c.group)] = totals[str(c.group)]+1
|
||||||
online[str(c.group)] = online[str(c.group)]+1
|
if yes:
|
||||||
else:
|
online[str(c.group)] = online[str(c.group)]+1
|
||||||
totals["Chums"] = totals["Chums"]+1
|
else:
|
||||||
if yes:
|
totals["Chums"] = totals["Chums"]+1
|
||||||
online["Chums"] = online["Chums"]+1
|
if yes:
|
||||||
for i in range(self.topLevelItemCount()):
|
online["Chums"] = online["Chums"]+1
|
||||||
text = str(self.topLevelItem(i).text(0))
|
for i in range(self.topLevelItemCount()):
|
||||||
if text.rfind(" ") != -1:
|
text = str(self.topLevelItem(i).text(0))
|
||||||
text = text[0:text.rfind(" ")]
|
if text.rfind(" ") != -1:
|
||||||
self.topLevelItem(i).setText(0, "%s (%i/%i)" % (text, online[text], totals[text]))
|
text = text[0:text.rfind(" ")]
|
||||||
|
self.topLevelItem(i).setText(0, "%s (%i/%i)" % (text, online[text], totals[text]))
|
||||||
def hideOnlineNumbers(self):
|
def hideOnlineNumbers(self):
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
text = str(self.topLevelItem(i).text(0))
|
text = str(self.topLevelItem(i).text(0))
|
||||||
|
|
Loading…
Reference in a new issue