comparison orpg/gametree/nodehandlers/core.py @ 66:c54768cffbd4 ornery-dev

Traipse Dev 'OpenRPG' {090818-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: *Unstable* This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author sirebral
date Tue, 18 Aug 2009 06:33:37 -0500
parents e8029caed892
children 449a8900f9ac
comparison
equal deleted inserted replaced
65:4840657c23c5 66:c54768cffbd4
29 __version__ = "$Id: core.py,v 1.49 2007/12/07 20:39:48 digitalxero Exp $" 29 __version__ = "$Id: core.py,v 1.49 2007/12/07 20:39:48 digitalxero Exp $"
30 30
31 from nodehandler_version import NODEHANDLER_VERSION 31 from nodehandler_version import NODEHANDLER_VERSION
32 try: 32 try:
33 from orpg.orpg_windows import * 33 from orpg.orpg_windows import *
34 import orpg.dirpath 34 from orpg.dirpath import dir_struct
35 from orpg.orpg_xml import * 35 from orpg.orpg_xml import *
36 from orpg.orpgCore import open_rpg 36 from orpg.orpgCore import component
37 import webbrowser 37 import webbrowser
38 from orpg.mapper import map 38 from orpg.mapper import map
39 import os 39 import os
40 except: 40 except:
41 import wx 41 import wx
51 class node_handler: 51 class node_handler:
52 """ Base nodehandler with virtual functions and standard implmentations """ 52 """ Base nodehandler with virtual functions and standard implmentations """
53 def __init__(self,xml_dom,tree_node): 53 def __init__(self,xml_dom,tree_node):
54 self.master_dom = xml_dom 54 self.master_dom = xml_dom
55 self.mytree_node = tree_node 55 self.mytree_node = tree_node
56 self.tree = open_rpg.get_component('tree') 56 self.tree = component.get('tree')
57 self.frame = open_rpg.get_component('frame') 57 self.frame = component.get('frame')
58 self.chat = open_rpg.get_component('chat') 58 self.chat = component.get('chat')
59 self.xml = open_rpg.get_component('xml') 59 self.xml = component.get('xml')
60 self.drag = True 60 self.drag = True
61 self.myeditor = None # designing 61 self.myeditor = None # designing
62 self.myviewer = None # prett print 62 self.myviewer = None # prett print
63 self.mywindow = None # using 63 self.mywindow = None # using
64 # call version hook 64 # call version hook
390 </nodehandler> 390 </nodehandler>
391 """ 391 """
392 def __init__(self,xml_dom,tree_node): 392 def __init__(self,xml_dom,tree_node):
393 node_handler.__init__(self,xml_dom,tree_node) 393 node_handler.__init__(self,xml_dom,tree_node)
394 self.file_node = self.master_dom._get_firstChild() 394 self.file_node = self.master_dom._get_firstChild()
395 self.frame = open_rpg.get_component('frame') 395 self.frame = component.get('frame')
396 396
397 def on_ldclick(self,evt): 397 def on_ldclick(self,evt):
398 file_name = self.file_node.getAttribute("name") 398 file_name = self.file_node.getAttribute("name")
399 self.tree.insert_xml(open(orpg.dirpath.dir_struct["nodes"] + file_name,"r").read()) 399 self.tree.insert_xml(open(orpg.dirpath.dir_struct["nodes"] + file_name,"r").read())
400 return 1 400 return 1
422 </nodehandler> 422 </nodehandler>
423 """ 423 """
424 def __init__(self,xml_dom,tree_node): 424 def __init__(self,xml_dom,tree_node):
425 node_handler.__init__(self,xml_dom,tree_node) 425 node_handler.__init__(self,xml_dom,tree_node)
426 self.file_node = self.master_dom._get_firstChild() 426 self.file_node = self.master_dom._get_firstChild()
427 self.frame = open_rpg.get_component('frame') 427 self.frame = component.get('frame')
428 428
429 def on_ldclick(self,evt): 429 def on_ldclick(self,evt):
430 file_name = self.file_node.getAttribute("url") 430 file_name = self.file_node.getAttribute("url")
431 file = urllib.urlopen(file_name) 431 file = urllib.urlopen(file_name)
432 self.tree.insert_xml(file.read()) 432 self.tree.insert_xml(file.read())
453 """ clones childe node and insert it at top of tree 453 """ clones childe node and insert it at top of tree
454 <nodehandler name='?' module='core' class='min_map' /> 454 <nodehandler name='?' module='core' class='min_map' />
455 """ 455 """
456 def __init__(self,xml_dom,tree_node): 456 def __init__(self,xml_dom,tree_node):
457 node_handler.__init__(self,xml_dom,tree_node) 457 node_handler.__init__(self,xml_dom,tree_node)
458 self.map = open_rpg.get_component('map') 458 self.map = component.get('map')
459 self.mapdata = self.master_dom._get_firstChild() 459 self.mapdata = self.master_dom._get_firstChild()
460 460
461 def on_ldclick(self,evt): 461 def on_ldclick(self,evt):
462 self.map.new_data(toxml(self.mapdata)) 462 self.map.new_data(toxml(self.mapdata))
463 return 1 463 return 1