small changes

This commit is contained in:
Stephen Dranger 2011-01-24 12:02:00 -06:00
parent 62bd13a936
commit b31c078688
2 changed files with 19 additions and 6 deletions

View file

@ -19,7 +19,11 @@ class Mood(object):
def value(self): def value(self):
return self.mood return self.mood
def name(self): def name(self):
return self.moods[self.mood] try:
name = self.moods[self.mood]
except IndexError:
name = "chummy"
return name
def icon(self, theme): def icon(self, theme):
f = theme["main/chums/moods"][self.name()]["icon"] f = theme["main/chums/moods"][self.name()]["icon"]
return QtGui.QIcon(f) return QtGui.QIcon(f)
@ -196,6 +200,10 @@ class PesterConvo(QtGui.QFrame):
else: else:
chum = self.chum chum = self.chum
self.textArea.addMessage(text, chum) self.textArea.addMessage(text, chum)
def showChat(self):
self.activateWindow()
self.raise_()
self.textInput.setFocus()
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def sentMessage(self): def sentMessage(self):
@ -216,9 +224,8 @@ class PesterWindow(MovingWindow):
self.config = userConfig() self.config = userConfig()
self.theme = self.config.getTheme() self.theme = self.config.getTheme()
main = self.theme["main"] main = self.theme["main"]
width = int(main['width']) size = main['size']
height = int(main['height']) self.setGeometry(100, 100, size[0], size[1])
self.setGeometry(100, 100, width, height)
self.setWindowIcon(QtGui.QIcon(main["icon"])) self.setWindowIcon(QtGui.QIcon(main["icon"]))
self.setStyleSheet("QFrame#main { "+main["style"]+" }") self.setStyleSheet("QFrame#main { "+main["style"]+" }")
@ -254,6 +261,13 @@ class PesterWindow(MovingWindow):
if self.convos.has_key(handle): if self.convos.has_key(handle):
self.convos[handle].updateMood(mood) self.convos[handle].updateMood(mood)
def newConversation(self, chum, initiated=True): def newConversation(self, chum, initiated=True):
if self.convos.has_key(chum.handle):
self.convos[chum.handle].showChat()
if not initiated:
# self.convos[chum.handle]
# add pesterchum:begin
pass
return
convoWindow = PesterConvo(chum, initiated, self) convoWindow = PesterConvo(chum, initiated, self)
self.connect(convoWindow, QtCore.SIGNAL('messageSent(QString, PyQt_PyObject)'), self.connect(convoWindow, QtCore.SIGNAL('messageSent(QString, PyQt_PyObject)'),
self, QtCore.SIGNAL('sendMessage(QString, PyQt_PyObject)')) self, QtCore.SIGNAL('sendMessage(QString, PyQt_PyObject)'))

View file

@ -1,7 +1,6 @@
{"main": {"main":
{"style": "background-image:url($path/pcbg.png);", {"style": "background-image:url($path/pcbg.png);",
"width": 300, "size": [300, 620],
"height": 620,
"icon": "$path/trayicon.gif", "icon": "$path/trayicon.gif",
"close": { "image": "$path/x.gif", "close": { "image": "$path/x.gif",
"loc": [275, 0]}, "loc": [275, 0]},