# HG changeset patch # User sirebral # Date 1272645457 18000 # Node ID b8091ede042a24fa1aaa1dd5fdc7e758ed6dde3c # Parent 50af54dbd6a641cdafb1412fe52e990d5e7fcb5a Traipse Alpha 'OpenRPG' {100430-01} 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 Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start New to Mini Lin node, change title in design mode New to Game Tree, never lose a node, appends a number to the end of corrupted trees New to Server GUI, Traipse Suite's Debug Console 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 Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up Fix to Mini Lib node that was preventing use Fix to plugins that parce dice but did not call InterParse Fix to nodes for name changing by double click Fix to Game Tree, node ordering on drag and drop corrected Fix to Game Tree, corrupted error message was not showing diff -r 50af54dbd6a6 -r b8091ede042a orpg/gametree/gametree.py --- a/orpg/gametree/gametree.py Fri Apr 30 05:36:11 2010 -0500 +++ b/orpg/gametree/gametree.py Fri Apr 30 11:37:37 2010 -0500 @@ -45,6 +45,7 @@ from orpg.dirpath import dir_struct from nodehandlers import core import string, urllib, time, os +from shutil import copytree, copystat, copy, copyfile from orpg.orpg_xml import xml from orpg.tools.validate import validate @@ -60,6 +61,12 @@ from xml.etree.ElementTree import fromstring, tostring, XML, iselement from xml.parsers.expat import ExpatError +def exists(path): + try: + os.stat(path) + return True + except: return False + STD_MENU_DELETE = wx.NewId() STD_MENU_DESIGN = wx.NewId() STD_MENU_USE = wx.NewId() @@ -206,9 +213,9 @@ self.EditLabel(curSelection) evt.Skip() - def locate_valid_tree(self, error, msg): ## --Snowdog 3/05 + def locate_valid_tree(self, error, msg, filename): ## --Snowdog 3/05 """prompts the user to locate a new tree file or create a new one""" - response = wx.MessageDialog(self, msg, error, wx.YES|wx.NO|wx.ICON_ERROR) + response = wx.MessageBox(msg, error, wx.YES|wx.NO|wx.ICON_ERROR) if response == wx.YES: file = None dlg = wx.FileDialog(self, "Locate Gametree file", dir_struct["user"], @@ -221,6 +228,7 @@ else: self.load_tree(file) return else: + copyfile(dir_struct['template']+'default_tree.xml', filename) validate.config_file("tree.xml","default_tree.xml") self.load_tree(error=1) return @@ -234,24 +242,25 @@ self.locate_valid_tree("Gametree Error", emsg) return try: + self.xml_root = False tree = parse(filename) self.xml_root = tree.getroot() - except: - self.xml_root = None - + except: self.xml_root = False if not self.xml_root: - os.rename(filename,filename+".corrupt") + count = 1 + while exists(filename[:len(filename)-4]+'-'+str(count)+'.xml'): count += 1 + corrupt_tree = filename[:len(filename)-4]+'-'+str(count)+'.xml' + copyfile(filename, corrupt_tree) emsg = "Your gametree is being regenerated.\n\n"\ "To salvage a recent version of your gametree\n"\ - "exit OpenRPG and copy the lastgood.xml file in\n"\ + "exit OpenRPG and copy the one of the tree-# files in\n"\ "your myfiles directory to "+filename+ "\n"\ "in your myfiles directory.\n\n"\ "lastgood.xml WILL BE OVERWRITTEN NEXT TIME YOU RUN OPENRPG.\n\n"\ "Would you like to select a different gametree file to use?\n"\ "(Selecting 'No' will cause a new default gametree to be generated)" - self.locate_valid_tree("Corrupt Gametree!", emsg) + self.locate_valid_tree("Corrupt Gametree!", emsg, filename) return - if self.xml_root.tag != "gametree": emsg = filename+" does not appear to be a valid gametree file.\n\n"\ "Would you like to select a different gametree file to use?\n"\ @@ -286,8 +295,22 @@ except Exception, e: logger.exception(traceback.format_exc()) - wx.MessageBox("Corrupt Tree!\nYour game tree is being regenerated. To\nsalvage a recent version of your gametree\nexit OpenRPG and copy the lastgood.xml\nfile in your myfiles directory\nto "+filename+ "\nin your myfiles directory.\nlastgood.xml WILL BE OVERWRITTEN NEXT TIME YOU RUN OPENRPG.") - os.rename(filename,filename+".corrupt") + + count = 1 + while exists(filename[:len(filename)-4]+'-'+str(count)+'.xml'): count += 1 + corrupt_tree = filename[:len(filename)-4]+'-'+str(count)+'.xml' + copyfile(filename, corrupt_tree) + wx.MessageBox("Your gametree is being regenerated.\n\n"\ + "To salvage a recent version of your gametree\n"\ + "exit OpenRPG and copy the one of the tree-# files in\n"\ + "your myfiles directory to "+filename+ "\n"\ + "in your myfiles directory.\n\n"\ + "lastgood.xml WILL BE OVERWRITTEN NEXT TIME YOU RUN OPENRPG.\n\n") + + count = 1 + while exists(filename[:len(filename)-4]+'-'+str(count)+'.xml'): count += 1 + corrupt_tree = filename[:len(filename)-4]+'-'+str(count)+'.xml' + copyfile(filename, corrupt_tree) validate.config_file("tree.xml","default_tree.xml") self.load_tree(error=1) diff -r 50af54dbd6a6 -r b8091ede042a orpg/networking/mplay_server.py --- a/orpg/networking/mplay_server.py Fri Apr 30 05:36:11 2010 -0500 +++ b/orpg/networking/mplay_server.py Fri Apr 30 11:37:37 2010 -0500 @@ -325,6 +325,7 @@ self.saveBanList() except Exception, e: self.log_msg("Exception in initBanList() " + str(e)) + self.log_msg( ('exception', str(e)) ) # This method writes out the server's ban list added by Darren def saveBanList( self ): @@ -343,6 +344,7 @@ file.close() except Exception, e: self.log_msg("Exception in saveBanList() " + str(e)) + self.log_msg( ('exception', str(e)) ) # This method reads in the server's configuration file and reconfigs the server # as needed, over-riding any default values as requested. @@ -526,6 +528,7 @@ except Exception, e: traceback.print_exc() self.log_msg("Exception in initServerConfig() " + str(e)) + self.log_msg( ('exception', str(e)) ) def makePersistentRooms(self): 'Creates rooms on the server as defined in the server config file.' @@ -571,6 +574,7 @@ return pr except: self.log_msg("Exception occured in isPersistentRoom(self,id)") + self.log_msg( ('exception', str(e)) ) return 0 #----------------------------------------------------- @@ -775,8 +779,8 @@ try: sentl = sock.send( lp ) # Send the encoded length sentm = sock.send( msg ) # Now, send the message the the length was describing - except socket.error, e: self.log_msg( e ) - except Exception, e: self.log_msg( e ) + except socket.error, e: self.log_msg( ('exception', str(e)) ); self.log_msg( e ) + except Exception, e: self.log_msg( e ); self.log_msg( ('exception', str(e)) ) def recvData( self, sock, readSize ): @@ -818,7 +822,7 @@ try: if useCompression and cmpType != None: msgData = cmpType.decompress(msgData) except: traceback.print_exc() - except Exception, e: self.log_msg( "Exception: recvMsg(): " + str(e) ) + except Exception, e: self.log_msg( "Exception: recvMsg(): " + str(e) ); self.log_msg( ('exception', str(e)) ) return msgData def kill_server(self): @@ -910,6 +914,7 @@ print except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) self.p_lock.release() """ @@ -996,6 +1001,7 @@ print except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) self.p_lock.release() """ @@ -1028,6 +1034,7 @@ print "\nStatistics: groups: " + str(len(self.groups)) + " players: " + str(len(self.players)) except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) self.p_lock.release() @@ -1045,6 +1052,7 @@ print "Bad Player Ref (#" + id + ") in group" except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) self.p_lock.release() def update_request(self,newsock, xml_dom): @@ -1110,7 +1118,7 @@ bad_xml_string += "Please report this bug to the development team at:
" bad_xml_string += "Traipse-Dev " bad_xml_string += "(http://www.assembla.com/spaces/traipse_dev/tickets/)
" - self.sendMsg( newsock, "" + bad_xml_string, + self.sendMsg( newsock, "" +bad_xml_string, new_stub.useCompression, new_stub.compressionType) time.sleep(2) @@ -1118,6 +1126,7 @@ print "Error in parse found from " + str(remote_host) + ". Disconnected." print " Offending data(" + str(len(data)) + "bytes)=" + data print "Exception=" + str(e) + self.log_msg( ('exception', str(e)) ) #if xml_dom: xml_dom.unlink() return @@ -1277,6 +1286,7 @@ except Exception, e: self.log_msg(("Error binding request socket!", e)) + self.log_msg( ('exception', str(e)) ) self.alive = 0 while self.alive: @@ -1293,9 +1303,10 @@ """ thread.start_new_thread(self.acceptedNewConnectionThread, ( newsock, addr )) - except: + except Exception, e: print "The following exception caught accepting new connection:" traceback.print_exc() + self.log_msg( ('exception', str(e)) ) # At this point, we're done and cleaning up. self.log_msg("server socket listening thread exiting...") @@ -1316,6 +1327,7 @@ try: newsock.close() except Exception, e: self.log_msg( str(e) ) + self.log_msg( ('exception', str(e)) ) print str(e) return #returning causes connection thread instance to terminate if data == "": @@ -1337,10 +1349,11 @@ except: try: newsock.close() - except: pass + except Exception, e: pass self.log_msg( "Error in parse found from " + str(addr) + ". Disconnected.") self.log_msg(" Offending data(" + str(len(data)) + "bytes)=" + data) self.log_msg( "Exception:") + self.log_msg( ('exception', str(e)) ) traceback.print_exc() return #returning causes connection thread instance to terminate @@ -1358,6 +1371,7 @@ print "The following message: " + str(data) print "from " + str(addr) + " created the following exception: " traceback.print_exc() + self.log_msg( ('exception', str(e)) ) return #returning causes connection thread instance to terminate """ @@ -1392,6 +1406,7 @@ data = None except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) self.log_msg("message handler thread exiting...") self.incoming_event.set() @@ -1410,11 +1425,14 @@ print "Error in parse of inbound message. Ignoring message." print " Offending data(" + str(len(data)) + "bytes)=" + data print "Exception=" + str(e) + self.log_msg( ('exception', str(e)) ) def message_action(self, xml_dom, data): tag_name = xml_dom.tag if self.svrcmds.has_key(tag_name): self.svrcmds[tag_name]['function'](xml_dom, data) - else: raise Exception, "Not a valid header!" + else: + raise Exception, "Not a valid header!" + self.log_msg( ('exception', 'Not a valid header!') ) #Message Action thread expires and closes here. return @@ -1518,6 +1536,7 @@ print "Bad input: " + data except Exception,e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) def join_group(self, xml_dom, data): try: @@ -1551,6 +1570,7 @@ self.move_player(from_id, group_id) except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) """ # move_player function -- added by Snowdog 4/03 @@ -1568,6 +1588,7 @@ else: self.players[from_id].role = "Lurker" except Exception, e: print "exception in move_player() " + self.log_msg( ('exception', str(e)) ) traceback.print_exc() old_group_id = self.players[from_id].change_group(group_id, self.groups) @@ -1596,6 +1617,7 @@ except Exception, e: roomMsg = "" self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) # Spit that darn message out now! self.players[from_id].outbox.put("" + roomMsg) @@ -1613,6 +1635,7 @@ self.handle_role("set", from_id, self.players[from_id].role, self.groups[group_id].boot_pwd, group_id) except Exception, e: self.log_msg(str(e)) + self.log_msg( ('exception', str(e)) ) thread.start_new_thread(self.registerRooms,(0,)) def return_room_roles(self, from_id, group_id): @@ -1771,7 +1794,7 @@ else: self.send_to_all("0",self.groups[group_id].toxml('update')) #The register Rooms thread thread.start_new_thread(self.registerRooms,(0,)) - except Exception, e: self.log_msg(str(e)) + except Exception, e: self.log_msg( ('exception', str(e)) ) def del_player(self, id, group_id): try: @@ -1789,7 +1812,7 @@ """ if self.be_registered: self.register() - except Exception, e: self.log_msg(str(e)) + except Exception, e: self.log_msg( ('exception', str(e)) ) self.log_msg("Explicit garbage collection shows %s undeletable items." % str(gc.collect())) def incoming_player_handler(self, xml_dom, data): @@ -1804,7 +1827,7 @@ try: self.send_player_list(id,group_id) self.send_group_list(id) - except Exception, e: traceback.print_exc() + except Exception, e: self.log_msg( ('exception', str(e)) ); traceback.print_exc() elif act=="del": self.del_player(id,group_id) self.check_group(id, group_id) @@ -1846,8 +1869,11 @@ to_id = xml_dom.get("to") from_id = xml_dom.get("from") group_id = xml_dom.get("group_id") + ## Backwards compatibility with older clients end = data.find(">") msg = data[end+1:] + if msg[-6:] == '': msg = msg[:-6] + data = msg if from_id == "0" or len(from_id) == 0: print "WARNING!! Message received with an invalid from_id. Message dropped." @@ -1872,7 +1898,7 @@ elif to_id.lower() == 'all': #valid map for all players that is not the lobby. self.send_to_group(from_id,group_id,data) - self.groups[group_id].game_map.init_from_xml(msg) + self.groups[group_id].game_map.init_from_xml(data) else: #attempting to send map to specific individuals which is not supported. self.players[from_id].self_message('Invalid map message. Message not sent to others.') @@ -1943,6 +1969,7 @@ print "due to the following exception:" traceback.print_exc() print "Ignoring boot message" + self.log_msg( ('exception', str(e)) ) def handle_boot(self,from_id,to_id,group_id,msg): xml_dom = None @@ -1952,10 +1979,11 @@ xml_dom = XML(msg) given_boot_pwd = xml_dom.get("boot_pwd") - except: + except Exception, e: print "Error in parse of boot message, Ignoring." print "Exception: " traceback.print_exc() + self.log_msg( ('exception', str(e)) ) try: actual_boot_pwd = self.groups[group_id].boot_pwd @@ -2008,6 +2036,7 @@ except Exception, e: traceback.print_exc() self.log_msg('Exception in handle_boot() ' + str(e)) + self.log_msg( ('exception', str(e)) ) finally: try: @@ -2015,6 +2044,7 @@ except Exception, e: traceback.print_exc() self.log_msg('Exception in xml_dom.unlink() ' + str(e)) + self.log_msg( ('exception', str(e)) ) """ # admin_kick function -- by Snowdog 4/03 @@ -2045,6 +2075,7 @@ except Exception, e: traceback.print_exc() self.log_msg('Exception in admin_kick() ' + str(e)) + self.log_msg( ('exception', str(e)) ) ### Alpha ### Addition added to assist in Un Banning users. def admin_build_banlist(self): @@ -2071,6 +2102,7 @@ except Exception, e: traceback.print_exc() self.log_msg('Exception in admin_banip() ' + str(e)) + self.log_msg( ('exception', str(e)) ) def admin_ban(self, id, message="", silent = 0): "Ban a player from a server from the console" @@ -2102,6 +2134,7 @@ except Exception, e: traceback.print_exc() self.log_msg('Exception in admin_ban() ' + str(e)) + self.log_msg( ('exception', str(e)) ) def admin_unban(self, ip): self.admin_build_banlist() @@ -2112,6 +2145,7 @@ except Exception, e: traceback.print_exc() self.log_msg('Exception in admin_unban() ' + str(e)) + self.log_msg( ('exception', str(e)) ) def admin_banlist(self): msg = [] @@ -2163,6 +2197,7 @@ except Exception, e: traceback.print_exc() self.log_msg("Exception: send_to_all(): " + str(e)) + self.log_msg( ('exception', str(e)) ) def send_to_group(self, from_id, group_id, data): #data = ("" + data + "") @@ -2176,6 +2211,7 @@ except Exception, e: traceback.print_exc() self.log_msg("Exception: send_to_group(): " + str(e)) + self.log_msg( ('exception', str(e)) ) def send_player_list(self,to_id,group_id): try: @@ -2187,6 +2223,7 @@ except Exception, e: traceback.print_exc() self.log_msg("Exception: send_player_list(): " + str(e)) + self.log_msg( ('exception', str(e)) ) def send_group_list(self, to_id, action="new"): try: @@ -2196,6 +2233,7 @@ except Exception, e: self.log_msg("Exception: send_group_list(): (client #"+to_id+") : " + str(e)) traceback.print_exc() + self.log_msg( ('exception', str(e)) ) """ # KICK_ALL_CLIENTS() @@ -2213,6 +2251,7 @@ except Exception, e: traceback.print_exc() self.log_msg("Exception: kick_all_clients(): " + str(e)) + self.log_msg( ('exception', str(e)) ) """ # This really has little value as it will only catch people that are hung @@ -2238,6 +2277,7 @@ self.admin_kick(k,"Removing dead client", self.silent_auto_kick) except Exception, e: self.log_msg("Exception: check_group_members(): " + str(e)) + self.log_msg( ('exception', str(e)) ) def remote_admin_handler(self,xml_dom,data): @@ -2387,6 +2427,7 @@ except Exception, e: self.log_msg("Exception: Remote Admin Handler Error: " + str(e)) traceback.print_exc() + self.log_msg( ('exception', str(e)) ) def toggleRemoteKill(self): if self.allowRemoteKill: self.allowRemoteKill = False @@ -2554,7 +2595,7 @@ pl += "" pl += "Statistics: groups: " + str(len(self.groups)) + " " pl += "players: " + str(len(self.players)) + "" - except Exception, e: self.log_msg(str(e)) + except Exception, e: self.log_msg(str(e)); self.log_msg( ('exception', str(e)) ) self.p_lock.release() return pl diff -r 50af54dbd6a6 -r b8091ede042a orpg/networking/mplay_server_gui.py --- a/orpg/networking/mplay_server_gui.py Fri Apr 30 05:36:11 2010 -0500 +++ b/orpg/networking/mplay_server_gui.py Fri Apr 30 11:37:37 2010 -0500 @@ -21,7 +21,7 @@ from xml.dom import minidom from orpg.orpgCore import component -from orpg.tools.orpg_log import debug +from orpg.tools.orpg_log import debug, DebugConsole from orpg.tools.orpg_settings import settings from xml.etree.ElementTree import ElementTree, Element, iselement @@ -384,6 +384,7 @@ cb["delete_group"] = self.OnDeleteGroup cb["join_group"] = self.OnJoinGroup cb['update_group'] = self.OnUpdateGroup + cb['exception'] = self.OnException cb["role"] = self.OnSetRole self.callbacks = cb @@ -439,6 +440,17 @@ self.Bind(wx.EVT_MENU, self.ConfigPingInterval, id=9) self.Bind(wx.EVT_MENU, self.LogToggle, id=10) self.mainMenu.Append( menu, '&Configuration') + + # Traipse Suite of Additions. + self.traipseSuite = wx.Menu() + self.debugger = DebugConsole(self) + self.mainMenu.Insert(3, self.traipseSuite, "&Traipse Suite") + + #Debugger Console + self.debugConsole = wx.MenuItem(self.traipseSuite, -1, "Debug Console", "Debug Console") + self.Bind(wx.EVT_MENU, self.OnMB_DebugConsole, self.debugConsole) + self.traipseSuite.AppendItem(self.debugConsole) + self.SetMenuBar(self.mainMenu) self.mainMenu.Enable(2, False) @@ -457,6 +469,40 @@ self.mainMenu.Enable(13, False) self.mainMenu.Enable(15, False) + def OnException(self, error): + self.TraipseSuiteWarn('debug') + self.debugger.console.AppendText(".. " + str(error) +'\n') + + def OnMB_DebugConsole(self, evt): + self.TraipseSuiteWarnCleanup('debug') + if self.debugger.IsShown() == True: self.debugger.Hide() + else: self.debugger.Show() + + def TraipseSuiteWarn(self, menuitem): + print 'traipse warn' #logger.debug('traipse warn') + ### Allows for the reuse of the 'Attention' menu. + ### component.get('frame').TraipseSuiteWarn('item') ### Portable + self.mainMenu.Remove(3) + self.mainMenu.Insert(3, self.traipseSuite, "&Traipse Suite!") + if menuitem == 'debug': + if self.debugger.IsShown() == True: + self.mainMenu.Remove(3) + self.mainMenu.Insert(3, self.traipseSuite, "&Traipse Suite") + else: + self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) + self.traipseSuite.RemoveItem(self.debugConsole) + self.traipseSuite.AppendItem(self.debugConsole) + + def TraipseSuiteWarnCleanup(self, menuitem): + ### Allows for portable cleanup of the 'Attention' menu. + ### component.get('frame').TraipseSuiteWarnCleanup('item') ### Portable + self.mainMenu.Remove(3) + self.mainMenu.Insert(3, self.traipseSuite, "&Traipse Suite") + if menuitem == 'debug': + self.traipseSuite.RemoveItem(self.debugConsole) + self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'clear.gif')) + self.traipseSuite.AppendItem(self.debugConsole) + def build_body(self): """ Create the ViewNotebook and logger. """ splitter = wx.SplitterWindow(self, -1, style=wx.NO_3D | wx.SP_3D) diff -r 50af54dbd6a6 -r b8091ede042a orpg/orpg_version.py --- a/orpg/orpg_version.py Fri Apr 30 05:36:11 2010 -0500 +++ b/orpg/orpg_version.py Fri Apr 30 11:37:37 2010 -0500 @@ -4,7 +4,7 @@ #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed) DISTRO = "Traipse Alpha" DIS_VER = "Ornery Orc" -BUILD = "100430-00" +BUILD = "100430-01" # This version is for network capability. PROTOCOL_VERSION = "1.2" diff -r 50af54dbd6a6 -r b8091ede042a orpg/templates/nodes/textctrl.xml --- a/orpg/templates/nodes/textctrl.xml Fri Apr 30 05:36:11 2010 -0500 +++ b/orpg/templates/nodes/textctrl.xml Fri Apr 30 11:37:37 2010 -0500 @@ -1,4 +1,1 @@ - - - text - +Text \ No newline at end of file