This commit is contained in:
Stephen Dranger 2011-02-13 20:01:58 -06:00
parent 201b9b3886
commit 9716448ba9
6 changed files with 13 additions and 11 deletions

View file

@ -1,5 +1,6 @@
from string import Template from string import Template
import re import re
import platform
from copy import copy from copy import copy
from datetime import datetime, timedelta from datetime import datetime, timedelta
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
@ -117,16 +118,12 @@ class PesterTabWindow(QtGui.QFrame):
return True return True
else: else:
return False return False
def activateChat(self):
if platform.system() == "Windows":
self.activateWindow()
def notifyNewMessage(self, handle): def notifyNewMessage(self, handle):
i = self.tabIndices[handle] i = self.tabIndices[handle]
self.tabs.setTabTextColor(i, QtGui.QColor(self.mainwindow.theme["%s/tabs/newmsgcolor" % (self.type)])) self.tabs.setTabTextColor(i, QtGui.QColor(self.mainwindow.theme["%s/tabs/newmsgcolor" % (self.type)]))
convo = self.convos[handle] convo = self.convos[handle]
def func(): def func():
convo.showChat() convo.showChat()
self.activateChat()
self.mainwindow.waitingMessages.addMessage(handle, func) self.mainwindow.waitingMessages.addMessage(handle, func)
# set system tray # set system tray
def clearNewMessage(self, handle): def clearNewMessage(self, handle):
@ -484,8 +481,6 @@ class PesterConvo(QtGui.QFrame):
self.parent().showChat(self.title()) self.parent().showChat(self.title())
self.raiseChat() self.raiseChat()
def activateChat(self): def activateChat(self):
if self.parent():
self.parent().activateChat()
if platform.system() == "Windows": if platform.system() == "Windows":
self.activateWindow() self.activateWindow()
def contextMenuEvent(self, event): def contextMenuEvent(self, event):

BIN
convo.pyc

Binary file not shown.

7
irc.py
View file

@ -12,11 +12,14 @@ from generic import PesterList
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
class PesterIRC(QtCore.QObject): class PesterIRC(QtCore.QObject):
def __init__(self, window): def __init__(self, config, window):
QtCore.QObject.__init__(self) QtCore.QObject.__init__(self)
self.mainwindow = window self.mainwindow = window
self.config = config
def IRCConnect(self): def IRCConnect(self):
self.cli = IRCClient(PesterHandler, host="irc.tymoon.eu", port=6667, nick=self.mainwindow.profile().handle, blocking=True) server = self.config.server()
port = self.config.port()
self.cli = IRCClient(PesterHandler, host=server, port=int(port), nick=self.mainwindow.profile().handle, blocking=True)
self.cli.command_handler.parent = self self.cli.command_handler.parent = self
self.cli.command_handler.mainwindow = self.mainwindow self.cli.command_handler.mainwindow = self.mainwindow
self.conn = self.cli.connect() self.conn = self.cli.connect()

BIN
irc.pyc

Binary file not shown.

View file

@ -1 +1 @@
{"tabs": true, "soundon": true, "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "adiosToreador", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "confusedTransient", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense"], "defaultprofile": "ghostDunk", "block": []} {"tabs": true, "soundon": true, "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "adiosToreador", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "confusedTransient", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense"], "defaultprofile": "ghostDunk", "block": [], "server": "irc.tymoon.eu"}

View file

@ -211,6 +211,10 @@ class userConfig(object):
l = self.getBlocklist() l = self.getBlocklist()
l.pop(l.index(handle)) l.pop(l.index(handle))
self.set('block', l) self.set('block', l)
def server(self):
return self.config.get('server', 'irc.tymoon.eu')
def port(self):
return self.config.get('port', '6667')
def soundOn(self): def soundOn(self):
if not self.config.has_key('soundon'): if not self.config.has_key('soundon'):
self.set('soundon', True) self.set('soundon', True)
@ -1708,7 +1712,7 @@ class MainProgram(QtCore.QObject):
self.trayicon, self.trayicon,
QtCore.SLOT('mainWindowClosed()')) QtCore.SLOT('mainWindowClosed()'))
self.irc = PesterIRC(self.widget) self.irc = PesterIRC(self.widget.config, self.widget)
self.connectWidgets(self.irc, self.widget) self.connectWidgets(self.irc, self.widget)
self.ircapp = IRCThread(self.irc) self.ircapp = IRCThread(self.irc)
self.connect(self.ircapp, QtCore.SIGNAL('finished()'), self.connect(self.ircapp, QtCore.SIGNAL('finished()'),
@ -1820,7 +1824,7 @@ class MainProgram(QtCore.QObject):
def restartIRC(self): def restartIRC(self):
self.widget.show() self.widget.show()
self.widget.activateWindow() self.widget.activateWindow()
self.irc = PesterIRC(self.widget) self.irc = PesterIRC(self.widget.config, self.widget)
self.connectWidgets(self.irc, self.widget) self.connectWidgets(self.irc, self.widget)
self.ircapp = IRCThread(self.irc) self.ircapp = IRCThread(self.irc)
self.connect(self.ircapp, QtCore.SIGNAL('finished()'), self.connect(self.ircapp, QtCore.SIGNAL('finished()'),