restructure, move logic

This commit is contained in:
Stephen Dranger 2011-01-21 18:37:02 -06:00
parent 7f76b9bb94
commit 93df12a446
7 changed files with 27 additions and 17 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -9,6 +9,19 @@ from PyQt4 import QtGui, QtCore
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
class PesterIRC(QtCore.QObject):
def __init__(self, window):
QtCore.QObject.__init__(self)
self.window = window
def IRCConnect(self):
self.cli = IRCClient(PesterHandler, host="irc.tymoon.eu", port=6667, nick="superGhost")
self.cli.command_handler.window = self.window
self.conn = self.cli.connect()
@QtCore.pyqtSlot()
def updateIRC(self):
self.conn.next()
class PesterHandler(DefaultCommandHandler): class PesterHandler(DefaultCommandHandler):
def privmsg(self, nick, chan, msg): def privmsg(self, nick, chan, msg):
# display msg, do other stuff # display msg, do other stuff
@ -35,8 +48,6 @@ class exitButton(QtGui.QPushButton):
def __init__(self, icon, parent=None): def __init__(self, icon, parent=None):
QtGui.QPushButton.__init__(self, icon, "", parent) QtGui.QPushButton.__init__(self, icon, "", parent)
self.setFlat(True) self.setFlat(True)
def clicked(self):
print "X"
class chumArea(QtGui.QListWidget): class chumArea(QtGui.QListWidget):
def __init__(self, chums, parent=None): def __init__(self, chums, parent=None):
@ -73,29 +84,23 @@ background-color: #fdb302;
self, QtCore.SLOT('close()')) self, QtCore.SLOT('close()'))
self.chumList = chumArea(self.config.chums(), self) self.chumList = chumArea(self.config.chums(), self)
self.cli = IRCClient(PesterHandler, host="irc.tymoon.eu", port=6667, nick="superGhost")
self.cli.command_handler.window = self
self.conn = self.cli.connect()
self.irctimer = QtCore.QTimer(self)
self.connect(self.irctimer, QtCore.SIGNAL('timeout()'),
self, QtCore.SLOT('updateIRC()'))
self.irctimer.start()
self.moving = None self.moving = None
self.moveupdate = 0
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
if self.moving: if self.moving:
move = event.globalPos() - self.moving move = event.globalPos() - self.moving
self.move(self.pos() + move) self.move(move)
self.moving = event.globalPos() self.moveupdate += 1
if self.moveupdate > 5:
self.moveupdate = 0
self.update()
def mousePressEvent(self, event): def mousePressEvent(self, event):
if event.button() == 1: if event.button() == 1:
self.moving = event.globalPos() self.moving = event.globalPos() - self.pos()
def mouseReleaseEvent(self, event): def mouseReleaseEvent(self, event):
if event.button() == 1: if event.button() == 1:
self.update()
self.moving = None self.moving = None
@QtCore.pyqtSlot()
def updateIRC(self):
self.conn.next()
def newMessage(self): def newMessage(self):
pass pass
@ -111,7 +116,12 @@ def main():
trayicon.setContextMenu(traymenu) trayicon.setContextMenu(traymenu)
trayicon.show() trayicon.show()
#irc = PesterIRC(widget)
#irc.IRCConnect()
#irctimer = QtCore.QTimer(widget)
#widget.connect(irctimer, QtCore.SIGNAL('timeout()'),
# irc, QtCore.SLOT('updateIRC()'))
#irctimer.start()
sys.exit(app.exec_()) sys.exit(app.exec_())
main() main()