comparison orpg/gametree/nodehandlers/dnd35.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 449a8900f9ac
comparison
equal deleted inserted replaced
66:c54768cffbd4 67:c5bc2abaf7f8
167 167
168 def tohtml(self): 168 def tohtml(self):
169 n_list = self.master_dom._get_childNodes() 169 n_list = self.master_dom._get_childNodes()
170 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>" 170 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
171 for n in n_list: 171 for n in n_list:
172 t_node = safe_get_text_node(n) 172 t_node = component.get('xml').safe_get_text_node(n)
173 html_str += "<B>"+n._get_tagName().capitalize() +":</B> " 173 html_str += "<B>"+n._get_tagName().capitalize() +":</B> "
174 html_str += t_node._get_nodeValue() + ", " 174 html_str += t_node._get_nodeValue() + ", "
175 html_str = html_str[:len(html_str)-2] + "</td></tr></table>" 175 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
176 return html_str 176 return html_str
177 177
181 self.charName = name #a 1.5002 make getting name easier. 181 self.charName = name #a 1.5002 make getting name easier.
182 182
183 183
184 def get_char_name( self ): 184 def get_char_name( self ):
185 node = self.master_dom.getElementsByTagName( 'name' )[0] 185 node = self.master_dom.getElementsByTagName( 'name' )[0]
186 t_node = safe_get_text_node( node ) 186 t_node = component.get('xml').safe_get_text_node( node )
187 return t_node._get_nodeValue() 187 return t_node._get_nodeValue()
188 188
189 class gen_grid(wx.grid.Grid): 189 class gen_grid(wx.grid.Grid):
190 """grid for gen info""" 190 """grid for gen info"""
191 def __init__(self, parent, handler): 191 def __init__(self, parent, handler):
216 if row==0: 216 if row==0:
217 self.handler.on_name_change(value) 217 self.handler.on_name_change(value)
218 #self.AutoSizeColumn(1) 218 #self.AutoSizeColumn(1)
219 219
220 def refresh_row(self,rowi): 220 def refresh_row(self,rowi):
221 t_node = safe_get_text_node(self.n_list[rowi]) 221 t_node = component.get('xml').safe_get_text_node(self.n_list[rowi])
222 222
223 self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName()) 223 self.SetCellValue(rowi,0,self.n_list[rowi]._get_tagName())
224 self.SetReadOnly(rowi,0) 224 self.SetReadOnly(rowi,0)
225 self.SetCellValue(rowi,1,t_node._get_nodeValue()) 225 self.SetCellValue(rowi,1,t_node._get_nodeValue())
226 self.AutoSizeColumn(1) 226 self.AutoSizeColumn(1)
242 242
243 def tohtml(self): 243 def tohtml(self):
244 n_list = self.master_dom._get_childNodes() 244 n_list = self.master_dom._get_childNodes()
245 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Inventory</th></tr><tr><td>" 245 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Inventory</th></tr><tr><td>"
246 for n in n_list: 246 for n in n_list:
247 t_node = safe_get_text_node(n) 247 t_node = component.get('xml').safe_get_text_node(n)
248 html_str += "<B>"+n._get_tagName().capitalize() +":</B> " 248 html_str += "<B>"+n._get_tagName().capitalize() +":</B> "
249 html_str += t_node._get_nodeValue() + "<br />" 249 html_str += t_node._get_nodeValue() + "<br />"
250 html_str = html_str[:len(html_str)-2] + "</td></tr></table>" 250 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
251 return html_str 251 return html_str
252 252
314 nodeName = 'Languages' 314 nodeName = 'Languages'
315 value = self.lang.GetValue() 315 value = self.lang.GetValue()
316 316
317 for node in self.n_list: 317 for node in self.n_list:
318 if node._get_tagName() == nodeName: 318 if node._get_tagName() == nodeName:
319 t_node = safe_get_text_node(node) 319 t_node = component.get('xml').safe_get_text_node(node)
320 t_node._set_nodeValue(value) 320 t_node._set_nodeValue(value)
321 321
322 def saveMoney(self, row, col): 322 def saveMoney(self, row, col):
323 value = self.grid.GetCellValue(row, col) 323 value = self.grid.GetCellValue(row, col)
324 t_node = safe_get_text_node(self.n_list[row]) 324 t_node = component.get('xml').safe_get_text_node(self.n_list[row])
325 t_node._set_nodeValue(value) 325 t_node._set_nodeValue(value)
326 326
327 def on_cell_change(self, evt): 327 def on_cell_change(self, evt):
328 row = evt.GetRow() 328 row = evt.GetRow()
329 col = evt.GetCol() 329 col = evt.GetCol()
331 wx.CallAfter(self.saveMoney, row, col) 331 wx.CallAfter(self.saveMoney, row, col)
332 332
333 333
334 334
335 def refresh_row(self, row): 335 def refresh_row(self, row):
336 t_node = safe_get_text_node(self.n_list[row]) 336 t_node = component.get('xml').safe_get_text_node(self.n_list[row])
337 tagname = self.n_list[row]._get_tagName() 337 tagname = self.n_list[row]._get_tagName()
338 value = t_node._get_nodeValue() 338 value = t_node._get_nodeValue()
339 if tagname == 'Gear': 339 if tagname == 'Gear':
340 self.fillTextNode(tagname, value) 340 self.fillTextNode(tagname, value)
341 elif tagname == 'Magic': 341 elif tagname == 'Magic':