comparison orpg/chat/chatwnd.py @ 196:0bc44a57ae6c alpha

Traipse Alpha 'OpenRPG' {100425-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Patch-2) New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues
author sirebral
date Sun, 25 Apr 2010 23:26:55 -0500
parents b633f4c64aae
children 9ac90179e8d8
comparison
equal deleted inserted replaced
195:b633f4c64aae 196:0bc44a57ae6c
1030 1030
1031 # play sound 1031 # play sound
1032 sound_file = self.settings.get_setting("SendSound") 1032 sound_file = self.settings.get_setting("SendSound")
1033 if sound_file != '': component.get('sound').play(sound_file) 1033 if sound_file != '': component.get('sound').play(sound_file)
1034 if s[0] != "/": ## it's not a slash command 1034 if s[0] != "/": ## it's not a slash command
1035 s = self.ParsePost( s, True, True ) 1035 s = Parse.Post(s, self, True, True)
1036 else: self.chat_cmds.docmd(s) # emote is in chatutils.py 1036 else: self.chat_cmds.docmd(s) # emote is in chatutils.py
1037 1037
1038 def on_chat_key_down(self, event): 1038 def on_chat_key_down(self, event):
1039 s = self.chattxt.GetValue() 1039 s = self.chattxt.GetValue()
1040 if event.GetKeyCode() == wx.WXK_RETURN and not event.ShiftDown(): 1040 if event.GetKeyCode() == wx.WXK_RETURN and not event.ShiftDown():
1169 id = evt.GetId() 1169 id = evt.GetId()
1170 if self.dieIDs.has_key(id): dieText += self.dieIDs[id] 1170 if self.dieIDs.has_key(id): dieText += self.dieIDs[id]
1171 if len(dieMod) and dieMod[0] not in "*/-+": dieMod = "+" + dieMod 1171 if len(dieMod) and dieMod[0] not in "*/-+": dieMod = "+" + dieMod
1172 dieText += dieMod 1172 dieText += dieMod
1173 dieText = "[" + dieText + "]" 1173 dieText = "[" + dieText + "]"
1174 self.ParsePost(dieText, 1, 1) 1174 Parse.Post(dieText, self, 1, 1)
1175 self.chattxt.SetFocus() 1175 self.chattxt.SetFocus()
1176 1176
1177 def on_chat_save(self, evt): 1177 def on_chat_save(self, evt):
1178 f = wx.FileDialog(self,"Save Chat Buffer",".","","HTM* (*.htm*)|*.htm*|HTML (*.html)|*.html|HTM (*.htm)|*.htm",wx.SAVE) 1178 f = wx.FileDialog(self,"Save Chat Buffer",".","","HTM* (*.htm*)|*.htm*|HTML (*.html)|*.html|HTM (*.htm)|*.htm",wx.SAVE)
1179 if f.ShowModal() == wx.ID_OK: 1179 if f.ShowModal() == wx.ID_OK:
1299 newmatch = re.sub(rule[0], rule[1], match) 1299 newmatch = re.sub(rule[0], rule[1], match)
1300 text = text.replace(match, newmatch) 1300 text = text.replace(match, newmatch)
1301 return text 1301 return text
1302 1302
1303 def emote_message(self, text): 1303 def emote_message(self, text):
1304 text = Parse.Normalize(text) 1304 text = Parse.Normalize(text, self)
1305 text = self.colorize(self.emotecolor, text) 1305 text = self.colorize(self.emotecolor, text)
1306 if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(text,chat_msg.EMOTE_MESSAGE) 1306 if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(text,chat_msg.EMOTE_MESSAGE)
1307 elif self.type == MAIN_TAB and self.sendtarget == "gm": 1307 elif self.type == MAIN_TAB and self.sendtarget == "gm":
1308 msg_type = chat_msg.WHISPER_EMOTE_MESSAGE 1308 msg_type = chat_msg.WHISPER_EMOTE_MESSAGE
1309 the_gms = self.get_gms() 1309 the_gms = self.get_gms()
1317 text = "** " + name + " " + text + " **" 1317 text = "** " + name + " " + text + " **"
1318 self.EmotePost(text) 1318 self.EmotePost(text)
1319 1319
1320 def whisper_to_players(self, text, player_ids): 1320 def whisper_to_players(self, text, player_ids):
1321 tabbed_whispers_p = self.settings.get_setting("tabbedwhispers") 1321 tabbed_whispers_p = self.settings.get_setting("tabbedwhispers")
1322 text = Parse.Normalize(text) 1322 text = Parse.Normalize(text, self)
1323 player_names = "" 1323 player_names = ""
1324 for m in player_ids: 1324 for m in player_ids:
1325 id = m.strip() 1325 id = m.strip()
1326 if self.session.is_valid_id(id): 1326 if self.session.is_valid_id(id):
1327 returned_name = self.session.get_player_by_player_id(id)[0] 1327 returned_name = self.session.get_player_by_player_id(id)[0]
1384 logger.general("EXCEPTION: " + str(e)) 1384 logger.general("EXCEPTION: " + str(e))
1385 strip_img = self.settings.get_setting("Show_Images_In_Chat") 1385 strip_img = self.settings.get_setting("Show_Images_In_Chat")
1386 if (strip_img == "0"): display_name = chat_util.strip_img_tags(display_name) 1386 if (strip_img == "0"): display_name = chat_util.strip_img_tags(display_name)
1387 recvSound = "RecvSound" 1387 recvSound = "RecvSound"
1388 # act on the type of messsage 1388 # act on the type of messsage
1389
1389 if (type == chat_msg.CHAT_MESSAGE): 1390 if (type == chat_msg.CHAT_MESSAGE):
1390 text = "<b>" + display_name + "</b>: " + text 1391 text = "<b>" + display_name + "</b>: " + text
1391 self.Post(text) 1392 self.Post(text)
1392 self.parent.newMsg(0) 1393 self.parent.newMsg(0)
1393 elif type == chat_msg.WHISPER_MESSAGE or type == chat_msg.WHISPER_EMOTE_MESSAGE: 1394 elif type == chat_msg.WHISPER_MESSAGE or type == chat_msg.WHISPER_EMOTE_MESSAGE:
1589 except Exception, e: 1590 except Exception, e:
1590 logger.general(traceback.format_exc()) 1591 logger.general(traceback.format_exc())
1591 logger.general("EXCEPTION: " + str(e)) 1592 logger.general("EXCEPTION: " + str(e))
1592 return "[ERROR]" 1593 return "[ERROR]"
1593 1594
1594 def ParsePost(self, s, send=False, myself=False):
1595 s = Parse.Normalize(s)
1596 self.set_colors()
1597 self.Post(s,send,myself)
1598
1599 # This subroutine builds a chat display name. 1595 # This subroutine builds a chat display name.
1600 # 1596 #
1601 def chat_display_name(self, player): 1597 def chat_display_name(self, player):
1602 if self.settings.get_setting("ShowIDInChat") == "0": 1598 if self.settings.get_setting("ShowIDInChat") == "0":
1603 display_name = player[0] 1599 display_name = player[0]