Merge branch 'master' of git://github.com/kiooeht/pesterchum

This commit is contained in:
Lexi 2011-07-23 23:02:16 +01:00
commit 5afff509a6
9 changed files with 69 additions and 18 deletions

View file

@ -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]

View file

@ -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
------------

View file

@ -236,6 +236,8 @@ class PesterProfile(object):
return "<c=%s><c=%s>%s</c> %s.</c>" % (syscolor.name(), self.colorhtml(), ", ".join(initials), verb)
else:
return "<c=%s><c=%s>%s%s%s</c> %s.</c>" % (syscolor.name(), self.colorhtml(), initials.pcf, self.initials(), initials.number, verb)
def memonetsplitmsg(self, syscolor, initials):
return "<c=%s>Netsplit quits: <c=black>%s</c></c>" % (syscolor.name(), ", ".join(initials))
def memoopenmsg(self, syscolor, td, timeGrammar, verb, channel):
(temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when)
timetext = timeDifference(td)

8
irc.py
View file

@ -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("!")]

View file

@ -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)

View file

@ -876,6 +876,15 @@ class PesterMemo(PesterConvo):
icon = QtGui.QIcon()
c.setIcon(icon)
@QtCore.pyqtSlot()
def dumpNetsplit(self):
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)
del self.netsplit
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
def userPresentChange(self, handle, channel, update):
h = unicode(handle)
@ -903,7 +912,11 @@ 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 = []
QtCore.QTimer.singleShot(1500, self, QtCore.SLOT('dumpNetsplit()'))
for c in chums:
chum = PesterProfile(h)
self.userlist.takeItem(self.userlist.row(c))
@ -915,9 +928,12 @@ 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)
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))

View file

@ -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
@ -1800,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(":"):]
@ -2208,7 +2211,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)
@ -2261,7 +2264,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)
@ -3195,8 +3198,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()'),

View file

@ -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):

View file

@ -3,6 +3,7 @@
import feedparser
import pickle
import os
import threading
from time import mktime
from PyQt4 import QtCore, QtGui
@ -12,10 +13,10 @@ 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)
def save_state(self):
@ -42,15 +43,25 @@ 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:
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)))