redesigned blocking
This commit is contained in:
parent
803dbd024c
commit
d815822e66
5 changed files with 228 additions and 64 deletions
|
@ -1 +1 @@
|
||||||
{"tabs": true, "chums": ["aquaMarinist", "gardenGnostic", "gamblingGenocider", "schlagzeugGator", "marineAquist", "unknownTraveler", "tentacleTherapist", "macruralAlchemist", "fireSwallow", "vaginalEngineer", "mechanicalSpectacle"], "defaultprofile": "ghostDunk"}
|
{"tabs": true, "chums": ["aquaMarinist", "marineAquist", "unknownTraveler", "tentacleTherapist", "macruralAlchemist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "fireSwallow", "gardenGnostic", "superGhost"], "defaultprofile": "ghostDunk", "block": []}
|
272
pesterchum.py
272
pesterchum.py
|
@ -171,7 +171,7 @@ class PesterLog(object):
|
||||||
del self.convos[handle]
|
del self.convos[handle]
|
||||||
def close(self):
|
def close(self):
|
||||||
for h in self.convos.keys():
|
for h in self.convos.keys():
|
||||||
self.close(h)
|
self.convos[h].close()
|
||||||
|
|
||||||
class PesterProfileDB(dict):
|
class PesterProfileDB(dict):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -206,6 +206,10 @@ class PesterProfileDB(dict):
|
||||||
dict.__setitem__(self, key, val)
|
dict.__setitem__(self, key, val)
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
class PesterProfileList(list):
|
||||||
|
def __init__(self, l):
|
||||||
|
self.extend(l)
|
||||||
|
|
||||||
class PesterProfile(object):
|
class PesterProfile(object):
|
||||||
def __init__(self, handle, color=None, mood=Mood("offline"), chumdb=None):
|
def __init__(self, handle, color=None, mood=Mood("offline"), chumdb=None):
|
||||||
self.handle = handle
|
self.handle = handle
|
||||||
|
@ -231,8 +235,8 @@ class PesterProfile(object):
|
||||||
return (self.handle, {"handle": self.handle,
|
return (self.handle, {"handle": self.handle,
|
||||||
"mood": self.mood.name(),
|
"mood": self.mood.name(),
|
||||||
"color": unicode(self.color.name())})
|
"color": unicode(self.color.name())})
|
||||||
def blocked(self, profile):
|
def blocked(self, config):
|
||||||
return self.handle in profile.getBlocklist()
|
return self.handle in config.getBlocklist()
|
||||||
|
|
||||||
def pestermsg(self, otherchum, syscolor, verb):
|
def pestermsg(self, otherchum, syscolor, verb):
|
||||||
return "<c=%s>-- %s <c=%s>[%s]</c> %s %s <c=%s>[%s]</c> at %s --</c>" % (syscolor.name(), self.handle, self.colorhtml(), self.initials(), verb, otherchum.handle, otherchum.colorhtml(), otherchum.initials(), datetime.now().strftime("%H:%M"))
|
return "<c=%s>-- %s <c=%s>[%s]</c> %s %s <c=%s>[%s]</c> at %s --</c>" % (syscolor.name(), self.handle, self.colorhtml(), self.initials(), verb, otherchum.handle, otherchum.colorhtml(), otherchum.initials(), datetime.now().strftime("%H:%M"))
|
||||||
|
@ -342,8 +346,25 @@ class userConfig(object):
|
||||||
newchums = self.config['chums'] + [chum.handle]
|
newchums = self.config['chums'] + [chum.handle]
|
||||||
self.set("chums", newchums)
|
self.set("chums", newchums)
|
||||||
def removeChum(self, chum):
|
def removeChum(self, chum):
|
||||||
newchums = [c for c in self.config['chums'] if c != chum.handle]
|
if type(chum) is PesterProfile:
|
||||||
|
handle = chum.handle
|
||||||
|
else:
|
||||||
|
handle = chum
|
||||||
|
newchums = [c for c in self.config['chums'] if c != handle]
|
||||||
self.set("chums", newchums)
|
self.set("chums", newchums)
|
||||||
|
def getBlocklist(self):
|
||||||
|
if not self.config.has_key('block'):
|
||||||
|
self.set('block', [])
|
||||||
|
return self.config['block']
|
||||||
|
def addBlocklist(self, handle):
|
||||||
|
l = self.getBlocklist()
|
||||||
|
if handle not in l:
|
||||||
|
l.append(handle)
|
||||||
|
self.set('block', l)
|
||||||
|
def delBlocklist(self, handle):
|
||||||
|
l = self.getBlocklist()
|
||||||
|
l.pop(l.index(handle))
|
||||||
|
self.set('block', l)
|
||||||
def set(self, item, setting):
|
def set(self, item, setting):
|
||||||
self.config[item] = setting
|
self.config[item] = setting
|
||||||
fp = open("pesterchum.js", 'w')
|
fp = open("pesterchum.js", 'w')
|
||||||
|
@ -389,18 +410,6 @@ class userProfile(object):
|
||||||
QtGui.QColor(self.userprofile["color"]),
|
QtGui.QColor(self.userprofile["color"]),
|
||||||
Mood(self.theme["main/defaultmood"]))
|
Mood(self.theme["main/defaultmood"]))
|
||||||
self.quirks = pesterQuirks(self.userprofile["quirks"])
|
self.quirks = pesterQuirks(self.userprofile["quirks"])
|
||||||
def getBlocklist(self):
|
|
||||||
if not self.userprofile.has_key('block'):
|
|
||||||
self.userprofile['block'] = []
|
|
||||||
self.save()
|
|
||||||
return self.userprofile['block']
|
|
||||||
def addBlocklist(self, handle):
|
|
||||||
if handle not in self.userprofile['block']:
|
|
||||||
self.userprofile['block'].append(handle)
|
|
||||||
self.save()
|
|
||||||
def delBlocklist(self, handle):
|
|
||||||
self.userprofile['block'].pop(self.userprofile['block'].index(handle))
|
|
||||||
self.save()
|
|
||||||
def setMood(self, mood):
|
def setMood(self, mood):
|
||||||
self.chat.mood = mood
|
self.chat.mood = mood
|
||||||
def setTheme(self, theme):
|
def setTheme(self, theme):
|
||||||
|
@ -780,23 +789,14 @@ class chumListing(QtGui.QListWidgetItem):
|
||||||
self.updateMood()
|
self.updateMood()
|
||||||
def setColor(self, color):
|
def setColor(self, color):
|
||||||
self.chum.color = color
|
self.chum.color = color
|
||||||
def updateBlocked(self):
|
|
||||||
self.setIcon(QtGui.QIcon(self.mainwindow.theme["main/chums/moods/blocked/icon"]))
|
|
||||||
self.setTextColor(QtGui.QColor(self.mainwindow.theme["main/chums/moods/blocked/color"]))
|
|
||||||
def updateMood(self, unblock=False):
|
def updateMood(self, unblock=False):
|
||||||
mood = self.chum.mood
|
mood = self.chum.mood
|
||||||
self.mood = mood
|
self.mood = mood
|
||||||
if self.chum.blocked(self.mainwindow.userprofile) and not unblock:
|
self.setIcon(self.mood.icon(self.mainwindow.theme))
|
||||||
self.updateBlocked()
|
self.setTextColor(QtGui.QColor(self.mainwindow.theme["main/chums/moods"][self.mood.name()]["color"]))
|
||||||
else:
|
|
||||||
self.setIcon(self.mood.icon(self.mainwindow.theme))
|
|
||||||
self.setTextColor(QtGui.QColor(self.mainwindow.theme["main/chums/moods"][self.mood.name()]["color"]))
|
|
||||||
def changeTheme(self, theme):
|
def changeTheme(self, theme):
|
||||||
if self.chum.blocked(self.mainwindow.userprofile):
|
self.setIcon(self.mood.icon(theme))
|
||||||
self.updateBlocked()
|
self.setTextColor(QtGui.QColor(theme["main/chums/moods"][self.mood.name()]["color"]))
|
||||||
else:
|
|
||||||
self.setIcon(self.mood.icon(theme))
|
|
||||||
self.setTextColor(QtGui.QColor(theme["main/chums/moods"][self.mood.name()]["color"]))
|
|
||||||
def __lt__(self, cl):
|
def __lt__(self, cl):
|
||||||
h1 = self.handle.lower()
|
h1 = self.handle.lower()
|
||||||
h2 = cl.handle.lower()
|
h2 = cl.handle.lower()
|
||||||
|
@ -831,13 +831,6 @@ class chumArea(QtGui.QListWidget):
|
||||||
self.optionsMenu.addAction(self.blockchum)
|
self.optionsMenu.addAction(self.blockchum)
|
||||||
self.optionsMenu.addAction(self.removechum)
|
self.optionsMenu.addAction(self.removechum)
|
||||||
|
|
||||||
self.blockedMenu = QtGui.QMenu(self)
|
|
||||||
self.unblockchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self)
|
|
||||||
self.connect(self.unblockchum, QtCore.SIGNAL('triggered()'),
|
|
||||||
self, QtCore.SLOT('unblockChum()'))
|
|
||||||
self.blockedMenu.addAction(self.unblockchum)
|
|
||||||
self.blockedMenu.addAction(self.removechum)
|
|
||||||
|
|
||||||
self.sortItems()
|
self.sortItems()
|
||||||
def addChum(self, chum):
|
def addChum(self, chum):
|
||||||
if len([c for c in self.chums if c.handle == chum.handle]) != 0:
|
if len([c for c in self.chums if c.handle == chum.handle]) != 0:
|
||||||
|
@ -864,7 +857,6 @@ class chumArea(QtGui.QListWidget):
|
||||||
self.pester.setText(theme["main/menus/rclickchumlist/pester"])
|
self.pester.setText(theme["main/menus/rclickchumlist/pester"])
|
||||||
self.removechum.setText(theme["main/menus/rclickchumlist/removechum"])
|
self.removechum.setText(theme["main/menus/rclickchumlist/removechum"])
|
||||||
self.blockchum.setText(theme["main/menus/rclickchumlist/blockchum"])
|
self.blockchum.setText(theme["main/menus/rclickchumlist/blockchum"])
|
||||||
self.unblockchum.setText(theme["main/menus/rclickchumlist/unblockchum"])
|
|
||||||
|
|
||||||
chumlistings = [self.item(i) for i in range(0, self.count())]
|
chumlistings = [self.item(i) for i in range(0, self.count())]
|
||||||
for c in chumlistings:
|
for c in chumlistings:
|
||||||
|
@ -874,15 +866,18 @@ class chumArea(QtGui.QListWidget):
|
||||||
if event.reason() == QtGui.QContextMenuEvent.Mouse:
|
if event.reason() == QtGui.QContextMenuEvent.Mouse:
|
||||||
chumlisting = self.itemAt(event.pos())
|
chumlisting = self.itemAt(event.pos())
|
||||||
self.setCurrentItem(chumlisting)
|
self.setCurrentItem(chumlisting)
|
||||||
if chumlisting.chum.blocked(self.mainwindow.userprofile):
|
self.optionsMenu.popup(event.globalPos())
|
||||||
self.blockedMenu.popup(event.globalPos())
|
|
||||||
else:
|
|
||||||
self.optionsMenu.popup(event.globalPos())
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def activateChum(self):
|
def activateChum(self):
|
||||||
self.itemActivated.emit(self.currentItem())
|
self.itemActivated.emit(self.currentItem())
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def removeChum(self):
|
def removeChum(self, handle = None):
|
||||||
|
if handle:
|
||||||
|
clistings = self.getChums(handle)
|
||||||
|
for c in clistings:
|
||||||
|
self.setCurrentItem(c)
|
||||||
|
if not self.currentItem():
|
||||||
|
return
|
||||||
currentChum = self.currentItem().chum
|
currentChum = self.currentItem().chum
|
||||||
self.chums = [c for c in self.chums if c.handle != currentChum.handle]
|
self.chums = [c for c in self.chums if c.handle != currentChum.handle]
|
||||||
self.removeChumSignal.emit(self.currentItem())
|
self.removeChumSignal.emit(self.currentItem())
|
||||||
|
@ -891,16 +886,125 @@ class chumArea(QtGui.QListWidget):
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def blockChum(self):
|
def blockChum(self):
|
||||||
currentChum = self.currentItem()
|
currentChum = self.currentItem()
|
||||||
|
if not currentChum:
|
||||||
|
return
|
||||||
self.blockChumSignal.emit(self.currentItem().chum.handle)
|
self.blockChumSignal.emit(self.currentItem().chum.handle)
|
||||||
currentChum.updateBlocked()
|
|
||||||
@QtCore.pyqtSlot()
|
|
||||||
def unblockChum(self):
|
|
||||||
currentChum = self.currentItem()
|
|
||||||
self.unblockChumSignal.emit(self.currentItem().chum.handle)
|
|
||||||
currentChum.updateMood(unblock=True)
|
|
||||||
|
|
||||||
removeChumSignal = QtCore.pyqtSignal(QtGui.QListWidgetItem)
|
removeChumSignal = QtCore.pyqtSignal(QtGui.QListWidgetItem)
|
||||||
blockChumSignal = QtCore.pyqtSignal(QtCore.QString)
|
blockChumSignal = QtCore.pyqtSignal(QtCore.QString)
|
||||||
|
|
||||||
|
class trollSlum(chumArea):
|
||||||
|
def __init__(self, trolls, mainwindow, parent=None):
|
||||||
|
QtGui.QListWidget.__init__(self, parent)
|
||||||
|
self.mainwindow = mainwindow
|
||||||
|
theme = self.mainwindow.theme
|
||||||
|
self.setStyleSheet(theme["main/trollslum/chumroll/style"])
|
||||||
|
self.chums = trolls
|
||||||
|
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.blockedMenu = QtGui.QMenu(self)
|
||||||
|
self.unblockchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self)
|
||||||
|
self.connect(self.unblockchum, QtCore.SIGNAL('triggered()'),
|
||||||
|
self, QtCore.SIGNAL('unblockChumSignal()'))
|
||||||
|
self.blockedMenu.addAction(self.unblockchum)
|
||||||
|
|
||||||
|
self.sortItems()
|
||||||
|
def changeTheme(self, theme):
|
||||||
|
self.setStyleSheet(theme["main/trollslum/chumroll/style"])
|
||||||
|
self.removechum.setText(theme["main/menus/rclickchumlist/removechum"])
|
||||||
|
self.unblockchum.setText(theme["main/menus/rclickchumlist/blockchum"])
|
||||||
|
|
||||||
|
chumlistings = [self.item(i) for i in range(0, self.count())]
|
||||||
|
for c in chumlistings:
|
||||||
|
c.changeTheme(theme)
|
||||||
|
|
||||||
|
def contextMenuEvent(self, event):
|
||||||
|
#fuckin Qt
|
||||||
|
if event.reason() == QtGui.QContextMenuEvent.Mouse:
|
||||||
|
chumlisting = self.itemAt(event.pos())
|
||||||
|
self.setCurrentItem(chumlisting)
|
||||||
|
self.blockedMenu.popup(event.globalPos())
|
||||||
|
|
||||||
|
unblockChumSignal = QtCore.pyqtSignal(QtCore.QString)
|
||||||
|
|
||||||
|
class TrollSlumWindow(QtGui.QFrame):
|
||||||
|
def __init__(self, trolls, mainwindow, parent=None):
|
||||||
|
QtGui.QFrame.__init__(self, parent)
|
||||||
|
self.mainwindow = mainwindow
|
||||||
|
theme = self.mainwindow.theme
|
||||||
|
self.slumlabel = QtGui.QLabel(self)
|
||||||
|
self.initTheme(theme)
|
||||||
|
|
||||||
|
self.trollslum = trollSlum(trolls, self.mainwindow, self)
|
||||||
|
self.connect(self.trollslum, QtCore.SIGNAL('unblockChumSignal()'),
|
||||||
|
self, QtCore.SLOT('removeCurrentTroll()'))
|
||||||
|
layout_1 = QtGui.QHBoxLayout()
|
||||||
|
self.addButton = QtGui.QPushButton("ADD", self)
|
||||||
|
self.connect(self.addButton, QtCore.SIGNAL('clicked()'),
|
||||||
|
self, QtCore.SLOT('addTrollWindow()'))
|
||||||
|
self.removeButton = QtGui.QPushButton("REMOVE", self)
|
||||||
|
self.connect(self.removeButton, QtCore.SIGNAL('clicked()'),
|
||||||
|
self, QtCore.SLOT('removeCurrentTroll()'))
|
||||||
|
layout_1.addWidget(self.addButton)
|
||||||
|
layout_1.addWidget(self.removeButton)
|
||||||
|
|
||||||
|
layout_0 = QtGui.QVBoxLayout()
|
||||||
|
layout_0.addWidget(self.slumlabel)
|
||||||
|
layout_0.addWidget(self.trollslum)
|
||||||
|
layout_0.addLayout(layout_1)
|
||||||
|
self.setLayout(layout_0)
|
||||||
|
|
||||||
|
def initTheme(self, theme):
|
||||||
|
self.resize(*theme["main/trollslum/size"])
|
||||||
|
self.setStyleSheet(theme["main/trollslum/style"])
|
||||||
|
self.slumlabel.setText(theme["main/trollslum/label/text"])
|
||||||
|
self.slumlabel.setStyleSheet(theme["main/trollslum/label/style"])
|
||||||
|
if not self.parent():
|
||||||
|
self.setWindowTitle(theme["main/menus/profile/block"])
|
||||||
|
self.setWindowIcon(self.mainwindow.windowIcon())
|
||||||
|
def changeTheme(self, theme):
|
||||||
|
self.initTheme(theme)
|
||||||
|
self.trollslum.changeTheme(theme)
|
||||||
|
# move unblocked trolls from slum to chumarea
|
||||||
|
def closeEvent(self, event):
|
||||||
|
self.mainwindow.closeTrollSlum()
|
||||||
|
|
||||||
|
def updateMood(self, handle, mood):
|
||||||
|
self.trollslum.updateMood(handle, mood)
|
||||||
|
def addTroll(self, chum):
|
||||||
|
self.trollslum.addChum(chum)
|
||||||
|
def removeTroll(self, handle):
|
||||||
|
self.trollslum.removeChum(handle)
|
||||||
|
@QtCore.pyqtSlot()
|
||||||
|
def removeCurrentTroll(self):
|
||||||
|
currentListing = self.trollslum.currentItem()
|
||||||
|
if not currentListing:
|
||||||
|
return
|
||||||
|
self.unblockChumSignal.emit(currentListing.chum.handle)
|
||||||
|
@QtCore.pyqtSlot()
|
||||||
|
def addTrollWindow(self):
|
||||||
|
if not hasattr(self, 'addtrolldialog'):
|
||||||
|
self.addtrolldialog = None
|
||||||
|
if self.addtrolldialog:
|
||||||
|
return
|
||||||
|
self.addtrolldialog = QtGui.QInputDialog(self)
|
||||||
|
(handle, ok) = self.addtrolldialog.getText(self, "Add Troll", "Enter Troll Handle:")
|
||||||
|
if ok:
|
||||||
|
handle = unicode(handle)
|
||||||
|
if not (PesterProfile.checkLength(handle) and
|
||||||
|
PesterProfile.checkValid(handle)):
|
||||||
|
errormsg = QtGui.QErrorMessage(self)
|
||||||
|
errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!")
|
||||||
|
self.addchumdialog = None
|
||||||
|
return
|
||||||
|
self.blockChumSignal.emit(handle)
|
||||||
|
self.addtrolldialog = None
|
||||||
|
|
||||||
|
blockChumSignal = QtCore.pyqtSignal(QtCore.QString)
|
||||||
unblockChumSignal = QtCore.pyqtSignal(QtCore.QString)
|
unblockChumSignal = QtCore.pyqtSignal(QtCore.QString)
|
||||||
|
|
||||||
class PesterMoodHandler(QtCore.QObject):
|
class PesterMoodHandler(QtCore.QObject):
|
||||||
|
@ -1071,7 +1175,7 @@ class PesterTabWindow(QtGui.QFrame):
|
||||||
self.setWindowIcon(icon)
|
self.setWindowIcon(icon)
|
||||||
def updateMood(self, handle, mood, unblocked=False):
|
def updateMood(self, handle, mood, unblocked=False):
|
||||||
i = self.tabIndices[handle]
|
i = self.tabIndices[handle]
|
||||||
if handle not in self.mainwindow.userprofile.getBlocklist() and not unblocked:
|
if handle in self.mainwindow.config.getBlocklist() and not unblocked:
|
||||||
icon = QtGui.QIcon(self.mainwindow.theme["main/chums/moods/blocked/icon"])
|
icon = QtGui.QIcon(self.mainwindow.theme["main/chums/moods/blocked/icon"])
|
||||||
else:
|
else:
|
||||||
icon = mood.icon(self.mainwindow.theme)
|
icon = mood.icon(self.mainwindow.theme)
|
||||||
|
@ -1277,7 +1381,7 @@ class PesterConvo(QtGui.QFrame):
|
||||||
self.newmessage = False
|
self.newmessage = False
|
||||||
|
|
||||||
def updateMood(self, mood, unblocked=False):
|
def updateMood(self, mood, unblocked=False):
|
||||||
if mood.name() == "offline" and self.chumopen == True:
|
if mood.name() == "offline" and self.chumopen == True and not unblocked:
|
||||||
msg = self.chum.pestermsg(self.mainwindow.profile(), QtGui.QColor(self.mainwindow.theme["convo/systemMsgColor"]), self.mainwindow.theme["convo/text/ceasepester"])
|
msg = self.chum.pestermsg(self.mainwindow.profile(), QtGui.QColor(self.mainwindow.theme["convo/systemMsgColor"]), self.mainwindow.theme["convo/text/ceasepester"])
|
||||||
self.textArea.append(convertColorTags(msg))
|
self.textArea.append(convertColorTags(msg))
|
||||||
self.mainwindow.chatlog.log(self.chum.handle, convertColorTags(msg, "bbcode"))
|
self.mainwindow.chatlog.log(self.chum.handle, convertColorTags(msg, "bbcode"))
|
||||||
|
@ -1431,6 +1535,10 @@ class PesterWindow(MovingWindow):
|
||||||
self.changequirks = changequirks
|
self.changequirks = changequirks
|
||||||
self.connect(changequirks, QtCore.SIGNAL('triggered()'),
|
self.connect(changequirks, QtCore.SIGNAL('triggered()'),
|
||||||
self, QtCore.SLOT('openQuirks()'))
|
self, QtCore.SLOT('openQuirks()'))
|
||||||
|
loadslum = QtGui.QAction(self.theme["main/menus/profile/block"], self)
|
||||||
|
self.loadslum = loadslum
|
||||||
|
self.connect(loadslum, QtCore.SIGNAL('triggered()'),
|
||||||
|
self, QtCore.SLOT('showTrollSlum()'))
|
||||||
|
|
||||||
changecoloraction = QtGui.QAction(self.theme["main/menus/profile/color"], self)
|
changecoloraction = QtGui.QAction(self.theme["main/menus/profile/color"], self)
|
||||||
self.changecoloraction = changecoloraction
|
self.changecoloraction = changecoloraction
|
||||||
|
@ -1446,6 +1554,7 @@ class PesterWindow(MovingWindow):
|
||||||
self.profilemenu = profilemenu
|
self.profilemenu = profilemenu
|
||||||
profilemenu.addAction(changetheme)
|
profilemenu.addAction(changetheme)
|
||||||
profilemenu.addAction(changequirks)
|
profilemenu.addAction(changequirks)
|
||||||
|
profilemenu.addAction(loadslum)
|
||||||
profilemenu.addAction(changecoloraction)
|
profilemenu.addAction(changecoloraction)
|
||||||
profilemenu.addAction(switch)
|
profilemenu.addAction(switch)
|
||||||
|
|
||||||
|
@ -1472,10 +1581,6 @@ class PesterWindow(MovingWindow):
|
||||||
QtCore.SIGNAL('blockChumSignal(QString)'),
|
QtCore.SIGNAL('blockChumSignal(QString)'),
|
||||||
self,
|
self,
|
||||||
QtCore.SLOT('blockChum(QString)'))
|
QtCore.SLOT('blockChum(QString)'))
|
||||||
self.connect(self.chumList,
|
|
||||||
QtCore.SIGNAL('unblockChumSignal(QString)'),
|
|
||||||
self,
|
|
||||||
QtCore.SLOT('unblockChum(QString)'))
|
|
||||||
|
|
||||||
self.addChumButton = QtGui.QPushButton(self.theme["main/addchum/text"], self)
|
self.addChumButton = QtGui.QPushButton(self.theme["main/addchum/text"], self)
|
||||||
self.connect(self.addChumButton, QtCore.SIGNAL('clicked()'),
|
self.connect(self.addChumButton, QtCore.SIGNAL('clicked()'),
|
||||||
|
@ -1518,9 +1623,11 @@ class PesterWindow(MovingWindow):
|
||||||
c.close()
|
c.close()
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
self.closeConversations()
|
self.closeConversations()
|
||||||
|
if hasattr(self, 'trollslum') and self.trollslum:
|
||||||
|
self.trollslum.close()
|
||||||
event.accept()
|
event.accept()
|
||||||
def newMessage(self, handle, msg):
|
def newMessage(self, handle, msg):
|
||||||
if handle in self.userprofile.getBlocklist():
|
if handle in self.config.getBlocklist():
|
||||||
#yeah suck on this
|
#yeah suck on this
|
||||||
return
|
return
|
||||||
if not self.convos.has_key(handle):
|
if not self.convos.has_key(handle):
|
||||||
|
@ -1551,6 +1658,8 @@ class PesterWindow(MovingWindow):
|
||||||
self.chumList.updateMood(handle, mood)
|
self.chumList.updateMood(handle, mood)
|
||||||
if self.convos.has_key(handle):
|
if self.convos.has_key(handle):
|
||||||
self.convos[handle].updateMood(mood)
|
self.convos[handle].updateMood(mood)
|
||||||
|
if hasattr(self, 'trollslum') and self.trollslum:
|
||||||
|
self.trollslum.updateMood(handle, mood)
|
||||||
def newConversation(self, chum, initiated=True):
|
def newConversation(self, chum, initiated=True):
|
||||||
if self.convos.has_key(chum.handle):
|
if self.convos.has_key(chum.handle):
|
||||||
self.convos[chum.handle].showChat()
|
self.convos[chum.handle].showChat()
|
||||||
|
@ -1667,6 +1776,8 @@ class PesterWindow(MovingWindow):
|
||||||
self.tabconvo.changeTheme(theme)
|
self.tabconvo.changeTheme(theme)
|
||||||
for c in self.convos.values():
|
for c in self.convos.values():
|
||||||
c.changeTheme(theme)
|
c.changeTheme(theme)
|
||||||
|
if hasattr(self, 'trollslum') and self.trollslum:
|
||||||
|
self.trollslum.changeTheme(theme)
|
||||||
# system tray icon
|
# system tray icon
|
||||||
self.updateSystemTray()
|
self.updateSystemTray()
|
||||||
|
|
||||||
|
@ -1694,10 +1805,7 @@ class PesterWindow(MovingWindow):
|
||||||
curChumListing = self.chumList.currentItem()
|
curChumListing = self.chumList.currentItem()
|
||||||
if curChumListing:
|
if curChumListing:
|
||||||
curChum = curChumListing.chum
|
curChum = curChumListing.chum
|
||||||
if curChum.blocked(self.userprofile):
|
self.blockChum(curChum.handle)
|
||||||
self.unblockChum(curChum.handle)
|
|
||||||
else:
|
|
||||||
self.blockChum(curChum.handle)
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def pesterSelectedChum(self):
|
def pesterSelectedChum(self):
|
||||||
curChum = self.chumList.currentItem()
|
curChum = self.chumList.currentItem()
|
||||||
|
@ -1768,26 +1876,39 @@ class PesterWindow(MovingWindow):
|
||||||
@QtCore.pyqtSlot(QtCore.QString)
|
@QtCore.pyqtSlot(QtCore.QString)
|
||||||
def blockChum(self, handle):
|
def blockChum(self, handle):
|
||||||
h = unicode(handle)
|
h = unicode(handle)
|
||||||
self.userprofile.addBlocklist(h)
|
self.config.addBlocklist(h)
|
||||||
|
self.config.removeChum(h)
|
||||||
if self.convos.has_key(h):
|
if self.convos.has_key(h):
|
||||||
convo = self.convos[h]
|
convo = self.convos[h]
|
||||||
msg = self.profile().pestermsg(convo.chum, QtGui.QColor(self.theme["convo/systemMsgColor"]), self.theme["convo/text/blocked"])
|
msg = self.profile().pestermsg(convo.chum, QtGui.QColor(self.theme["convo/systemMsgColor"]), self.theme["convo/text/blocked"])
|
||||||
convo.textArea.append(convertColorTags(msg))
|
convo.textArea.append(convertColorTags(msg))
|
||||||
self.chatlog.log(convo.chum.handle, convertColorTags(msg, "bbcode"))
|
self.chatlog.log(convo.chum.handle, convertColorTags(msg, "bbcode"))
|
||||||
convo.updateBlocked()
|
convo.updateBlocked()
|
||||||
|
self.chumList.removeChum(h)
|
||||||
|
if hasattr(self, 'trollslum') and self.trollslum:
|
||||||
|
newtroll = PesterProfile(h)
|
||||||
|
self.trollslum.addTroll(newtroll)
|
||||||
|
self.moodRequest.emit(newtroll)
|
||||||
self.blockedChum.emit(handle)
|
self.blockedChum.emit(handle)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QtCore.QString)
|
@QtCore.pyqtSlot(QtCore.QString)
|
||||||
def unblockChum(self, handle):
|
def unblockChum(self, handle):
|
||||||
h = unicode(handle)
|
h = unicode(handle)
|
||||||
self.userprofile.delBlocklist(h)
|
self.config.delBlocklist(h)
|
||||||
if self.convos.has_key(h):
|
if self.convos.has_key(h):
|
||||||
convo = self.convos[h]
|
convo = self.convos[h]
|
||||||
msg = self.profile().pestermsg(convo.chum, QtGui.QColor(self.theme["convo/systemMsgColor"]), self.theme["convo/text/unblocked"])
|
msg = self.profile().pestermsg(convo.chum, QtGui.QColor(self.theme["convo/systemMsgColor"]), self.theme["convo/text/unblocked"])
|
||||||
convo.textArea.append(convertColorTags(msg))
|
convo.textArea.append(convertColorTags(msg))
|
||||||
self.chatlog.log(convo.chum.handle, convertColorTags(msg, "bbcode"))
|
self.chatlog.log(convo.chum.handle, convertColorTags(msg, "bbcode"))
|
||||||
convo.updateMood(convo.chum.mood, unblocked=True)
|
convo.updateMood(convo.chum.mood, unblocked=True)
|
||||||
|
chum = PesterProfile(h, chumdb=self.chumdb)
|
||||||
|
if hasattr(self, 'trollslum') and self.trollslum:
|
||||||
|
self.trollslum.removeTroll(handle)
|
||||||
|
self.config.addChum(chum)
|
||||||
|
self.chumList.addChum(chum)
|
||||||
|
self.moodRequest.emit(chum)
|
||||||
self.unblockedChum.emit(handle)
|
self.unblockedChum.emit(handle)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def openQuirks(self):
|
def openQuirks(self):
|
||||||
if not hasattr(self, 'quirkmenu'):
|
if not hasattr(self, 'quirkmenu'):
|
||||||
|
@ -1902,9 +2023,28 @@ class PesterWindow(MovingWindow):
|
||||||
self.config.set("defaultprofile", self.userprofile.chat.handle)
|
self.config.set("defaultprofile", self.userprofile.chat.handle)
|
||||||
# this may have to be fixed
|
# this may have to be fixed
|
||||||
self.closeConversations()
|
self.closeConversations()
|
||||||
|
if hasattr(self, 'trollslum') and self.trollslum:
|
||||||
|
self.trollslum.close()
|
||||||
self.chooseprofile = None
|
self.chooseprofile = None
|
||||||
self.profileChanged.emit()
|
self.profileChanged.emit()
|
||||||
|
@QtCore.pyqtSlot()
|
||||||
|
def showTrollSlum(self):
|
||||||
|
if not hasattr(self, 'trollslum'):
|
||||||
|
self.trollslum = None
|
||||||
|
if self.trollslum:
|
||||||
|
return
|
||||||
|
trolls = [PesterProfile(h) for h in self.config.getBlocklist()]
|
||||||
|
self.trollslum = TrollSlumWindow(trolls, self)
|
||||||
|
self.connect(self.trollslum, QtCore.SIGNAL('blockChumSignal(QString)'),
|
||||||
|
self, QtCore.SLOT('blockChum(QString)'))
|
||||||
|
self.connect(self.trollslum,
|
||||||
|
QtCore.SIGNAL('unblockChumSignal(QString)'),
|
||||||
|
self, QtCore.SLOT('unblockChum(QString)'))
|
||||||
|
self.moodsRequest.emit(PesterProfileList(trolls))
|
||||||
|
self.trollslum.show()
|
||||||
|
@QtCore.pyqtSlot()
|
||||||
|
def closeTrollSlum(self):
|
||||||
|
self.trollslum = None
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def changeMyColor(self):
|
def changeMyColor(self):
|
||||||
if not hasattr(self, 'colorDialog'):
|
if not hasattr(self, 'colorDialog'):
|
||||||
|
@ -1959,6 +2099,7 @@ class PesterWindow(MovingWindow):
|
||||||
convoClosed = QtCore.pyqtSignal(QtCore.QString)
|
convoClosed = QtCore.pyqtSignal(QtCore.QString)
|
||||||
profileChanged = QtCore.pyqtSignal()
|
profileChanged = QtCore.pyqtSignal()
|
||||||
moodRequest = QtCore.pyqtSignal(PesterProfile)
|
moodRequest = QtCore.pyqtSignal(PesterProfile)
|
||||||
|
moodsRequest = QtCore.pyqtSignal(PesterProfileList)
|
||||||
moodUpdated = QtCore.pyqtSignal()
|
moodUpdated = QtCore.pyqtSignal()
|
||||||
mycolorUpdated = QtCore.pyqtSignal()
|
mycolorUpdated = QtCore.pyqtSignal()
|
||||||
trayIconSignal = QtCore.pyqtSignal(int)
|
trayIconSignal = QtCore.pyqtSignal(int)
|
||||||
|
@ -1978,6 +2119,9 @@ class PesterIRC(QtCore.QObject):
|
||||||
@QtCore.pyqtSlot(PesterProfile)
|
@QtCore.pyqtSlot(PesterProfile)
|
||||||
def getMood(self, *chums):
|
def getMood(self, *chums):
|
||||||
self.cli.command_handler.getMood(*chums)
|
self.cli.command_handler.getMood(*chums)
|
||||||
|
@QtCore.pyqtSlot(PesterProfileList)
|
||||||
|
def getMoods(self, chums):
|
||||||
|
self.cli.command_handler.getMood(*chums)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(QtCore.QString, PesterProfile)
|
@QtCore.pyqtSlot(QtCore.QString, PesterProfile)
|
||||||
def sendMessage(self, text, chum):
|
def sendMessage(self, text, chum):
|
||||||
|
@ -2174,6 +2318,10 @@ def main():
|
||||||
QtCore.SIGNAL('moodRequest(PyQt_PyObject)'),
|
QtCore.SIGNAL('moodRequest(PyQt_PyObject)'),
|
||||||
irc,
|
irc,
|
||||||
QtCore.SLOT('getMood(PyQt_PyObject)'))
|
QtCore.SLOT('getMood(PyQt_PyObject)'))
|
||||||
|
irc.connect(widget,
|
||||||
|
QtCore.SIGNAL('moodsRequest(PyQt_PyObject)'),
|
||||||
|
irc,
|
||||||
|
QtCore.SLOT('getMoods(PyQt_PyObject)'))
|
||||||
irc.connect(widget,
|
irc.connect(widget,
|
||||||
QtCore.SIGNAL('moodUpdated()'),
|
QtCore.SIGNAL('moodUpdated()'),
|
||||||
irc,
|
irc,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"color": "#ff00ff", "theme": "pesterchum", "quirks": [], "handle": "ghostDunk", "block": []}
|
{"color": "#ff00ff", "theme": "pesterchum", "quirks": [], "handle": "ghostDunk"}
|
|
@ -22,6 +22,7 @@
|
||||||
"switch": "SWITCH",
|
"switch": "SWITCH",
|
||||||
"color": "COLOR",
|
"color": "COLOR",
|
||||||
"theme": "THEME",
|
"theme": "THEME",
|
||||||
|
"block": "TROLLSLUM",
|
||||||
"quirks": "QUIRKS"},
|
"quirks": "QUIRKS"},
|
||||||
"rclickchumlist": {"pester": "PESTER",
|
"rclickchumlist": {"pester": "PESTER",
|
||||||
"removechum": "REMOVE CHUM",
|
"removechum": "REMOVE CHUM",
|
||||||
|
@ -62,6 +63,13 @@
|
||||||
"color": "black" }
|
"color": "black" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"trollslum": {
|
||||||
|
"style": "background: #fdb302; border:2px solid yellow; font-family: 'Courier'",
|
||||||
|
"size": [195, 200],
|
||||||
|
"label": { "text": "TROLLSLUM",
|
||||||
|
"style": "color: rgba(0, 0, 0, 100%) ;font:bold; font-family: 'Courier';border:0px;" },
|
||||||
|
"chumroll": {"style": "border:2px solid yellow; background-color: black;color: white;font: bold;font-family: 'Courier';selection-background-color:#646464; " }
|
||||||
|
},
|
||||||
"mychumhandle": { "label": { "text": "CHUMHANDLE:",
|
"mychumhandle": { "label": { "text": "CHUMHANDLE:",
|
||||||
"loc": [19,232],
|
"loc": [19,232],
|
||||||
"style": "color: rgba(255, 255, 0, 0%) ;font:bold; font-family: 'Courier';" },
|
"style": "color: rgba(255, 255, 0, 0%) ;font:bold; font-family: 'Courier';" },
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
"switch": "Trolltag",
|
"switch": "Trolltag",
|
||||||
"theme": "Theme",
|
"theme": "Theme",
|
||||||
"color": "Hemospectrum",
|
"color": "Hemospectrum",
|
||||||
|
"block": "Trollslum",
|
||||||
"quirks": "Annoying"},
|
"quirks": "Annoying"},
|
||||||
"rclickchumlist": {"pester": "Troll",
|
"rclickchumlist": {"pester": "Troll",
|
||||||
"removechum": "Trash",
|
"removechum": "Trash",
|
||||||
|
@ -87,6 +88,13 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"trollslum": {
|
||||||
|
"style": "background: rgb(190, 19, 4); font-family: 'Arial'",
|
||||||
|
"size": [175, 461],
|
||||||
|
"label": { "text": "TROLLSLUM",
|
||||||
|
"style": "color: rgba(0, 0, 0, 100%) ;font:bold; font-family: 'Arial';border: 0px;" },
|
||||||
|
"chumroll": {"style": "border: 0px; background-color: white; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200); " }
|
||||||
|
},
|
||||||
"mychumhandle": { "label": { "text": "",
|
"mychumhandle": { "label": { "text": "",
|
||||||
"loc": [85,410],
|
"loc": [85,410],
|
||||||
"style": "color:rgba(0,0,0,0);" },
|
"style": "color:rgba(0,0,0,0);" },
|
||||||
|
|
Loading…
Reference in a new issue