/[fgs]/fgs/client/tkinter/chatwidget.py
ViewVC logotype

Diff of /fgs/client/tkinter/chatwidget.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by tps12, Wed Sep 3 23:44:30 2003 UTC revision 1.2 by tps12, Tue Sep 9 02:33:07 2003 UTC
# Line 1  Line 1 
1  from Tkinter import *  from Tkinter import *
2  from ScrolledText import *  from ScrolledText import *
3    from string import replace, find
4    
5  class Chat(Frame):  class Chat(Frame):
6    
# Line 10  class Chat(Frame): Line 11  class Chat(Frame):
11          self.tellhandler = tellhandler # Tell or RoomTell          self.tellhandler = tellhandler # Tell or RoomTell
12                    
13          self.output = ScrolledText(self, state=DISABLED)          self.output = ScrolledText(self, state=DISABLED)
14          #self.output.tag_config("name", self.output.text.font.copy().config(weight=BOLD))          outputfont = "Arial 10"
15            self.output.tag_config("normal", font=outputfont)
16            self.output.tag_config("name", font=outputfont + " bold")
17            self.output.tag_config("action", font=outputfont + " italic")
18          self.output.grid(row=0, sticky=NE+SW)          self.output.grid(row=0, sticky=NE+SW)
19    
20          self.input = Entry(self)          self.input = Entry(self)
# Line 28  class Chat(Frame): Line 32  class Chat(Frame):
32    
33      def receive(self, source, speech):      def receive(self, source, speech):
34          self.output.config(state=NORMAL)          self.output.config(state=NORMAL)
35          self.output.insert(END, source, "name")          # check for action (string beginning with "/me")
36          self.output.insert(END, speech + "\n")          action = 0
37            if find(speech, "/me", 0, 3) > -1:
38                action = 1
39            # replace "/me" with user's name
40            speech = replace(speech, "/me", source)
41            if not action:
42                self.output.insert(END, source + ": ", "name")
43                self.output.insert(END, speech + "\n", "normal")
44            else:
45                self.output.insert(END, "***" + speech + "\n", "action")
46          self.output.config(state=DISABLED)          self.output.config(state=DISABLED)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26