comparison 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
comparison
equal deleted inserted replaced
194:44ef45e77880 212:13054be69834
243 self.SetAutoLayout(True) 243 self.SetAutoLayout(True)
244 self.Fit() 244 self.Fit()
245 parent.SetSize(self.GetBestSize()) 245 parent.SetSize(self.GetBestSize())
246 self.Bind(wx.EVT_TEXT, self.on_text, id=1) 246 self.Bind(wx.EVT_TEXT, self.on_text, id=1)
247 247
248
249 def on_text(self,evt): 248 def on_text(self,evt):
250 txt = self.title.GetValue() 249 txt = self.title.GetValue()
251 if txt != "": 250 if txt != "":
252 self.handler.xml.set('name',txt) 251 self.handler.xml.set('name',txt)
253 self.handler.rename(txt) 252 self.handler.rename(txt)
279 def on_drop(self,evt): 278 def on_drop(self,evt):
280 drag_obj = self.tree.drag_obj 279 drag_obj = self.tree.drag_obj
281 container_handler.on_drop(self,evt) 280 container_handler.on_drop(self,evt)
282 281
283 def build_splitter_wnd(self, parent, mode): 282 def build_splitter_wnd(self, parent, mode):
283 self.parent = parent
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.frame = self.pane.frame
286 self.splitter = MultiSplitterWindow(self.pane, -1, 287 self.splitter = MultiSplitterWindow(self.pane, -1,
287 style=wx.SP_LIVE_UPDATE|wx.SP_3DSASH|wx.SP_NO_XP_THEME) 288 style=wx.SP_LIVE_UPDATE|wx.SP_3DSASH|wx.SP_NO_XP_THEME)
289 self.splitter.parent = self
288 if self.split == '1': self.splitter.SetOrientation(wx.VERTICAL) 290 if self.split == '1': self.splitter.SetOrientation(wx.VERTICAL)
289 else: self.splitter.SetOrientation(wx.HORIZONTAL) 291 else: self.splitter.SetOrientation(wx.HORIZONTAL)
290 self.bestSizex = -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() 294 self.pane.SetAutoLayout(True)
295 self.pane.SetSize((self.bestSizex, self.bestSizey)) 295 self.pane.Fit()
296 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
300 def doSplit(self, treenode, mode): 299 def doSplit(self, treenode, mode):
301 node = self.tree.GetPyData(treenode) 300 node = self.tree.GetPyData(treenode)
302 if mode == 1: tmp = node.get_design_panel(self.splitter) 301 if mode == 1: tmp = node.get_design_panel(self.splitter)
303 else: tmp = node.get_use_panel(self.splitter) 302 else: tmp = node.get_use_panel(self.splitter)
304 if self.split == '1': 303 if self.split == '1': sash = self.frame.GetSize()[1]/len(self.xml.findall('nodehandler'))
305 sash = tmp.GetBestSize()[1]+1 304 else: sash = self.frame.GetSize()[0]/len(self.xml.findall('nodehandler'))
306 self.bestSizey += sash+11
307 if self.bestSizex < tmp.GetBestSize()[0]: self.bestSizex = tmp.GetBestSize()[0]+10
308 else:
309 sash = tmp.GetBestSize()[0]+1
310 self.bestSizex += sash
311 if self.bestSizey < tmp.GetBestSize()[1]: self.bestSizey = tmp.GetBestSize()[1]+31
312 self.splitter.AppendWindow(tmp, sash) 305 self.splitter.AppendWindow(tmp, sash)
306
313 def get_size_constraint(self): 307 def get_size_constraint(self):
314 return 1 308 return 1
315 309
316 class splitter_panel(wx.Panel): 310 class splitter_panel(wx.Panel):
317 def __init__(self, parent, handler): 311 def __init__(self, parent, handler, mode):
318 wx.Panel.__init__(self, parent, -1) 312 wx.Panel.__init__(self, parent, -1)
313 self.parent = parent
319 self.handler = handler 314 self.handler = handler
320 sizer = wx.BoxSizer(wx.VERTICAL) 315 self.sizer = wx.BoxSizer(wx.VERTICAL)
321 self.title = wx.TextCtrl(self, 1, handler.xml.get('name')) 316 if mode == 0: self.title = wx.StaticText(self, 1, handler.xml.get('name'))
322 317 elif mode == 1: self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
323 self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split") 318 self.frame = self.GetParent()
324 hoz = self.handler.xml.get("horizontal") 319 while self.frame.GetName() != 'frame':
325 320 self.frame = self.frame.GetParent()
326 if hoz == '1': self.hozCheck.SetValue(True) 321
327 else: self.hozCheck.SetValue(False) 322 if mode == 1:
328 323 self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split")
329 sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND) 324 hoz = self.handler.xml.get("horizontal")
330 sizer.Add(self.title, 0) 325 if hoz == '1': self.hozCheck.SetValue(True)
331 sizer.Add(self.hozCheck, 0, wx.EXPAND) 326 else: self.hozCheck.SetValue(False)
332 sizer.Add(wx.Size(10,0)) 327
333 328 if mode == 1: self.sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
334 self.sizer = sizer 329 self.sizer.Add(self.title, 0)
330 if mode == 1: self.sizer.Add(self.hozCheck, 0, wx.EXPAND)
331 self.sizer.Add(wx.Size(10,0))
332
335 self.SetSizer(self.sizer) 333 self.SetSizer(self.sizer)
336 self.SetAutoLayout(True) 334 self.SetAutoLayout(True)
337 self.Bind(wx.EVT_TEXT, self.on_text, id=1) 335 self.Bind(wx.EVT_TEXT, self.on_text, id=1)
338 self.Bind(wx.EVT_CHECKBOX, self.on_check_box, id=self.hozCheck.GetId()) 336 if mode == 1: self.Bind(wx.EVT_CHECKBOX, self.on_check_box, id=self.hozCheck.GetId())
339 337
340 def on_check_box(self,evt): 338 def on_check_box(self,evt):
341 state = self.hozCheck.GetValue() 339 state = self.hozCheck.GetValue()
342 if state: self.handler.xml.set("horizontal", "1") 340 if state: self.handler.xml.set("horizontal", "1")
343 else: self.handler.xml.set("horizontal", "0") 341 else: self.handler.xml.set("horizontal", "0")