diff orpg/gametree/nodehandlers/containers.py @ 212:13054be69834 beta

Traipse Beta 'OpenRPG' {100428-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 Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start 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 Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up
author sirebral
date Wed, 28 Apr 2010 08:08:09 -0500
parents dcae32e219f1
children a00b40ee92fc
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/containers.py	Mon Feb 01 18:29:16 2010 -0600
+++ b/orpg/gametree/nodehandlers/containers.py	Wed Apr 28 08:08:09 2010 -0500
@@ -245,7 +245,6 @@
         parent.SetSize(self.GetBestSize())
         self.Bind(wx.EVT_TEXT, self.on_text, id=1)
 
-
     def on_text(self,evt):
         txt = self.title.GetValue()
         if txt != "":
@@ -281,19 +280,19 @@
         container_handler.on_drop(self,evt)
 
     def build_splitter_wnd(self, parent, mode):
+        self.parent = parent
         self.split = self.xml.get("horizontal")
-        self.pane = splitter_panel(parent, self)
+        self.pane = splitter_panel(parent, self, mode)
+        self.frame = self.pane.frame
         self.splitter = MultiSplitterWindow(self.pane, -1, 
                         style=wx.SP_LIVE_UPDATE|wx.SP_3DSASH|wx.SP_NO_XP_THEME)
+        self.splitter.parent = self
         if self.split == '1': self.splitter.SetOrientation(wx.VERTICAL)
         else: self.splitter.SetOrientation(wx.HORIZONTAL)
-        self.bestSizex = -1
-        self.bestSizey = -1
         self.tree.traverse(self.mytree_node, self.doSplit, mode, False) 
-        self.pane.sizer.Add(self.splitter, 1, wx.EXPAND)
-        if mode != 1: self.pane.hozCheck.Hide()
-        self.pane.SetSize((self.bestSizex, self.bestSizey))
-        self.pane.Layout()
+        self.pane.sizer.Add(self.splitter, -1, wx.EXPAND)
+        self.pane.SetAutoLayout(True)
+        self.pane.Fit()
         parent.SetSize(self.pane.GetSize())
         return self.pane
 
@@ -301,41 +300,40 @@
         node = self.tree.GetPyData(treenode)
         if mode == 1: tmp = node.get_design_panel(self.splitter)
         else: tmp = node.get_use_panel(self.splitter)
-        if self.split == '1':
-            sash = tmp.GetBestSize()[1]+1
-            self.bestSizey += sash+11
-            if self.bestSizex < tmp.GetBestSize()[0]: self.bestSizex = tmp.GetBestSize()[0]+10
-        else:
-            sash = tmp.GetBestSize()[0]+1
-            self.bestSizex += sash
-            if self.bestSizey < tmp.GetBestSize()[1]: self.bestSizey = tmp.GetBestSize()[1]+31
+        if self.split == '1': sash = self.frame.GetSize()[1]/len(self.xml.findall('nodehandler'))
+        else: sash = self.frame.GetSize()[0]/len(self.xml.findall('nodehandler'))
         self.splitter.AppendWindow(tmp, sash)
+
     def get_size_constraint(self):
         return 1
 
 class splitter_panel(wx.Panel):
-    def __init__(self, parent, handler):
+    def __init__(self, parent, handler, mode):
         wx.Panel.__init__(self, parent, -1)
+        self.parent = parent
         self.handler = handler
-        sizer = wx.BoxSizer(wx.VERTICAL)
-        self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
-
-        self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split")
-        hoz = self.handler.xml.get("horizontal")
+        self.sizer = wx.BoxSizer(wx.VERTICAL)
+        if mode == 0: self.title = wx.StaticText(self, 1, handler.xml.get('name'))
+        elif mode == 1: self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
+        self.frame = self.GetParent()
+        while self.frame.GetName() != 'frame':
+            self.frame = self.frame.GetParent()
 
-        if hoz == '1': self.hozCheck.SetValue(True)
-        else: self.hozCheck.SetValue(False)
+        if mode == 1:
+            self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split")
+            hoz = self.handler.xml.get("horizontal")
+            if hoz == '1': self.hozCheck.SetValue(True)
+            else: self.hozCheck.SetValue(False)
 
-        sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
-        sizer.Add(self.title, 0)
-        sizer.Add(self.hozCheck, 0, wx.EXPAND)
-        sizer.Add(wx.Size(10,0))
+        if mode == 1: self.sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
+        self.sizer.Add(self.title, 0)
+        if mode == 1: self.sizer.Add(self.hozCheck, 0, wx.EXPAND)
+        self.sizer.Add(wx.Size(10,0))
 
-        self.sizer = sizer
         self.SetSizer(self.sizer)
         self.SetAutoLayout(True)
         self.Bind(wx.EVT_TEXT, self.on_text, id=1)
-        self.Bind(wx.EVT_CHECKBOX, self.on_check_box, id=self.hozCheck.GetId())
+        if mode == 1: self.Bind(wx.EVT_CHECKBOX, self.on_check_box, id=self.hozCheck.GetId())
 
     def on_check_box(self,evt):
         state = self.hozCheck.GetValue()