Mercurial > traipse_dev
comparison orpg/gametree/nodehandlers/forms.py @ 196:0bc44a57ae6c alpha
Traipse Alpha 'OpenRPG' {100425-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 (Patch-2)
New Features:
New Namespace method with two new syntaxes
New Namespace Internal is context sensitive, always!
New Namespace External is 'as narrow as you make it'
New PluginDB access for URL2Link plugin
New to Forms, they now show their content in Design Mode
Fixes:
Fix to Server GUI startup errors
Fix to Server GUI Rooms tab updating
Fix to Chat and Settings if non existant die roller is picked
Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated
Fix to Alias Lib's Export to Tree, Open, Save features
Fix to alias node, now works properly
Fix to Splitter node, minor GUI cleanup
Fix to Backgrounds not loading through remote loader
Fix to Node name errors
Fix to rolling dice in chat Whispers
Fix to Splitters Sizing issues
author | sirebral |
---|---|
date | Sun, 25 Apr 2010 23:26:55 -0500 |
parents | b633f4c64aae |
children | 43a91298ac33 |
comparison
equal
deleted
inserted
replaced
195:b633f4c64aae | 196:0bc44a57ae6c |
---|---|
107 self.main_sizer.Add(panel, size, wx.EXPAND) | 107 self.main_sizer.Add(panel, size, wx.EXPAND) |
108 self.main_sizer.Add(wx.Size(10,10)) | 108 self.main_sizer.Add(wx.Size(10,10)) |
109 | 109 |
110 F_HEIGHT = wx.NewId() | 110 F_HEIGHT = wx.NewId() |
111 F_WIDTH = wx.NewId() | 111 F_WIDTH = wx.NewId() |
112 class form_edit_panel(wx.Panel): | 112 class form_edit_panel(ScrolledPanel): |
113 def __init__(self, parent, handler): | 113 def __init__(self, parent, handler): |
114 wx.Panel.__init__(self, parent, -1) | 114 ScrolledPanel.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER|wx.VSCROLL|wx.HSCROLL) |
115 self.handler = handler | 115 self.handler = handler |
116 sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Form Properties"), wx.VERTICAL) | 116 self.main_sizer = wx.BoxSizer(wx.VERTICAL) |
117 wh_sizer = wx.BoxSizer(wx.HORIZONTAL) | 117 wh_sizer = wx.BoxSizer(wx.HORIZONTAL) |
118 self.text = { P_TITLE : wx.TextCtrl(self, P_TITLE, handler.xml.get('name')), | 118 self.text = { P_TITLE : wx.TextCtrl(self, P_TITLE, handler.xml.get('name')), |
119 F_HEIGHT : wx.TextCtrl(self, F_HEIGHT, handler.xml.get('height')), | 119 F_HEIGHT : wx.TextCtrl(self, F_HEIGHT, handler.xml.get('height')), |
120 F_WIDTH : wx.TextCtrl(self, F_WIDTH, handler.xml.get('width')) | 120 F_WIDTH : wx.TextCtrl(self, F_WIDTH, handler.xml.get('width')) |
121 } | 121 } |
126 wh_sizer.Add(wx.Size(10,10)) | 126 wh_sizer.Add(wx.Size(10,10)) |
127 wh_sizer.Add(wx.StaticText(self, -1, "Height:"), 0, wx.ALIGN_CENTER) | 127 wh_sizer.Add(wx.StaticText(self, -1, "Height:"), 0, wx.ALIGN_CENTER) |
128 wh_sizer.Add(wx.Size(10,10)) | 128 wh_sizer.Add(wx.Size(10,10)) |
129 wh_sizer.Add(self.text[F_HEIGHT], 0, wx.EXPAND) | 129 wh_sizer.Add(self.text[F_HEIGHT], 0, wx.EXPAND) |
130 | 130 |
131 sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND) | 131 self.main_sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND) |
132 sizer.Add(self.text[P_TITLE], 0, wx.EXPAND) | 132 self.main_sizer.Add(self.text[P_TITLE], 0, wx.EXPAND) |
133 sizer.Add(wx.Size(10,10)) | 133 self.main_sizer.Add(wx.Size(10,10)) |
134 sizer.Add(wh_sizer,0,wx.EXPAND) | 134 self.main_sizer.Add(wh_sizer,0,wx.EXPAND) |
135 | 135 handler.tree.traverse(handler.mytree_node, self.create_child_wnd, None, False) |
136 self.SetSizer(sizer) | 136 |
137 self.SetSizer(self.main_sizer) | |
137 self.SetAutoLayout(True) | 138 self.SetAutoLayout(True) |
139 self.SetupScrolling() | |
140 parent.SetSize(self.GetSize()) | |
138 self.Fit() | 141 self.Fit() |
139 parent.SetSize(self.GetBestSize()) | |
140 | 142 |
141 self.Bind(wx.EVT_TEXT, self.on_text, id=P_TITLE) | 143 self.Bind(wx.EVT_TEXT, self.on_text, id=P_TITLE) |
142 self.Bind(wx.EVT_TEXT, self.on_text, id=F_HEIGHT) | 144 self.Bind(wx.EVT_TEXT, self.on_text, id=F_HEIGHT) |
143 self.Bind(wx.EVT_TEXT, self.on_text, id=F_WIDTH) | 145 self.Bind(wx.EVT_TEXT, self.on_text, id=F_WIDTH) |
144 | 146 |
152 elif id == F_HEIGHT or id == F_WIDTH: | 154 elif id == F_HEIGHT or id == F_WIDTH: |
153 try: int(txt) | 155 try: int(txt) |
154 except: return 0 | 156 except: return 0 |
155 if id == F_HEIGHT: self.handler.xml.set("height",txt) | 157 if id == F_HEIGHT: self.handler.xml.set("height",txt) |
156 elif id == F_WIDTH: self.handler.xml.set("width",txt) | 158 elif id == F_WIDTH: self.handler.xml.set("width",txt) |
159 | |
160 def create_child_wnd(self, treenode, evt): | |
161 node = self.handler.tree.GetPyData(treenode) | |
162 panel = node.get_design_panel(self) | |
163 size = node.get_size_constraint() | |
164 if panel: | |
165 self.main_sizer.Add(panel, size, wx.EXPAND) | |
166 self.main_sizer.Add(wx.Size(10,10)) | |
157 | 167 |
158 ########################## | 168 ########################## |
159 ## control handler | 169 ## control handler |
160 ########################## | 170 ########################## |
161 class control_handler(node_handler): | 171 class control_handler(node_handler): |
318 multi = 1 | 328 multi = 1 |
319 else: | 329 else: |
320 sizer_style=wx.EXPAND | 330 sizer_style=wx.EXPAND |
321 text_style = 0 | 331 text_style = 0 |
322 multi = 0 | 332 multi = 0 |
323 self.text = wx.TextCtrl(self, F_TEXT, handler.get_value(),style=text_style) | 333 self.text = wx.TextCtrl(self, F_TEXT, handler.get_value() or '',style=text_style) |
324 sizer.Add(wx.Size(5,0)) | 334 sizer.Add(wx.Size(5,0)) |
325 sizer.Add(self.text, multi, sizer_style) | 335 sizer.Add(self.text, multi, sizer_style) |
326 self.SetSizer(sizer) | 336 self.SetSizer(sizer) |
327 self.SetAutoLayout(True) | 337 self.SetAutoLayout(True) |
328 | 338 |
617 | 627 |
618 | 628 |
619 class listbox_panel(wx.Panel): | 629 class listbox_panel(wx.Panel): |
620 def __init__(self, parent, handler): | 630 def __init__(self, parent, handler): |
621 wx.Panel.__init__(self, parent, -1) | 631 wx.Panel.__init__(self, parent, -1) |
632 #ScrolledPanel.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER|wx.VSCROLL|wx.HSCROLL) | |
622 self.handler = handler | 633 self.handler = handler |
623 self.chat = handler.chat | 634 self.chat = handler.chat |
624 opts = [] | 635 opts = [] |
625 values = handler.get_options() | 636 values = handler.get_options() |
626 captions = handler.get_captions() | 637 captions = handler.get_captions() |
634 if type == L_DROP: | 645 if type == L_DROP: |
635 self.list = wx.ComboBox(self, F_LIST, cur_opt, choices=opts, style=wx.CB_READONLY) | 646 self.list = wx.ComboBox(self, F_LIST, cur_opt, choices=opts, style=wx.CB_READONLY) |
636 if self.list.GetSize()[0] > 200: | 647 if self.list.GetSize()[0] > 200: |
637 self.list.Destroy() | 648 self.list.Destroy() |
638 self.list = wx.ComboBox(self, F_LIST, cur_opt, size=(200, -1), choices=opts, style=wx.CB_READONLY) | 649 self.list = wx.ComboBox(self, F_LIST, cur_opt, size=(200, -1), choices=opts, style=wx.CB_READONLY) |
639 elif type == L_LIST: self.list = wx.ListBox(self,F_LIST,choices=opts) | 650 elif type == L_LIST: self.list = wx.ListBox(self, F_LIST, choices=opts) |
640 elif type == L_RADIO: self.list = wx.RadioBox(self,F_LIST,label,choices=opts,majorDimension=3) | 651 elif type == L_RADIO: self.list = wx.RadioBox(self, F_LIST, label, choices=opts, majorDimension=3) |
641 elif type == L_CHECK: | 652 elif type == L_CHECK: |
642 self.list = wx.CheckListBox(self,F_LIST,choices=opts) | 653 self.list = wx.CheckListBox(self,F_LIST,choices=opts) |
643 self.set_checks() | 654 self.set_checks() |
644 | 655 |
645 for i in handler.get_selections_text(): | 656 for i in handler.get_selections_text(): |
647 else: self.list.SetStringSelection( i ) | 658 else: self.list.SetStringSelection( i ) |
648 if type == L_DROP: sizer = wx.BoxSizer(wx.HORIZONTAL) | 659 if type == L_DROP: sizer = wx.BoxSizer(wx.HORIZONTAL) |
649 else: sizer = wx.BoxSizer(wx.VERTICAL) | 660 else: sizer = wx.BoxSizer(wx.VERTICAL) |
650 | 661 |
651 if type != L_RADIO: | 662 if type != L_RADIO: |
652 sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND) | 663 sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND|wx.ALL) |
653 sizer.Add(wx.Size(5,0)) | 664 sizer.Add(self.list, 1, wx.EXPAND|wx.ALL) |
654 sizer.Add(self.list, 1, wx.EXPAND) | |
655 if handler.has_send_button(): | 665 if handler.has_send_button(): |
656 sizer.Add(wx.Button(self, F_SEND, "Send"), 0, wx.EXPAND) | 666 sizer.Add(wx.Button(self, F_SEND, "Send"), 0, wx.EXPAND|wx.ALL) |
657 self.Bind(wx.EVT_BUTTON, self.handler.on_send_to_chat, id=F_SEND) | 667 self.Bind(wx.EVT_BUTTON, self.handler.on_send_to_chat, id=F_SEND) |
658 self.sizer = sizer | 668 self.sizer = sizer |
659 self.SetSizer(sizer) | 669 self.SetSizer(sizer) |
660 self.SetAutoLayout(True) | 670 self.SetAutoLayout(True) |
671 #self.SetupScrolling() | |
672 #parent.SetSize(self.GetBestSize()) | |
661 self.Fit() | 673 self.Fit() |
662 parent.SetSize(self.GetBestSize()) | |
663 | 674 |
664 if type == L_DROP: self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST) | 675 if type == L_DROP: self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST) |
665 elif type == L_LIST: self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST) | 676 elif type == L_LIST: self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST) |
666 elif type == L_RADIO: self.Bind(wx.EVT_RADIOBOX, self.on_change, id=F_LIST) | 677 elif type == L_RADIO: self.Bind(wx.EVT_RADIOBOX, self.on_change, id=F_LIST) |
667 elif type == L_CHECK:self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, id=F_LIST) | 678 elif type == L_CHECK:self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, id=F_LIST) |