comparison orpg/gametree/nodehandlers/d20.py @ 67:c5bc2abaf7f8 ornery-dev

Traipse Dev 'OpenRPG' {090818-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: *Stable* 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(). Fixes nodehandlers to bring the dev back to a stable push. Known issue with a nodehandler and it's sub dialogs.
author sirebral
date Tue, 18 Aug 2009 07:34:35 -0500
parents c54768cffbd4
children 217fb049bd00 dcf4fbe09b70
comparison
equal deleted inserted replaced
66:c54768cffbd4 67:c5bc2abaf7f8
571 571
572 def tohtml(self): 572 def tohtml(self):
573 n_list = self.master_dom._get_childNodes() 573 n_list = self.master_dom._get_childNodes()
574 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>" 574 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
575 for n in n_list: 575 for n in n_list:
576 t_node = safe_get_text_node(n) 576 t_node = component.get('xml').safe_get_text_node(n)
577 html_str += "<B>"+n._get_tagName().capitalize() +":</B> " 577 html_str += "<B>"+n._get_tagName().capitalize() +":</B> "
578 html_str += t_node._get_nodeValue() + ", " 578 html_str += t_node._get_nodeValue() + ", "
579 html_str = html_str[:len(html_str)-2] + "</td></tr></table>" 579 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
580 return html_str 580 return html_str
581 581
582 def on_name_change(self,name): 582 def on_name_change(self,name):
583 self.char_hander.rename(name) 583 self.char_hander.rename(name)
584 584
585 def get_char_name( self ): 585 def get_char_name( self ):
586 node = self.master_dom.getElementsByTagName( 'name' )[0] 586 node = self.master_dom.getElementsByTagName( 'name' )[0]
587 t_node = safe_get_text_node( node ) 587 t_node = component.get('xml').safe_get_text_node( node )
588 return t_node._get_nodeValue() 588 return t_node._get_nodeValue()
589 589
590 590
591 class d20classes(d20_char_child): 591 class d20classes(d20_char_child):
592 """ Node Handler for classes. This handler will be 592 """ Node Handler for classes. This handler will be
712 class d20divine(d20_char_child): 712 class d20divine(d20_char_child):
713 """ Node Handler for classes. This handler will be 713 """ Node Handler for classes. This handler will be
714 created by d20char_handler. 714 created by d20char_handler.
715 """ 715 """
716 def __init__(self,xml_dom,tree_node,parent): 716 def __init__(self,xml_dom,tree_node,parent):
717 d20_char_child.__init__(self,xml_dom,tree_node,openrpg,parent) 717 d20_char_child.__init__(self,xml_dom,tree_node,component,parent)
718 node_list = self.master_dom.getElementsByTagName( 'gift' ) 718 node_list = self.master_dom.getElementsByTagName( 'gift' )
719 self.spells = {} 719 self.spells = {}
720 tree = self.tree 720 tree = self.tree
721 icons = self.tree.icons 721 icons = self.tree.icons
722 for n in node_list: 722 for n in node_list:
901 901
902 def tohtml(self): 902 def tohtml(self):
903 n_list = self.master_dom._get_childNodes() 903 n_list = self.master_dom._get_childNodes()
904 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>" 904 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
905 for n in n_list: 905 for n in n_list:
906 t_node = safe_get_text_node(n) 906 t_node = component.get('xml').safe_get_text_node(n)
907 html_str += "<B>"+n._get_tagName().capitalize() +":</B> " 907 html_str += "<B>"+n._get_tagName().capitalize() +":</B> "
908 html_str += t_node._get_nodeValue() + "<br />" 908 html_str += t_node._get_nodeValue() + "<br />"
909 html_str = html_str[:len(html_str)-2] + "</td></tr></table>" 909 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
910 return html_str 910 return html_str
911 911
912 def on_name_change(self,name): 912 def on_name_change(self,name):
913 self.char_hander.rename(name) 913 self.char_hander.rename(name)
914 914
915 def get_char_name( self ): 915 def get_char_name( self ):
916 node = self.master_dom.getElementsByTagName( 'name' )[0] 916 node = self.master_dom.getElementsByTagName( 'name' )[0]
917 t_node = safe_get_text_node( node ) 917 t_node = component.get('xml').safe_get_text_node( node )
918 return t_node._get_nodeValue() 918 return t_node._get_nodeValue()
919 919
920 class d20hp(d20_char_child): 920 class d20hp(d20_char_child):
921 """ Node Handler for hit points. This handler will be 921 """ Node Handler for hit points. This handler will be
922 created by d20char_handler. 922 created by d20char_handler.
1300 pname = handler.master_dom.setAttribute("name", 'How To') 1300 pname = handler.master_dom.setAttribute("name", 'How To')
1301 self.sizer = wx.FlexGridSizer(2, 4, 2, 2) # rows, cols, hgap, vgap 1301 self.sizer = wx.FlexGridSizer(2, 4, 2, 2) # rows, cols, hgap, vgap
1302 self.master_dom = handler.master_dom 1302 self.master_dom = handler.master_dom
1303 n_list = self.master_dom._get_childNodes() 1303 n_list = self.master_dom._get_childNodes()
1304 for n in n_list: 1304 for n in n_list:
1305 t_node = safe_get_text_node(n) 1305 t_node = component.get('xml').safe_get_text_node(n)
1306 self.sizer.AddMany([ (wx.StaticText(self, -1, t_node._get_nodeValue()), 0, wx.ALIGN_CENTER_VERTICAL), 1306 self.sizer.AddMany([ (wx.StaticText(self, -1, t_node._get_nodeValue()), 0, wx.ALIGN_CENTER_VERTICAL),
1307 ]) 1307 ])
1308 self.sizer.AddGrowableCol(1) 1308 self.sizer.AddGrowableCol(1)
1309 self.SetSizer(self.sizer) 1309 self.SetSizer(self.sizer)
1310 1310
1409 t_node = self.n_list[row]._get_firstChild() 1409 t_node = self.n_list[row]._get_firstChild()
1410 t_node._set_nodeValue(value) 1410 t_node._set_nodeValue(value)
1411 if row==0: self.handler.on_name_change(value) 1411 if row==0: self.handler.on_name_change(value)
1412 1412
1413 def refresh_row(self,rowi): 1413 def refresh_row(self,rowi):
1414 t_node = safe_get_text_node(self.n_list[rowi]) 1414 t_node = component.get('xml').safe_get_text_node(self.n_list[rowi])
1415 self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName()) 1415 self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName())
1416 self.SetReadOnly(rowi,0) 1416 self.SetReadOnly(rowi,0)
1417 self.SetCellValue(rowi,1,t_node._get_nodeValue()) 1417 self.SetCellValue(rowi,1,t_node._get_nodeValue())
1418 1418
1419 def on_size(self,evt): 1419 def on_size(self,evt):
1449 t_node = self.n_list[row]._get_firstChild() 1449 t_node = self.n_list[row]._get_firstChild()
1450 t_node._set_nodeValue(value) 1450 t_node._set_nodeValue(value)
1451 if row==0: self.handler.on_name_change(value) 1451 if row==0: self.handler.on_name_change(value)
1452 1452
1453 def refresh_row(self,rowi): 1453 def refresh_row(self,rowi):
1454 t_node = safe_get_text_node(self.n_list[rowi]) 1454 t_node = component.get('xml').safe_get_text_node(self.n_list[rowi])
1455 self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName()) 1455 self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName())
1456 self.SetReadOnly(rowi,0) 1456 self.SetReadOnly(rowi,0)
1457 self.SetCellValue(rowi,1,t_node._get_nodeValue()) 1457 self.SetCellValue(rowi,1,t_node._get_nodeValue())
1458 1458
1459 def on_size(self,evt): 1459 def on_size(self,evt):