Mercurial > traipse_dev
comparison orpg/gametree/nodehandlers/forms.py @ 195:b633f4c64aae alpha
Traipse Alpha 'OpenRPG' {100219-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
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
author | sirebral |
---|---|
date | Sat, 24 Apr 2010 08:37:20 -0500 |
parents | 4b2884f29a72 |
children | 0bc44a57ae6c |
comparison
equal
deleted
inserted
replaced
182:4b2884f29a72 | 195:b633f4c64aae |
---|---|
19 # | 19 # |
20 # File: forms.py | 20 # File: forms.py |
21 # Author: Chris Davis | 21 # Author: Chris Davis |
22 # Maintainer: | 22 # Maintainer: |
23 # Version: | 23 # Version: |
24 # $Id: forms.py,v 1.53 2007/04/21 23:00:51 digitalxero Exp $ | 24 # $Id: forms.py,v Traipse 'Ornery-Orc' prof.ebral Exp $ |
25 # | 25 # |
26 # Description: The file contains code for the form based nodehanlers | 26 # Description: The file contains code for the form based nodehanlers |
27 # | 27 # |
28 | 28 |
29 __version__ = "$Id: forms.py,v 1.53 2007/04/21 23:00:51 digitalxero Exp $" | 29 __version__ = "$Id: forms.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" |
30 | 30 |
31 from containers import * | 31 from containers import * |
32 import orpg.minidom as minidom | 32 import orpg.minidom as minidom |
33 from orpg.orpg_xml import xml | 33 from orpg.orpg_xml import xml |
34 from wx.lib.scrolledpanel import ScrolledPanel | 34 from wx.lib.scrolledpanel import ScrolledPanel |
35 from orpg.tools.settings import settings | 35 from orpg.tools.settings import settings |
36 from orpg.tools.InterParse import Parse | |
36 | 37 |
37 def bool2int(b): | 38 def bool2int(b): |
38 #in wxPython 2.5+, evt.Checked() returns True or False instead of 1.0 or 0. | 39 #in wxPython 2.5+, evt.Checked() returns True or False instead of 1.0 or 0. |
39 #by running the results of that through this function, we convert it. | 40 #by running the results of that through this function, we convert it. |
40 #if it was an int already, nothing changes. The difference between 1.0 | 41 #if it was an int already, nothing changes. The difference between 1.0 |
260 #txt = strip_text(txt) ##Does not seem to exist. | 261 #txt = strip_text(txt) ##Does not seem to exist. |
261 self.handler.text_elem.text = txt | 262 self.handler.text_elem.text = txt |
262 | 263 |
263 def on_send(self, evt): | 264 def on_send(self, evt): |
264 txt = self.text.GetValue() | 265 txt = self.text.GetValue() |
265 txt = self.chat.ParseMap(txt, self.handler.xml) | 266 txt = Parse.ParseLogic(txt, self.handler.xml) |
266 txt = self.chat.ParseParent(txt, self.handler.xml.get('map')) | |
267 if not self.handler.is_raw_send(): | 267 if not self.handler.is_raw_send(): |
268 self.chat.ParsePost(self.handler.tohtml(), True, True) | 268 Parse.Post(self.handler.tohtml(), True, True) |
269 return 1 | 269 return 1 |
270 actionlist = txt.split("\n") | 270 actionlist = txt.split("\n") |
271 for line in actionlist: | 271 for line in actionlist: |
272 line = Parse.ParseLogic(line, self.handler.xml) | |
272 if(line != ""): | 273 if(line != ""): |
273 if line[0] != "/": ## it's not a slash command | 274 if line[0] != "/": ## it's not a slash command |
274 self.chat.ParsePost(line, True, True) | 275 Parse.Post(line, True, True) |
275 else: | 276 else: |
276 action = line | 277 action = line |
277 self.chat.chat_cmds.docmd(action) | 278 self.chat.chat_cmds.docmd(action) |
278 return 1 | 279 return 1 |
279 | 280 |
593 def get_value(self): | 594 def get_value(self): |
594 return "\n".join(self.get_selections_text()) | 595 return "\n".join(self.get_selections_text()) |
595 | 596 |
596 def on_send_to_chat(self, evt): | 597 def on_send_to_chat(self, evt): |
597 txt = self.get_selected_text() | 598 txt = self.get_selected_text() |
598 txt = self.chat.ParseMap(txt, self.xml) | 599 txt = Parse.ParseLogic(txt, self.xml) |
599 txt = self.chat.ParseParent(txt, self.xml.get('map')) | |
600 if not self.is_raw_send(): | 600 if not self.is_raw_send(): |
601 self.chat.ParsePost(self.tohtml(), True, True) | 601 Parse.Post(self.tohtml(), True, True) |
602 return 1 | 602 return 1 |
603 actionlist = self.get_selections_text() | 603 actionlist = self.get_selections_text() |
604 for line in actionlist: | 604 for line in actionlist: |
605 line = self.chat.ParseMap(line, self.xml) | 605 line = Parse.ParseLogic(line, self.xml) |
606 line = self.chat.ParseParent(line, self.xml.get('map')) | |
607 if(line != ""): | 606 if(line != ""): |
608 if line[0] != "/": ## it's not a slash command | 607 if line[0] != "/": ## it's not a slash command |
609 self.chat.ParsePost(line, True, True) | 608 Parse.Post(line, True, True) |
610 else: | 609 else: |
611 action = line | 610 action = line |
612 self.chat.chat_cmds.docmd(action) | 611 self.chat.chat_cmds.docmd(action) |
613 return 1 | 612 return 1 |
614 | 613 |
752 self.handler.set_type(evt.GetInt()) | 751 self.handler.set_type(evt.GetInt()) |
753 | 752 |
754 def on_add(self,evt): | 753 def on_add(self,evt): |
755 self.dlg = wx.Frame(self, -1, 'Text', size=(300,150)) | 754 self.dlg = wx.Frame(self, -1, 'Text', size=(300,150)) |
756 edit_panel = wx.Panel(self.dlg, -1) | 755 edit_panel = wx.Panel(self.dlg, -1) |
757 sizer = wx.GridBagSizer(1, 2) | 756 sizer = wx.GridBagSizer(1, 1) |
758 edit_panel.SetSizer(sizer) | 757 edit_panel.SetSizer(sizer) |
759 caption_text = wx.StaticText(edit_panel, -1, 'Caption') | 758 caption_text = wx.StaticText(edit_panel, -1, 'Caption') |
760 self.caption_entry = wx.TextCtrl(edit_panel, -1, '') | 759 self.caption_entry = wx.TextCtrl(edit_panel, -1, '') |
761 value_text = wx.StaticText(edit_panel, -1, 'Value') | 760 value_text = wx.StaticText(edit_panel, -1, 'Value') |
762 self.value_entry = wx.TextCtrl(edit_panel, -1, '') | 761 self.value_entry = wx.TextCtrl(edit_panel, -1, '') |
763 button_ok = wx.Button(edit_panel, wx.ID_OK) | 762 button_ok = wx.Button(edit_panel, wx.ID_OK) |
764 button_cancel = wx.Button(edit_panel, wx.ID_CANCEL) | 763 button_cancel = wx.Button(edit_panel, wx.ID_CANCEL) |
765 button_ref = wx.Button(edit_panel, BUT_REF, "Reference") | 764 button_ref = wx.Button(edit_panel, BUT_REF, "Reference") |
766 sizer.Add(caption_text, (0,0)) | 765 sizer.Add(caption_text, (0,0)) |
767 sizer.Add(self.caption_entry, (0,1), span=(1,3), flag=wx.EXPAND) | 766 sizer.Add(self.caption_entry, (0,1), span=(1,4), flag=wx.EXPAND) |
768 sizer.Add(value_text, (1,0)) | 767 sizer.Add(value_text, (1,0)) |
769 sizer.Add(self.value_entry, (1,1), span=(1,3), flag=wx.EXPAND) | 768 sizer.Add(self.value_entry, (1,1), span=(1,4), flag=wx.EXPAND) |
770 sizer.Add(button_ok, (3,0)) | 769 sizer.Add(button_ok, (3,0)) |
771 sizer.Add(button_cancel, (3,1)) | 770 sizer.Add(button_cancel, (3,1)) |
772 sizer.Add(button_ref, (3,2), flag=wx.EXPAND) | 771 sizer.Add(button_ref, (3,2), flag=wx.EXPAND) |
772 sizer.AddGrowableCol(3) | |
773 sizer.AddGrowableRow(2) | |
774 self.dlg.SetSize((275, 125)) | |
775 self.dlg.SetMinSize((275, 125)) | |
776 self.dlg.Layout() | |
773 self.Bind(wx.EVT_BUTTON, self.on_reference, id=BUT_REF) | 777 self.Bind(wx.EVT_BUTTON, self.on_reference, id=BUT_REF) |
774 self.Bind(wx.EVT_BUTTON, self.on_add_option, id=wx.ID_OK) | 778 self.Bind(wx.EVT_BUTTON, self.on_add_option, id=wx.ID_OK) |
775 self.Bind(wx.EVT_BUTTON, self.on_edit_cancel, id=wx.ID_CANCEL) | 779 self.Bind(wx.EVT_BUTTON, self.on_edit_cancel, id=wx.ID_CANCEL) |
776 self.dlg.Show() | 780 self.dlg.Show() |
777 | 781 |
881 self.value_entry = wx.TextCtrl(edit_panel, -1, self.handler.get_option(self.index)) | 885 self.value_entry = wx.TextCtrl(edit_panel, -1, self.handler.get_option(self.index)) |
882 button_ok = wx.Button(edit_panel, wx.ID_OK) | 886 button_ok = wx.Button(edit_panel, wx.ID_OK) |
883 button_cancel = wx.Button(edit_panel, wx.ID_CANCEL) | 887 button_cancel = wx.Button(edit_panel, wx.ID_CANCEL) |
884 button_ref = wx.Button(edit_panel, BUT_REF, "Reference") | 888 button_ref = wx.Button(edit_panel, BUT_REF, "Reference") |
885 sizer.Add(caption_text, (0,0)) | 889 sizer.Add(caption_text, (0,0)) |
886 sizer.Add(self.caption_entry, (0,1), span=(1,3), flag=wx.EXPAND) | 890 sizer.Add(self.caption_entry, (0,1), span=(1,4), flag=wx.EXPAND) |
887 sizer.Add(value_text, (1,0)) | 891 sizer.Add(value_text, (1,0)) |
888 sizer.Add(self.value_entry, (1,1), span=(1,3), flag=wx.EXPAND) | 892 sizer.Add(self.value_entry, (1,1), span=(1,4), flag=wx.EXPAND) |
889 sizer.Add(button_ok, (3,0)) | 893 sizer.Add(button_ok, (3,0)) |
890 sizer.Add(button_cancel, (3,1)) | 894 sizer.Add(button_cancel, (3,1)) |
891 sizer.Add(button_ref, (3,2), flag=wx.EXPAND) | 895 sizer.Add(button_ref, (3,2), flag=wx.EXPAND) |
896 sizer.AddGrowableCol(3) | |
897 sizer.AddGrowableRow(2) | |
898 self.dlg.SetSize((275, 125)) | |
899 self.dlg.SetMinSize((275, 125)) | |
900 self.dlg.Layout() | |
892 self.Bind(wx.EVT_BUTTON, self.on_reference, id=BUT_REF) | 901 self.Bind(wx.EVT_BUTTON, self.on_reference, id=BUT_REF) |
893 self.Bind(wx.EVT_BUTTON, self.on_edit_ok, id=wx.ID_OK) | 902 self.Bind(wx.EVT_BUTTON, self.on_edit_ok, id=wx.ID_OK) |
894 self.Bind(wx.EVT_BUTTON, self.on_edit_cancel, id=wx.ID_CANCEL) | 903 self.Bind(wx.EVT_BUTTON, self.on_edit_cancel, id=wx.ID_CANCEL) |
895 self.dlg.Show() | 904 self.dlg.Show() |
896 | 905 |