-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessageDialog.py
executable file
·33 lines (26 loc) · 1.39 KB
/
MessageDialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from PyQt4.QtCore import SIGNAL
import datetime
from AbstractDialog import AbstractDialog
class MessageDialog(AbstractDialog):
def __init__(self, con, jidTo, buddyList, parent = None, nick = None):
AbstractDialog.__init__(self, con, jidTo, buddyList, nick, parent)
def receiveMessage(self, msg):
time = str(datetime.datetime.now().strftime("%H:%M:%S"))
if self.nick:
message = """\n<span style="color: darkblue">[%s] <strong>%s:</strong></span> %s""" % (time, self.nick, msg)
else:
message = """\n<span style="color: darkblue">[%s] <strong>%s:</strong></span> %s""" % (time, self.con.getName(self.jidTo[0]), msg)
self.tbr_browser.append(message)
self.emit(SIGNAL("debug"), "message form " + self.con.getName(self.jidTo[0]) + ":\n" + msg + "\n\n")
def sendMessage(self, text):
time = str(datetime.datetime.now().strftime("%H:%M:%S"))
message = """\n<span style="color: darkred">[%s] <strong>%s:</strong></span> %s""" % (time, self.tr("Me"), text)
self.tbr_browser.append(message)
self.con.sendMessage(self.jidTo[0], text)
self.messageTextEdit.clear()
def sendCanvasStroke(self, d, stroke, stroke_width):
self.con.sendCanvasStroke("chat", self.jidTo[0], d, stroke, stroke_width)
def CanvasStroke(self, d, stroke, stroke_width):
self.showMultimedia(True)
#print "======private\n", d, stroke, stroke_width, "======\n"
self.canvas.scribbleArea.draw(d, stroke, stroke_width)