From 5775fbadf4564eb7936c2cd7f3164e84014a64df Mon Sep 17 00:00:00 2001 From: Lexi Date: Fri, 15 Jul 2011 16:23:41 +0800 Subject: [PATCH 1/9] TODO update. Mostly from complaints --- TODO.mkdn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TODO.mkdn b/TODO.mkdn index e614f03..08af9c1 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -17,6 +17,11 @@ Features * Tab completion of two letter names * Customizable name alerts * When 'banned' make impossible to connect using timestamp banned under +* Explain why a chumhandle is invalid +* Make some kind of notification when the program is 'closed' but is + still running in the system tray, like how MSN does it. ("MSN is still + running in the system tray. Right click it to close it. Click here not + to show this message again.") Bugs ---- @@ -44,3 +49,6 @@ Mac Bugs * SS: in the one-on-one pester it resizes with the window * SS: but the memo one doesn't resize * SS: and the arrows next to the time thing overlap the CLOSE button +* Lex: Emotes show up as errors +* Lex: INFO logging shows up in OSX's error console +* Lex: There seems to be a faint outline around most non-square themes. From 838c5efcd5ad514f601a85551c26f16a5c915abd Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sun, 17 Jul 2011 01:58:19 -0700 Subject: [PATCH 2/9] Inform in memos on Netsplit --- TODO.mkdn | 1 - dataobjs.py | 2 ++ irc.py | 8 +++++++- memos.py | 30 ++++++++++++++++++++++++++---- pesterchum.py | 2 +- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/TODO.mkdn b/TODO.mkdn index 08af9c1..ee00f2a 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -34,7 +34,6 @@ Bugs * right clicking an offline chum and choosing remove asks you why you're reporting someone, and if you hit cancel the menus stop working * Closing a timeclone doesn't actually cease for everyone else * Kill Zalgo -* Handle netsplits Windows Bugs ------------ diff --git a/dataobjs.py b/dataobjs.py index 4b0ee60..71a0054 100644 --- a/dataobjs.py +++ b/dataobjs.py @@ -236,6 +236,8 @@ class PesterProfile(object): return "%s %s." % (syscolor.name(), self.colorhtml(), ", ".join(initials), verb) else: return "%s%s%s %s." % (syscolor.name(), self.colorhtml(), initials.pcf, self.initials(), initials.number, verb) + def memonetsplitmsg(self, syscolor, initials): + return "Netsplit quits: %s" % (syscolor.name(), ", ".join(initials)) def memoopenmsg(self, syscolor, td, timeGrammar, verb, channel): (temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when) timetext = timeDifference(td) diff --git a/irc.py b/irc.py index 9a6cfe4..72f57ca 100644 --- a/irc.py +++ b/irc.py @@ -396,8 +396,14 @@ class PesterHandler(DefaultCommandHandler): helpers.nick(self.client, newnick) self.parent.nickCollision.emit(nick, newnick) def quit(self, nick, reason): + print reason handle = nick[0:nick.find("!")] - self.parent.userPresentUpdate.emit(handle, "", "quit") + server = self.parent.mainwindow.config.server() + baseserver = server[server.rfind(".", 0, server.rfind(".")):] + if reason.count(baseserver) == 2: + self.parent.userPresentUpdate.emit(handle, "", "netsplit") + else: + self.parent.userPresentUpdate.emit(handle, "", "quit") self.parent.moodUpdated.emit(handle, Mood("offline")) def kick(self, opnick, channel, handle, reason): op = opnick[0:opnick.find("!")] diff --git a/memos.py b/memos.py index 8a919b0..ca5ae6c 100644 --- a/memos.py +++ b/memos.py @@ -876,6 +876,16 @@ class PesterMemo(PesterConvo): icon = QtGui.QIcon() c.setIcon(icon) + @QtCore.pyqtSlot() + def dumpNetsplit(self): + self.splitTimer.stop() + chum = self.mainwindow.profile() + systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"]) + msg = chum.memonetsplitmsg(systemColor, self.netsplit) + self.textArea.append(convertTags(msg)) + self.mainwindow.chatlog.log(self.channel, msg) + self.netsplit = [] + @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) def userPresentChange(self, handle, channel, update): h = unicode(handle) @@ -903,7 +913,13 @@ class PesterMemo(PesterConvo): chums = self.userlist.findItems(h, QtCore.Qt.MatchFlags(0)) systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"]) # print exit - if update == "quit" or update == "left" or update == "nick": + if update in ("quit", "left", "nick", "netsplit"): + if update == "netsplit": + if not hasattr(self, "netsplit"): + self.netsplit = [] + self.splitTimer = QtCore.QTimer(self) + self.connect(self.splitTimer, QtCore.SIGNAL('timeout()'), + self, QtCore.SLOT('dumpNetsplit()')) for c in chums: chum = PesterProfile(h) self.userlist.takeItem(self.userlist.row(c)) @@ -915,9 +931,15 @@ class PesterMemo(PesterConvo): grammar = t.getGrammar() allinitials.append("%s%s%s" % (grammar.pcf, chum.initials(), grammar.number)) self.times[h].removeTime(t.getTime()) - msg = chum.memoclosemsg(systemColor, allinitials, self.mainwindow.theme["convo/text/closememo"]) - self.textArea.append(convertTags(msg)) - self.mainwindow.chatlog.log(self.channel, msg) + if update == "netsplit": + self.netsplit.extend(initials) + if self.splitTimer.isActive(): + self.splitTimer.stop() + self.splitTimer.start(1000) + else: + msg = chum.memoclosemsg(systemColor, allinitials, self.mainwindow.theme["convo/text/closememo"]) + self.textArea.append(convertTags(msg)) + self.mainwindow.chatlog.log(self.channel, msg) if update == "nick": self.addUser(newnick) newchums = self.userlist.findItems(newnick, QtCore.Qt.MatchFlags(0)) diff --git a/pesterchum.py b/pesterchum.py index 0bf799d..b568790 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -2261,7 +2261,7 @@ class PesterWindow(MovingWindow): l = n.split(":") oldnick = l[0] newnick = l[1] - if update == "quit": + if update in ("quit", "netsplit"): for c in self.namesdb.keys(): try: i = self.namesdb[c].index(n) From 97742beab8b4dacacd1a0da2e471944079a2000e Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sun, 17 Jul 2011 01:59:41 -0700 Subject: [PATCH 3/9] Small fixes --- pesterchum.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pesterchum.py b/pesterchum.py index b568790..fa73763 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -2208,7 +2208,7 @@ class PesterWindow(MovingWindow): msgbox = QtGui.QMessageBox() msgbox.setText("This chumhandle has been registered; you may not use it.") msgbox.setInformativeText("Your handle is now being changed to %s." % (changedto)) - msgbox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) + msgbox.setStandardButtons(QtGui.QMessageBox.Ok) ret = msgbox.exec_() elif h == self.randhandler.randNick: self.randhandler.incoming(msg) @@ -3195,8 +3195,8 @@ class MainProgram(QtCore.QObject): 'cannotSendToChan(QString, QString)'), ('tooManyPeeps()', 'tooManyPeeps()'), - ('quirkDisable(QString, QString, QString)', - 'quirkDisable(QString, QString, QString)') + ('quirkDisable(QString, QString, QString)', + 'quirkDisable(QString, QString, QString)') ] def connectWidgets(self, irc, widget): self.connect(irc, QtCore.SIGNAL('finished()'), From 79331e17ac5ce9e0dbf071d64a82072089449318 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Tue, 19 Jul 2011 16:26:27 -0700 Subject: [PATCH 4/9] Bug fix: Only send NOTICEs to randomEncounter of options change --- pesterchum.py | 2 ++ randomer.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pesterchum.py b/pesterchum.py index fa73763..80c1e00 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -609,6 +609,8 @@ class userProfile(object): self.quirks = quirks self.userprofile["quirks"] = self.quirks.plainList() self.save() + def getRandom(self): + return self.randoms def setRandom(self, random): self.randoms = random self.userprofile["randoms"] = random diff --git a/randomer.py b/randomer.py index 4c89b47..54c2c7f 100644 --- a/randomer.py +++ b/randomer.py @@ -14,10 +14,11 @@ class RandomHandler(QtCore.QObject): self.mainwindow.sendNotice.emit("?", self.randNick) def setRandomer(self, r): - if r: code = "+" - else: code = "-" - self.queue.append(code) - self.mainwindow.sendNotice.emit(code, self.randNick) + if r != self.mainwindow.userprofile.getRandom(): + if r: code = "+" + else: code = "-" + self.queue.append(code) + self.mainwindow.sendNotice.emit(code, self.randNick) @QtCore.pyqtSlot() def getEncounter(self): From 6e3c97fb587e0bf4628cbd2b9253a6e928b191b0 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Tue, 19 Jul 2011 16:39:19 -0700 Subject: [PATCH 5/9] Bug fix: Hopefully netsplit informing works? --- memos.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/memos.py b/memos.py index ca5ae6c..586c9eb 100644 --- a/memos.py +++ b/memos.py @@ -878,13 +878,12 @@ class PesterMemo(PesterConvo): @QtCore.pyqtSlot() def dumpNetsplit(self): - self.splitTimer.stop() chum = self.mainwindow.profile() systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"]) msg = chum.memonetsplitmsg(systemColor, self.netsplit) self.textArea.append(convertTags(msg)) self.mainwindow.chatlog.log(self.channel, msg) - self.netsplit = [] + del self.netsplit @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) def userPresentChange(self, handle, channel, update): @@ -917,9 +916,7 @@ class PesterMemo(PesterConvo): if update == "netsplit": if not hasattr(self, "netsplit"): self.netsplit = [] - self.splitTimer = QtCore.QTimer(self) - self.connect(self.splitTimer, QtCore.SIGNAL('timeout()'), - self, QtCore.SLOT('dumpNetsplit()')) + QtCore.QTimer.singleShot(1500, self, QtCore.SLOT('dumpNetsplit()')) for c in chums: chum = PesterProfile(h) self.userlist.takeItem(self.userlist.row(c)) @@ -933,9 +930,6 @@ class PesterMemo(PesterConvo): self.times[h].removeTime(t.getTime()) if update == "netsplit": self.netsplit.extend(initials) - if self.splitTimer.isActive(): - self.splitTimer.stop() - self.splitTimer.start(1000) else: msg = chum.memoclosemsg(systemColor, allinitials, self.mainwindow.theme["convo/text/closememo"]) self.textArea.append(convertTags(msg)) From 048caa527ae23e7770af7514697b19e3c8a43d42 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Wed, 20 Jul 2011 22:10:06 -0700 Subject: [PATCH 6/9] Don't ping of all lowercase initials --- pesterchum.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pesterchum.py b/pesterchum.py index 80c1e00..c73d4ea 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -1802,7 +1802,8 @@ class PesterWindow(MovingWindow): if self.config.memoSound(): if self.config.nameSound(): initials = self.userprofile.chat.initials() - search = r"\b[%s%s][%s%s]\b" % (initials[0].lower(), initials[0], initials[1].lower(), initials[1]) + initials = (initials, "%s%s" % (initials[0].lower(), initials[1]), "%s%s" % (initials[0], initials[1].lower())) + search = r"\b%s\b" % ("|".join(initials)) m = convertTags(msg, "text") if m.find(":") <= 3: m = m[m.find(":"):] From b9a48671face42a0c9da25e549041c0ee3dc9287 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sat, 23 Jul 2011 10:06:06 -0700 Subject: [PATCH 7/9] Bug fix: Lock MSPA update checking threads. Stops Pesterchum freezing when MSPA is down --- updatecheck.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/updatecheck.py b/updatecheck.py index a3ebc82..0734534 100644 --- a/updatecheck.py +++ b/updatecheck.py @@ -17,6 +17,7 @@ class MSPAChecker(QtGui.QWidget): self, QtCore.SLOT('check_site()')) self.check_site() self.timer.start(1000*self.refreshRate) + self.lock = False def save_state(self): try: @@ -45,12 +46,18 @@ class MSPAChecker(QtGui.QWidget): def check_site(self): if not self.mainwindow.config.checkMSPA(): return + if self.lock: + return + print "Checking MSPA updates..." rss = None must_save = False try: + self.lock = True rss = feedparser.parse("http://www.mspaintadventures.com/rss/rss.xml") except: return + finally: + self.lock = False if len(rss.entries) == 0: return entries = sorted(rss.entries,key=(lambda x: mktime(x.updated_parsed))) From e420d4e97d08272e855de76bd66912750834f7a6 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sat, 23 Jul 2011 12:28:40 -0700 Subject: [PATCH 8/9] Bug fix: Thread MSPA update checker, stop hanging up the whole program on slow MSPA --- updatecheck.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/updatecheck.py b/updatecheck.py index 0734534..fff5464 100644 --- a/updatecheck.py +++ b/updatecheck.py @@ -3,6 +3,7 @@ import feedparser import pickle import os +import threading from time import mktime from PyQt4 import QtCore, QtGui @@ -12,12 +13,11 @@ class MSPAChecker(QtGui.QWidget): self.mainwindow = parent self.refreshRate = 30 # seconds self.status = None + self.lock = False self.timer = QtCore.QTimer(self) self.connect(self.timer, QtCore.SIGNAL('timeout()'), - self, QtCore.SLOT('check_site()')) - self.check_site() + self, QtCore.SLOT('check_site_wrapper()')) self.timer.start(1000*self.refreshRate) - self.lock = False def save_state(self): try: @@ -43,12 +43,16 @@ class MSPAChecker(QtGui.QWidget): msg.show() @QtCore.pyqtSlot() - def check_site(self): + def check_site_wrapper(self): if not self.mainwindow.config.checkMSPA(): return if self.lock: return print "Checking MSPA updates..." + s = threading.Thread(target=self.check_site) + s.start() + + def check_site(self): rss = None must_save = False try: From e580fc4b11fcc701e20bc6b9f0eb8fe466578223 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sat, 23 Jul 2011 14:53:05 -0700 Subject: [PATCH 9/9] Button for logs directory --- CHANGELOG.mkdn | 1 + logviewer.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 13bdade..dd6ac22 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -58,6 +58,7 @@ CHANGELOG * Display channel mode change message - Kiooeht [evacipatedBox] * Disable quirks in +c memos - Lexi [lexicalNuance] * Founder, admin, and halfop support - Kiooeht [evacipatedBox] +* Button for direct access to logs directory - Kiooeht [evacipatedBox] * Bug fixes * Logviewer updates - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox] diff --git a/logviewer.py b/logviewer.py index 4b253ea..f11df3e 100644 --- a/logviewer.py +++ b/logviewer.py @@ -83,12 +83,16 @@ class PesterLogUserSelect(QtGui.QDialog): layout_ok = QtGui.QHBoxLayout() layout_ok.addWidget(self.cancel) layout_ok.addWidget(self.ok) + self.directory = QtGui.QPushButton("LOG DIRECTORY", self) + self.connect(self.directory, QtCore.SIGNAL('clicked()'), + self, QtCore.SLOT('openDir()')) layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(instructions) layout_0.addWidget(self.chumsBox) layout_0.addWidget(self.search) layout_0.addLayout(layout_ok) + layout_0.addWidget(self.directory) self.setLayout(layout_0) @@ -119,6 +123,14 @@ class PesterLogUserSelect(QtGui.QDialog): self.pesterlogviewer.close() self.pesterlogviewer = None + @QtCore.pyqtSlot() + def openDir(self): + if sys.platform == "darwin": + _datadir = os.path.join(str(QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.DataLocation)),"Pesterchum/") + QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(_datadir, "logs"), QtCore.QUrl.TolerantMode)) + else: + QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(os.getcwd(), "logs"), QtCore.QUrl.TolerantMode)) + class PesterLogViewer(QtGui.QDialog): def __init__(self, chum, config, theme, parent): QtGui.QDialog.__init__(self, parent)