hide offline chums

This commit is contained in:
Stephen Dranger 2011-02-24 17:46:09 -06:00
parent b3e99df069
commit 45827b45d1
3 changed files with 51 additions and 11 deletions

View file

@ -510,6 +510,9 @@ class PesterOptions(QtGui.QDialog):
self.tabcheck = QtGui.QCheckBox("Tabbed Conversations", self) self.tabcheck = QtGui.QCheckBox("Tabbed Conversations", self)
if self.config.tabs(): if self.config.tabs():
self.tabcheck.setChecked(True) self.tabcheck.setChecked(True)
self.hideOffline = QtGui.QCheckBox("Hide Offline Chums", self)
if self.config.hideOfflineChums():
self.hideOffline.setChecked(True)
self.soundcheck = QtGui.QCheckBox("Sounds On", self) self.soundcheck = QtGui.QCheckBox("Sounds On", self)
if self.config.soundOn(): if self.config.soundOn():
@ -528,6 +531,7 @@ class PesterOptions(QtGui.QDialog):
layout_0 = QtGui.QVBoxLayout() layout_0 = QtGui.QVBoxLayout()
layout_0.addWidget(self.tabcheck) layout_0.addWidget(self.tabcheck)
layout_0.addWidget(self.soundcheck) layout_0.addWidget(self.soundcheck)
layout_0.addWidget(self.hideOffline)
layout_0.addLayout(layout_2) layout_0.addLayout(layout_2)
self.setLayout(layout_0) self.setLayout(layout_0)

View file

@ -1 +1 @@
{"tabs": true, "soundon": true, "server": "irc.tymoon.eu", "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "confusedTransient", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "obliviousCrafter", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead"], "defaultprofile": "ghostDunk", "block": []} {"hideOfflineChums": true, "tabs": true, "soundon": true, "server": "irc.tymoon.eu", "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "confusedTransient", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "obliviousCrafter", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead"], "defaultprofile": "ghostDunk", "block": []}

View file

@ -374,12 +374,8 @@ class chumArea(RightClickList):
self.mainwindow = parent self.mainwindow = parent
theme = self.mainwindow.theme theme = self.mainwindow.theme
self.chums = chums self.chums = chums
for c in self.chums: if not self.mainwindow.config.hideOfflineChums():
chandle = c.handle self.showAllChums()
if not self.findItems(chandle, QtCore.Qt.MatchFlags(0)):
chumLabel = chumListing(c, self.mainwindow)
self.addItem(chumLabel)
self.optionsMenu = QtGui.QMenu(self) self.optionsMenu = QtGui.QMenu(self)
self.pester = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self) self.pester = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self)
self.connect(self.pester, QtCore.SIGNAL('triggered()'), self.connect(self.pester, QtCore.SIGNAL('triggered()'),
@ -407,9 +403,41 @@ class chumArea(RightClickList):
def getChums(self, handle): def getChums(self, handle):
chums = self.findItems(handle, QtCore.Qt.MatchFlags(0)) chums = self.findItems(handle, QtCore.Qt.MatchFlags(0))
return chums return chums
def showAllChums(self):
for c in self.chums:
chandle = c.handle
if not self.findItems(chandle, QtCore.Qt.MatchFlags(0)):
chumLabel = chumListing(c, self.mainwindow)
self.addItem(chumLabel)
self.sortItems()
def hideOfflineChums(self):
i = 0
listing = self.item(i)
while listing is not None:
if listing.chum.mood.name() == "offline":
self.takeItem(i)
else:
i += 1
listing = self.item(i)
self.sortItems()
def updateMood(self, handle, mood): def updateMood(self, handle, mood):
hideoff = self.mainwindow.config.hideOfflineChums()
chums = self.getChums(handle) chums = self.getChums(handle)
oldmood = None oldmood = None
if hideoff:
if mood.name() != "offline" and \
len(chums) == 0 and \
handle in [p.handle for p in self.chums]:
newLabel = chumListing([p for p in self.chums if p.handle == handle][0], self.mainwindow)
self.addItem(newLabel)
self.sortItems()
chums = [newLabel]
elif mood.name() == "offline" and \
len(chums) > 0:
for c in chums:
self.takeItem(self.row(c))
chums = []
for c in chums: for c in chums:
oldmood = c.mood oldmood = c.mood
c.setMood(mood) c.setMood(mood)
@ -596,6 +624,7 @@ class PesterMoodHandler(QtCore.QObject):
b.raise_() b.raise_()
@QtCore.pyqtSlot(int) @QtCore.pyqtSlot(int)
def updateMood(self, m): def updateMood(self, m):
# update MY mood
oldmood = self.mainwindow.profile().mood oldmood = self.mainwindow.profile().mood
try: try:
oldbutton = self.buttons[oldmood.value()] oldbutton = self.buttons[oldmood.value()]
@ -636,6 +665,7 @@ class PesterMoodButton(QtGui.QPushButton):
self.setStyleSheet(self.unselectedSheet) self.setStyleSheet(self.unselectedSheet)
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def updateMood(self): def updateMood(self):
# updates OUR mood
self.moodUpdated.emit(self.mood.value()) self.moodUpdated.emit(self.mood.value())
moodUpdated = QtCore.pyqtSignal(int) moodUpdated = QtCore.pyqtSignal(int)
@ -775,9 +805,6 @@ class PesterWindow(MovingWindow):
self.namesdb = {} self.namesdb = {}
self.chumdb = PesterProfileDB() self.chumdb = PesterProfileDB()
if self.config.hideOfflineChums():
chums = []
else:
chums = [PesterProfile(c, chumdb=self.chumdb) for c in set(self.config.chums())] chums = [PesterProfile(c, chumdb=self.chumdb) for c in set(self.config.chums())]
self.chumList = chumArea(chums, self) self.chumList = chumArea(chums, self)
self.connect(self.chumList, self.connect(self.chumList,
@ -910,6 +937,7 @@ class PesterWindow(MovingWindow):
self.chumdb.setColor(handle, color) self.chumdb.setColor(handle, color)
def updateMood(self, handle, mood): def updateMood(self, handle, mood):
# updates OTHER chums' moods
oldmood = self.chumList.updateMood(handle, mood) oldmood = self.chumList.updateMood(handle, mood)
if self.convos.has_key(handle): if self.convos.has_key(handle):
self.convos[handle].updateMood(mood, old=oldmood) self.convos[handle].updateMood(mood, old=oldmood)
@ -1519,6 +1547,14 @@ class PesterWindow(MovingWindow):
self.memos = newmemos self.memos = newmemos
# save options # save options
self.config.set("tabs", tabsetting) self.config.set("tabs", tabsetting)
# hidden chums
chumsetting = self.optionmenu.hideOffline.isChecked()
curchum = self.config.hideOfflineChums()
if curchum and not chumsetting:
self.chumList.showAllChums()
elif chumsetting and not curchum:
self.chumList.hideOfflineChums()
self.config.set("hideOfflineChums", chumsetting)
# sound # sound
soundsetting = self.optionmenu.soundcheck.isChecked() soundsetting = self.optionmenu.soundcheck.isChecked()
self.config.set("soundon", soundsetting) self.config.set("soundon", soundsetting)