Merge remote branch 'upstream/master'

Conflicts:
	pesterchum.py
This commit is contained in:
Kiooeht 2011-04-14 22:50:53 -07:00
commit 45d6922ddd
6 changed files with 42 additions and 34 deletions

View file

@ -9,6 +9,17 @@ class mysteryTime(timedelta):
def __neq__(self, other): def __neq__(self, other):
return (type(other) is not mysteryTime) return (type(other) is not mysteryTime)
class CaseInsensitiveDict(dict):
def __setitem__(self, key, value):
super(CaseInsensitiveDict, self).__setitem__(key.lower(), value)
def __getitem__(self, key):
return super(CaseInsensitiveDict, self).__getitem__(key.lower())
def __contains__(self, key):
return super(CaseInsensitiveDict, self).__contains__(key.lower())
def has_key(self, key):
return super(CaseInsensitiveDict, self).has_key(key.lower())
def __delitem__(self, key):
super(CaseInsensitiveDict, self).__delitem__(key.lower())
class PesterList(list): class PesterList(list):
def __init__(self, l): def __init__(self, l):
self.extend(l) self.extend(l)

View file

@ -218,10 +218,10 @@ class MemoTabWindow(PesterTabWindow):
def __init__(self, mainwindow, parent=None): def __init__(self, mainwindow, parent=None):
PesterTabWindow.__init__(self, mainwindow, parent, "memos") PesterTabWindow.__init__(self, mainwindow, parent, "memos")
def addChat(self, convo): def addChat(self, convo):
self.convos[convo.channel.upper()] = convo self.convos[convo.channel] = convo
# either addTab or setCurrentIndex will trigger changed() # either addTab or setCurrentIndex will trigger changed()
newindex = self.tabs.addTab(convo.channel.upper()) newindex = self.tabs.addTab(convo.channel)
self.tabIndices[convo.channel.upper()] = newindex self.tabIndices[convo.channel] = newindex
self.tabs.setCurrentIndex(newindex) self.tabs.setCurrentIndex(newindex)
self.tabs.setTabIcon(newindex, PesterIcon(self.mainwindow.theme["memos/memoicon"])) self.tabs.setTabIcon(newindex, PesterIcon(self.mainwindow.theme["memos/memoicon"]))
def updateBlocked(self): def updateBlocked(self):
@ -291,16 +291,16 @@ class MemoText(PesterText):
grammar = time.getGrammar() grammar = time.getGrammar()
joinmsg = chum.memojoinmsg(systemColor, time.getTime(), grammar, window.theme["convo/text/joinmemo"]) joinmsg = chum.memojoinmsg(systemColor, time.getTime(), grammar, window.theme["convo/text/joinmemo"])
self.append(convertTags(joinmsg)) self.append(convertTags(joinmsg))
parent.mainwindow.chatlog.log(parent.channel.upper(), joinmsg) parent.mainwindow.chatlog.log(parent.channel, joinmsg)
time.openCurrentTime() time.openCurrentTime()
if type(lexmsg[0]) is mecmd: if type(lexmsg[0]) is mecmd:
memsg = chum.memsg(systemColor, lexmsg, time=time.getGrammar()) memsg = chum.memsg(systemColor, lexmsg, time=time.getGrammar())
window.chatlog.log(parent.channel.upper(), memsg) window.chatlog.log(parent.channel, memsg)
self.append(convertTags(memsg)) self.append(convertTags(memsg))
else: else:
self.append(convertTags(lexmsg)) self.append(convertTags(lexmsg))
window.chatlog.log(parent.channel.upper(), lexmsg) window.chatlog.log(parent.channel, lexmsg)
def changeTheme(self, theme): def changeTheme(self, theme):
self.initTheme(theme) self.initTheme(theme)
@ -417,7 +417,7 @@ class PesterMemo(PesterConvo):
msg = p.memoopenmsg(systemColor, self.time.getTime(), timeGrammar, self.mainwindow.theme["convo/text/openmemo"], self.channel) msg = p.memoopenmsg(systemColor, self.time.getTime(), timeGrammar, self.mainwindow.theme["convo/text/openmemo"], self.channel)
self.time.openCurrentTime() self.time.openCurrentTime()
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel.upper(), msg) self.mainwindow.chatlog.log(self.channel, msg)
self.op = False self.op = False
self.newmessage = False self.newmessage = False
@ -425,7 +425,7 @@ class PesterMemo(PesterConvo):
self.applyquirks = True self.applyquirks = True
def title(self): def title(self):
return self.channel.upper() return self.channel
def icon(self): def icon(self):
return PesterIcon(self.mainwindow.theme["memos/memoicon"]) return PesterIcon(self.mainwindow.theme["memos/memoicon"])
@ -555,7 +555,7 @@ class PesterMemo(PesterConvo):
self.times[handle].removeTime(close) self.times[handle].removeTime(close)
msg = chum.memoclosemsg(systemColor, grammar, window.theme["convo/text/closememo"]) msg = chum.memoclosemsg(systemColor, grammar, window.theme["convo/text/closememo"])
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel.upper(), msg) self.mainwindow.chatlog.log(self.channel, msg)
elif timed not in self.times[handle]: elif timed not in self.times[handle]:
self.times[handle].addTime(timed) self.times[handle].addTime(timed)
else: else:
@ -601,7 +601,7 @@ class PesterMemo(PesterConvo):
namesdb = self.mainwindow.namesdb namesdb = self.mainwindow.namesdb
# reload names # reload names
self.userlist.clear() self.userlist.clear()
for n in self.mainwindow.namesdb[self.channel.upper()]: for n in self.mainwindow.namesdb[self.channel]:
self.addUser(n) self.addUser(n)
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
@ -635,7 +635,7 @@ class PesterMemo(PesterConvo):
grammar = t.getGrammar() grammar = t.getGrammar()
msg = chum.memoclosemsg(systemColor, grammar, self.mainwindow.theme["convo/text/closememo"]) msg = chum.memoclosemsg(systemColor, grammar, self.mainwindow.theme["convo/text/closememo"])
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel.upper(), msg) self.mainwindow.chatlog.log(self.channel, msg)
self.times[h].removeTime(t.getTime()) self.times[h].removeTime(t.getTime())
if update == "nick": if update == "nick":
self.addUser(newnick) self.addUser(newnick)
@ -663,7 +663,7 @@ class PesterMemo(PesterConvo):
opgrammar = TimeGrammar("CURRENT", "C", "RIGHT NOW") opgrammar = TimeGrammar("CURRENT", "C", "RIGHT NOW")
msg = chum.memobanmsg(opchum, opgrammar, systemColor, grammar) msg = chum.memobanmsg(opchum, opgrammar, systemColor, grammar)
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel.upper(), msg) self.mainwindow.chatlog.log(self.channel, msg)
ttracker.removeTime(ttracker.getTime()) ttracker.removeTime(ttracker.getTime())
if chum is self.mainwindow.profile(): if chum is self.mainwindow.profile():
@ -682,10 +682,10 @@ class PesterMemo(PesterConvo):
self.time.openCurrentTime() self.time.openCurrentTime()
msg = me.memoopenmsg(systemColor, self.time.getTime(), self.time.getGrammar(), self.mainwindow.theme["convo/text/openmemo"], self.channel) msg = me.memoopenmsg(systemColor, self.time.getTime(), self.time.getGrammar(), self.mainwindow.theme["convo/text/openmemo"], self.channel)
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel.upper(), msg) self.mainwindow.chatlog.log(self.channel, msg)
elif ret == QtGui.QMessageBox.Cancel: elif ret == QtGui.QMessageBox.Cancel:
if self.parent(): if self.parent():
i = self.parent().tabIndices[self.channel.upper()] i = self.parent().tabIndices[self.channel]
self.parent().tabClose(i) self.parent().tabClose(i)
else: else:
self.close() self.close()
@ -749,7 +749,7 @@ class PesterMemo(PesterConvo):
systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"]) systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"])
msg = me.memoclosemsg(systemColor, grammar, self.mainwindow.theme["convo/text/closememo"]) msg = me.memoclosemsg(systemColor, grammar, self.mainwindow.theme["convo/text/closememo"])
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel.upper(), msg) self.mainwindow.chatlog.log(self.channel, msg)
newtime = self.time.getTime() newtime = self.time.getTime()
if newtime is None: if newtime is None:

View file

@ -656,7 +656,7 @@ class PesterUserlist(QtGui.QDialog):
self.updateUsers() self.updateUsers()
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def updateUsers(self): def updateUsers(self):
names = self.mainwindow.namesdb["#PESTERCHUM"] names = self.mainwindow.namesdb["#pesterchum"]
self.userarea.clear() self.userarea.clear()
for n in names: for n in names:
item = QtGui.QListWidgetItem(n) item = QtGui.QListWidgetItem(n)

View file

@ -319,7 +319,6 @@ class parseLeaf(object):
def append(self, node): def append(self, node):
self.nodes.append(node) self.nodes.append(node)
def expand(self, mo): def expand(self, mo):
print "starting expand"
out = "" out = ""
for n in self.nodes: for n in self.nodes:
if type(n) == parseLeaf: if type(n) == parseLeaf:
@ -328,9 +327,7 @@ class parseLeaf(object):
out += mo.group(int(n.number)) out += mo.group(int(n.number))
else: else:
out += n out += n
print "out: %s" % (out)
out = self.function(out) out = self.function(out)
print "returning %s" % (out)
return out return out
class backreference(object): class backreference(object):
def __init__(self, number): def __init__(self, number):

View file

@ -1 +1 @@
{"hideOfflineChums": true, "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": []} {"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", "computerCyanide"], "defaultprofile": "testProfile", "block": []}

View file

@ -18,7 +18,7 @@ from menus import PesterChooseQuirks, PesterChooseTheme, \
PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList, \ PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList, \
LoadingScreen, AboutPesterchum LoadingScreen, AboutPesterchum
from dataobjs import PesterProfile, Mood, pesterQuirk, pesterQuirks from dataobjs import PesterProfile, Mood, pesterQuirk, pesterQuirks
from generic import PesterIcon, RightClickList, RightClickTree, MultiTextDialog, PesterList from generic import PesterIcon, RightClickList, RightClickTree, MultiTextDialog, PesterList, CaseInsensitiveDict
from convo import PesterTabWindow, PesterText, PesterInput, PesterConvo from convo import PesterTabWindow, PesterText, PesterInput, PesterConvo
from parsetools import convertTags, addTimeInitial from parsetools import convertTags, addTimeInitial
from memos import PesterMemo, MemoTabWindow, TimeTracker from memos import PesterMemo, MemoTabWindow, TimeTracker
@ -1188,8 +1188,8 @@ class PesterWindow(MovingWindow):
MovingWindow.__init__(self, parent, MovingWindow.__init__(self, parent,
(QtCore.Qt.CustomizeWindowHint | (QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint)) QtCore.Qt.FramelessWindowHint))
self.convos = {} self.convos = CaseInsensitiveDict()
self.memos = {} self.memos = CaseInsensitiveDict()
self.tabconvo = None self.tabconvo = None
self.tabmemo = None self.tabmemo = None
@ -1309,7 +1309,7 @@ class PesterWindow(MovingWindow):
self.connect(self.miniButton, QtCore.SIGNAL('clicked()'), self.connect(self.miniButton, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('showMinimized()')) self, QtCore.SLOT('showMinimized()'))
self.namesdb = {} self.namesdb = CaseInsensitiveDict()
self.chumdb = PesterProfileDB() self.chumdb = PesterProfileDB()
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())]
@ -1421,10 +1421,10 @@ class PesterWindow(MovingWindow):
else: else:
self.alarm.play() self.alarm.play()
def newMemoMsg(self, chan, handle, msg): def newMemoMsg(self, chan, handle, msg):
if not self.memos.has_key(chan.upper()): if not self.memos.has_key(chan):
# silently ignore in case we forgot to /part # silently ignore in case we forgot to /part
return return
memo = self.memos[chan.upper()] memo = self.memos[chan]
msg = unicode(msg) msg = unicode(msg)
if not memo.times.has_key(handle): if not memo.times.has_key(handle):
# new chum! time current # new chum! time current
@ -1492,8 +1492,8 @@ class PesterWindow(MovingWindow):
def newMemo(self, channel, timestr, secret=False): def newMemo(self, channel, timestr, secret=False):
if channel == "#pesterchum": if channel == "#pesterchum":
return return
if self.memos.has_key(channel.upper()): if self.memos.has_key(channel):
self.memos[channel.upper()].showChat() self.memos[channel].showChat()
return return
# do slider dialog then set # do slider dialog then set
if self.config.tabs(): if self.config.tabs():
@ -1514,7 +1514,7 @@ class PesterWindow(MovingWindow):
QtCore.SIGNAL('userPresentSignal(QString, QString, QString)'), QtCore.SIGNAL('userPresentSignal(QString, QString, QString)'),
memoWindow, QtCore.SLOT('userPresentChange(QString, QString, QString)')) memoWindow, QtCore.SLOT('userPresentChange(QString, QString, QString)'))
# chat client send memo open # chat client send memo open
self.memos[channel.upper()] = memoWindow self.memos[channel] = memoWindow
self.joinChannel.emit(channel) # race condition? self.joinChannel.emit(channel) # race condition?
self.secret = secret self.secret = secret
if self.secret: if self.secret:
@ -1745,7 +1745,7 @@ class PesterWindow(MovingWindow):
c = unicode(channel) c = unicode(channel)
self.chatlog.finish(c) self.chatlog.finish(c)
self.leftChannel.emit(channel) self.leftChannel.emit(channel)
del self.memos[c.upper()] del self.memos[c]
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def tabsClosed(self): def tabsClosed(self):
del self.tabconvo del self.tabconvo
@ -1777,19 +1777,19 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
def timeCommand(self, chan, handle, command): def timeCommand(self, chan, handle, command):
(c, h, cmd) = (unicode(chan), unicode(handle), unicode(command)) (c, h, cmd) = (unicode(chan), unicode(handle), unicode(command))
if self.memos[c.upper()]: if self.memos[c]:
self.memos[c.upper()].timeUpdate(h, cmd) self.memos[c].timeUpdate(h, cmd)
@QtCore.pyqtSlot(QtCore.QString, PesterList) @QtCore.pyqtSlot(QtCore.QString, PesterList)
def updateNames(self, channel, names): def updateNames(self, channel, names):
c = unicode(channel).upper() c = unicode(channel)
# update name DB # update name DB
self.namesdb[c] = names self.namesdb[c] = names
# warn interested party of names # warn interested party of names
self.namesUpdated.emit() self.namesUpdated.emit()
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
def userPresentUpdate(self, handle, channel, update): def userPresentUpdate(self, handle, channel, update):
c = unicode(channel).upper() c = unicode(channel)
n = unicode(handle) n = unicode(handle)
if update == "nick": if update == "nick":
l = n.split(":") l = n.split(":")