annotate orpg/gametree/nodehandlers/StarWarsd20.py @ 124:8827271fbe1b alpha

Traipse Alpha 'OpenRPG' {091001-01} 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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sun, 01 Nov 2009 11:36:14 -0600
parents c5bc2abaf7f8
children 06f10429eedc
rev   line source
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
2 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
3 # openrpg-dev@lists.sourceforge.net
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
4 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
5 # This program is free software; you can redistribute it and/or modify
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
6 # it under the terms of the GNU General Public License as published by
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
8 # (at your option) any later version.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
9 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
10 # This program is distributed in the hope that it will be useful,
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
13 # GNU General Public License for more details.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
14 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
15 # You should have received a copy of the GNU General Public License
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
16 # along with this program; if not, write to the Free Software
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
18 # --
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
19 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
20 # File: StarWarsd20.py
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
21 # Author: Chris Davis; Mark Twombley
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
22 # Maintainer: Mark Twombley
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
23 # Version:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
24 # $Id: StarWarsd20.py,v 1.18 2006/11/15 12:11:23 digitalxero Exp $
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
25 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
26 # Description: The file contains code for the StarWarsd20 nodehanlers
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
27 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
28
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
29 __version__ = "$Id: StarWarsd20.py,v 1.18 2006/11/15 12:11:23 digitalxero Exp $"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
30
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
31 from core import *
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
32 from orpg.tools.orpg_log import debug
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
33 from xml.etree.ElementTree import parse
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
34
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
35 SWD20_EXPORT = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
36 ############################
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
37 ## StarWarsd20 character node handler
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
38 ############################
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
39 ##The whole look and easy of use redone by Digitalxero
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
40 class container_handler(node_handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
41 """ should not be used! only a base class!
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
42 <nodehandler name='?' module='core' class='container_handler' />
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
43 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
44 def __init__(self,xml_dom,tree_node):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
45 node_handler.__init__(self,xml_dom,tree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
46 self.load_children()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
47
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
48 def load_children(self):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
49 children = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
50 for c in children:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
51 self.tree.load_xml(c,self.mytree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
52
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
53
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
54 def on_drop(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
55 drag_obj = self.tree.drag_obj
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
56 #if self.is_my_child(self.mytree_node,drag_obj.mytree_node):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
57 # return
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
58 if drag_obj == self:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
59 return
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
60 opt = wx.MessageBox("Add node as child?","Container Node",wx.YES_NO|wx.CANCEL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
61 if opt == wx.YES:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
62 xml_dom = self.tree.drag_obj.delete()
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
63 xml_dom = self.xml.insertBefore(xml_dom,None)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
64 self.tree.load_xml(xml_dom, self.mytree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
65 self.tree.Expand(self.mytree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
66 elif opt == wx.NO:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
67 node_handler.on_drop(self,evt)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
68
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
69 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
70 cookie = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
71 html_str = "<table border=\"1\" ><tr><td>"
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
72 html_str += "<b>"+self.xml.get("name") + "</b>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
73 html_str += "</td></tr>\n"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
74 html_str += "<tr><td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
75 max = tree.GetChildrenCount(handler.mytree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
76 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
77 (child,cookie)=self.tree.GetFirstChild(self.mytree_node,cookie)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
78 except: # If this happens we probably have a newer version of wxPython
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
79 (child,cookie)=self.tree.GetFirstChild(self.mytree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
80 obj = self.tree.GetPyData(child)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
81 for m in xrange(max):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
82 html_str += "<p>" + obj.tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
83 if m < max-1:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
84 child = self.tree.GetNextSibling(child)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
85 obj = self.tree.GetPyData(child)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
86 html_str += "</td></tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
87 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
88
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
89 def get_size_constraint(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
90 return 1
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
91
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
92 def get_char_name( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
93 return self.child_handlers['general'].get_char_name()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
94
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
95 ## def set_char_pp(self,attr,evl):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
96 ## return self.child_handlers['pp'].set_char_pp(attr,evl)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
97 ##
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
98 ## def get_char_pp( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
99 ## return self.child_handlers['pp'].get_char_pp(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
100 ##
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
101 def get_char_lvl( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
102 return self.child_handlers['classes'].get_char_lvl(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
103
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
104
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
105
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
106 class SWd20char_handler(node_handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
107 """ Node handler for a SWd20 charactor
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
108 <nodehandler name='?' module='StarWarsd20' class='SWd20char_handler' />
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
109 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
110 def __init__(self,xml_dom,tree_node):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
111 node_handler.__init__(self,xml_dom,tree_node)
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 60
diff changeset
112 self.frame = component.get('frame')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
113 self.child_handlers = {}
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
114 self.new_child_handler('howtouse','HowTO use this tool',SWd20howto,'note')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
115 self.new_child_handler('general','General Information',SWd20general,'gear')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
116 self.new_child_handler('inventory','Money and Inventory',SWd20inventory,'money')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
117 self.new_child_handler('abilities','Abilities Scores',SWd20ability,'gear')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
118 self.new_child_handler('classes','Classes',SWd20classes,'knight')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
119 self.new_child_handler('saves','Saves',SWd20saves,'skull')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
120 self.new_child_handler('skills','Skills',SWd20skill,'book')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
121 self.new_child_handler('feats','Feats',SWd20feats,'book')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
122 self.new_child_handler('wp','Wound Points',SWd20hp,'gear')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
123 self.new_child_handler('vp','Vitality Points',SWd20vp,'gear')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
124 self.new_child_handler('attacks','Attacks',SWd20attacks,'spears')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
125 self.new_child_handler('ac','Armor',SWd20armor,'spears')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
126 self.myeditor = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
127
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
128
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
129 def on_version(self,old_version):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
130 node_handler.on_version(self,old_version)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
131 if old_version == "":
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
132 tree = parse(dir_struct["nodes"]+"StarWars_d20character.xml")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
133 xml_dom = tree.getroot()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
134 ## add new nodes
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
135 for tag in ("howtouse","inventory","powers","divine","pp"):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
136 node_list = xml_dom.findall(tag)
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
137 self.xml.append(node_list[0])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
138
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
139 ## add new atts
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
140 melee_attack = self.xml.findall('melee')[0]
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
141 melee_attack.set("second","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
142 melee_attack.set("third","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
143 melee_attack.set("forth","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
144 melee_attack.set("fifth","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
145 melee_attack.set("sixth","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
146 range_attack = self.xml.findall('ranged')[0]
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
147 range_attack.set("second","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
148 range_attack.set("third","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
149 range_attack.set("forth","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
150 range_attack.set("fifth","0")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
151 range_attack.set("sixth","0")
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
152
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
153 gen_list = self.xml.findall('general')[0]
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
154
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
155 for tag in ("currentxp","xptolevel"):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
156 node_list = xml_dom.findall(tag)
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
157 gen_list.append(node_list[0])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
158 ## temp fix
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
159 #parent = self.xml._get_parentNode()
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
160 #old_dom = parent.replaceChild(xml_dom,self.xml)
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
161 #self.xml = xml_dom
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
162 print old_version
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
163
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
164
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
165 def get_char_name( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
166 return self.child_handlers['general'].get_char_name()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
167
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
168 ## def set_char_pp(self,attr,evl):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
169 ## return self.child_handlers['pp'].set_char_pp(attr,evl)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
170 ##
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
171 ## def get_char_pp( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
172 ## return self.child_handlers['pp'].get_char_pp(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
173
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
174 def get_char_lvl( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
175 return self.child_handlers['classes'].get_char_lvl(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
176
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
177
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
178 def new_child_handler(self,tag,text,handler_class,icon='gear'):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
179 node_list = self.xml.findall(tag)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
180 tree = self.tree
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
181 i = self.tree.icons[icon]
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
182 new_tree_node = tree.AppendItem(self.mytree_node,text,i,i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
183 handler = handler_class(node_list[0],new_tree_node,self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
184 tree.SetPyData(new_tree_node,handler)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
185 self.child_handlers[tag] = handler
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
186
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
187 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
188 return tabbed_panel(parent,self,1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
189
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
190
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
191 def get_use_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
192 return tabbed_panel(parent,self,2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
193
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
194
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
195 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
196 html_str = "<table><tr><td colspan=2 >"+self.child_handlers['general'].tohtml()+"</td></tr>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
197 html_str += "<tr><td width='50%' valign=top >"+self.child_handlers['abilities'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
198 html_str += "<P>" + self.child_handlers['saves'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
199 html_str += "<P>" + self.child_handlers['attacks'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
200 html_str += "<P>" + self.child_handlers['ac'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
201 html_str += "<P>" + self.child_handlers['feats'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
202 #html_str += "<P>" + self.child_handlers['spells'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
203 #html_str += "<P>" + self.child_handlers['divine'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
204 #html_str += "<P>" + self.child_handlers['powers'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
205 html_str += "<P>" + self.child_handlers['inventory'].tohtml() +"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
206 html_str += "<td width='50%' valign=top >"+self.child_handlers['classes'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
207 html_str += "<P>" + self.child_handlers['wp'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
208 html_str += "<P>" + self.child_handlers['vp'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
209 #html_str += "<P>" + self.child_handlers['pp'].tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
210 html_str += "<P>" + self.child_handlers['skills'].tohtml() +"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
211 html_str += "</tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
212 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
213
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
214 def about(self):
67
c5bc2abaf7f8 Traipse Dev 'OpenRPG' {090818-01}
sirebral
parents: 66
diff changeset
215 html_str = "<img src='" + dir_struct["icon"]+'d20_logo.gif' "><br /><b>d20 Character Tool v0.7 beta</b>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
216 html_str += "<br />by Chris Davis<br />chris@rpgarchive.com"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
217 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
218
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
219 def get_char_name( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
220 return self.child_handlers['general'].get_char_name()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
221 def get_armor_class( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
222 return self.child_handlers['ac'].get_armor_class()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
223 def get_max_hp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
224 return self.child_handlers['wp'].get_max_hp()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
225 def get_current_hp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
226 return self.child_handlers['wp'].get_current_hp()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
227 def get_max_vp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
228 return self.child_handlers['vp'].get_max_vp()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
229 def get_current_vp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
230 return self.child_handlers['vp'].get_current_vp()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
231
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
232 ## def set_char_pp(self,attr,evl):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
233 ## return self.child_handlers['pp'].set_char_pp(attr,evl)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
234 ##
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
235 ## def get_char_pp( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
236 ## return self.child_handlers['pp'].get_char_pp(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
237
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
238 def get_char_lvl( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
239 return self.child_handlers['classes'].get_char_lvl(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
240
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
241 class tabbed_panel(wx.Notebook):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
242 def __init__(self, parent, handler, mode):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
243 wx.Notebook.__init__(self, parent, -1, size=(1200,800))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
244 self.handler = handler
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
245 self.parent = parent
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
246 tree = self.handler.tree
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
247 max = tree.GetChildrenCount(handler.mytree_node, False)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
248 cookie = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
249 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
250 (child,cookie)=tree.GetFirstChild(handler.mytree_node,cookie)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
251 except: # If this happens we probably have a newer version of wxPython
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
252 (child,cookie)=tree.GetFirstChild(handler.mytree_node)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
253 obj = tree.GetPyData(child)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
254 for m in xrange(max):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
255
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
256 if mode == 1:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
257 panel = obj.get_design_panel(self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
258 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
259 panel = obj.get_use_panel(self)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
260 name = obj.xml.get("name")
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
261
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
262 if panel:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
263 self.AddPage(panel,name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
264 if m < max-1:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
265 child = tree.GetNextSibling(child)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
266 obj = tree.GetPyData(child)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
267
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
268
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
269 def about(self):
67
c5bc2abaf7f8 Traipse Dev 'OpenRPG' {090818-01}
sirebral
parents: 66
diff changeset
270 html_str = "<img src='" + dir_struct["icon"]+'d20_logo.gif' "><br /><b>d20 Character Tool v0.7 beta</b>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
271 html_str += "<br />by Chris Davis<br />chris@rpgarchive.com"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
272 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
273
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
274 def get_char_name( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
275 return self.child_handlers['general'].get_char_name()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
276
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
277 ## def set_char_pp(self,attr,evl):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
278 ## return self.child_handlers['pp'].set_char_pp(attr,evl)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
279 ##
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
280 ## def get_char_pp( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
281 ## return self.child_handlers['pp'].get_char_pp(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
282
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
283 def get_char_lvl( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
284 return self.child_handlers['classes'].get_char_lvl(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
285
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
286 class SWd20_char_child(node_handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
287 """ Node Handler for skill. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
288 created by SWd20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
289 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
290 def __init__(self, xml_dom, tree_node, parent):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
291 node_handler.__init__(self, xml_dom, tree_node)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
292 self.char_hander = parent
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
293 self.drag = False
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 60
diff changeset
294 self.frame = component.get('frame')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
295 self.myeditor = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
296
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
297
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
298 def on_drop(self, evt):
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
299 pass
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
300
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
301 def on_rclick(self, evt):
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
302 pass
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
303
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
304 def on_ldclick(self, evt):
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
305 return
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
306
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
307 def on_html(self, evt):
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
308 html_str = self.tohtml()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
309 wnd = http_html_window(self.frame.note,-1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
310 wnd.title = self.xml.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
311 self.frame.add_panel(wnd)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
312 wnd.SetPage(html_str)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
313
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
314 def get_design_panel(self, parent):
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
315 pass
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
316
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
317 def get_use_panel(self, parent):
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
318 return self.get_design_panel(parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
319
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
320 def delete(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
321 pass
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
322
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
323
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
324 class SWd20skill(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
325 """ Node Handler for skill. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
326 created by SWd20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
327 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
328 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
329 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
330 tree = self.tree
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
331 icons = self.tree.icons
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
332 node_list = self.xml.findall('skill')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
333 self.skills={}
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
334 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
335 name = n.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
336 self.skills[name] = n
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
337 new_tree_node = tree.AppendItem(self.mytree_node,name,icons['gear'],icons['gear'])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
338 tree.SetPyData(new_tree_node,self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
339
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
340 def get_mod(self,name):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
341 skill = self.skills[name]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
342 stat = skill.get('stat')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
343 ac = int(skill.get('armorcheck'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
344 if ac:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
345 ac = self.char_hander.child_handlers['ac'].get_check_pen()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
346 stat_mod = self.char_hander.child_handlers['abilities'].get_mod(stat)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
347 rank = int(skill.get('rank'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
348 misc = int(skill.get('misc'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
349 total = stat_mod + rank + misc + ac
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
350 return total
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
351
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
352 def on_rclick(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
353 #updated with code for untrained use check
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
354 item = self.tree.GetSelection()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
355 name = self.tree.GetItemText(item)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
356 skill = self.skills[name]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
357 rank = int(skill.get('rank'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
358 untrained = int(skill.get('untrained'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
359 chat = self.chat
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
360 if item == self.mytree_node:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
361 SWd20_char_child.on_ldclick(self,evt)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
362 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
363 if rank == 0 and untrained == 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
364 chat.Post('Can\'t use untrained!',True,True)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
365 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
366 mod = self.get_mod(name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
367 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
368 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
369 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
370 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
371 txt = '%s Skill Check: [1d20%s%s]' % (name, mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
372 chat.ParsePost(txt,True,True)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
373
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
374 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
375 wnd = outline_panel(parent,self,skill_grid,"Skills")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
376 wnd.title = "Skills (edit)"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
377 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
378
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
379 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
380 html_str = """<table border='1' width=100% ><tr BGCOLOR=#E9E9E9 ><th width='30%'>Skill</th><th>Key</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
381 <th>Rank</th><th>Abil</th><th>Misc</th><th>Total</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
382 node_list = self.xml.findall('skill')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
383 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
384 name = n.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
385 stat = n.get('stat')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
386 rank = n.get('rank')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
387 html_str = html_str + "<tr ALIGN='center'><td>"+name+"</td><td>"+stat+"</td><td>"+rank+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
388 stat_mod = str(self.char_hander.child_handlers['abilities'].get_mod(stat))
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
389 misc = n.get('misc')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
390 mod = str(self.get_mod(name))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
391 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
392 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
393 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
394 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
395 html_str = html_str + "<td>"+stat_mod+"</td><td>"+misc+'</td><td>%s%s</td></tr>' % (mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
396 html_str = html_str + "</table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
397 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
398
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
399
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
400 class SWd20ability(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
401 """ Node Handler for ability. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
402 created by SWd20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
403 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
404 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
405 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
406 self.abilities = {}
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
407 node_list = self.xml.findall('stat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
408 tree = self.tree
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
409 icons = tree.icons
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
410 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
411 name = n.get('abbr')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
412 self.abilities[name] = n
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
413 new_tree_node = tree.AppendItem( self.mytree_node, name, icons['gear'], icons['gear'] )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
414 tree.SetPyData( new_tree_node, self )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
415
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
416 def on_rclick( self, evt ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
417 item = self.tree.GetSelection()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
418 name = self.tree.GetItemText( item )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
419 if item == self.mytree_node:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
420 SWd20_char_child.on_ldclick( self, evt )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
421 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
422 mod = self.get_mod( name )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
423 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
424 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
425 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
426 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
427 chat = self.chat
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
428 txt = '%s check: [1d20%s%s]' % ( name, mod1, mod )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
429 chat.ParsePost( txt, True, True )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
430
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
431 def get_mod(self,abbr):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
432 score = int(self.abilities[abbr].get('base'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
433 mod = (score - 10) / 2
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
434 return mod
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
435
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
436 def set_score(self,abbr,score):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
437 if score >= 0:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
438 self.abilities[abbr].set("base",str(score))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
439
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
440 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
441 wnd = outline_panel(parent,self,abil_grid,"Abilities")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
442 wnd.title = "Abilities (edit)"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
443 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
444
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
445 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
446 html_str = """<table border='1' width=100%><tr BGCOLOR=#E9E9E9 ><th width='50%'>Ability</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
447 <th>Base</th><th>Modifier</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
448 node_list = self.xml.findall('stat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
449 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
450 name = n.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
451 abbr = n.get('abbr')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
452 base = n.get('base')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
453 mod = str(self.get_mod(abbr))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
454 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
455 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
456 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
457 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
458 html_str = html_str + "<tr ALIGN='center'><td>"+name+"</td><td>"+base+'</td><td>%s%s</td></tr>' % (mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
459 html_str = html_str + "</table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
460 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
461
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
462 class SWd20saves(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
463 """ Node Handler for saves. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
464 created by SWd20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
465 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
466 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
467 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
468 tree = self.tree
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
469 icons = self.tree.icons
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
470 node_list = self.xml.findall('save')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
471 self.saves={}
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
472 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
473 name = n.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
474 self.saves[name] = n
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
475 new_tree_node = tree.AppendItem(self.mytree_node,name,icons['gear'],icons['gear'])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
476 tree.SetPyData(new_tree_node,self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
477
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
478 def get_mod(self,name):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
479 save = self.saves[name]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
480 stat = save.get('stat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
481 stat_mod = self.char_hander.child_handlers['abilities'].get_mod(stat)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
482 base = int(save.get('base'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
483 miscmod = int(save.get('miscmod'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
484 # magmod = int(save.get('magmod'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
485 # total = stat_mod + base + miscmod + magmod
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
486 total = stat_mod + base + miscmod
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
487 return total
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
488
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
489 def on_rclick(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
490 item = self.tree.GetSelection()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
491 name = self.tree.GetItemText(item)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
492 if item == self.mytree_node:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
493 SWd20_char_child.on_ldclick(self,evt)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
494 #wnd = save_grid(self.frame.note,self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
495 #wnd.title = "Saves"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
496 #self.frame.add_panel(wnd)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
497 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
498 mod = self.get_mod(name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
499 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
500 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
501 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
502 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
503 chat = self.chat
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
504 txt = '%s save: [1d20%s%s]' % (name, mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
505 chat.ParsePost( txt, True, True )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
506
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
507 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
508 wnd = outline_panel(parent,self,save_grid,"Saves")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
509 wnd.title = "Saves"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
510 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
511
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
512 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
513 html_str = """<table border='1' width=100% ><tr BGCOLOR=#E9E9E9 ><th width='30%'>Save</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
514 <th>Key</th><th>Base</th><th>Abil</th><th>Magic</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
515 <th>Misc</th><th>Total</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
516 node_list = self.xml.findall('save')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
517 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
518 name = n.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
519 stat = n.get('stat')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
520 base = n.get('base')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
521 html_str = html_str + "<tr ALIGN='center'><td>"+name+"</td><td>"+stat+"</td><td>"+base+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
522 stat_mod = str(self.char_hander.child_handlers['abilities'].get_mod(stat))
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
523 mag = n.get('magmod')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
524 misc = n.get('miscmod')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
525 mod = str(self.get_mod(name))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
526 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
527 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
528 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
529 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
530 html_str = html_str + "<td>"+stat_mod+"</td><td>"+mag+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
531 html_str = html_str + '<td>'+misc+'</td><td>%s%s</td></tr>' % (mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
532 html_str = html_str + "</table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
533 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
534
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
535
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
536 class SWd20general(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
537 """ Node Handler for general information. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
538 created by SWd20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
539 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
540 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
541 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
542
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
543 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
544 wnd = outline_panel(parent,self,gen_grid,"General Information")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
545 wnd.title = "General Info"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
546 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
547
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
548 def tohtml(self):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
549 n_list = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
550 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
551 for n in n_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
552 html_str += "<B>"+n.tag.capitalize() +":</B> "
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
553 html_str += n.text + ", "
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
554 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
555 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
556
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
557 def on_name_change(self,name):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
558 self.char_hander.rename(name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
559
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
560 def get_char_name( self ):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
561 node = self.xml.findall( 'name' )[0]
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
562 return node.text
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
563
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
564
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
565 class SWd20classes(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
566 """ Node Handler for classes. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
567 created by SWd20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
568 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
569 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
570 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
571
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
572 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
573 wnd = outline_panel(parent,self,class_panel,"Classes")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
574 wnd.title = "Classes"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
575 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
576
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
577 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
578 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Classes</th></tr><tr><td>"
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
579 n_list = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
580 for n in n_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
581 html_str += n.get('name') + " ("+n.get('level')+"), "
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
582 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
583 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
584
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
585 def get_char_lvl( self, attr ):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
586 node_list = self.xml.findall('class')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
587 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
588 lvl = n.get('level')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
589 type = n.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
590 if attr == "level":
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
591 return lvl
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
592 elif attr == "class":
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
593 return type
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
594
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
595
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
596 class SWd20feats(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
597 """ Node Handler for classes. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
598 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
599 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
600 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
601 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
602
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
603 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
604 wnd = outline_panel(parent,self,feat_panel,"Feats")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
605 wnd.title = "Feats"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
606 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
607
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
608 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
609 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Feats</th></tr><tr><td>"
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
610 n_list = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
611 for n in n_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
612 html_str += n.get('name')+ ", "
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
613 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
614 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
615
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
616 class SWd20howto(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
617 """ Node Handler for hit points. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
618 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
619 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
620 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
621 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
622
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
623 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
624 wnd = outline_panel(parent,self,howto_panel,"How To")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
625 wnd.title = "How To"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
626 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
627
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
628 class SWd20inventory(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
629 """ Node Handler for general information. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
630 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
631 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
632 def __init__(self, xml_dom, tree_node, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
633 SWd20_char_child.__init__(self, xml_dom, tree_node, parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
634
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
635 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
636 wnd = outline_panel(parent,self,inventory_grid,"Inventory")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
637 wnd.title = "General Info"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
638 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
639
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
640 def tohtml(self):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
641 n_list = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
642 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
643 for n in n_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
644 html_str += "<B>"+n.tag.capitalize() +":</B> "
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
645 html_str += n.text + "<br />"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
646 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
647 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
648
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
649 def on_name_change(self,name):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
650 self.char_hander.rename(name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
651
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
652 def get_char_name( self ):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
653 node = self.xml.findall( 'name' )[0]
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
654 return node.text
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
655
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
656 class SWd20hp(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
657 """ Node Handler for hit points. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
658 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
659 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
660 def __init__(self,xml_dom,tree_node,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
661 SWd20_char_child.__init__(self,xml_dom,tree_node,parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
662
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
663 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
664 wnd = outline_panel(parent,self,hp_panel,"Wound Points")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
665 wnd.title = "Wound Points"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
666 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
667
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
668 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
669 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=4>Wound Points</th></tr>"
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
670 html_str += "<tr><th>Max:</th><td>"+self.xml.get('max')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
671 html_str += "<th>Current:</th><td>"+self.xml.get('current')+"</td>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
672 html_str += "</tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
673 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
674
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
675 def get_max_hp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
676 try:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
677 return eval( self.xml.get( 'max' ) )
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
678 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
679 return 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
680 def get_current_hp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
681 try:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
682 return eval( self.xml.get( 'current' ) )
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
683 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
684 return 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
685
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
686 class SWd20vp(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
687 """ Node Handler for hit points. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
688 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
689 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
690 def __init__(self,xml_dom,tree_node,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
691 SWd20_char_child.__init__(self,xml_dom,tree_node,parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
692
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
693 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
694 wnd = outline_panel(parent,self,vp_panel,"Vitality Points")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
695 wnd.title = "Vitality Points"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
696 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
697
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
698 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
699 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=4>Vitality Points</th></tr>"
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
700 html_str += "<tr><th>Max:</th><td>"+self.xml.get('max')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
701 html_str += "<th>Current:</th><td>"+self.xml.get('current')+"</td>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
702 html_str += "</tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
703 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
704
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
705 def get_max_vp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
706 try:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
707 return eval( self.xml.get( 'max' ) )
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
708 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
709 return 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
710 def get_current_vp( self ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
711 try:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
712 return eval( self.xml.get( 'current' ) )
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
713 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
714 return 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
715
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
716 class SWd20attacks(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
717 """ Node Handler for attacks. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
718 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
719 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
720 def __init__(self,xml_dom,tree_node,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
721 SWd20_char_child.__init__(self,xml_dom,tree_node,parent)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
722 node_list = self.xml.findall('melee')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
723 self.melee = node_list[0]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
724 node_list = self.xml.findall('ranged')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
725 self.ranged = node_list[0]
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
726 self.refresh_weapons()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
727
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
728 def refresh_weapons(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
729 self.weapons = {}
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
730 tree = self.tree
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
731 icons = self.tree.icons
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
732 tree.CollapseAndReset(self.mytree_node)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
733 node_list = self.xml.findall('weapon')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
734 for n in node_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
735 name = n.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
736 new_tree_node = tree.AppendItem(self.mytree_node,name,icons['sword'],icons['sword'])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
737 tree.SetPyData(new_tree_node,self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
738 self.weapons[name]=n
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
739
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
740 def get_mod(self,type='m'):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
741 (base, base2, base3, base4, base5, base6, stat_mod, misc) = self.get_attack_data(type)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
742 return base + misc + stat_mod
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
743
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
744 def get_attack_data(self,type='m'):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
745 if type=='m' or type=='0':
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
746 stat_mod = self.char_hander.child_handlers['abilities'].get_mod('Str')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
747 temp = self.melee
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
748 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
749 stat_mod = self.char_hander.child_handlers['abilities'].get_mod('Dex')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
750 temp = self.ranged
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
751 base = int(temp.get('base'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
752 base2 = int(temp.get('second'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
753 base3 = int(temp.get('third'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
754 base4 = int(temp.get('forth'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
755 base5 = int(temp.get('fifth'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
756 base6 = int(temp.get('sixth'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
757 misc = int(temp.get('misc'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
758 return (base, base2, base3, base4, base5, base6, stat_mod ,misc)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
759
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
760 def on_rclick(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
761 #removed the DnD specific code
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
762 item = self.tree.GetSelection()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
763 name = self.tree.GetItemText(item)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
764 if item == self.mytree_node:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
765 SWd20_char_child.on_ldclick(self,evt)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
766 #self.frame.add_panel(self.get_design_panel(self.frame.note))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
767 else:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
768 mod = int(self.weapons[name].get('mod'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
769 if self.weapons[name].get('range') == '0':
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
770 mod = mod + self.get_mod('m')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
771 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
772 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
773 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
774 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
775 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
776 mod = mod + self.get_mod('r')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
777 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
778 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
779 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
780 mod1 = ""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
781 chat = self.chat
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
782 dmg = self.weapons[name].get('damage')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
783 lvl = self.get_char_lvl('level')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
784 cname = self.char_hander.get_char_name()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
785 txt = '%s %s Attack Roll: [1d20%s%s] ===> DMG: [%s%s%s]' % (cname, name, mod1, mod, dmg, mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
786 chat.ParsePost( txt, True, False )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
787 temp = self.melee
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
788 stat_mod = self.char_hander.child_handlers['abilities'].get_mod('Str')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
789
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
790 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
791 wnd = outline_panel(parent,self,attack_panel,"Attacks")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
792 wnd.title = "Attacks"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
793 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
794
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
795 def get_char_lvl( self, attr ):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
796 return self.char_hander.get_char_lvl(attr)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
797
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
798 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
799 melee = self.get_attack_data('m')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
800 ranged = self.get_attack_data('r')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
801 html_str = """<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>Attack</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
802 <th>Total</th><th >Base</th><th>Abil</th><th>Misc</th></tr>"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
803 html_str += "<tr ALIGN='center' ><th >Melee:</th>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
804 html_str += "<td>"+str(melee[0]+melee[1]+melee[2])+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
805 html_str += "<td>"+str(melee[0])+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
806 html_str += "<td>"+str(melee[1])+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
807 html_str += "<td>"+str(melee[2])+"</td></tr>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
808
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
809 html_str += "<tr ALIGN='center' ><th >Ranged:</th>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
810 html_str += "<td>"+str(ranged[0]+ranged[1]+ranged[2])+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
811 html_str += "<td>"+str(ranged[0])+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
812 html_str += "<td>"+str(ranged[1])+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
813 html_str += "<td>"+str(ranged[2])+"</td></tr></table>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
814
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
815 n_list = self.xml.findall('weapon')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
816 for n in n_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
817 mod = n.get('mod')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
818 if mod >= 0:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
819 mod1 = "+"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
820 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
821 mod1 = ""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
822 ran = n.get('range')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
823 total = str(int(mod) + self.get_mod(ran))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
824 html_str += """<P><table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=2>Weapon</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
825 <th>Attack</th><th >Damage</th><th>Critical</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
826 html_str += "<tr ALIGN='center' ><td colspan=2>"+n.get('name')+"</td><td>"+total+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
827 html_str += "<td>"+n.get('damage')+"</td><td>"+n.get('critical')+"</td></tr>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
828 html_str += """<tr BGCOLOR=#E9E9E9 ><th>Range</th><th>Weight</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
829 <th>Type</th><th>Size</th><th>Misc Mod</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
830 html_str += "<tr ALIGN='center'><td>"+ran+"</td><td>"+n.get('weight')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
831 html_str += "<td>"+n.get('type')+"</td><td>"+n.get('size')+"</td>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
832 html_str += '<td>%s%s</td></tr></table>' % (mod1, mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
833 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
834
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
835 class SWd20armor(SWd20_char_child):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
836 """ Node Handler for ac. This handler will be
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
837 created by d20char_handler.
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
838 """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
839 def __init__(self,xml_dom,tree_node,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
840 SWd20_char_child.__init__(self,xml_dom,tree_node,parent)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
841
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
842 def get_total_weight(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
843 return self.get_total('weight')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
844
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
845 def get_check_pen(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
846 return self.get_total('checkpenalty')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
847
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
848 def get_armor_class(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
849 ac_total = 10
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
850 ac_total += self.get_total('bonus')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
851 dex_mod = self.char_hander.child_handlers['abilities'].get_mod('Dex')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
852 max_dex = self.get_max_dex()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
853 if dex_mod < max_dex:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
854 ac_total += dex_mod
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
855 else:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
856 ac_total += max_dex
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
857 return ac_total
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
858
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
859 def get_max_dex(self):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
860 armor_list = self.xml.findall('armor')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
861 dex = 10
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
862 for a in armor_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
863 temp = int(a.get("maxdex"))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
864 if temp < dex:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
865 dex = temp
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
866 return dex
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
867
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
868 def get_total(self,attr):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
869 armor_list = self.xml.findall('armor')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
870 total = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
871 for a in armor_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
872 total += int(a.get(attr))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
873 return total
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
874
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
875 def get_design_panel(self,parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
876 wnd = outline_panel(parent,self,ac_panel,"Armor")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
877 wnd.title = "Armor"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
878 return wnd
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
879
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
880 def tohtml(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
881 html_str = """<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>AC</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
882 <th>Check Penalty</th><th >Spell Failure</th><th>Max Dex</th><th>Total Weight</th></tr>"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
883 html_str += "<tr ALIGN='center' ><td>"+str(self.get_armor_class())+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
884 html_str += "<td>"+str(self.get_check_pen())+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
885 html_str += "<td>"+str(self.get_spell_failure())+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
886 html_str += "<td>"+str(self.get_max_dex())+"</td>"
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
887 html_str += "<td>"+str(self.get_total_weight())+"</td></tr></table>"
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
888 n_list = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
889 for n in n_list:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
890 html_str += """<P><table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th colspan=3>Armor</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
891 <th>Type</th><th >Bonus</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
892 html_str += "<tr ALIGN='center' ><td colspan=3>"+n.get('name')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
893 html_str += "<td>"+n.get('type')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
894 html_str += "<td>"+n.get('bonus')+"</td></tr>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
895 html_str += """<tr BGCOLOR=#E9E9E9 ><th>Check Penalty</th><th>Spell Failure</th>
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
896 <th>Max Dex</th><th>Speed</th><th>Weight</th></tr>"""
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
897 html_str += "<tr ALIGN='center'><td>"+n.get('checkpenalty')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
898 html_str += "<td>"+n.get('maxdex')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
899 html_str += "<td>"+n.get('speed')+"</td>"
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
900 html_str += "<td>"+n.get('weight')+"</td></tr></table>"
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
901 return html_str
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
902
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
903
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
904 ########################
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
905 ## d20 char windows
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
906 ########################
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
907
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
908 class base_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
909 def __init__(self, parent):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
910 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
911
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
912 #self.build_ctrls()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
913 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
914
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
915 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
916 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
917 #self.splitter.SetDimensions(0,0,s[0],s[1])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
918
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
919 class outline_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
920 def __init__(self, parent, handler, wnd, txt,):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
921 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
922 self.panel = wnd(self,handler)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
923 self.outline = wx.StaticBox(self,-1,txt)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
924 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
925
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
926 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
927 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
928 self.panel.SetDimensions(20,20,s[0]-40,s[1]-40)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
929 self.outline.SetDimensions(5,5,s[0]-10,s[1]-10)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
930
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
931 class char_panel(wx.ScrolledWindow):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
932 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
933 pname = handler.xml.set("name", 'TWO')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
934 wx.ScrolledWindow.__init__(self, parent, -1,style=wx.VSCROLL | wx.SUNKEN_BORDER )
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
935 self.height = 1200
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
936 self.SetScrollbars(10, 10,80, self.height/10)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
937 self.main_sizer = wx.BoxSizer(wx.HORIZONTAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
938 self.panels = {}
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
939 keys = handler.child_handlers.keys()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
940 for k in keys:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
941 self.panels[k] = handler.child_handlers[k].get_design_panel(self, [k])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
942 self.sub_sizer = wx.BoxSizer(wx.VERTICAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
943 self.sub_sizer2 = wx.BoxSizer(wx.VERTICAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
944 self.sub_sizer.Add(self.panels['general'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
945 self.sub_sizer.Add(self.panels['abilities'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
946
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
947 self.sub_sizer.Add(self.panels['attacks'], 2, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
948 self.sub_sizer.Add(self.panels['ac'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
949 #self.sub_sizer.Add(self.panels['spells'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
950
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
951 self.sub_sizer2.Add(self.panels['classes'], 2, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
952 self.sub_sizer2.Add(self.panels['wp'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
953 self.sub_sizer2.Add(self.panels['vp'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
954 #self.sub_sizer2.Add(self.panels['pp'], 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
955 self.sub_sizer2.Add(self.panels['saves'], 2, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
956
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
957 self.sub_sizer2.Add(self.panels['feats'], 2, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
958 #self.sub_sizer2.Add(self.panels['powers'], 2, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
959 self.sub_sizer2.Add(self.panels['skills'], 3, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
960
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
961 self.main_sizer.Add(self.sub_sizer, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
962 self.main_sizer.Add(self.sub_sizer2, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
963 self.panels['abilities'].panel.char_wnd = self
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
964 self.SetSizer(self.main_sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
965 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
966
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
967
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
968 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
969 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
970 self.SetScrollbars(10, 10,s[0]/10, self.height/10)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
971 dc = wx.ClientDC(self)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
972 x = dc.DeviceToLogicalX(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
973 y = dc.DeviceToLogicalY(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
974 self.main_sizer.SetDimension(x,y,s[0],self.height)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
975 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
976
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
977 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
978 self.panels['saves'].panel.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
979 self.panels['skills'].panel.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
980 self.panels['attacks'].panel.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
981 # self.panels['powers'].panel.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
982 # self.panels['spells'].panel.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
983
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
984 HOWTO_MAX = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
985
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
986 class howto_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
987 def __init__(self, parent, handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
988 wx.Panel.__init__(self, parent, -1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
989 pname = handler.xml.set("name", 'How To')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
990 self.sizer = wx.FlexGridSizer(2, 4, 2, 2) # rows, cols, hgap, vgap
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
991 self.xml = handler.xml
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
992 n_list = self.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
993 for n in n_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
994 self.sizer.AddMany([ (wx.StaticText(self, -1, n.text), 0, wx.ALIGN_CENTER_VERTICAL),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
995 ])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
996 self.sizer.AddGrowableCol(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
997 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
998
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
999
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1000 WP_CUR = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1001 WP_MAX = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1002
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1003 class hp_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1004 def __init__(self, parent, handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1005 wx.Panel.__init__(self, parent, -1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1006 pname = handler.xml.set("name", 'WoundPoints')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1007 self.sizer = wx.FlexGridSizer(2, 4, 2, 2) # rows, cols, hgap, vgap
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1008 self.xml = handler.xml
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1009 self.sizer.AddMany([ (wx.StaticText(self, -1, "WP Current:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1010 (wx.TextCtrl(self, WP_CUR, self.xml.get('current')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1011 (wx.StaticText(self, -1, "WP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1012 (wx.TextCtrl(self, WP_MAX, self.xml.get('max')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1013 ])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1014 self.sizer.AddGrowableCol(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1015 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1016 self.Bind(wx.EVT_TEXT, self.on_text, id=WP_MAX)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1017 self.Bind(wx.EVT_TEXT, self.on_text, id=WP_CUR)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1018 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1019
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1020 def on_text(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1021 id = evt.GetId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1022 if id == WP_CUR:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1023 self.xml.set('current',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1024 elif id == WP_MAX:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1025 self.xml.set('max',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1026
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1027 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1028 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1029 self.sizer.SetDimension(0,0,s[0],s[1])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1030
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1031 VP_CUR = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1032 VP_MAX = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1033
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1034 class vp_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1035 def __init__(self, parent, handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1036 wx.Panel.__init__(self, parent, -1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1037 pname = handler.xml.set("name", 'VitalityPoints')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1038 self.sizer = wx.FlexGridSizer(2, 4, 2, 2) # rows, cols, hgap, vgap
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1039 self.xml = handler.xml
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1040 self.sizer.AddMany([ (wx.StaticText(self, -1, "VP Current:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1041 (wx.TextCtrl(self, VP_CUR, self.xml.get('current')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1042 (wx.StaticText(self, -1, "VP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1043 (wx.TextCtrl(self, VP_MAX, self.xml.get('max')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1044 ])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1045 self.sizer.AddGrowableCol(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1046 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1047 self.Bind(wx.EVT_TEXT, self.on_text, id=VP_MAX)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1048 self.Bind(wx.EVT_TEXT, self.on_text, id=VP_CUR)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1049 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1050
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1051 def on_text(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1052 id = evt.GetId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1053 if id == VP_CUR:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1054 self.xml.set('current',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1055 elif id == VP_MAX:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1056 self.xml.set('max',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1057
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1058 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1059 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1060 self.sizer.SetDimension(0,0,s[0],s[1])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1061
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1062 #PP_CUR = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1063 #PP_MAX = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1064 #PP_FRE = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1065 #PP_MFRE = wx.NewId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1066
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1067 #class pp_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1068 # def __init__(self, parent, handler):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1069 # wx.Panel.__init__(self, parent, -1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1070 # pname = handler.xml.set("name", 'PowerPoints')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1071 # self.sizer = wx.FlexGridSizer(2, 4, 2, 2) # rows, cols, hgap, vgap
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1072 # self.xml = handler.xml
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1073 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1074 # self.sizer.AddMany([ (wx.StaticText(self, -1, "PP Current:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1075 # (wx.TextCtrl(self, PP_CUR, self.xml.get('current1')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1076 # (wx.StaticText(self, -1, "PP Max:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1077 # (wx.TextCtrl(self, PP_MAX, self.xml.get('max1')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1078 # (wx.StaticText(self, -1, "Current Free Talants per day:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1079 # (wx.TextCtrl(self, PP_FRE, self.xml.get('free')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1080 # (wx.StaticText(self, -1, "Max Free Talants per day:"), 0, wx.ALIGN_CENTER_VERTICAL),
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1081 # (wx.TextCtrl(self, PP_MFRE, self.xml.get('maxfree')), 0, wx.EXPAND),
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1082 # ])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1083 # self.sizer.AddGrowableCol(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1084 # self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1085 # self.Bind(wx.EVT_TEXT, self.on_text, id=PP_MAX)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1086 # self.Bind(wx.EVT_TEXT, self.on_text, id=PP_CUR)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1087 # self.Bind(wx.EVT_TEXT, self.on_text, id=PP_FRE)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1088 # self.Bind(wx.EVT_TEXT, self.on_text, id=PP_MFRE)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1089 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1090 # def on_text(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1091 # id = evt.GetId()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1092 # if id == PP_CUR:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1093 # self.xml.set('current1',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1094 # elif id == PP_MAX:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1095 # self.xml.set('max1',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1096 # elif id == PP_FRE:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1097 # self.xml.set('free',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1098 # elif id == PP_MFRE:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1099 # self.xml.set('maxfree',evt.GetString())
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1100 #
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1101 # def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1102 # s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1103 # self.sizer.SetDimension(0,0,s[0],s[1])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1104
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1105
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1106 class gen_grid(wx.grid.Grid):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1107 """grid for gen info"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1108 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1109 pname = handler.xml.set("name", 'General')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1110 wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1111 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1112 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1113 self.handler = handler
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1114 n_list = handler.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1115 self.CreateGrid(len(n_list),2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1116 self.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1117 self.SetColLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1118 self.n_list = n_list
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1119 i = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1120 for i in range(len(n_list)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1121 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1122
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1123 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1124 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1125 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1126 value = self.GetCellValue(row,col)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1127 self.n_list[row].text = value
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1128 if row==0: self.handler.on_name_change(value)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1129
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1130 def refresh_row(self,rowi):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1131 self.SetCellValue(rowi,0,self.n_list[rowi].tag)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1132 self.SetReadOnly(rowi,0)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1133 self.SetCellValue(rowi,1,self.n_list[rowi].text)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1134
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1135 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1136 (w,h) = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1137 cols = self.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1138 col_w = w/(cols)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1139 for i in range(0,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1140 self.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1141 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1142 self.Refresh()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1143
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1144 class inventory_grid(wx.grid.Grid):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1145 """grid for gen info"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1146 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1147 pname = handler.xml.set("name", 'Money and Inventory')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1148 wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1149 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1150 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1151 self.handler = handler
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1152 n_list = handler.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1153 self.CreateGrid(len(n_list),2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1154 self.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1155 self.SetColLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1156 self.n_list = n_list
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1157 i = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1158 for i in range(len(n_list)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1159 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1160
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1161 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1162 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1163 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1164 value = self.GetCellValue(row,col)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1165 self.n_list[row].text = value
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1166 if row==0: self.handler.on_name_change(value)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1167
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1168 def refresh_row(self,rowi):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1169 self.SetCellValue(rowi,0, self.n_list[rowi].tag)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1170 self.SetReadOnly(rowi,0)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1171 self.SetCellValue(rowi,1,self.n_list[rowi].text)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1172
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1173 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1174 (w,h) = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1175 cols = self.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1176 col_w = w/(cols)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1177 for i in range(0,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1178 self.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1179 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1180 self.Refresh()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1181
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1182 class abil_grid(wx.grid.Grid):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1183 """grid for abilities"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1184 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1185 pname = handler.xml.set("name", 'Stats')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1186 wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1187 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1188 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1189 self.handler = handler
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1190 stats = handler.xml.findall('stat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1191 self.CreateGrid(len(stats),3)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1192 self.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1193 col_names = ['Ability','Score','Modifier']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1194 for i in range(len(col_names)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1195 self.SetColLabelValue(i,col_names[i])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1196 self.stats = stats
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1197 i = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1198 for i in range(len(stats)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1199 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1200 self.char_wnd = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1201
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1202 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1203 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1204 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1205 value = self.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1206 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1207 int(value)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1208 self.stats[row].set('base',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1209 self.refresh_row(row)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1210 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1211 self.SetCellValue(row,col,"0")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1212 if self.char_wnd:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1213 self.char_wnd.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1214
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1215 def refresh_row(self,rowi):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1216 s = self.stats[rowi]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1217 name = s.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1218 abbr = s.get('abbr')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1219 self.SetCellValue(rowi,0,name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1220 self.SetReadOnly(rowi,0)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1221 self.SetCellValue(rowi,1,s.get('base'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1222 self.SetCellValue(rowi,2,str(self.handler.get_mod(abbr)))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1223 self.SetReadOnly(rowi,2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1224
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1225 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1226 (w,h) = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1227 cols = self.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1228 col_w = w/(cols+2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1229 self.SetColSize(0,col_w*3)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1230 for i in range(1,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1231 self.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1232 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1233 self.Refresh()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1234
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1235 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1236 for r in range(self.GetNumberRows()-1):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1237 self.refresh_row(r)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1238
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1239
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1240 class save_grid(wx.grid.Grid):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1241 """grid for saves"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1242 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1243 pname = handler.xml.set("name", 'Saves')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1244 wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1245 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1246 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1247 self.handler = handler
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1248 saves = handler.xml.findall('save')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1249 self.stats = handler.char_hander.child_handlers['abilities']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1250 self.CreateGrid(len(saves),7)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1251 self.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1252 col_names = ['Save','Key','base','Abil','Magic','Misc','Total']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1253 for i in range(len(col_names)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1254 self.SetColLabelValue(i,col_names[i])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1255 self.saves = saves
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1256 i = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1257 for i in range(len(saves)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1258 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1259
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1260 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1261 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1262 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1263 value = self.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1264 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1265 int(value)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1266 if col == 2:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1267 self.saves[row].set('base',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1268 elif col ==4:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1269 self.saves[row].set('magmod',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1270 elif col ==4:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1271 self.saves[row].set('miscmod',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1272 self.refresh_row(row)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1273 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1274 self.SetCellValue(row,col,"0")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1275
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1276 def refresh_row(self,rowi):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1277 s = self.saves[rowi]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1278 name = s.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1279 self.SetCellValue(rowi,0,name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1280 self.SetReadOnly(rowi,0)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1281 stat = s.get('stat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1282 self.SetCellValue(rowi,1,stat)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1283 self.SetReadOnly(rowi,1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1284 self.SetCellValue(rowi,2,s.get('base'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1285 self.SetCellValue(rowi,3,str(self.stats.get_mod(stat)))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1286 self.SetReadOnly(rowi,3)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1287 self.SetCellValue(rowi,4,s.get('magmod'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1288 self.SetCellValue(rowi,5,s.get('miscmod'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1289 mod = str(self.handler.get_mod(name))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1290 self.SetCellValue(rowi,6,mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1291 self.SetReadOnly(rowi,6)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1292
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1293 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1294 (w,h) = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1295 cols = self.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1296 col_w = w/(cols+2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1297 self.SetColSize(0,col_w*3)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1298 for i in range(1,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1299 self.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1300 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1301 self.Refresh()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1302
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1303 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1304 for r in range(self.GetNumberRows()):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1305 self.refresh_row(r)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1306
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1307
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1308 class skill_grid(wx.grid.Grid):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1309 """ panel for skills """
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1310 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1311 pname = handler.xml.set("name", 'Skills')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1312 wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1313 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1314 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1315 self.handler = handler
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1316 skills = handler.xml.findall('skill')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1317 self.stats = handler.char_hander.child_handlers['abilities']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1318 self.CreateGrid(len(skills),7)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1319 self.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1320 col_names = ['Skill','Key','Rank','Abil','Misc','Total']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1321 for i in range(len(col_names)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1322 self.SetColLabelValue(i,col_names[i])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1323 rowi = 0
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1324 self.skills = skills
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1325 for i in range(len(skills)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1326 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1327
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1328 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1329 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1330 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1331 value = self.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1332 #print value
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1333 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1334 int(value)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1335 if col == 3:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1336 self.skills[row].set('rank',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1337 elif col ==5:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1338 self.skills[row].set('misc',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1339 elif col == 1:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1340 self.skills[row].set('untrained',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1341 self.refresh_row(row)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1342 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1343 self.SetCellValue(row,col,"0")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1344
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1345 def refresh_row(self,rowi):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1346 s = self.skills[rowi]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1347 name = s.get('name')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1348 self.SetCellValue(rowi,0,name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1349 self.SetReadOnly(rowi,0)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1350 self.SetCellValue(rowi,1,s.get('untrained'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1351 stat = s.get('stat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1352 self.SetCellValue(rowi,2,stat)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1353 self.SetReadOnly(rowi,2)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1354 self.SetCellValue(rowi,3,s.get('rank'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1355 self.SetCellValue(rowi,4,str(self.stats.get_mod(stat)))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1356 self.SetReadOnly(rowi,4)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1357 self.SetCellValue(rowi,5,s.get('misc'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1358 mod = str(self.handler.get_mod(name))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1359 self.SetCellValue(rowi,6,mod)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1360 self.SetReadOnly(rowi,6)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1361
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1362 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1363 (w,h) = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1364 cols = self.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1365 col_w = w/(cols+2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1366 self.SetColSize(0,col_w*3)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1367 for i in range(1,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1368 self.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1369 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1370 self.Refresh()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1371
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1372 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1373 for r in range(self.GetNumberRows()):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1374 self.refresh_row(r)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1375
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1376
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1377
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1378 class feat_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1379 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1380 pname = handler.xml.set("name", 'Feats')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1381 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1382 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1383 sizer = wx.BoxSizer(wx.HORIZONTAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1384 remove_btn = wx.Button(self, wx.ID_ANY, "Remove Feat")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1385 add_btn = wx.Button(self, wx.ID_ANY, "Add Feat")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1386 sizer.Add(remove_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1387 sizer.Add(wx.Size(10,10))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1388 sizer.Add(add_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1389 self.sizer = sizer
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1390 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1391 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1392 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1393 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1394
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1395 n_list = handler.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1396 self.n_list = n_list
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1397 self.xml = handler.xml
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1398 self.grid.CreateGrid(len(n_list),2,1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1399 self.grid.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1400 self.grid.SetColLabelValue(0,"Feat")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1401 self.grid.SetColLabelValue(1,"Type")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1402 for i in range(len(n_list)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1403 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1404 self.temp_dom = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1405
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1406 def refresh_row(self,i):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1407 feat = self.n_list[i]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1408 name = feat.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1409 type = feat.get('type')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1410 self.grid.SetCellValue(i,0,name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1411 self.grid.SetReadOnly(i,0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1412 self.grid.SetCellValue(i,1,type)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1413 self.grid.SetReadOnly(i,1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1414
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1415 def on_remove(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1416 rows = self.grid.GetNumberRows()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1417 for i in range(rows):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1418 if self.grid.IsInSelection(i,0):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1419 self.grid.DeleteRows(i)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1420 self.xml.remove(self.n_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1421
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1422 def on_add(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1423 if not self.temp_dom:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1424 tree = parse(dir_struct["SWd20"]+"d20feats.xml")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1425 self.temp_dom = tree.getroot()
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1426 f_list = self.temp_dom.findall('feat')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1427 opts = []
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1428 for f in f_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1429 opts.append(f.get('name'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1430 dlg = wx.SingleChoiceDialog(self,'Choose Feat','Feats',opts)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1431 if dlg.ShowModal() == wx.ID_OK:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1432 i = dlg.GetSelection()
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1433 new_node = self.xml.append(f_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1434 self.grid.AppendRows(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1435 self.refresh_row(self.grid.GetNumberRows()-1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1436 dlg.Destroy()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1437
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1438
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1439 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1440 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1441 self.grid.SetDimensions(0,0,s[0],s[1]-25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1442 self.sizer.SetDimension(0,s[1]-25,s[0],25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1443 (w,h) = self.grid.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1444 cols = self.grid.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1445 col_w = w/(cols)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1446 for i in range(0,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1447 self.grid.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1448
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1449 class attack_grid(wx.grid.Grid):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1450 """grid for attacks"""
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1451 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1452 pname = handler.xml.set("name", 'Melee')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1453 wx.grid.Grid.__init__(self, parent, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1454 self.parent = parent
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1455 self.handler = handler
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1456 self.rows = (self.handler.melee,self.handler.ranged)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1457 self.CreateGrid(2,10)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1458 self.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1459 col_names = ['Type','base','base 2','base 3','base 4','base 5','base 6','abil','misc','Total']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1460 for i in range(len(col_names)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1461 self.SetColLabelValue(i,col_names[i])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1462 self.SetCellValue(0,0,"Melee")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1463 self.SetCellValue(1,0,"Ranged")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1464 self.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1465 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1466 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1467
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1468 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1469 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1470 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1471 value = self.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1472 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1473 int(value)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1474 if col==1:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1475 self.rows[row].set('base',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1476 elif col==2:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1477 self.rows[row].set('second',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1478 elif col==3:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1479 self.rows[row].set('third',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1480 elif col==4:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1481 self.rows[row].set('forth',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1482 elif col==5:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1483 self.rows[row].set('fifth',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1484 elif col==6:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1485 self.rows[row].set('sixth',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1486 elif col==8:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1487 self.rows[row].set('misc',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1488 self.parent.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1489 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1490 self.SetCellValue(row,col,"0")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1491
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1492 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1493 melee = self.handler.get_attack_data('m')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1494 ranged = self.handler.get_attack_data('r')
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1495 for i in range(0,7):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1496 self.SetCellValue(0,i+1,str(melee[i]))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1497 self.SetCellValue(1,i+1,str(ranged[i]))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1498 self.SetCellValue(0,9,str(melee[0]+melee[6]+melee[7]))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1499 self.SetCellValue(1,9,str(ranged[0]+ranged[6]+ranged[7]))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1500 self.SetReadOnly(0,0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1501 self.SetReadOnly(1,0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1502 self.SetReadOnly(0,7)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1503 self.SetReadOnly(1,7)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1504 self.SetReadOnly(0,9)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1505 self.SetReadOnly(1,9)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1506
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1507
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1508 def on_size(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1509 (w,h) = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1510 cols = self.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1511 col_w = w/(cols+1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1512 self.SetColSize(0,col_w*2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1513 for i in range(1,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1514 self.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1515 evt.Skip()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1516 self.Refresh()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1517
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1518 class weapon_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1519 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1520 pname = handler.xml.set("name", 'Weapons')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1521 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1522 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1523 sizer = wx.BoxSizer(wx.HORIZONTAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1524 remove_btn = wx.Button(self, 10, "Remove Weapon")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1525 add_btn = wx.Button(self, 20, "Add Weapon")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1526 sizer.Add(remove_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1527 sizer.Add(wx.Size(10,10))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1528 sizer.Add(add_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1529 self.sizer = sizer
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1530 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1531 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1532 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1533 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1534 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1535 n_list = handler.xml.findall('weapon')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1536 self.n_list = n_list
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1537 self.xml = handler.xml
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1538 self.handler = handler
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1539 self.grid.CreateGrid(len(n_list),9,1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1540 self.grid.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1541 col_names = ['Name','damage','mod','critical','type','weight','range','size','Total']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1542 for i in range(len(col_names)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1543 self.grid.SetColLabelValue(i,col_names[i])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1544 self.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1545 self.temp_dom = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1546
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1547 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1548 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1549 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1550 value = self.grid.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1551 if col == 0:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1552 self.n_list[row].set('name',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1553 elif col == 2:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1554 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1555 int(value)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1556 self.n_list[row].set('mod',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1557 self.refresh_row(row)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1558 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1559 self.grid.SetCellValue(row,col,"1")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1560 else:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1561 self.n_list[row].set(self.grid.GetColLabelValue(col),value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1562
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1563 def refresh_row(self,i):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1564 n = self.n_list[i]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1565 name = n.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1566 mod = n.get('mod')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1567 ran = n.get('range')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1568 total = str(int(mod) + self.handler.get_mod(ran))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1569 self.grid.SetCellValue(i,0,name)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1570 self.grid.SetCellValue(i,1,n.get('damage'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1571 self.grid.SetCellValue(i,2,mod)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1572 self.grid.SetCellValue(i,3,n.get('critical'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1573 self.grid.SetCellValue(i,4,n.get('type'))
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1574 self.grid.SetCellValue(i,5,n.get('weight'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1575 self.grid.SetCellValue(i,6,ran)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1576 self.grid.SetCellValue(i,7,n.get('size') )
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1577 self.grid.SetCellValue(i,8,total)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1578 self.grid.SetReadOnly(i,8)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1579
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1580 def on_remove(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1581 rows = self.grid.GetNumberRows()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1582 for i in range(rows):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1583 if self.grid.IsInSelection(i,0):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1584 self.grid.DeleteRows(i)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1585 self.xml.remove(self.n_list[i])
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1586 self.n_list = self.xml.findall('weapon')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1587 self.handler.refresh_weapons()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1588
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1589 def on_add(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1590 if not self.temp_dom:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1591 tree = parse(dir_struct["SWd20"]+"d20weapons.xml")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1592 self.temp_dom = tree.getroot()
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1593 f_list = self.temp_dom.findall('weapon')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1594 opts = []
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1595 for f in f_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1596 opts.append(f.get('name'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1597 dlg = wx.SingleChoiceDialog(self,'Choose Weapon','Weapon List',opts)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1598 if dlg.ShowModal() == wx.ID_OK:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1599 i = dlg.GetSelection()
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1600 new_node = self.xml.append(f_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1601 self.grid.AppendRows(1)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1602 self.n_list = self.xml.findall('weapon')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1603 self.refresh_row(self.grid.GetNumberRows()-1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1604 self.handler.refresh_weapons()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1605 dlg.Destroy()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1606
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1607 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1608 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1609 self.grid.SetDimensions(0,0,s[0],s[1]-25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1610 self.sizer.SetDimension(0,s[1]-25,s[0],25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1611 (w,h) = self.grid.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1612 cols = self.grid.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1613 col_w = w/(cols+1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1614 self.grid.SetColSize(0,col_w*2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1615 for i in range(1,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1616 self.grid.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1617
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1618 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1619 for i in range(len(self.n_list)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1620 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1621
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1622
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1623 class attack_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1624 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1625 pname = handler.xml.set("name", 'Melee')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1626 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1627
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1628 self.a_grid = attack_grid(self, handler)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1629 self.w_panel = weapon_panel(self, handler)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1630 self.sizer = wx.BoxSizer(wx.VERTICAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1631 self.sizer.Add(self.a_grid, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1632 self.sizer.Add(self.w_panel, 2, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1633 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1634 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1635
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1636 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1637 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1638 self.sizer.SetDimension(0,0,s[0],s[1])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1639
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1640 def refresh_data(self):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1641 self.w_panel.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1642 self.a_grid.refresh_data()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1643
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1644
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1645 class ac_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1646 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1647 pname = handler.xml.set("name", 'Armor')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1648 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1649 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1650 sizer = wx.BoxSizer(wx.HORIZONTAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1651 remove_btn = wx.Button(self, 10, "Remove Armor")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1652 add_btn = wx.Button(self, 20, "Add Armor")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1653 sizer.Add(remove_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1654 sizer.Add(wx.Size(10,10))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1655 sizer.Add(add_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1656 self.sizer = sizer
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1657 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1658 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1659 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1660 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1661 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1662 self.xml = handler.xml
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1663 n_list = handler.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1664 self.n_list = n_list
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1665 col_names = ['Armor','DR','Max Dex','Check Penalty','Weight','Speed (10)','Speed (6)','type']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1666 self.grid.CreateGrid(len(n_list),len(col_names),1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1667 self.grid.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1668 for i in range(len(col_names)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1669 self.grid.SetColLabelValue(i,col_names[i])
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1670 self.atts =['name','bonus','maxdex','checkpenalty','weight','speed','speed6','type']
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1671 for i in range(len(n_list)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1672 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1673 self.temp_dom = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1674
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1675
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1676 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1677 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1678 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1679 value = self.grid.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1680 if col >= 1 and col <= 5:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1681 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1682 int(value)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1683 self.n_list[row].set(self.atts[col],value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1684 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1685 self.grid.SetCellValue(row,col,"0")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1686 else:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1687 self.n_list[row].set(self.atts[col],value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1688
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1689 def refresh_row(self,i):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1690 n = self.n_list[i]
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1691 for y in range(len(self.atts)):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1692 self.grid.SetCellValue(i,y,n.get(self.atts[y]))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1693
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1694 def on_remove(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1695 rows = self.grid.GetNumberRows()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1696 for i in range(rows):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1697 if self.grid.IsInSelection(i,0):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1698 self.grid.DeleteRows(i)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1699 self.xml.remove(self.n_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1700
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1701 def on_add(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1702 if not self.temp_dom:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1703 tree = parse(dir_struct["SWd20"]+"d20armor.xml")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1704 self.temp_dom = tree.getroot()
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1705 f_list = self.temp_dom.findall('armor')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1706 opts = []
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1707 for f in f_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1708 opts.append(f.get('name'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1709 dlg = wx.SingleChoiceDialog(self,'Choose Armor:','Armor List',opts)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1710 if dlg.ShowModal() == wx.ID_OK:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1711 i = dlg.GetSelection()
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1712 new_node = self.xml.append(f_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1713 self.grid.AppendRows(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1714 self.refresh_row(self.grid.GetNumberRows()-1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1715 dlg.Destroy()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1716
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1717 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1718 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1719 self.grid.SetDimensions(0,0,s[0],s[1]-25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1720 self.sizer.SetDimension(0,s[1]-25,s[0],25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1721 (w,h) = self.grid.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1722 cols = self.grid.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1723 col_w = w/(cols+2)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1724 self.grid.SetColSize(0,col_w*3)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1725 for i in range(1,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1726 self.grid.SetColSize(i,col_w)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1727
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1728
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1729 class class_panel(wx.Panel):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1730 def __init__(self, parent, handler):
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1731 pname = handler.xml.set("name", 'Class')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1732 wx.Panel.__init__(self, parent, -1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1733 self.grid =wx.grid.Grid(self, -1, style=wx.SUNKEN_BORDER | wx.WANTS_CHARS)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1734 sizer = wx.BoxSizer(wx.HORIZONTAL)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1735 remove_btn = wx.Button(self, wx.ID_ANY, "Remove Class")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1736 add_btn = wx.Button(self, wx.ID_ANY, "Add Class")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1737 sizer.Add(remove_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1738 sizer.Add(wx.Size(10,10))
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1739 sizer.Add(add_btn, 1, wx.EXPAND)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1740 self.sizer = sizer
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1741 self.SetSizer(self.sizer)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1742 self.Bind(wx.EVT_SIZE, self.on_size)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1743 self.Bind(wx.EVT_BUTTON, self.on_remove, remove_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1744 self.Bind(wx.EVT_BUTTON, self.on_add, add_btn)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1745 self.grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1746
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1747 n_list = handler.xml.getchildren()
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1748 self.n_list = n_list
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1749 self.xml = handler.xml
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1750 self.grid.CreateGrid(len(n_list),2,1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1751 self.grid.SetRowLabelSize(0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1752 self.grid.SetColLabelValue(0,"Class")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1753 self.grid.SetColLabelValue(1,"Level")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1754 for i in range(len(n_list)):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1755 self.refresh_row(i)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1756 self.temp_dom = None
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1757
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1758 def on_cell_change(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1759 row = evt.GetRow()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1760 col = evt.GetCol()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1761 value = self.grid.GetCellValue(row,col)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1762 try:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1763 int(value)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1764 self.n_list[row].set('level',value)
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1765 except:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1766 self.grid.SetCellValue(row,col,"1")
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1767
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1768
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1769 def refresh_row(self,i):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1770 n = self.n_list[i]
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1771 name = n.get('name')
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1772 level = n.get('level')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1773 self.grid.SetCellValue(i,0,name)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1774 self.grid.SetReadOnly(i,0)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1775 self.grid.SetCellValue(i,1,level)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1776 #self.grid.SetReadOnly(i,1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1777
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1778 def on_remove(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1779 rows = self.grid.GetNumberRows()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1780 for i in range(rows):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1781 if self.grid.IsInSelection(i,0):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1782 self.grid.DeleteRows(i)
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1783 self.xml.remove(self.n_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1784
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1785 def on_add(self,evt):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1786 if not self.temp_dom:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1787 tree = parse(dir_struct["SWd20"]+"SWd20classes.xml")
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1788 self.temp_dom = tree.getroot()
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1789 f_list = self.temp_dom.findall('class')
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1790 opts = []
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1791 for f in f_list:
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1792 opts.append(f.get('name'))
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1793 dlg = wx.SingleChoiceDialog(self,'Choose Class','Classes',opts)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1794 if dlg.ShowModal() == wx.ID_OK:
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1795 i = dlg.GetSelection()
124
8827271fbe1b Traipse Alpha 'OpenRPG' {091001-01}
sirebral
parents: 67
diff changeset
1796 new_node = self.xml.append(f_list[i])
60
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1797 self.grid.AppendRows(1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1798 self.refresh_row(self.grid.GetNumberRows()-1)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1799 dlg.Destroy()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1800
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1801
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1802 def on_size(self,event):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1803 s = self.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1804 self.grid.SetDimensions(0,0,s[0],s[1]-25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1805 self.sizer.SetDimension(0,s[1]-25,s[0],25)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1806 (w,h) = self.grid.GetClientSizeTuple()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1807 cols = self.grid.GetNumberCols()
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1808 col_w = w/(cols)
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1809 for i in range(0,cols):
3b2cfa13b610 Fix to toolbar menus. More correct fix so docking is working on Ubuntu
sirebral
parents: 0
diff changeset
1810 self.grid.SetColSize(i,col_w)