profiles pt3 all but theme changes!

This commit is contained in:
Stephen Dranger 2011-01-28 00:41:01 -06:00
parent 28f476e7fd
commit 9bb57931a2
4 changed files with 41 additions and 4 deletions

2
TODO
View file

@ -1,6 +1,7 @@
Features: Features:
* Profile management * Profile management
* pesterchum:begin * pesterchum:begin
* pesterchum:cease
* changeColor * changeColor
* protect against messages from yourself :P * protect against messages from yourself :P
* Theme Changing * Theme Changing
@ -15,6 +16,7 @@ Features:
* Quirks * Quirks
* Block list * Block list
* User list/add from list * User list/add from list
* System tray stuff
* Chat rooms * Chat rooms
* Spy mode * Spy mode

View file

@ -1 +1 @@
{"tabs": false, "theme": "pesterchum", "chums": ["gamblingGenocider", "grimAuxiliatrix", "gardenGnostic", "ghostDunk", "spaceGhost", "aquaMarinist", "carcinoGeneticist", "tentacleTherapist"]} {"tabs": true, "chums": ["gamblingGenocider", "grimAuxiliatrix", "gardenGnostic", "ghostDunk", "spaceGhost", "aquaMarinist", "carcinoGeneticist", "tentacleTherapist"], "defaultprofile": "superGhost"}

View file

@ -546,6 +546,14 @@ class PesterWindow(MovingWindow):
filemenu.addAction(opts) filemenu.addAction(opts)
filemenu.addAction(exitaction) filemenu.addAction(exitaction)
filemenu.setStyleSheet(qmenustyle) filemenu.setStyleSheet(qmenustyle)
switch = QtGui.QAction("SWITCH", self)
self.connect(switch, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('switchProfile()'))
profilemenu = self.menu.addMenu("PROFILE")
profilemenu.addAction(switch)
profilemenu.setStyleSheet(qmenustyle)
self.menu.setStyleSheet("QMenuBar { background: transparent; %s } QMenuBar::item { background: transparent; } " % (self.theme["main/menubar/style"])) self.menu.setStyleSheet("QMenuBar { background: transparent; %s } QMenuBar::item { background: transparent; } " % (self.theme["main/menubar/style"]))
closestyle = main["close"] closestyle = main["close"]
@ -566,12 +574,14 @@ class PesterWindow(MovingWindow):
self.convos = {} self.convos = {}
self.tabconvo = None self.tabconvo = None
self.optionmenu = None self.optionmenu = None
def closeEvent(self, event): def closeConversations(self):
if self.tabconvo: if self.tabconvo:
self.tabconvo.close() self.tabconvo.close()
else: else:
for c in self.convos.values(): for c in self.convos.values():
c.close() c.close()
def closeEvent(self, event):
self.closeConversations()
event.accept() event.accept()
def newMessage(self, handle, msg): def newMessage(self, handle, msg):
if not self.convos.has_key(handle): if not self.convos.has_key(handle):
@ -619,7 +629,6 @@ class PesterWindow(MovingWindow):
self.chooseprofile = PesterChooseProfile(self.userprofile, self.config, self.theme, self, collision=collision) self.chooseprofile = PesterChooseProfile(self.userprofile, self.config, self.theme, self, collision=collision)
self.chooseprofile.exec_() self.chooseprofile.exec_()
@QtCore.pyqtSlot(QtGui.QListWidgetItem) @QtCore.pyqtSlot(QtGui.QListWidgetItem)
def newConversationWindow(self, chumlisting): def newConversationWindow(self, chumlisting):
chum = chumlisting.chum chum = chumlisting.chum
@ -702,7 +711,7 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def profileSelected(self): def profileSelected(self):
if self.chooseprofile.profileBox and \ if self.chooseprofile.profileBox and \
self.chooseprofile.profileBox.currentIndex > 0: self.chooseprofile.profileBox.currentIndex() > 0:
handle = unicode(self.chooseprofile.profileBox.currentText()) handle = unicode(self.chooseprofile.profileBox.currentText())
self.userprofile = userProfile(handle) self.userprofile = userProfile(handle)
self.profile = self.userprofile.chat self.profile = self.userprofile.chat
@ -714,10 +723,26 @@ class PesterWindow(MovingWindow):
self.userprofile = userProfile.newUserProfile(profile) self.userprofile = userProfile.newUserProfile(profile)
self.profile = self.userprofile.chat self.profile = self.userprofile.chat
# this may have to be fixed
self.closeConversations()
self.profileChanged.emit()
self.chooseprofile = None self.chooseprofile = None
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def closeProfile(self): def closeProfile(self):
self.chooseprofile = None self.chooseprofile = None
@QtCore.pyqtSlot()
def switchProfile(self):
closeWarning = QtGui.QMessageBox()
closeWarning.setText("WARNING: THIS WILL CLOSE ALL CONVERSATION WINDOWS!")
closeWarning.setInformativeText("i warned you bro")
closeWarning.setStandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)
closeWarning.setDefaultButton(QtGui.QMessageBox.Ok)
ret = closeWarning.exec_()
if ret == QtGui.QMessageBox.Cancel:
return
elif ret == QtGui.QMessageBox.Ok:
self.changeProfile()
@QtCore.pyqtSlot(QtCore.QString) @QtCore.pyqtSlot(QtCore.QString)
def nickCollision(self, handle): def nickCollision(self, handle):
@ -728,6 +753,7 @@ class PesterWindow(MovingWindow):
newConvoStarted = QtCore.pyqtSignal(QtCore.QString, bool, name="newConvoStarted") newConvoStarted = QtCore.pyqtSignal(QtCore.QString, bool, name="newConvoStarted")
sendMessage = QtCore.pyqtSignal(QtCore.QString, PesterProfile) sendMessage = QtCore.pyqtSignal(QtCore.QString, PesterProfile)
convoClosed = QtCore.pyqtSignal(QtCore.QString) convoClosed = QtCore.pyqtSignal(QtCore.QString)
profileChanged = QtCore.pyqtSignal()
class PesterIRC(QtCore.QObject): class PesterIRC(QtCore.QObject):
def __init__(self, window): def __init__(self, window):
@ -757,6 +783,10 @@ class PesterIRC(QtCore.QObject):
def endConvo(self, handle): def endConvo(self, handle):
h = str(handle) h = str(handle)
helpers.msg(self.cli, h, "PESTERCHUM:CEASE") helpers.msg(self.cli, h, "PESTERCHUM:CEASE")
@QtCore.pyqtSlot()
def updateProfile(self):
handle = self.window.profile.handle
helpers.nick(self.cli, handle)
def updateIRC(self): def updateIRC(self):
self.conn.next() self.conn.next()
@ -859,6 +889,10 @@ def main():
irc.connect(widget, irc.connect(widget,
QtCore.SIGNAL('convoClosed(QString)'), QtCore.SIGNAL('convoClosed(QString)'),
irc, QtCore.SLOT('endConvo(QString)')) irc, QtCore.SLOT('endConvo(QString)'))
irc.connect(widget,
QtCore.SIGNAL('profileChanged()'),
irc,
QtCore.SLOT('updateProfile()'))
irc.connect(irc, irc.connect(irc,
QtCore.SIGNAL('moodUpdated(QString, PyQt_PyObject)'), QtCore.SIGNAL('moodUpdated(QString, PyQt_PyObject)'),
widget, widget,

1
profiles/superGhost.js Normal file
View file

@ -0,0 +1 @@
{"color": "#00aaff", "theme": "pesterchum", "quirks": [], "handle": "superGhost"}