comparison orpg/gametree/nodehandlers/containers.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 fa18af3e04b9
children 0bc44a57ae6c
comparison
equal deleted inserted replaced
182:4b2884f29a72 195:b633f4c64aae
19 # 19 #
20 # File: containers.py 20 # File: containers.py
21 # Author: Chris Davis 21 # Author: Chris Davis
22 # Maintainer: 22 # Maintainer:
23 # Version: 23 # Version:
24 # $Id: containers.py,v 1.43 2007/08/08 19:17:17 digitalxero Exp $ 24 # $Id: containers.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: The file contains code for the container nodehandlers 26 # Description: The file contains code for the container nodehandlers
27 # 27 #
28 28
29 29
280 drag_obj = self.tree.drag_obj 280 drag_obj = self.tree.drag_obj
281 container_handler.on_drop(self,evt) 281 container_handler.on_drop(self,evt)
282 282
283 def build_splitter_wnd(self, parent, mode): 283 def build_splitter_wnd(self, parent, mode):
284 self.split = self.xml.get("horizontal") 284 self.split = self.xml.get("horizontal")
285 self.pane = splitter_panel(parent, self) 285 self.pane = splitter_panel(parent, self, mode)
286 self.splitter = MultiSplitterWindow(self.pane, -1, 286 self.splitter = MultiSplitterWindow(self.pane, -1,
287 style=wx.SP_LIVE_UPDATE|wx.SP_3DSASH|wx.SP_NO_XP_THEME) 287 style=wx.SP_LIVE_UPDATE|wx.SP_3DSASH|wx.SP_NO_XP_THEME)
288 if self.split == '1': self.splitter.SetOrientation(wx.VERTICAL) 288 if self.split == '1': self.splitter.SetOrientation(wx.VERTICAL)
289 else: self.splitter.SetOrientation(wx.HORIZONTAL) 289 else: self.splitter.SetOrientation(wx.HORIZONTAL)
290 self.bestSizex = -1 290 self.bestSizex = -1
291 self.bestSizey = -1 291 self.bestSizey = -1
292 self.tree.traverse(self.mytree_node, self.doSplit, mode, False) 292 self.tree.traverse(self.mytree_node, self.doSplit, mode, False)
293 self.pane.sizer.Add(self.splitter, 1, wx.EXPAND) 293 self.pane.sizer.Add(self.splitter, 1, wx.EXPAND)
294 if mode != 1: self.pane.hozCheck.Hide()
295 self.pane.SetSize((self.bestSizex, self.bestSizey)) 294 self.pane.SetSize((self.bestSizex, self.bestSizey))
296 self.pane.Layout() 295 self.pane.Layout()
297 parent.SetSize(self.pane.GetSize()) 296 parent.SetSize(self.pane.GetSize())
298 return self.pane 297 return self.pane
299 298
312 self.splitter.AppendWindow(tmp, sash) 311 self.splitter.AppendWindow(tmp, sash)
313 def get_size_constraint(self): 312 def get_size_constraint(self):
314 return 1 313 return 1
315 314
316 class splitter_panel(wx.Panel): 315 class splitter_panel(wx.Panel):
317 def __init__(self, parent, handler): 316 def __init__(self, parent, handler, mode):
318 wx.Panel.__init__(self, parent, -1) 317 wx.Panel.__init__(self, parent, -1)
319 self.handler = handler 318 self.handler = handler
320 sizer = wx.BoxSizer(wx.VERTICAL) 319 self.sizer = wx.BoxSizer(wx.VERTICAL)
321 self.title = wx.TextCtrl(self, 1, handler.xml.get('name')) 320 if mode == 0: self.title = wx.StaticText(self, 1, handler.xml.get('name'))
322 321 elif mode == 1: self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
323 self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split") 322 #self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
324 hoz = self.handler.xml.get("horizontal") 323
325 324 if mode == 1:
326 if hoz == '1': self.hozCheck.SetValue(True) 325 self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split")
327 else: self.hozCheck.SetValue(False) 326 hoz = self.handler.xml.get("horizontal")
328 327 if hoz == '1': self.hozCheck.SetValue(True)
329 sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND) 328 else: self.hozCheck.SetValue(False)
330 sizer.Add(self.title, 0) 329
331 sizer.Add(self.hozCheck, 0, wx.EXPAND) 330 if mode == 1: self.sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
332 sizer.Add(wx.Size(10,0)) 331 self.sizer.Add(self.title, 0)
333 332 if mode == 1: self.sizer.Add(self.hozCheck, 0, wx.EXPAND)
334 self.sizer = sizer 333 self.sizer.Add(wx.Size(10,0))
334
335 self.SetSizer(self.sizer) 335 self.SetSizer(self.sizer)
336 self.SetAutoLayout(True) 336 self.SetAutoLayout(True)
337 self.Bind(wx.EVT_TEXT, self.on_text, id=1) 337 self.Bind(wx.EVT_TEXT, self.on_text, id=1)
338 self.Bind(wx.EVT_CHECKBOX, self.on_check_box, id=self.hozCheck.GetId()) 338 if mode == 1: self.Bind(wx.EVT_CHECKBOX, self.on_check_box, id=self.hozCheck.GetId())
339 339
340 def on_check_box(self,evt): 340 def on_check_box(self,evt):
341 state = self.hozCheck.GetValue() 341 state = self.hozCheck.GetValue()
342 if state: self.handler.xml.set("horizontal", "1") 342 if state: self.handler.xml.set("horizontal", "1")
343 else: self.handler.xml.set("horizontal", "0") 343 else: self.handler.xml.set("horizontal", "0")