This commit is contained in:
Stephen Dranger 2011-02-18 02:17:13 -06:00
parent 5bae56ddbd
commit f50c617d6d
13 changed files with 73 additions and 14 deletions

BIN
convo.pyc

Binary file not shown.

7
irc.py
View file

@ -24,10 +24,14 @@ class PesterIRC(QtCore.QObject):
self.cli.command_handler.mainwindow = self.mainwindow
self.conn = self.cli.connect()
self.brokenConnection = False
self.connectedIRC = False
def closeConnection(self):
self.cli.close()
def setConnectionBroken(self, broken=True):
self.brokenConnection = True
def setConnected(self):
self.connectedIRC = True
self.connected.emit()
@QtCore.pyqtSlot(PesterProfile)
def getMood(self, *chums):
self.cli.command_handler.getMood(*chums)
@ -178,6 +182,7 @@ class PesterIRC(QtCore.QObject):
class PesterHandler(DefaultCommandHandler):
def privmsg(self, nick, chan, msg):
msg = msg.decode("utf-8")
# display msg, do other stuff
if len(msg) == 0:
return
@ -223,7 +228,7 @@ class PesterHandler(DefaultCommandHandler):
def welcome(self, server, nick, msg):
self.parent.connected.emit()
self.parent.setConnected()
helpers.join(self.client, "#pesterchum")
mychumhandle = self.mainwindow.profile().handle
mymood = self.mainwindow.profile().mood.value()

BIN
irc.pyc

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -636,16 +636,24 @@ class LoadingScreen(QtGui.QDialog):
self.mainwindow = parent
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
self.loadinglabel = QtGui.QLabel("LO4D1NG")
self.cancel = QtGui.QPushButton("QU1T >:?")
self.loadinglabel = QtGui.QLabel("CONN3CT1NG", self)
self.cancel = QtGui.QPushButton("QU1T >:?", self)
self.ok = QtGui.QPushButton("R3CONN3CT >:]", self)
self.connect(self.cancel, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('reject()'))
self.connect(self.ok, QtCore.SIGNAL('clicked()'),
self, QtCore.SIGNAL('tryAgain()'))
self.layout = QtGui.QVBoxLayout()
self.layout.addWidget(self.loadinglabel)
self.layout.addWidget(self.cancel)
layout_1 = QtGui.QHBoxLayout()
layout_1.addWidget(self.cancel)
layout_1.addWidget(self.ok)
self.layout.addLayout(layout_1)
self.setLayout(self.layout)
tryAgain = QtCore.pyqtSignal()
class AboutPesterchum(QtGui.QMessageBox):
def __init__(self, parent=None):
QtGui.QMessageBox.__init__(self, parent)

BIN
menus.pyc

Binary file not shown.

View file

@ -129,14 +129,13 @@ class IRCClient:
self.socket.send(msg + bytes("\r\n", "ascii"))
except socket.error, se:
try: # a little dance of compatibility to get the errno
errno = e.errno
errno = se.errno
except AttributeError:
errno = e[0]
errno = se[0]
if not self.blocking and errno == 11:
print "O WELLS"
pass
else:
raise e
raise se
def connect(self):
""" initiates the connection to the server set in self.host:self.port
@ -192,7 +191,13 @@ class IRCClient:
pass
yield True
finally:
except socket.error, se:
if self.socket:
logging.info('closing socket')
self.socket.close()
print se
raise se
else:
if self.socket:
logging.info('closing socket')
self.socket.close()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -3,7 +3,7 @@
Name "PESTERCHUM3.14a"
; The file to write
OutFile "pesterchum3.14a.2update.exe"
OutFile "pesterchum3.14a.3update.exe"
RequestExecutionLevel admin

View file

@ -3,7 +3,7 @@
Name "PESTERCHUM3.14a"
; The file to write
OutFile "pesterchum3.14a.1.exe"
OutFile "pesterchum3.14a.3.exe"
InstallDir C:\Pesterchum

View file

@ -1675,10 +1675,17 @@ class IRCThread(QtCore.QThread):
irc.IRCConnect()
try:
irc.updateIRC()
except socket.error:
irc.setConnectionBroken()
except socket.error, se:
if irc.connectedIRC:
irc.setConnectionBroken()
else:
irc.closeConnection()
self.failedIRC.emit()
except StopIteration:
pass
restartIRC = QtCore.pyqtSignal()
failedIRC = QtCore.pyqtSignal()
class PesterTray(QtGui.QSystemTrayIcon):
def __init__(self, icon, mainwindow, parent):
@ -1750,6 +1757,8 @@ class MainProgram(QtCore.QObject):
self.ircapp = IRCThread(self.irc)
self.connect(self.ircapp, QtCore.SIGNAL('restartIRC()'),
self, QtCore.SLOT('restartIRC()'))
self.connect(self.ircapp, QtCore.SIGNAL('failedIRC()'),
self, QtCore.SLOT('failedIRC()'))
def connectWidgets(self, irc, widget):
irc.connect(widget, QtCore.SIGNAL('sendMessage(QString, QString)'),
@ -1857,22 +1866,54 @@ class MainProgram(QtCore.QObject):
widget,
QtCore.SLOT('timeCommand(QString, QString, QString)'))
@QtCore.pyqtSlot()
def tryAgain(self):
self.ircapp.irc.closeConnection()
self.ircapp.irc.IRCConnect()
labeltxt = self.widget.loadingscreen.loadinglabel.text()
if labeltxt != "R3CONN3CT1NG":
self.widget.loadingscreen.loadinglabel.setText("R3CONN3CTING")
elif labeltxt[0:12] == "R3CONN3CT1NG":
i = int(labeltxt[13:])
self.widget.loadingscreen.loadinglabel.setText("R3CONN3CTING %d" (i+1))
@QtCore.pyqtSlot()
def restartIRC(self):
# tell ppl that we're restarting
self.widget.show()
self.widget.activateWindow()
self.widget.loadingscreen = LoadingScreen(self.widget)
self.connect(self.widget.loadingscreen, QtCore.SIGNAL('rejected()'),
self.widget, QtCore.SLOT('close()'))
self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'),
self, QtCore.SLOT('tryAgain()'))
status = self.widget.loadingscreen.exec_()
if status == QtGui.QDialog.Rejected:
sys.exit(0)
@QtCore.pyqtSlot()
def failedIRC(self):
self.widget.show()
self.widget.activateWindow()
if not self.widget.loadingscreen:
self.widget.loadingscreen = LoadingScreen(self.widget)
self.widget.loadingscreen.loadinglabel.setText("F41L3D")
self.connect(self.widget.loadingscreen, QtCore.SIGNAL('rejected()'),
self.widget, QtCore.SLOT('close()'))
self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'),
self, QtCore.SLOT('tryAgain()'))
status = self.widget.loadingscreen.exec_()
if status == QtGui.QDialog.Rejected:
sys.exit(0)
else:
self.widget.loadingscreen.loadinglabel.setText("F41L3D")
def run(self):
self.ircapp.start()
self.widget.loadingscreen = LoadingScreen(self.widget)
self.connect(self.widget.loadingscreen, QtCore.SIGNAL('rejected()'),
self.widget, QtCore.SLOT('close()'))
self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'),
self, QtCore.SLOT('tryAgain()'))
status = self.widget.loadingscreen.exec_()
if status == QtGui.QDialog.Rejected:
sys.exit(0)