This commit is contained in:
illuminatedwax 2011-04-13 01:12:19 -05:00
parent b38965126d
commit 4b504a0e98
12 changed files with 107 additions and 20 deletions

View file

@ -18,6 +18,7 @@ CHANGELOG
* Quirk ordering - alGore
* # of users in a memo - alGore
* @links to users - illuminatedwax [ghostDunk]
* Support for REPORT and ALT to calSprite built in
BUG FIXES:
* mixer bug fixed

View file

@ -8,7 +8,7 @@ from datetime import datetime, timedelta
from PyQt4 import QtGui, QtCore
from dataobjs import PesterProfile, Mood, PesterHistory
from generic import PesterIcon, RightClickList
from generic import PesterIcon
from parsetools import convertTags, lexMessage, splitMessage, mecmd, colorBegin, colorEnd, img2smiley
class PesterTabWindow(QtGui.QFrame):
@ -306,14 +306,7 @@ class PesterText(QtGui.QTextEdit):
self.parent().mainwindow.showMemos(url[1:])
elif url[0] == "@":
handle = unicode(url[1:])
mw = self.parent().mainwindow
matchingChums = [c for c in mw.chumList.chums if c.handle == handle]
if len(matchingChums) > 0:
mood = matchingChums[0].mood
else:
mood = Mood(0)
chum = PesterProfile(handle, mood=mood, chumdb=mw.chumdb)
mw.newConversation(chum)
self.parent().mainwindow.newConversation(handle)
else:
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode))
QtGui.QTextEdit.mousePressEvent(self, event)
@ -453,10 +446,14 @@ class PesterConvo(QtGui.QFrame):
self.unblockchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self)
self.connect(self.unblockchum, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('unblockChumSlot()'))
self.reportchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self)
self.connect(self.reportchum, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('reportThisChum()'))
self.optionsMenu.addAction(self.quirksOff)
self.optionsMenu.addAction(self.addChumAction)
self.optionsMenu.addAction(self.blockAction)
self.optionsMenu.addAction(self.reportchum)
self.chumopen = False
self.applyquirks = True
@ -629,6 +626,9 @@ class PesterConvo(QtGui.QFrame):
def blockThisChum(self):
self.mainwindow.blockChum(self.chum.handle)
@QtCore.pyqtSlot()
def reportThisChum(self):
self.mainwindow.reportChum(self.chum.handle)
@QtCore.pyqtSlot()
def unblockChumSlot(self):
self.mainwindow.unblockChum(self.chum.handle)
@QtCore.pyqtSlot(bool)

View file

@ -35,7 +35,9 @@ class RightClickList(QtGui.QListWidget):
if event.reason() == QtGui.QContextMenuEvent.Mouse:
listing = self.itemAt(event.pos())
self.setCurrentItem(listing)
self.optionsMenu.popup(event.globalPos())
self.getOptionsMenu().popup(event.globalPos())
def getOptionsMenu(self):
return self.optionsMenu
class MultiTextDialog(QtGui.QDialog):
def __init__(self, title, parent, *queries):

View file

@ -610,7 +610,11 @@ class PesterUserlist(QtGui.QDialog):
self.addChumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self)
self.connect(self.addChumAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('addChumSlot()'))
self.pesterChumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self)
self.connect(self.pesterChumAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('pesterChumSlot()'))
self.userarea.optionsMenu.addAction(self.addChumAction)
self.userarea.optionsMenu.addAction(self.pesterChumAction)
self.ok = QtGui.QPushButton("OK", self)
self.ok.setDefault(True)
@ -634,7 +638,7 @@ class PesterUserlist(QtGui.QDialog):
self.updateUsers()
@QtCore.pyqtSlot()
def updateUsers(self):
names = self.mainwindow.namesdb["#pesterchum"]
names = self.mainwindow.namesdb["#PESTERCHUM"]
self.userarea.clear()
for n in names:
item = QtGui.QListWidgetItem(n)
@ -675,8 +679,15 @@ class PesterUserlist(QtGui.QDialog):
if not cur:
return
self.addChum.emit(cur.text())
@QtCore.pyqtSlot()
def pesterChumSlot(self):
cur = self.userarea.currentItem()
if not cur:
return
self.pesterChum.emit(cur.text())
addChum = QtCore.pyqtSignal(QtCore.QString)
pesterChum = QtCore.pyqtSignal(QtCore.QString)
class MemoListItem(QtGui.QListWidgetItem):
@ -798,6 +809,6 @@ class LoadingScreen(QtGui.QDialog):
class AboutPesterchum(QtGui.QMessageBox):
def __init__(self, parent=None):
QtGui.QMessageBox.__init__(self, parent)
self.setText("P3ST3RCHUM V. 3.14")
self.setInformativeText("Programming by illuminatedwax (ghostDunk), art by Grimlive (aquaMarinist). Special thanks to ABT and gamblingGenocider.")
self.setText("P3ST3RCHUM V. 3.14.1")
self.setInformativeText("Programming by illuminatedwax (ghostDunk), Kiooeht (evacipatedBox), alGore, art by Grimlive (aquaMarinist). Special thanks to ABT and gamblingGenocider.")
self.mainwindow = parent

View file

@ -192,6 +192,15 @@ def convertTags(lexed, format="html"):
def splitMessage(msg, format="ctag"):
"""Splits message if it is too long."""
# split long text lines
buf = []
for o in msg:
if type(o) in [str, unicode] and len(o) > 200:
for i in range(0, len(o), 200):
buf.append(o[i:i+200])
else:
buf.append(o)
msg = buf
okmsg = []
cbegintags = []
output = []
@ -200,11 +209,7 @@ def splitMessage(msg, format="ctag"):
if type(o) is colorBegin:
cbegintags.append(o)
elif type(o) is colorEnd:
print len(cbegintags)
try:
cbegintags.pop()
except IndexError:
print len(cbegintags)
cbegintags.pop()
# yeah normally i'd do binary search but im lazy
msglen = len(convertTags(okmsg, format)) + 4*(len(cbegintags))
if msglen > 400:

View file

@ -1 +1 @@
{"hideOfflineChums": false, "time12Format": true, "tabs": true, "showSeconds": false, "server": "irc.mindfang.org", "soundon": true, "showTimeStamps": false, "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead", "magmaExploiter", "hannaSongstress", "endlessVoid", "grayscaleVisionary", "corruptedInsanity", "stupidlyBrilliant", "artsyGyarados", "obliviousCrafter", "sporadicAgent", "subtleChaotician", "nareSolee", "apostateCourier", "nocturnalTherapist", "herpaDerp", "clockworkUtopia", "digitalSamurai", "astronomicalMaster", "slipshodBrisant", "genialDustbuster", "hyperdriveTyphoon", "magnificentMiser", "gentleRuffian", "riskRepeats", "globalsoftPrika", "globalsoftPirka", "devonianCritter", "lethargicSerpent", "laughingShisa", "bluntInstrument", "sunilaSeed", "bluntInstrument", "nickServ", "ghostBinoculars", "alGore", "evacipatedBox", "acrylicEmulator", "prettyGemmaiden", "calSprite", "fairytalePorn", "brooklynRage"], "defaultprofile": "testProfile", "block": []}
{"hideOfflineChums": false, "time12Format": true, "tabs": true, "soundon": true, "server": "irc.mindfang.org", "showSeconds": false, "showTimeStamps": false, "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead", "magmaExploiter", "hannaSongstress", "endlessVoid", "grayscaleVisionary", "corruptedInsanity", "stupidlyBrilliant", "artsyGyarados", "obliviousCrafter", "sporadicAgent", "subtleChaotician", "nareSolee", "apostateCourier", "nocturnalTherapist", "herpaDerp", "clockworkUtopia", "digitalSamurai", "astronomicalMaster", "slipshodBrisant", "genialDustbuster", "hyperdriveTyphoon", "magnificentMiser", "gentleRuffian", "riskRepeats", "globalsoftPrika", "globalsoftPirka", "devonianCritter", "lethargicSerpent", "laughingShisa", "bluntInstrument", "sunilaSeed", "bluntInstrument", "nickServ", "ghostBinoculars", "alGore", "evacipatedBox", "acrylicEmulator", "prettyGemmaiden", "calSprite", "fairytalePorn", "brooklynRage"], "defaultprofile": "testProfile", "block": []}

View file

@ -26,6 +26,7 @@ from irc import PesterIRC
from logviewer import PesterLogUserSelect, PesterLogViewer
_datadir = QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.DataLocation)+"Pesterchum/"
canon_handles = ["apocalypseArisen", "arsenicCatnip", "arachnidsGrip", "adiosToreador", "caligulasAquarium", "cuttlefishCuller", "carcinoGeneticist", "centaursTesticle", "grimAuxiliatrix", "gallowsCalibrator", "gardenGnostic", "ectoBiologist", "twinArmageddons", "terminallyCapricious", "turntechGodhead", "tentacleTherapist"]
if sys.platform == "darwin":
if not os.path.exists(_datadir):
@ -452,6 +453,7 @@ class chumArea(RightClickList):
if not self.mainwindow.config.hideOfflineChums():
self.showAllChums()
self.optionsMenu = QtGui.QMenu(self)
self.canonMenu = QtGui.QMenu(self)
self.pester = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self)
self.connect(self.pester, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('activateChum()'))
@ -464,13 +466,35 @@ class chumArea(RightClickList):
self.logchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self)
self.connect(self.logchum, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('openChumLogs()'))
self.reportchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self)
self.connect(self.reportchum, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('reportChum()'))
self.findalts = QtGui.QAction("Find Alts", self)
self.connect(self.findalts, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('findAlts()'))
self.optionsMenu.addAction(self.pester)
self.optionsMenu.addAction(self.logchum)
self.optionsMenu.addAction(self.blockchum)
self.optionsMenu.addAction(self.removechum)
self.optionsMenu.addAction(self.reportchum)
self.canonMenu.addAction(self.pester)
self.canonMenu.addAction(self.logchum)
self.canonMenu.addAction(self.blockchum)
self.canonMenu.addAction(self.removechum)
self.canonMenu.addAction(self.reportchum)
self.canonMenu.addAction(self.findalts)
self.initTheme(theme)
self.sortItems()
def getOptionsMenu(self):
currenthandle = self.currentItem().chum.handle
if currenthandle in canon_handles:
return self.canonMenu
else:
return self.optionsMenu
def addChum(self, chum):
if len([c for c in self.chums if c.handle == chum.handle]) != 0:
return
@ -566,6 +590,18 @@ class chumArea(RightClickList):
return
self.blockChumSignal.emit(self.currentItem().chum.handle)
@QtCore.pyqtSlot()
def reportChum(self):
currentChum = self.currentItem()
if not currentChum:
return
self.mainwindow.reportChum(self.currentItem().chum.handle)
@QtCore.pyqtSlot()
def findAlts(self):
currentChum = self.currentItem()
if not currentChum:
return
self.mainwindow.sendMessage.emit("ALT %s" % (currentChum.chum.handle) , "calSprite")
@QtCore.pyqtSlot()
def openChumLogs(self):
currentChum = self.currentItem().text()
if not currentChum:
@ -910,15 +946,18 @@ class PesterWindow(MovingWindow):
self.aboutAction = QtGui.QAction(self.theme["main/menus/help/about"], self)
self.connect(self.aboutAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('aboutPesterchum()'))
self.botAction = QtGui.QAction("CALSPRITE", self)
self.connect(self.botAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('loadCalsprite()'))
self.helpAction = QtGui.QAction("HELP", self)
self.connect(self.helpAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('launchHelp()'))
helpmenu = self.menu.addMenu(self.theme["main/menus/help/_name"])
self.helpmenu = helpmenu
self.helpmenu.addAction(self.helpAction)
self.helpmenu.addAction(self.botAction)
self.helpmenu.addAction(self.aboutAction)
self.closeButton = WMButton(PesterIcon(self.theme["main/close/image"]), self)
self.connect(self.closeButton, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('closeToTray()'))
@ -1069,6 +1108,16 @@ class PesterWindow(MovingWindow):
if hasattr(self, 'trollslum') and self.trollslum:
self.trollslum.updateMood(handle, mood)
def newConversation(self, chum, initiated=True):
if type(chum) in [str, unicode]:
matchingChums = [c for c in self.chumList.chums if c.handle == chum]
if len(matchingChums) > 0:
mood = matchingChums[0].mood
else:
mood = Mood(2)
chum = PesterProfile(chum, mood=mood, chumdb=self.chumdb)
if len(matchingChums) == 0:
self.moodRequest.emit(chum)
if self.convos.has_key(chum.handle):
self.convos[chum.handle].showChat()
return
@ -1454,6 +1503,11 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot(QtCore.QString)
def removeChum(self, chumlisting):
self.config.removeChum(chumlisting)
def reportChum(self, handle):
(reason, ok) = QtGui.QInputDialog.getText(self, "Report User", "Enter the reason you are reporting this user (optional):")
if ok:
self.sendMessage.emit("REPORT %s %s" % (handle, reason) , "calSprite")
@QtCore.pyqtSlot(QtCore.QString)
def blockChum(self, handle):
h = unicode(handle)
@ -1613,6 +1667,8 @@ class PesterWindow(MovingWindow):
self, QtCore.SLOT('userListClose()'))
self.connect(self.allusers, QtCore.SIGNAL('addChum(QString)'),
self, QtCore.SLOT('userListAdd(QString)'))
self.connect(self.allusers, QtCore.SIGNAL('pesterChum(QString)'),
self, QtCore.SLOT('userListPester(QString)'))
self.requestNames.emit("#pesterchum")
self.allusers.show()
@ -1621,6 +1677,10 @@ class PesterWindow(MovingWindow):
h = unicode(handle)
chum = PesterProfile(h, chumdb=self.chumdb)
self.addChum(chum)
@QtCore.pyqtSlot(QtCore.QString)
def userListPester(self, handle):
h = unicode(handle)
self.newConversation(h)
@QtCore.pyqtSlot()
def userListClose(self):
self.allusers = None
@ -1851,6 +1911,9 @@ class PesterWindow(MovingWindow):
self.aboutwindow.exec_()
self.aboutwindow = None
@QtCore.pyqtSlot()
def loadCalsprite(self):
self.newConversation("calSprite")
@QtCore.pyqtSlot()
def launchHelp(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://nova.xzibition.com/~illuminatedwax/help.html", QtCore.QUrl.TolerantMode))

View file

@ -35,6 +35,7 @@
"rclickchumlist": {"pester": "Pester",
"removechum": "Remove Chum",
"blockchum": "Block",
"report", "Report",
"addchum": "Add Chum",
"viewlog": "View Pesterlog",
"unblockchum": "Unblock",

View file

@ -36,6 +36,7 @@
"about": "About" },
"rclickchumlist": {"pester": "Pester",
"removechum": "Remove Chum",
"report": "Report",
"blockchum": "Block",
"addchum": "Add Chum",
"viewlog": "View Pesterlog",

View file

@ -36,6 +36,7 @@
"about": "ABOUT" },
"rclickchumlist": {"pester": "PESTER",
"removechum": "REMOVE CHUM",
"report": "REPORT",
"blockchum": "BLOCK",
"addchum": "ADD CHUM",
"viewlog": "VIEW PESTERLOG",

View file

@ -34,6 +34,7 @@
"about": "About" },
"rclickchumlist": {"pester": "Troll",
"removechum": "Trash",
"report": "Remove",
"blockchum": "Block",
"addchum": "Add Chump",
"viewlog": "View Pesterlog",

View file

@ -36,6 +36,7 @@
"about": "About" },
"rclickchumlist": {"pester": "Converse",
"removechum": "Erase User",
"report": "Report User",
"blockchum": "Condemn",
"addchum": "Add User",
"viewlog": "View Pesterlog",