derp
This commit is contained in:
parent
e0bfd64184
commit
fececa45ba
19 changed files with 44 additions and 34 deletions
BIN
convo.pyc
BIN
convo.pyc
Binary file not shown.
BIN
dataobjs.pyc
BIN
dataobjs.pyc
Binary file not shown.
BIN
generic.pyc
BIN
generic.pyc
Binary file not shown.
10
irc.py
10
irc.py
|
@ -24,13 +24,15 @@ class PesterIRC(QtCore.QObject):
|
|||
self.cli.command_handler.mainwindow = self.mainwindow
|
||||
self.conn = self.cli.connect()
|
||||
self.brokenConnection = False
|
||||
self.connectedIRC = False
|
||||
self.registeredIRC = False
|
||||
def closeConnection(self):
|
||||
self.cli.close()
|
||||
if self.cli:
|
||||
self.cli.close()
|
||||
self.cli = None
|
||||
def setConnectionBroken(self, broken=True):
|
||||
self.brokenConnection = True
|
||||
def setConnected(self):
|
||||
self.connectedIRC = True
|
||||
self.registeredIRC = True
|
||||
self.connected.emit()
|
||||
@QtCore.pyqtSlot(PesterProfile)
|
||||
def getMood(self, *chums):
|
||||
|
@ -166,7 +168,7 @@ class PesterIRC(QtCore.QObject):
|
|||
self.setConnectionBroken()
|
||||
|
||||
def updateIRC(self):
|
||||
self.conn.next()
|
||||
return self.conn.next()
|
||||
|
||||
moodUpdated = QtCore.pyqtSignal(QtCore.QString, Mood)
|
||||
colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor)
|
||||
|
|
BIN
irc.pyc
BIN
irc.pyc
Binary file not shown.
BIN
memos.pyc
BIN
memos.pyc
Binary file not shown.
BIN
menus.pyc
BIN
menus.pyc
Binary file not shown.
BIN
mispeller.pyc
BIN
mispeller.pyc
Binary file not shown.
Binary file not shown.
|
@ -168,8 +168,7 @@ class IRCClient:
|
|||
try:
|
||||
buffer += self.socket.recv(1024)
|
||||
except socket.timeout, e:
|
||||
yield True
|
||||
continue
|
||||
raise e
|
||||
except socket.error, e:
|
||||
try: # a little dance of compatibility to get the errno
|
||||
errno = e.errno
|
||||
|
@ -195,6 +194,8 @@ class IRCClient:
|
|||
pass
|
||||
|
||||
yield True
|
||||
except socket.timeout, se:
|
||||
raise se
|
||||
except socket.error, se:
|
||||
if self.socket:
|
||||
logging.info('closing socket')
|
||||
|
@ -206,7 +207,9 @@ class IRCClient:
|
|||
logging.info('closing socket')
|
||||
self.socket.close()
|
||||
def close(self):
|
||||
self.socket.close()
|
||||
if self.socket:
|
||||
logging.info('closing socket')
|
||||
self.socket.close()
|
||||
|
||||
class IRCApp:
|
||||
""" This class manages several IRCClient instances without the use of threads.
|
||||
|
|
BIN
oyoyo/client.pyc
BIN
oyoyo/client.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
oyoyo/parse.pyc
BIN
oyoyo/parse.pyc
Binary file not shown.
BIN
parsetools.pyc
BIN
parsetools.pyc
Binary file not shown.
|
@ -168,7 +168,7 @@ class pesterTheme(dict):
|
|||
v = dict.__getitem__(self, keys.pop(0))
|
||||
for k in keys:
|
||||
v = v[k]
|
||||
return v
|
||||
return default if v is None else v
|
||||
except KeyError:
|
||||
if hasattr(self, 'inheritedTheme'):
|
||||
return self.inheritedTheme.get(key, default)
|
||||
|
@ -181,7 +181,7 @@ class pesterTheme(dict):
|
|||
v = dict.__getitem__(self, keys.pop(0))
|
||||
for k in keys:
|
||||
v = v[k]
|
||||
return True
|
||||
return False if v is None else True
|
||||
except KeyError:
|
||||
if hasattr(self, 'inheritedTheme'):
|
||||
return self.inheritedTheme.has_key(key)
|
||||
|
@ -1667,22 +1667,33 @@ class IRCThread(QtCore.QThread):
|
|||
def run(self):
|
||||
irc = self.irc
|
||||
irc.IRCConnect()
|
||||
while 1:
|
||||
if irc.brokenConnection:
|
||||
irc.brokenConnection = False
|
||||
self.restartIRC.emit()
|
||||
timer = QtCore.QTimer(self)
|
||||
self.connect(timer, QtCore.SIGNAL('timeout()'),
|
||||
self, QtCore.SLOT('updateIRC()'))
|
||||
timer.start()
|
||||
self.exec_()
|
||||
@QtCore.pyqtSlot()
|
||||
def updateIRC(self):
|
||||
irc = self.irc
|
||||
if irc.brokenConnection:
|
||||
irc.brokenConnection = False
|
||||
self.restartIRC.emit()
|
||||
irc.closeConnection()
|
||||
irc.IRCConnect()
|
||||
try:
|
||||
res = irc.updateIRC()
|
||||
except socket.timeout, se:
|
||||
if not irc.registeredIRC:
|
||||
irc.closeConnection()
|
||||
irc.IRCConnect()
|
||||
try:
|
||||
irc.updateIRC()
|
||||
except socket.error, se:
|
||||
if irc.connectedIRC:
|
||||
irc.setConnectionBroken()
|
||||
else:
|
||||
irc.closeConnection()
|
||||
self.failedIRC.emit(str(se))
|
||||
except StopIteration:
|
||||
pass
|
||||
self.failedIRC.emit("Connection timed out")
|
||||
except socket.error, se:
|
||||
if irc.registeredIRC:
|
||||
irc.setConnectionBroken()
|
||||
else:
|
||||
irc.closeConnection()
|
||||
self.failedIRC.emit(str(se))
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
restartIRC = QtCore.pyqtSignal()
|
||||
failedIRC = QtCore.pyqtSignal(QtCore.QString)
|
||||
|
@ -1868,14 +1879,8 @@ class MainProgram(QtCore.QObject):
|
|||
|
||||
@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))
|
||||
self.ircapp.quit()
|
||||
print "Quit?"
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
def restartIRC(self):
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"color": "#ff00ff", "theme": "pesterchum", "quirks": [], "handle": "ghostDunk"}
|
||||
{"color": "#ff00ff", "theme": "pesterchum2.5", "quirks": [], "handle": "ghostDunk"}
|
|
@ -47,7 +47,7 @@
|
|||
},
|
||||
"moodlabel": { "style": "font:bold;font-family:'Courier';color:black;",
|
||||
"loc": [12, 466],
|
||||
"text": "MOODS:"
|
||||
"text": "MOOD:"
|
||||
},
|
||||
"moods": [
|
||||
{ "style": "text-align:left; background:#ffff00;border:2px solid #c48a00;color: black; font-family:'Courier'; font:bold; padding-left:3px;",
|
||||
|
|
Loading…
Reference in a new issue