Re-add: Fix groups stuff to work with online numbers
This commit is contained in:
parent
339cf975ae
commit
45e6fe9e19
1 changed files with 24 additions and 6 deletions
|
@ -611,7 +611,10 @@ class chumArea(RightClickTree):
|
||||||
def moveGroupMenu(self):
|
def moveGroupMenu(self):
|
||||||
currentGroup = self.currentItem()
|
currentGroup = self.currentItem()
|
||||||
if currentGroup:
|
if currentGroup:
|
||||||
currentGroup = currentGroup.parent().text(0)
|
text = str(currentGroup.parent().text(0))
|
||||||
|
if text.rfind(" ") != -1:
|
||||||
|
text = text[0:text.rfind(" ")]
|
||||||
|
currentGroup = text
|
||||||
self.moveMenu.clear()
|
self.moveMenu.clear()
|
||||||
actGroup = QtGui.QActionGroup(self)
|
actGroup = QtGui.QActionGroup(self)
|
||||||
|
|
||||||
|
@ -629,8 +632,12 @@ class chumArea(RightClickTree):
|
||||||
if event.reason() == QtGui.QContextMenuEvent.Mouse:
|
if event.reason() == QtGui.QContextMenuEvent.Mouse:
|
||||||
listing = self.itemAt(event.pos())
|
listing = self.itemAt(event.pos())
|
||||||
self.setCurrentItem(listing)
|
self.setCurrentItem(listing)
|
||||||
if self.currentItem().text(0) == "Chums" or \
|
text = str(self.currentItem().text(0))
|
||||||
self.currentItem().text(0) in self.groups:
|
if text.rfind(" ") != -1:
|
||||||
|
text = text[0:text.rfind(" ")]
|
||||||
|
if text == "Chums":
|
||||||
|
return
|
||||||
|
elif text in self.groups:
|
||||||
self.groupoptionsmenu()
|
self.groupoptionsmenu()
|
||||||
else:
|
else:
|
||||||
self.chumoptionsmenu()
|
self.chumoptionsmenu()
|
||||||
|
@ -673,7 +680,10 @@ class chumArea(RightClickTree):
|
||||||
def showAllGroups(self):
|
def showAllGroups(self):
|
||||||
curgroups = []
|
curgroups = []
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
curgroups.append(self.topLevelItem(i).text(0))
|
text = str(self.topLevelItem(i).text(0))
|
||||||
|
if text.rfind(" ") != -1:
|
||||||
|
text = text[0:text.rfind(" ")]
|
||||||
|
curgroups.append(text)
|
||||||
if "Chums" not in curgroups:
|
if "Chums" not in curgroups:
|
||||||
child_1 = QtGui.QTreeWidgetItem(["Chums"])
|
child_1 = QtGui.QTreeWidgetItem(["Chums"])
|
||||||
self.addTopLevelItem(child_1)
|
self.addTopLevelItem(child_1)
|
||||||
|
@ -907,7 +917,10 @@ class chumArea(RightClickTree):
|
||||||
index = self.indexOfTopLevelItem(currentGroup)
|
index = self.indexOfTopLevelItem(currentGroup)
|
||||||
if index != -1:
|
if index != -1:
|
||||||
expanded = currentGroup.isExpanded()
|
expanded = currentGroup.isExpanded()
|
||||||
self.mainwindow.config.delGroup(str(currentGroup.text(0)))
|
text = str(currentGroup.text(0))
|
||||||
|
if text.rfind(" ") != -1:
|
||||||
|
text = text[0:text.rfind(" ")]
|
||||||
|
self.mainwindow.config.delGroup(text)
|
||||||
self.mainwindow.config.addGroup(gname, expanded)
|
self.mainwindow.config.addGroup(gname, expanded)
|
||||||
gTemp = self.mainwindow.config.getGroups()
|
gTemp = self.mainwindow.config.getGroups()
|
||||||
self.groups = [g[0] for g in gTemp]
|
self.groups = [g[0] for g in gTemp]
|
||||||
|
@ -916,13 +929,18 @@ class chumArea(RightClickTree):
|
||||||
currentGroup.child(i).chum.group = gname
|
currentGroup.child(i).chum.group = gname
|
||||||
self.mainwindow.chumdb.setGroup(currentGroup.child(i).chum.handle, gname)
|
self.mainwindow.chumdb.setGroup(currentGroup.child(i).chum.handle, gname)
|
||||||
currentGroup.setText(0, gname)
|
currentGroup.setText(0, gname)
|
||||||
|
if self.mainwindow.config.showOnlineNumbers():
|
||||||
|
self.showOnlineNumbers()
|
||||||
self.renamegroupdialog = None
|
self.renamegroupdialog = None
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def removeGroup(self):
|
def removeGroup(self):
|
||||||
currentGroup = self.currentItem()
|
currentGroup = self.currentItem()
|
||||||
if not currentGroup:
|
if not currentGroup:
|
||||||
return
|
return
|
||||||
self.mainwindow.config.delGroup(currentGroup.text(0))
|
text = str(currentGroup.text(0))
|
||||||
|
if text.rfind(" ") != -1:
|
||||||
|
text = text[0:text.rfind(" ")]
|
||||||
|
self.mainwindow.config.delGroup(text)
|
||||||
gTemp = self.mainwindow.config.getGroups()
|
gTemp = self.mainwindow.config.getGroups()
|
||||||
self.groups = [g[0] for g in gTemp]
|
self.groups = [g[0] for g in gTemp]
|
||||||
self.openGroups = [g[1] for g in gTemp]
|
self.openGroups = [g[1] for g in gTemp]
|
||||||
|
|
Loading…
Reference in a new issue