comparison orpg/gametree/nodehandlers/StarWarsd20.py @ 60:3b2cfa13b610 ornery-dev

Fix to toolbar menus. More correct fix so docking is working on Ubuntu Fix to three broken nodes. Update Manager is no longer a top window, has an icon and now has a place on the task bar (panel).
author sirebral
date Wed, 12 Aug 2009 20:54:46 -0500
parents 4385a7d0efd1
children c54768cffbd4
comparison
equal deleted inserted replaced
59:5aff3ef1ae46 60:3b2cfa13b610
242 def __init__(self, parent, handler, mode): 242 def __init__(self, parent, handler, mode):
243 wx.Notebook.__init__(self, parent, -1, size=(1200,800)) 243 wx.Notebook.__init__(self, parent, -1, size=(1200,800))
244 self.handler = handler 244 self.handler = handler
245 self.parent = parent 245 self.parent = parent
246 tree = self.handler.tree 246 tree = self.handler.tree
247 max = tree.GetChildrenCount(handler.mytree_node) 247 max = tree.GetChildrenCount(handler.mytree_node, False)
248
249 cookie = 0 248 cookie = 0
250 max = tree.GetChildrenCount(handler.mytree_node)
251 try: 249 try:
252 (child,cookie)=tree.GetFirstChild(handler.mytree_node,cookie) 250 (child,cookie)=tree.GetFirstChild(handler.mytree_node,cookie)
253 except: # If this happens we probably have a newer version of wxPython 251 except: # If this happens we probably have a newer version of wxPython
254 (child,cookie)=tree.GetFirstChild(handler.mytree_node) 252 (child,cookie)=tree.GetFirstChild(handler.mytree_node)
255 obj = tree.GetPyData(child) 253 obj = tree.GetPyData(child)
256 for m in xrange(max): 254 for m in xrange(max):
255
257 if mode == 1: 256 if mode == 1:
258 panel = obj.get_design_panel(self) 257 panel = obj.get_design_panel(self)
259 else: 258 else:
260 panel = obj.get_use_panel(self) 259 panel = obj.get_use_panel(self)
261 name = obj.master_dom.getAttribute("name") 260 name = obj.master_dom.getAttribute("name")
262 261
263 if panel: 262 if panel:
264 self.AddPage(panel,name) 263 self.AddPage(panel,name)
265 if m < max-1: 264 if m < max-1:
266 child = tree.GetNextSibling(child) 265 child = tree.GetNextSibling(child)
267 obj = tree.GetPyData(child) 266 obj = tree.GetPyData(child)
268 267
269 268
270 def about(self): 269 def about(self):
300 pass 299 pass
301 300
302 def on_rclick(self,evt): 301 def on_rclick(self,evt):
303 pass 302 pass
304 303
305 def on_ldclick(self,evt): 304 def on_ldclick(self,evt): #Function needs help. Needs an OnClose I think.
306 return
307 if self.myeditor == None or self.myeditor.destroyed: 305 if self.myeditor == None or self.myeditor.destroyed:
308 title = self.master_dom.getAttribute('name') + " Editor" 306 title = self.master_dom.getAttribute('name') + " Editor"
309 self.myeditor = orpgPFrame(self.frame,title,orpg.dirpath.dir_struct["icon"]+'grid.ico') 307 # Frame created in correctly.
308 self.myeditor = wx.Frame(self.frame,title,orpg.dirpath.dir_struct["icon"]+'grid.ico')
310 wnd = self.get_design_panel(self.myeditor) 309 wnd = self.get_design_panel(self.myeditor)
311 self.myeditor.panel = wnd 310 self.myeditor.panel = wnd
312 self.wnd = wnd 311 self.wnd = wnd
313 self.myeditor.Show(1) 312 self.myeditor.Show(1)
314 else: 313 else:
1398 def __init__(self, parent, handler): 1397 def __init__(self, parent, handler):
1399 pname = handler.master_dom.setAttribute("name", 'Feats') 1398 pname = handler.master_dom.setAttribute("name", 'Feats')
1400 wx.Panel.__init__(self, parent, -1) 1399 wx.Panel.__init__(self, parent, -1)
1401 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS) 1400 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
1402 sizer = wx.BoxSizer(wx.HORIZONTAL) 1401 sizer = wx.BoxSizer(wx.HORIZONTAL)
1403 sizer.Add(wx.Button(self, 10, "Remove Feat"), 1, wx.EXPAND) 1402 remove_btn = wx.Button(self, wx.ID_ANY, "Remove Feat")
1403 add_btn = wx.Button(self, wx.ID_ANY, "Add Feat")
1404 sizer.Add(remove_btn, 1, wx.EXPAND)
1404 sizer.Add(wx.Size(10,10)) 1405 sizer.Add(wx.Size(10,10))
1405 sizer.Add(wx.Button(self, 20, "Add Feat"), 1, wx.EXPAND) 1406 sizer.Add(add_btn, 1, wx.EXPAND)
1406 self.sizer = sizer 1407 self.sizer = sizer
1407 self.SetSizer(self.sizer) 1408 self.SetSizer(self.sizer)
1408 self.Bind(wx.EVT_SIZE, self.on_size) 1409 self.Bind(wx.EVT_SIZE, self.on_size)
1409 EVT_BUTTON(self, 10, self.on_remove) 1410 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
1410 EVT_BUTTON(self, 20, self.on_add) 1411 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
1411 1412
1412 n_list = handler.master_dom._get_childNodes() 1413 n_list = handler.master_dom._get_childNodes()
1413 self.n_list = n_list 1414 self.n_list = n_list
1414 self.master_dom = handler.master_dom 1415 self.master_dom = handler.master_dom
1415 self.grid.CreateGrid(len(n_list),2,1) 1416 self.grid.CreateGrid(len(n_list),2,1)
1539 def __init__(self, parent, handler): 1540 def __init__(self, parent, handler):
1540 pname = handler.master_dom.setAttribute("name", 'Weapons') 1541 pname = handler.master_dom.setAttribute("name", 'Weapons')
1541 wx.Panel.__init__(self, parent, -1) 1542 wx.Panel.__init__(self, parent, -1)
1542 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS) 1543 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
1543 sizer = wx.BoxSizer(wx.HORIZONTAL) 1544 sizer = wx.BoxSizer(wx.HORIZONTAL)
1544 sizer.Add(wx.Button(self, 10, "Remove Weapon"), 1, wx.EXPAND) 1545 remove_btn = wx.Button(self, 10, "Remove Weapon")
1546 add_btn = wx.Button(self, 20, "Add Weapon")
1547 sizer.Add(remove_btn, 1, wx.EXPAND)
1545 sizer.Add(wx.Size(10,10)) 1548 sizer.Add(wx.Size(10,10))
1546 sizer.Add(wx.Button(self, 20, "Add Weapon"), 1, wx.EXPAND) 1549 sizer.Add(add_btn, 1, wx.EXPAND)
1547 self.sizer = sizer 1550 self.sizer = sizer
1548 self.SetSizer(self.sizer) 1551 self.SetSizer(self.sizer)
1549 self.Bind(wx.EVT_SIZE, self.on_size) 1552 self.Bind(wx.EVT_SIZE, self.on_size)
1550 EVT_BUTTON(self, 10, self.on_remove) 1553 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
1551 EVT_BUTTON(self, 20, self.on_add) 1554 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
1552 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change) 1555 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
1553 n_list = handler.master_dom.getElementsByTagName('weapon') 1556 n_list = handler.master_dom.getElementsByTagName('weapon')
1554 self.n_list = n_list 1557 self.n_list = n_list
1555 self.master_dom = handler.master_dom 1558 self.master_dom = handler.master_dom
1556 self.handler = handler 1559 self.handler = handler
1667 def __init__(self, parent, handler): 1670 def __init__(self, parent, handler):
1668 pname = handler.master_dom.setAttribute("name", 'Armor') 1671 pname = handler.master_dom.setAttribute("name", 'Armor')
1669 wx.Panel.__init__(self, parent, -1) 1672 wx.Panel.__init__(self, parent, -1)
1670 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS) 1673 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
1671 sizer = wx.BoxSizer(wx.HORIZONTAL) 1674 sizer = wx.BoxSizer(wx.HORIZONTAL)
1672 sizer.Add(wx.Button(self, 10, "Remove Armor"), 1, wx.EXPAND) 1675 remove_btn = wx.Button(self, 10, "Remove Armor")
1676 add_btn = wx.Button(self, 20, "Add Armor")
1677 sizer.Add(remove_btn, 1, wx.EXPAND)
1673 sizer.Add(wx.Size(10,10)) 1678 sizer.Add(wx.Size(10,10))
1674 sizer.Add(wx.Button(self, 20, "Add Armor"), 1, wx.EXPAND) 1679 sizer.Add(add_btn, 1, wx.EXPAND)
1675 self.sizer = sizer 1680 self.sizer = sizer
1676 self.SetSizer(self.sizer) 1681 self.SetSizer(self.sizer)
1677 self.Bind(wx.EVT_SIZE, self.on_size) 1682 self.Bind(wx.EVT_SIZE, self.on_size)
1678 EVT_BUTTON(self, 10, self.on_remove) 1683 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
1679 EVT_BUTTON(self, 20, self.on_add) 1684 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
1680 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change) 1685 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
1681 self.master_dom = handler.master_dom 1686 self.master_dom = handler.master_dom
1682 n_list = handler.master_dom._get_childNodes() 1687 n_list = handler.master_dom._get_childNodes()
1683 self.n_list = n_list 1688 self.n_list = n_list
1684 col_names = ['Armor','DR','Max Dex','Check Penalty','Weight','Speed (10)','Speed (6)','type'] 1689 col_names = ['Armor','DR','Max Dex','Check Penalty','Weight','Speed (10)','Speed (6)','type']
1752 def __init__(self, parent, handler): 1757 def __init__(self, parent, handler):
1753 pname = handler.master_dom.setAttribute("name", 'Class') 1758 pname = handler.master_dom.setAttribute("name", 'Class')
1754 wx.Panel.__init__(self, parent, -1) 1759 wx.Panel.__init__(self, parent, -1)
1755 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS) 1760 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
1756 sizer = wx.BoxSizer(wx.HORIZONTAL) 1761 sizer = wx.BoxSizer(wx.HORIZONTAL)
1757 sizer.Add(wx.Button(self, 10, "Remove Class"), 1, wx.EXPAND) 1762 remove_btn = wx.Button(self, wx.ID_ANY, "Remove Class")
1763 add_btn = wx.Button(self, wx.ID_ANY, "Add Class")
1764 sizer.Add(remove_btn, 1, wx.EXPAND)
1758 sizer.Add(wx.Size(10,10)) 1765 sizer.Add(wx.Size(10,10))
1759 sizer.Add(wx.Button(self, 20, "Add Class"), 1, wx.EXPAND) 1766 sizer.Add(add_btn, 1, wx.EXPAND)
1760 self.sizer = sizer 1767 self.sizer = sizer
1761 self.SetSizer(self.sizer) 1768 self.SetSizer(self.sizer)
1762 self.Bind(wx.EVT_SIZE, self.on_size) 1769 self.Bind(wx.EVT_SIZE, self.on_size)
1763 EVT_BUTTON(self, 10, self.on_remove) 1770 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
1764 EVT_BUTTON(self, 20, self.on_add) 1771 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
1765 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change) 1772 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
1766 1773
1767 n_list = handler.master_dom._get_childNodes() 1774 n_list = handler.master_dom._get_childNodes()
1768 self.n_list = n_list 1775 self.n_list = n_list
1769 self.master_dom = handler.master_dom 1776 self.master_dom = handler.master_dom