comparison orpg/gametree/nodehandlers/forms.py @ 152:6081bdc2b8d5 beta

Traipse Beta 'OpenRPG' {091125-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 (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 Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Wed, 25 Nov 2009 06:16:35 -0600
parents 2345c12d93a7
children 3b6888bb53b5
comparison
equal deleted inserted replaced
150:6c5f46a5924b 152:6081bdc2b8d5
209 return int(self.text_elem.get("send_button",0)) 209 return int(self.text_elem.get("send_button",0))
210 210
211 def tohtml(self): 211 def tohtml(self):
212 txt = self.get_value() 212 txt = self.get_value()
213 txt = string.replace(txt,'\n',"<br />") 213 txt = string.replace(txt,'\n',"<br />")
214 if not self.is_hide_title(): 214 if not self.is_hide_title(): txt = "<b>"+self.xml.get("name")+":</b> "+txt
215 txt = "<b>"+self.xml.get("name")+":</b> "+txt
216 return txt 215 return txt
217 216
218 def get_value(self): 217 def get_value(self):
219 return self.text_elem.text 218 return self.text_elem.text
220 219
243 self.text = wx.TextCtrl(self, FORM_TEXT_CTRL, txt, style=text_style) 242 self.text = wx.TextCtrl(self, FORM_TEXT_CTRL, txt, style=text_style)
244 sizer.Add(wx.StaticText(self, -1, handler.xml.get('name')+": "), 0, sizer_style) 243 sizer.Add(wx.StaticText(self, -1, handler.xml.get('name')+": "), 0, sizer_style)
245 sizer.Add(wx.Size(5,0)) 244 sizer.Add(wx.Size(5,0))
246 sizer.Add(self.text, 1, sizer_style) 245 sizer.Add(self.text, 1, sizer_style)
247 246
248 if handler.has_send_button(): 247 if handler.has_send_button(): sizer.Add(wx.Button(self, FORM_SEND_BUTTON, "Send"), 0, sizer_style)
249 sizer.Add(wx.Button(self, FORM_SEND_BUTTON, "Send"), 0, sizer_style)
250 248
251 self.sizer = sizer 249 self.sizer = sizer
252 self.SetSizer(sizer) 250 self.SetSizer(sizer)
253 self.SetAutoLayout(True) 251 self.SetAutoLayout(True)
254 252
543 else: sizer = wx.BoxSizer(wx.VERTICAL) 541 else: sizer = wx.BoxSizer(wx.VERTICAL)
544 542
545 if type != L_RADIO: 543 if type != L_RADIO:
546 sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND) 544 sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND)
547 sizer.Add(wx.Size(5,0)) 545 sizer.Add(wx.Size(5,0))
548
549 sizer.Add(self.list, 1, wx.EXPAND) 546 sizer.Add(self.list, 1, wx.EXPAND)
550
551 if handler.has_send_button(): 547 if handler.has_send_button():
552 sizer.Add(wx.Button(self, F_SEND, "Send"), 0, wx.EXPAND) 548 sizer.Add(wx.Button(self, F_SEND, "Send"), 0, wx.EXPAND)
553 self.Bind(wx.EVT_BUTTON, self.handler.on_send_to_chat, id=F_SEND) 549 self.Bind(wx.EVT_BUTTON, self.handler.on_send_to_chat, id=F_SEND)
554
555 self.sizer = sizer 550 self.sizer = sizer
556 self.SetSizer(sizer) 551 self.SetSizer(sizer)
557 self.SetAutoLayout(True) 552 self.SetAutoLayout(True)
558 self.Fit() 553 self.Fit()
559
560 parent.SetSize(self.GetBestSize()) 554 parent.SetSize(self.GetBestSize())
561 555
562 if type == L_DROP: self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST) 556 if type == L_DROP: self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST)
563 elif type == L_LIST: self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST) 557 elif type == L_LIST: self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST)
564 elif type == L_RADIO: self.Bind(wx.EVT_RADIOBOX, self.on_change, id=F_LIST) 558 elif type == L_RADIO: self.Bind(wx.EVT_RADIOBOX, self.on_change, id=F_LIST)
713 return link_panel(parent,self) 707 return link_panel(parent,self)
714 708
715 def tohtml(self): 709 def tohtml(self):
716 href = self.link.get("href") 710 href = self.link.get("href")
717 title = self.xml.get("name") 711 title = self.xml.get("name")
718 return "<a href=\""+href+"\" >"+title+"</a>" 712 return "<a href='"+href+"' >"+title+"</a>"
719 713
720 class link_panel(wx.StaticText): 714 class link_panel(wx.StaticText):
721 def __init__(self,parent,handler): 715 def __init__(self,parent,handler):
722 self.handler = handler 716 self.handler = handler
723 label = handler.xml.get('name') 717 label = handler.xml.get('name')
724 wx.StaticText.__init__(self,parent,-1,label) 718 wx.StaticText.__init__(self,parent,-1,label)
725 self.SetForegroundColour(wx.BLUE) 719 self.SetForegroundColour(wx.BLUE)
726 self.Bind(wx.EVT_LEFT_DOWN, self.handler.on_use) 720 self.Bind(wx.EVT_LEFT_DOWN, self.handler.on_use)
727
728 721
729 P_URL = wx.NewId() 722 P_URL = wx.NewId()
730 723
731 class link_edit_panel(wx.Panel): 724 class link_edit_panel(wx.Panel):
732 def __init__(self, parent, handler): 725 def __init__(self, parent, handler):
752 txt = self.text[id].GetValue() 745 txt = self.text[id].GetValue()
753 if not len(txt): return 746 if not len(txt): return
754 if id == P_TITLE: 747 if id == P_TITLE:
755 self.handler.xml.set('name',txt) 748 self.handler.xml.set('name',txt)
756 self.handler.rename(txt) 749 self.handler.rename(txt)
757 elif id == P_URL: 750 elif id == P_URL: self.handler.link.set('href',txt)
758 self.handler.link.set('href',txt)
759 751
760 ########################## 752 ##########################
761 ## webimg node handler 753 ## webimg node handler
762 ########################## 754 ##########################
763 class webimg_handler(node_handler): 755 class webimg_handler(node_handler):
773 def get_design_panel(self,parent): 765 def get_design_panel(self,parent):
774 return link_edit_panel(parent,self) 766 return link_edit_panel(parent,self)
775 767
776 def get_use_panel(self,parent): 768 def get_use_panel(self,parent):
777 img = img_helper().load_url(self.link.get("href")) 769 img = img_helper().load_url(self.link.get("href"))
778 if not img is None: 770 if not img is None: return wx.StaticBitmap(parent,-1,img,size= wx.Size(img.GetWidth(),img.GetHeight()))
779 return wx.StaticBitmap(parent,-1,img,size= wx.Size(img.GetWidth(),img.GetHeight()))
780 return wx.EmptyBitmap(1, 1) 771 return wx.EmptyBitmap(1, 1)
781 772
782 def tohtml(self): 773 def tohtml(self):
783 href = self.link.get("href") 774 href = self.link.get("href")
784 title = self.xml.get("name") 775 title = self.xml.get("name")
785 return "<img src=\""+href+"\" alt="+title+" >" 776 return "<img src='"+href+"' alt="+title+" >"