Mercurial > traipse_dev
comparison orpg/gametree/nodehandlers/forms.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 | 4385a7d0efd1 |
children | 449a8900f9ac |
comparison
equal
deleted
inserted
replaced
65:4840657c23c5 | 66:c54768cffbd4 |
---|---|
209 </nodehandler> | 209 </nodehandler> |
210 """ | 210 """ |
211 def __init__(self,xml_dom,tree_node): | 211 def __init__(self,xml_dom,tree_node): |
212 node_handler.__init__(self,xml_dom,tree_node) | 212 node_handler.__init__(self,xml_dom,tree_node) |
213 self.text_elem = self.master_dom.getElementsByTagName('text')[0] | 213 self.text_elem = self.master_dom.getElementsByTagName('text')[0] |
214 self.text = safe_get_text_node(self.text_elem) | 214 self.text = component.get('xml').safe_get_text_node(self.text_elem) |
215 if self.text_elem.getAttribute("send_button") == "": | 215 if self.text_elem.getAttribute("send_button") == "": |
216 self.text_elem.setAttribute("send_button","0") | 216 self.text_elem.setAttribute("send_button","0") |
217 if self.text_elem.getAttribute("raw_mode") == "": | 217 if self.text_elem.getAttribute("raw_mode") == "": |
218 self.text_elem.setAttribute("raw_mode","0") | 218 self.text_elem.setAttribute("raw_mode","0") |
219 if self.text_elem.getAttribute("hide_title") == "": | 219 if self.text_elem.getAttribute("hide_title") == "": |
446 return 0 | 446 return 0 |
447 | 447 |
448 def get_selected_text(self): | 448 def get_selected_text(self): |
449 node = self.get_selected_node() | 449 node = self.get_selected_node() |
450 if node: | 450 if node: |
451 return safe_get_text_node(node)._get_nodeValue() | 451 return component.get('xml').safe_get_text_node(node)._get_nodeValue() |
452 else: | 452 else: |
453 return "" | 453 return "" |
454 | 454 |
455 | 455 |
456 # mult selection methods | 456 # mult selection methods |
464 | 464 |
465 def get_selections_text(self): | 465 def get_selections_text(self): |
466 opts = [] | 466 opts = [] |
467 for opt in self.options: | 467 for opt in self.options: |
468 if opt.getAttribute("selected") == "1": | 468 if opt.getAttribute("selected") == "1": |
469 opts.append(safe_get_text_node(opt)._get_nodeValue()) | 469 opts.append(component.get('xml').safe_get_text_node(opt)._get_nodeValue()) |
470 return opts | 470 return opts |
471 | 471 |
472 def get_selections_index(self): | 472 def get_selections_index(self): |
473 opts = [] | 473 opts = [] |
474 i = 0 | 474 i = 0 |
492 # misc methods | 492 # misc methods |
493 | 493 |
494 def get_options(self): | 494 def get_options(self): |
495 opts = [] | 495 opts = [] |
496 for opt in self.options: | 496 for opt in self.options: |
497 opts.append(safe_get_text_node(opt)._get_nodeValue()) | 497 opts.append(component.get('xml').safe_get_text_node(opt)._get_nodeValue()) |
498 return opts | 498 return opts |
499 | 499 |
500 def get_option(self,index): | 500 def get_option(self,index): |
501 return safe_get_text_node(self.options[index])._get_nodeValue() | 501 return component.get('xml').safe_get_text_node(self.options[index])._get_nodeValue() |
502 | 502 |
503 def add_option(self,opt): | 503 def add_option(self,opt): |
504 elem = minidom.Element('option') | 504 elem = minidom.Element('option') |
505 elem.setAttribute("value","0") | 505 elem.setAttribute("value","0") |
506 elem.setAttribute("selected","0") | 506 elem.setAttribute("selected","0") |
512 def remove_option(self,index): | 512 def remove_option(self,index): |
513 self.list.removeChild(self.options[index]) | 513 self.list.removeChild(self.options[index]) |
514 self.options = self.list.getElementsByTagName('option') | 514 self.options = self.list.getElementsByTagName('option') |
515 | 515 |
516 def edit_option(self,index,value): | 516 def edit_option(self,index,value): |
517 safe_get_text_node(self.options[index])._set_nodeValue(value) | 517 component.get('xml').safe_get_text_node(self.options[index])._set_nodeValue(value) |
518 | 518 |
519 def has_send_button(self): | 519 def has_send_button(self): |
520 if self.list.getAttribute("send_button") == '0': | 520 if self.list.getAttribute("send_button") == '0': |
521 return False | 521 return False |
522 else: | 522 else: |