comparison orpg/gametree/nodehandlers/forms.py @ 132:fe4dc5817d5e alpha

Traipse Alpha 'OpenRPG' {091005-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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana **Pretty important update that can help remove thousands of dead children from your gametree. **Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! **New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!! Dead Node Children, now that's a O O -v-v- Happy Halloween!
author sirebral
date Thu, 05 Nov 2009 12:15:19 -0600
parents 90d19eb43830
children 2ffc5de126c8
comparison
equal deleted inserted replaced
131:90d19eb43830 132:fe4dc5817d5e
181 </nodehandler> 181 </nodehandler>
182 """ 182 """
183 def __init__(self,xml,tree_node): 183 def __init__(self,xml,tree_node):
184 node_handler.__init__(self,xml,tree_node) 184 node_handler.__init__(self,xml,tree_node)
185 self.text_elem = self.xml.find('text') 185 self.text_elem = self.xml.find('text')
186 if self.text_elem.get("send_button") == "": 186 if self.text_elem.get("send_button") == "": self.text_elem.set("send_button","0")
187 self.text_elem.set("send_button","0") 187 if self.text_elem.get("raw_mode") == "": self.text_elem.set("raw_mode","0")
188 if self.text_elem.get("raw_mode") == "": 188 if self.text_elem.get("hide_title") == "": self.text_elem.set("hide_title","0")
189 self.text_elem.set("raw_mode","0")
190 if self.text_elem.get("hide_title") == "":
191 self.text_elem.set("hide_title","0")
192 189
193 def get_design_panel(self,parent): 190 def get_design_panel(self,parent):
194 return textctrl_edit_panel(parent,self) 191 return textctrl_edit_panel(parent,self)
195 192
196 def get_use_panel(self,parent): 193 def get_use_panel(self,parent):
257 254
258 parent.SetSize(self.GetBestSize()) 255 parent.SetSize(self.GetBestSize())
259 self.Bind(wx.EVT_TEXT, self.on_text, id=FORM_TEXT_CTRL) 256 self.Bind(wx.EVT_TEXT, self.on_text, id=FORM_TEXT_CTRL)
260 self.Bind(wx.EVT_BUTTON, self.on_send, id=FORM_SEND_BUTTON) 257 self.Bind(wx.EVT_BUTTON, self.on_send, id=FORM_SEND_BUTTON)
261 258
262 def on_text(self,evt): 259 def on_text(self, evt):
260 debug()
263 txt = self.text.GetValue() 261 txt = self.text.GetValue()
264 #txt = strip_text(txt) ##Does not seem to exist. 262 #txt = strip_text(txt) ##Does not seem to exist.
265 self.handler.text_elem.text = txt 263 self.handler.text_elem.text = txt
266 264
267 def on_send(self,evt): 265 def on_send(self, evt):
268 txt = self.text.GetValue() 266 txt = self.text.GetValue()
267 txt = self.chat.ParseMap(txt, self.handler.xml)
269 if not self.handler.is_raw_send(): 268 if not self.handler.is_raw_send():
270 #self.chat.ParsePost(self.tohtml(),True,True) 269 self.chat.ParsePost(self.handler.tohtml(), True, True)
271 self.chat.ParsePost(self.handler.tohtml(),True,True)
272 return 1 270 return 1
273 actionlist = txt.split("\n") 271 actionlist = txt.split("\n")
274 for line in actionlist: 272 for line in actionlist:
275 if(line != ""): 273 if(line != ""):
276 if line[0] != "/": ## it's not a slash command 274 if line[0] != "/": ## it's not a slash command
277 self.chat.ParsePost(line,True,True) 275 self.chat.ParsePost(line, True, True)
278 else: 276 else:
279 action = line 277 action = line
280 self.chat.chat_cmds.docmd(action) 278 self.chat.chat_cmds.docmd(action)
281 return 1 279 return 1
282 280
424 else: 422 else:
425 return "" 423 return ""
426 424
427 425
428 # mult selection methods 426 # mult selection methods
429
430 def get_selections(self): 427 def get_selections(self):
431 opts = [] 428 opts = []
432 for opt in self.options: 429 for opt in self.options:
433 if opt.get("selected") == "1": 430 if opt.get("selected") == "1":
434 opts.append(opt) 431 opts.append(opt)
449 opts.append(i) 446 opts.append(i)
450 i += 1 447 i += 1
451 return opts 448 return opts
452 449
453 # setting selection method 450 # setting selection method
454
455 def set_selected_node(self,index,selected=1): 451 def set_selected_node(self,index,selected=1):
456 if self.get_type() != L_CHECK: 452 if self.get_type() != L_CHECK:
457 self.clear_selections() 453 self.clear_selections()
458 self.options[index].set("selected", str(bool2int(selected))) 454 self.options[index].set("selected", str(bool2int(selected)))
459 455
460 def clear_selections(self): 456 def clear_selections(self):
461 for opt in self.options: 457 for opt in self.options:
462 opt.set("selected","0") 458 opt.set("selected","0")
463 459
464 # misc methods 460 # misc methods
465
466 def get_options(self): 461 def get_options(self):
467 opts = [] 462 opts = []
468 for opt in self.options: 463 for opt in self.options: opts.append(opt.text)
469 opts.append(opt.text)
470 return opts 464 return opts
471 465
472 def get_option(self,index): 466 def get_option(self,index):
473 return self.options[index].text 467 return self.options[index].text
474 468
486 480
487 def edit_option(self,index,value): 481 def edit_option(self,index,value):
488 self.options[index].text = value 482 self.options[index].text = value
489 483
490 def has_send_button(self): 484 def has_send_button(self):
491 if self.list.get("send_button") == '0': 485 if self.list.get("send_button") == '0': return False
492 return False 486 else: return True
493 else:
494 return True
495 487
496 def get_size_constraint(self): 488 def get_size_constraint(self):
497 if self.get_type() == L_DROP: 489 if self.get_type() == L_DROP: return 0
498 return 0 490 else: return 1
499 else:
500 return 1
501 491
502 def tohtml(self): 492 def tohtml(self):
503 opts = self.get_selections_text() 493 opts = self.get_selections_text()
504 text = "" 494 text = ""
505 if not self.is_hide_title(): 495 if not self.is_hide_title(): text = "<b>"+self.xml.get("name")+":</b> "
506 text = "<b>"+self.xml.get("name")+":</b> "
507 comma = ", " 496 comma = ", "
508 text += comma.join(opts) 497 text += comma.join(opts)
509 return text 498 return text
510 499
511 def get_value(self): 500 def get_value(self):