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

View file

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