diff --git a/convo.py b/convo.py index 8e8b503..760e17f 100644 --- a/convo.py +++ b/convo.py @@ -7,12 +7,10 @@ from generic import PesterIcon from parsetools import escapeBrackets, convertTags class PesterTabWindow(QtGui.QFrame): - def __init__(self, mainwindow, parent=None): + def __init__(self, mainwindow, parent=None, convo="convo"): QtGui.QFrame.__init__(self, parent) self.setFocusPolicy(QtCore.Qt.ClickFocus) self.mainwindow = mainwindow - self.resize(*self.mainwindow.theme["convo/size"]) - self.setStyleSheet(self.mainwindow.theme["convo/style"]) self.tabs = QtGui.QTabBar(self) self.tabs.setTabsClosable(True) @@ -20,9 +18,8 @@ class PesterTabWindow(QtGui.QFrame): self, QtCore.SLOT('changeTab(int)')) self.connect(self.tabs, QtCore.SIGNAL('tabCloseRequested(int)'), self, QtCore.SLOT('tabClose(int)')) - self.tabs.setShape(self.mainwindow.theme["convo/tabs/tabstyle"]) - self.tabs.setStyleSheet("QTabBar::tab{ %s } QTabBar::tab:selected { %s }" % (self.mainwindow.theme["convo/tabs/style"], self.mainwindow.theme["convo/tabs/selectedstyle"])) + self.initTheme(self.mainwindow.theme[convo]) self.layout = QtGui.QVBoxLayout() self.layout.setContentsMargins(0,0,0,0) self.layout.addWidget(self.tabs) @@ -33,8 +30,11 @@ class PesterTabWindow(QtGui.QFrame): self.changedTab = False self.softclose = False + self.type = convo + # get default tab color i guess self.defaultTabTextColor = self.getTabTextColor() + def getTabTextColor(self): # ugly, ugly hack self.changedTab = True @@ -44,12 +44,12 @@ class PesterTabWindow(QtGui.QFrame): self.changedTab = False return c def addChat(self, convo): - self.convos[convo.chum.handle] = convo + self.convos[convo.title()] = convo # either addTab or setCurrentIndex will trigger changed() - newindex = self.tabs.addTab(convo.chum.handle) - self.tabIndices[convo.chum.handle] = newindex + newindex = self.tabs.addTab(convo.title()) + self.tabIndices[convo.title()] = newindex self.tabs.setCurrentIndex(newindex) - self.tabs.setTabIcon(newindex, convo.chum.mood.icon(self.mainwindow.theme)) + self.tabs.setTabIcon(newindex, convo.icon()) def showChat(self, handle): tabi = self.tabIndices[handle] if self.tabs.currentIndex() == tabi: @@ -61,7 +61,7 @@ class PesterTabWindow(QtGui.QFrame): def convoHasFocus(self, convo): if ((self.hasFocus() or self.tabs.hasFocus()) and - self.tabs.tabText(self.tabs.currentIndex()) == convo.chum.handle): + self.tabs.tabText(self.tabs.currentIndex()) == convo.title()): return True def keyPressEvent(self, event): @@ -69,7 +69,7 @@ class PesterTabWindow(QtGui.QFrame): mods = event.modifiers() if ((mods & QtCore.Qt.ControlModifier) and keypress == QtCore.Qt.Key_Tab): - nexti = (self.tabIndices[self.currentConvo.chum.handle] + 1) % self.tabs.count() + nexti = (self.tabIndices[self.currentConvo.title()] + 1) % self.tabs.count() self.tabs.setCurrentIndex(nexti) def closeSoft(self): @@ -112,7 +112,7 @@ class PesterTabWindow(QtGui.QFrame): def notifyNewMessage(self, handle): i = self.tabIndices[handle] - self.tabs.setTabTextColor(i, QtGui.QColor(self.mainwindow.theme["convo/tabs/newmsgcolor"])) + self.tabs.setTabTextColor(i, QtGui.QColor(self.mainwindow.theme["%s/tabs/newmsgcolor" % (self.type)])) convo = self.convos[handle] def func(): convo.showChat() @@ -125,11 +125,14 @@ class PesterTabWindow(QtGui.QFrame): except KeyError: pass self.mainwindow.waitingMessages.messageAnswered(handle) + def initTheme(self, convo): + self.resize(*convo["size"]) + self.setStyleSheet(convo["style"]) + self.tabs.setShape(convo["tabs"]["tabstyle"]) + self.tabs.setStyleSheet("QTabBar::tab{ %s } QTabBar::tab:selected { %s }" % (convo["tabs"]["style"], convo["tabs"]["selectedstyle"])) + def changeTheme(self, theme): - self.resize(*theme["convo/size"]) - self.setStyleSheet(theme["convo/style"]) - self.tabs.setShape(theme["convo/tabs/tabstyle"]) - self.tabs.setStyleSheet("QTabBar::tabs{ %s }" % (theme["convo/tabs/style"])) + self.initTheme(theme["convo"]) for c in self.convos.values(): tabi = self.tabIndices[c.chum.handle] self.tabs.setTabIcon(tabi, c.chum.mood.icon(theme)) @@ -174,8 +177,8 @@ class PesterTabWindow(QtGui.QFrame): self.layout.removeWidget(self.currentConvo) self.currentConvo = convo self.layout.addWidget(convo) - self.setWindowIcon(convo.chum.mood.icon(self.mainwindow.theme)) - self.setWindowTitle(convo.chum.handle) + self.setWindowIcon(convo.icon()) + self.setWindowTitle(convo.title()) self.activateWindow() self.raise_() convo.raiseChat() @@ -281,8 +284,8 @@ class PesterConvo(QtGui.QFrame): convo = self.mainwindow.theme["convo"] self.resize(*convo["size"]) self.setStyleSheet(convo["style"]) - self.setWindowIcon(chum.mood.icon(self.mainwindow.theme)) - self.setWindowTitle(chum.handle) + self.setWindowIcon(self.icon()) + self.setWindowTitle(self.title()) t = Template(self.mainwindow.theme["convo/chumlabel/text"]) @@ -318,17 +321,22 @@ class PesterConvo(QtGui.QFrame): msg = self.mainwindow.profile().pestermsg(self.chum, QtGui.QColor(self.mainwindow.theme["convo/systemMsgColor"]), self.mainwindow.theme["convo/text/beganpester"]) self.setChumOpen(True) self.textArea.append(convertTags(msg)) - self.mainwindow.chatlog.log(self.chum.handle, convertTags(msg, "bbcode")) + self.mainwindow.chatlog.log(self.title(), convertTags(msg, "bbcode")) self.newmessage = False + def title(self): + return self.chum.handle + def icon(self): + return self.chum.mood.icon(self.mainwindow.theme) + def updateMood(self, mood, unblocked=False): if mood.name() == "offline" and self.chumopen == True and not unblocked: msg = self.chum.pestermsg(self.mainwindow.profile(), QtGui.QColor(self.mainwindow.theme["convo/systemMsgColor"]), self.mainwindow.theme["convo/text/ceasepester"]) self.textArea.append(convertTags(msg)) - self.mainwindow.chatlog.log(self.chum.handle, convertTags(msg, "bbcode")) + self.mainwindow.chatlog.log(self.title(), convertTags(msg, "bbcode")) self.chumopen = False if self.parent(): - self.parent().updateMood(self.chum.handle, mood, unblocked) + self.parent().updateMood(self.title(), mood, unblocked) else: if self.chum.blocked(self.mainwindow.config) and not unblocked: self.setWindowIcon(QtGui.QIcon(self.mainwindow.theme["main/chums/moods/blocked/icon"])) @@ -337,7 +345,7 @@ class PesterConvo(QtGui.QFrame): # print mood update? def updateBlocked(self): if self.parent(): - self.parent().updateBlocked(self.chum.handle) + self.parent().updateBlocked(self.title()) else: self.setWindowIcon(QtGui.QIcon(self.mainwindow.theme["main/chums/moods/blocked/icon"])) def updateColor(self, color): @@ -354,25 +362,25 @@ class PesterConvo(QtGui.QFrame): # first see if this conversation HASS the focus if not (self.hasFocus() or self.textArea.hasFocus() or self.textInput.hasFocus() or - (self.parent() and self.parent().convoHasFocus(self.chum.handle))): + (self.parent() and self.parent().convoHasFocus(self.title()))): # ok if it has a tabconvo parent, send that the notify. if self.parent(): - self.parent().notifyNewMessage(self.chum.handle) + self.parent().notifyNewMessage(self.title()) # if not change the window title and update system tray else: self.newmessage = True - self.setWindowTitle(self.chum.handle+"*") + self.setWindowTitle(self.title()+"*") def func(): self.showChat() - self.mainwindow.waitingMessages.addMessage(self.chum.handle, func) + self.mainwindow.waitingMessages.addMessage(self.title(), func) def clearNewMessage(self): if self.parent(): - self.parent().clearNewMessage(self.chum.handle) + self.parent().clearNewMessage(self.title()) elif self.newmessage: self.newmessage = False - self.setWindowTitle(self.chum.handle) - self.mainwindow.waitingMessages.messageAnswered(self.chum.handle) + self.setWindowTitle(self.title()) + self.mainwindow.waitingMessages.messageAnswered(self.title()) # reset system tray def focusInEvent(self, event): self.clearNewMessage() @@ -384,12 +392,12 @@ class PesterConvo(QtGui.QFrame): def showChat(self): if self.parent(): - self.parent().showChat(self.chum.handle) + self.parent().showChat(self.title()) self.raiseChat() def closeEvent(self, event): - self.mainwindow.waitingMessages.messageAnswered(self.chum.handle) - self.windowClosed.emit(self.chum.handle) + self.mainwindow.waitingMessages.messageAnswered(self.title()) + self.windowClosed.emit(self.title()) def setChumOpen(self, o): self.chumopen = o def changeTheme(self, theme): @@ -399,9 +407,9 @@ class PesterConvo(QtGui.QFrame): self.layout.setContentsMargins(margins["left"], margins["top"], margins["right"], margins["bottom"]) - self.setWindowIcon(self.chum.mood.icon(theme)) + self.setWindowIcon(self.icon()) t = Template(self.mainwindow.theme["convo/chumlabel/text"]) - self.chumLabel.setText(t.safe_substitute(handle=self.chum.handle)) + self.chumLabel.setText(t.safe_substitute(handle=self.title())) self.chumLabel.setStyleSheet(theme["convo/chumlabel/style"]) self.chumLabel.setAlignment(self.aligndict["h"][self.mainwindow.theme["convo/chumlabel/align/h"]] | self.aligndict["v"][self.mainwindow.theme["convo/chumlabel/align/v"]]) self.chumLabel.setMaximumHeight(self.mainwindow.theme["convo/chumlabel/maxheight"]) @@ -421,13 +429,13 @@ class PesterConvo(QtGui.QFrame): self.textInput.setText("") self.addMessage(text, True) # if ceased, rebegin - if not self.chumopen: - self.mainwindow.newConvoStarted.emit(QtCore.QString(self.chum.handle), True) + if hasattr(self, 'chumopen') and not self.chumopen: + self.mainwindow.newConvoStarted.emit(QtCore.QString(self.title()), True) # convert color tags text = convertTags(unicode(text), "ctag") - self.messageSent.emit(text, self.chum) + self.messageSent.emit(text, self.title()) - messageSent = QtCore.pyqtSignal(QtCore.QString, PesterProfile) + messageSent = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) windowClosed = QtCore.pyqtSignal(QtCore.QString) aligndict = {"h": {"center": QtCore.Qt.AlignHCenter, diff --git a/convo.pyc b/convo.pyc index 6ea4496..17043a1 100644 Binary files a/convo.pyc and b/convo.pyc differ diff --git a/dataobjs.pyc b/dataobjs.pyc index 38eda05..b6d0ace 100644 Binary files a/dataobjs.pyc and b/dataobjs.pyc differ diff --git a/generic.pyc b/generic.pyc index 0f85a66..6e857d8 100644 Binary files a/generic.pyc and b/generic.pyc differ diff --git a/memos.py b/memos.py index 0aa0a4a..cbb4984 100644 --- a/memos.py +++ b/memos.py @@ -4,7 +4,24 @@ from PyQt4 import QtGui, QtCore from dataobjs import PesterProfile, Mood from generic import PesterIcon -from convo import PesterConvo, PesterInput, PesterText +from convo import PesterConvo, PesterInput, PesterText, PesterTabWindow + +class MemoTabWindow(PesterTabWindow): + def __init__(self, mainwindow, parent=None): + PesterTabWindow.__init__(self, mainwindow, parent, "memos") + def addChat(self, convo): + self.convos[convo.channel] = convo + # either addTab or setCurrentIndex will trigger changed() + newindex = self.tabs.addTab(convo.channel) + self.tabIndices[convo.channel] = newindex + self.tabs.setCurrentIndex(newindex) + self.tabs.setTabIcon(newindex, PesterIcon(self.mainwindow.theme["memos/memoicon"])) + def updateBlocked(self): + pass + def updateMood(self): + pass + +_ctag_begin = re.compile(r'<c=(.*?)>') class MemoText(PesterText): def __init__(self, theme, parent=None): @@ -13,7 +30,11 @@ class MemoText(PesterText): self.setReadOnly(True) self.setMouseTracking(True) def addMessage(self, text, chum): - pass + # get chum color from c tag + mobj = _ctag_begin.match(text) + # tinychum sends straight /me with no color. go to chumdb! + systemColor = QtGui.QColor(self.parent().mainwindow.theme["memo/systemMsgColor"]) + def changeTheme(self): pass @@ -46,6 +67,9 @@ class PesterMemo(PesterConvo): self.initTheme(self.mainwindow.theme) # connect + self.connect(self.textInput, QtCore.SIGNAL('returnPressed()'), + self, QtCore.SLOT('sentMessage()')) + layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(self.channelLabel) layout_0.addWidget(self.textArea) @@ -66,22 +90,27 @@ class PesterMemo(PesterConvo): self.layout.setContentsMargins(margins["left"], margins["top"], margins["right"], margins["bottom"]) - #if parent: - # parent.addChat(self) + if parent: + parent.addChat(self) self.newmessage = False + def title(self): + return self.channel + def icon(self): + return PesterIcon(self.mainwindow.theme["memos/memoicon"]) + def updateMood(self): pass def updateBlocked(self): pass def updateColor(self): pass - def addMessage(self): - pass - def notifyNewMessage(self): - pass - def clearNewMessage(self): - pass + def addMessage(self, text, handle): + if type(handle) is bool: + chum = self.mainwindow.profile() + else: + chum = PesterProfile(handle) + self.textArea.addMessage(text, chum) def initTheme(self, theme): memo = theme["memos"] @@ -104,14 +133,19 @@ class PesterMemo(PesterConvo): slidercss = "QSlider { %s } QSlider::groove { %s } QSlider::handle { %s }" % (theme["memos/time/slider/style"], theme["memos/time/slider/groove"], theme["memos/time/slider/handle"]) self.timeslider.setStyleSheet(slidercss) - def changeTheme(self, theme): self.initTheme(theme) self.textArea.changeTheme(theme) self.textInput.changeTheme(theme) + @QtCore.pyqtSlot() def sentMessage(self): - pass + text = self.textInput.text() + if text == "": + return + text = "<c=%s>%s</c>" % (self.mainwindow.profile().colorcmd(), text) + self.textInput.setText(text) + PesterConvo.sentMessage(self) def closeEvent(self, event): self.mainwindow.waitingMessages.messageAnswered(self.channel) diff --git a/memos.pyc b/memos.pyc index 4107ccc..a2a0430 100644 Binary files a/memos.pyc and b/memos.pyc differ diff --git a/menus.py b/menus.py index c93c286..e187afd 100644 --- a/menus.py +++ b/menus.py @@ -2,7 +2,7 @@ from PyQt4 import QtGui, QtCore import re from generic import RightClickList, MultiTextDialog -from pesterdata import pesterQuirk, PesterProfile +from dataobjs import pesterQuirk, PesterProfile class PesterQuirkItem(QtGui.QListWidgetItem): def __init__(self, quirk, parent): @@ -450,3 +450,26 @@ class PesterMemoList(QtGui.QDialog): def joinActivatedMemo(self, item): self.channelarea.setCurrentItem(item) self.accept() + + +class LoadingScreen(QtGui.QDialog): + def __init__(self, parent=None): + QtGui.QDialog.__init__(self, parent, flags=(QtCore.Qt.CustomizeWindowHint | + QtCore.Qt.FramelessWindowHint)) + self.mainwindow = parent + self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) + + self.loadinglabel = QtGui.QLabel("LO4D1NG") + + self.layout = QtGui.QVBoxLayout() + self.layout.addWidget(self.loadinglabel) + self.setLayout(self.layout) + QtCore.QTimer.singleShot(25000, self, QtCore.SLOT('connectTimeout()')) + @QtCore.pyqtSlot() + def connectTimeout(self): + if hasattr(self, 'failed'): + self.accept() + else: + self.failed = True + self.loadinglabel.setText("F41L3D") + QtCore.QTimer.singleShot(1000, self, QtCore.SLOT('connectTimeout()')) diff --git a/menus.pyc b/menus.pyc index 9196adf..7229cd5 100644 Binary files a/menus.pyc and b/menus.pyc differ diff --git a/oyoyo/__init__.pyc b/oyoyo/__init__.pyc index 28e3e80..be26c04 100644 Binary files a/oyoyo/__init__.pyc and b/oyoyo/__init__.pyc differ diff --git a/oyoyo/client.py b/oyoyo/client.py index 795d9b1..0cb2b4e 100644 --- a/oyoyo/client.py +++ b/oyoyo/client.py @@ -170,7 +170,7 @@ class IRCClient: try: self.command_handler.run(command, prefix, *args) except CommandError: - # error will of already been loggingged by the handler + # error will have already been loggingged by the handler pass yield True diff --git a/oyoyo/client.pyc b/oyoyo/client.pyc index ad7d9f7..5ba5325 100644 Binary files a/oyoyo/client.pyc and b/oyoyo/client.pyc differ diff --git a/oyoyo/cmdhandler.pyc b/oyoyo/cmdhandler.pyc index d97b3d1..e9def19 100644 Binary files a/oyoyo/cmdhandler.pyc and b/oyoyo/cmdhandler.pyc differ diff --git a/oyoyo/helpers.pyc b/oyoyo/helpers.pyc index 16a01a9..c05a1cd 100644 Binary files a/oyoyo/helpers.pyc and b/oyoyo/helpers.pyc differ diff --git a/oyoyo/ircevents.pyc b/oyoyo/ircevents.pyc index c83999f..1f1ccd6 100644 Binary files a/oyoyo/ircevents.pyc and b/oyoyo/ircevents.pyc differ diff --git a/oyoyo/parse.pyc b/oyoyo/parse.pyc index 9095b24..e67f2ea 100644 Binary files a/oyoyo/parse.pyc and b/oyoyo/parse.pyc differ diff --git a/parsetools.py b/parsetools.py index bceaba2..5e9236b 100644 --- a/parsetools.py +++ b/parsetools.py @@ -12,7 +12,7 @@ def convertTags(string, format="html"): color = matchobj.group(1) if _ctag_rgb.match(color) is not None: if format=='ctag': - return "<c=%s,%s,%s>" + return "<c=%s>" % (color) try: qc = QtGui.QColor(*[int(c) for c in color.split(",")]) except ValueError: diff --git a/parsetools.pyc b/parsetools.pyc index 11c33a8..82e6ea5 100644 Binary files a/parsetools.pyc and b/parsetools.pyc differ diff --git a/pesterchum.js b/pesterchum.js index 4114dfc..129b3f8 100644 --- a/pesterchum.js +++ b/pesterchum.js @@ -1 +1 @@ -{"tabs": false, "chums": ["aquaMarinist", "marineAquist", "unknownTraveler", "tentacleTherapist", "macruralAlchemist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "fireSwallow", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr"], "defaultprofile": "testProfile", "block": []} \ No newline at end of file +{"tabs": false, "chums": ["aquaMarinist", "marineAquist", "unknownTraveler", "tentacleTherapist", "macruralAlchemist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "fireSwallow", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "adiosToreador"], "defaultprofile": "testProfile", "block": []} \ No newline at end of file diff --git a/pesterchum.py b/pesterchum.py index f0ab366..ba2b613 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -14,16 +14,16 @@ from PyQt4 import QtGui, QtCore import pygame from menus import PesterChooseQuirks, PesterChooseTheme, \ - PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList + PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList, \ + LoadingScreen from dataobjs import PesterProfile, Mood, pesterQuirk, pesterQuirks from generic import PesterIcon, RightClickList, MultiTextDialog from convo import PesterTabWindow, PesterText, PesterInput, PesterConvo from parsetools import convertTags -from memos import PesterMemo +from memos import PesterMemo, MemoTabWindow logging.basicConfig(level=logging.INFO) - class waitingMessageHolder(object): def __init__(self, mainwindow, **msgfuncs): self.mainwindow = mainwindow @@ -583,6 +583,7 @@ class PesterWindow(MovingWindow): self.convos = {} self.memos = {} self.tabconvo = None + self.tabmemo = None self.setObjectName("main") self.config = userConfig() @@ -706,6 +707,7 @@ class PesterWindow(MovingWindow): if not self.config.defaultprofile(): self.changeProfile() + self.loadingscreen = LoadingScreen(self) def profile(self): return self.userprofile.chat @@ -717,6 +719,12 @@ class PesterWindow(MovingWindow): else: for c in self.convos.values(): c.close() + if self.tabmemo: + self.tabmemo.close() + else: + for m in self.memos.values(): + m.close() + def closeEvent(self, event): self.closeConversations() if hasattr(self, 'trollslum') and self.trollslum: @@ -742,6 +750,12 @@ class PesterWindow(MovingWindow): convo.addMessage(msg, False) # play sound here self.alarm.play() + def newMemoMsg(self, chan, handle, msg): + if not self.memos.has_key(chan): + # silently ignore in case we forgot to /part + return + memo = self.memos[chan] + memo.addMessage(msg, handle) def changeColor(self, handle, color): # pesterconvo and chumlist @@ -767,33 +781,46 @@ class PesterWindow(MovingWindow): self.tabconvo.show() else: convoWindow = PesterConvo(chum, initiated, self) - self.connect(convoWindow, QtCore.SIGNAL('messageSent(QString, PyQt_PyObject)'), - self, QtCore.SIGNAL('sendMessage(QString, PyQt_PyObject)')) + self.connect(convoWindow, QtCore.SIGNAL('messageSent(QString, QString)'), + self, QtCore.SIGNAL('sendMessage(QString, QString)')) self.connect(convoWindow, QtCore.SIGNAL('windowClosed(QString)'), self, QtCore.SLOT('closeConvo(QString)')) self.convos[chum.handle] = convoWindow self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated) convoWindow.show() + def createTabWindow(self): self.tabconvo = PesterTabWindow(self) self.connect(self.tabconvo, QtCore.SIGNAL('windowClosed()'), self, QtCore.SLOT('tabsClosed()')) - + def createMemoTabWindow(self): + self.tabmemo = MemoTabWindow(self) + self.connect(self.tabmemo, QtCore.SIGNAL('windowClosed()'), + self, QtCore.SLOT('memoTabsClosed()')) def newMemo(self, channel): + if channel == "#pesterchum": + return if self.memos.has_key(channel): # load memo return + # do slider dialog then set + if self.config.tabs(): + if not self.tabmemo: + self.createMemoTabWindow() + memoWindow = PesterMemo(channel, self, self.tabmemo) + self.tabmemo.show() else: - # do slider dialog then set - if self.config.tabs(): - # create new tabbed memo window - pass - else: - self.memoWindow = PesterMemo(channel, self, None) + memoWindow = PesterMemo(channel, self, None) # connect signals + self.connect(memoWindow, QtCore.SIGNAL('messageSent(QString, QString)'), + self, QtCore.SIGNAL('sendMessage(QString, QString)')) +# self.connect(memoWindow, QtCore.SIGNAL('windowClosed(QString)'), +# self, QtCore.SLOT('closeConvo(QString)')) # chat client send memo open - self.memoWindow.show() + self.memos[channel] = memoWindow + self.joinChannel.emit(channel) + memoWindow.show() def addChum(self, chum): self.chumList.addChum(chum) @@ -919,7 +946,11 @@ class PesterWindow(MovingWindow): else: self.waitingMessages.answerMessage() - + @QtCore.pyqtSlot() + def connected(self): + if self.loadingscreen: + self.loadingscreen.close() + self.loadingscreen = None @QtCore.pyqtSlot() def blockSelectedChum(self): curChumListing = self.chumList.currentItem() @@ -953,6 +984,10 @@ class PesterWindow(MovingWindow): def tabsClosed(self): del self.tabconvo self.tabconvo = None + @QtCore.pyqtSlot() + def memoTabsClosed(self): + del self.tabmemo + self.tabmemo = None @QtCore.pyqtSlot(QtCore.QString, Mood) def updateMoodSlot(self, handle, mood): @@ -969,6 +1004,10 @@ class PesterWindow(MovingWindow): h = unicode(handle) m = unicode(msg) self.newMessage(h, m) + @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) + def deliverMemo(self, chan, handle, msg): + (c, h, m) = (unicode(chan), unicode(handle), unicode(msg)) + self.newMemoMsg(c,h,m) @QtCore.pyqtSlot(QtCore.QString, PesterList) def updateNames(self, channel, names): @@ -1083,9 +1122,11 @@ class PesterWindow(MovingWindow): newmemo = self.memochooser.newmemoname() selectedmemo = self.memochooser.selectedmemo() if newmemo: - self.newMemo('#'+newmemo) - else: - self.newMemo('#'+selectedmemo.text()) + channel = "#"+unicode(newmemo) + self.newMemo(channel) + elif selectedmemo: + channel = "#"+unicode(selectedmemo.text()) + self.newMemo(channel) self.memochooser = None @QtCore.pyqtSlot() def memoChooserClose(self): @@ -1310,7 +1351,7 @@ class PesterWindow(MovingWindow): pass newConvoStarted = QtCore.pyqtSignal(QtCore.QString, bool, name="newConvoStarted") - sendMessage = QtCore.pyqtSignal(QtCore.QString, PesterProfile) + sendMessage = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) convoClosed = QtCore.pyqtSignal(QtCore.QString) profileChanged = QtCore.pyqtSignal() moodRequest = QtCore.pyqtSignal(PesterProfile) @@ -1324,6 +1365,7 @@ class PesterWindow(MovingWindow): trayIconSignal = QtCore.pyqtSignal(int) blockedChum = QtCore.pyqtSignal(QtCore.QString) unblockedChum = QtCore.pyqtSignal(QtCore.QString) + joinChannel = QtCore.pyqtSignal(QtCore.QString) class PesterIRC(QtCore.QObject): def __init__(self, window): @@ -1342,10 +1384,10 @@ class PesterIRC(QtCore.QObject): def getMoods(self, chums): self.cli.command_handler.getMood(*chums) - @QtCore.pyqtSlot(QtCore.QString, PesterProfile) - def sendMessage(self, text, chum): - handle = chum.handle - helpers.msg(self.cli, handle, text) + @QtCore.pyqtSlot(QtCore.QString, QtCore.QString) + def sendMessage(self, text, handle): + h = unicode(handle) + helpers.msg(self.cli, h, text) @QtCore.pyqtSlot(QtCore.QString, bool) def startConvo(self, handle, initiated): @@ -1387,16 +1429,21 @@ class PesterIRC(QtCore.QObject): @QtCore.pyqtSlot() def requestChannelList(self): helpers.channel_list(self.cli) - + @QtCore.pyqtSlot(QtCore.QString) + def joinChannel(self, channel): + c = unicode(channel) + helpers.join(self.cli, c) def updateIRC(self): self.conn.next() moodUpdated = QtCore.pyqtSignal(QtCore.QString, Mood) colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor) messageReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) + memoReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString) namesReceived = QtCore.pyqtSignal(QtCore.QString, PesterList) channelListReceived = QtCore.pyqtSignal(PesterList) nickCollision = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) + connected = QtCore.pyqtSignal() userPresentUpdate = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString) @@ -1422,7 +1469,12 @@ class PesterHandler(DefaultCommandHandler): if msg.find(mychumhandle, 8) != -1: helpers.msg(self.client, "#pesterchum", "MOOD >%d" % (mymood)) - + elif chan[0] == '#': + if msg[0:16] == "PESTERCHUM:TIME>": + # send time msg + pass + else: + self.parent.memoReceived.emit(chan, handle, msg) else: # private message # silently ignore messages to yourself. @@ -1441,6 +1493,7 @@ class PesterHandler(DefaultCommandHandler): def welcome(self, server, nick, msg): + self.parent.connected.emit() helpers.join(self.client, "#pesterchum") mychumhandle = self.mainwindow.profile().handle mymood = self.mainwindow.profile().mood.value() @@ -1561,8 +1614,8 @@ def main(): irc = PesterIRC(widget) irc.IRCConnect() - irc.connect(widget, QtCore.SIGNAL('sendMessage(QString, PyQt_PyObject)'), - irc, QtCore.SLOT('sendMessage(QString, PyQt_PyObject)')) + irc.connect(widget, QtCore.SIGNAL('sendMessage(QString, QString)'), + irc, QtCore.SLOT('sendMessage(QString, QString)')) irc.connect(widget, QtCore.SIGNAL('newConvoStarted(QString, bool)'), irc, QtCore.SLOT('startConvo(QString, bool)')) @@ -1605,8 +1658,14 @@ def main(): QtCore.SIGNAL('requestChannelList()'), irc, QtCore.SLOT('requestChannelList()')) + irc.connect(widget, + QtCore.SIGNAL('joinChannel(QString)'), + irc, + QtCore.SLOT('joinChannel(QString)')) # IRC --> Main window + irc.connect(irc, QtCore.SIGNAL('connected()'), + widget, QtCore.SLOT('connected()')) irc.connect(irc, QtCore.SIGNAL('moodUpdated(QString, PyQt_PyObject)'), widget, @@ -1619,6 +1678,10 @@ def main(): QtCore.SIGNAL('messageReceived(QString, QString)'), widget, QtCore.SLOT('deliverMessage(QString, QString)')) + irc.connect(irc, + QtCore.SIGNAL('memoReceived(QString, QString, QString)'), + widget, + QtCore.SLOT('deliverMemo(QString, QString, QString)')) irc.connect(irc, QtCore.SIGNAL('nickCollision(QString, QString)'), widget, @@ -1638,6 +1701,7 @@ def main(): ircapp = IRCThread(irc) ircapp.start() + widget.loadingscreen.exec_() sys.exit(app.exec_()) main() diff --git a/themes/pesterchum/style.js b/themes/pesterchum/style.js index 0d3abb4..466a065 100644 --- a/themes/pesterchum/style.js +++ b/themes/pesterchum/style.js @@ -216,6 +216,12 @@ {"memoicon": "$path/memo.png", "style": "background: #fdb302; font-family:'Courier';font:bold;selection-background-color:#919191; ", "size": [600,300], + "tabs": { + "style": "", + "selectedstyle": "", + "newmsgcolor": "#fdb302", + "tabstyle": 0 + }, "label": { "text": "$channel", "style": "background: rgb(196, 138, 0); color: white; border:0px;", "align": { "h": "center", "v": "center" }, @@ -230,6 +236,7 @@ "slider": { "style": "", "groove": "", "handle": "" } - } + }, + "systemMsgColor": "#646464" } } \ No newline at end of file diff --git a/tmp/new pc themes.zip b/tmp/new pc themes.zip deleted file mode 100644 index 44447b1..0000000 Binary files a/tmp/new pc themes.zip and /dev/null differ