comparison orpg/gametree/gametree.py @ 191:a3d7e05085da beta

Traipse Beta 'OpenRPG' {100201-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 (Beta) New Features: New Bookmarks Feature New 'boot' command to remote admin New confirmation window for sent nodes Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG New Zoom Mouse plugin added New Images added to Plugin UI Switching to Element Tree New Map efficiency, from FlexiRPG New Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) New Portable Mercurial New Tip of the Day, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added New Dieroller structure from Core New DieRoller portability for odd Dice New 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added New vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Included for Mythos roller also New Warhammer FRPG Die Roller (Special thanks to Puu-san for the support) New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Beta!) New Grids act more like Spreadsheets in Use mode, with Auto Calc Fixes: Fix to allow for portability to an OpenSUSE linux OS Fix to mplay_client for Fedora and OpenSUSE Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fix to Whiteboard ID to prevent random line or text deleting. Fixes to Server, Remote Server, and Server GUI Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and now reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode Fix made Image Fetching. New fetching image and new failed image Fix to whiteboard ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml
author sirebral
date Mon, 01 Feb 2010 09:57:07 -0600
parents dcae32e219f1
children 13054be69834
comparison
equal deleted inserted replaced
190:15488fe94f52 191:a3d7e05085da
35 from orpg.orpg_wx import * 35 from orpg.orpg_wx import *
36 from orpg.orpg_windows import * 36 from orpg.orpg_windows import *
37 from orpg.orpgCore import component 37 from orpg.orpgCore import component
38 from orpg.dirpath import dir_struct 38 from orpg.dirpath import dir_struct
39 from nodehandlers import core 39 from nodehandlers import core
40 import string, urllib, time, os 40 import string, urllib, time, os, shutil
41 41
42 from orpg.orpg_xml import xml 42 from orpg.orpg_xml import xml
43 from orpg.tools.validate import validate 43 from orpg.tools.validate import validate
44 from orpg.tools.orpg_log import logger, debug 44 from orpg.tools.orpg_log import logger, debug
45 from orpg.tools.orpg_settings import settings 45 from orpg.tools.orpg_settings import settings
79 TOP_SAVE_TREE = wx.NewId() 79 TOP_SAVE_TREE = wx.NewId()
80 TOP_SAVE_TREE_AS = wx.NewId() 80 TOP_SAVE_TREE_AS = wx.NewId()
81 TOP_TREE_PROP = wx.NewId() 81 TOP_TREE_PROP = wx.NewId()
82 TOP_FEATURES = wx.NewId() 82 TOP_FEATURES = wx.NewId()
83 EZ_REF = wx.NewId() 83 EZ_REF = wx.NewId()
84
85 def exists(path):
86 try:
87 os.stat(path)
88 return True
89 except: return False
84 90
85 class game_tree(wx.TreeCtrl): 91 class game_tree(wx.TreeCtrl):
86 92
87 def __init__(self, parent, id): 93 def __init__(self, parent, id):
88 wx.TreeCtrl.__init__(self,parent,id, wx.DefaultPosition, 94 wx.TreeCtrl.__init__(self,parent,id, wx.DefaultPosition,
231 self.xml_root = tree.getroot() 237 self.xml_root = tree.getroot()
232 except: 238 except:
233 self.xml_root = None 239 self.xml_root = None
234 240
235 if not self.xml_root: 241 if not self.xml_root:
236 os.rename(filename,filename+".corrupt") 242 count = 1
243 while exists(filename[:len(filename)-4]+'-bad-'+str(count)+'.xml'): count += 1
244 shutil.copy(filename, filename[:len(filename)-4]+'-bad-'+str(count)+'.xml')
245 shutil.copyfile(dir_struct["template"]+'default_tree.xml', filename)
237 emsg = "Your gametree is being regenerated.\n\n"\ 246 emsg = "Your gametree is being regenerated.\n\n"\
238 "To salvage a recent version of your gametree\n"\ 247 "To salvage a recent version of your gametree\n"\
239 "exit OpenRPG and copy the lastgood.xml file in\n"\ 248 "exit OpenRPG and copy the lastgood.xml file in\n"\
240 "your myfiles directory to "+filename+ "\n"\ 249 "your myfiles directory to "+filename[:len(filename)-4]+'-bad-'+str(count)+'.xml'+ "\n"\
241 "in your myfiles directory.\n\n"\ 250 "in your myfiles directory.\n\n"\
242 "lastgood.xml WILL BE OVERWRITTEN NEXT TIME YOU RUN OPENRPG.\n\n"\ 251 "lastgood.xml WILL BE OVERWRITTEN NEXT TIME YOU RUN OPENRPG.\n\n"\
243 "Would you like to select a different gametree file to use?\n"\ 252 "Would you like to select a different gametree file to use?\n"\
244 "(Selecting 'No' will cause a new default gametree to be generated)" 253 "(Selecting 'No' will cause a new default gametree to be generated)"
245 self.locate_valid_tree("Corrupt Gametree!", emsg) 254 self.locate_valid_tree("Corrupt Gametree!", emsg)
277 outfile.write(infile.read()) 286 outfile.write(infile.read())
278 else: logger.info("Not overwriting lastgood.xml file.", True) 287 else: logger.info("Not overwriting lastgood.xml file.", True)
279 288
280 except Exception, e: 289 except Exception, e:
281 logger.exception(traceback.format_exc()) 290 logger.exception(traceback.format_exc())
291 count = 1
292 while exists(filename[:len(filename)-4]+'-bad-'+str(count)+'.xml'): count += 1
293 shutil.copy(filename, filename[:len(filename)-4]+'-bad-'+str(count)+'.xml')
294 shutil.copyfile(dir_struct["template"]+'default_tree.xml', filename)
282 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.") 295 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.")
283 os.rename(filename,filename+".corrupt")
284 validate.config_file("tree.xml","default_tree.xml") 296 validate.config_file("tree.xml","default_tree.xml")
285 self.load_tree(error=1) 297 self.load_tree(error=1)
286 298
287 def build_std_menu(self, obj=None): 299 def build_std_menu(self, obj=None):
288 # build useful menu 300 # build useful menu