comparison tools/editor/plugins/ObjectEdit.py @ 599:a2024b994ca3

- re-arranged the ObjectEdit gui to avoid misunderstandings; - the object section groups everything which allows to edit the object file - the instance section only shows instance id and rotation - added help button to plugin - added plugin help text to lang/
author chewie@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 27 Aug 2010 12:59:50 +0000
parents ed01a5c9c7e0
children 4f36c890b1dd
comparison
equal deleted inserted replaced
598:36b865a9cde7 599:a2024b994ca3
73 self.imagepool = None 73 self.imagepool = None
74 self._animationpool = None 74 self._animationpool = None
75 75
76 self.guidata = {} 76 self.guidata = {}
77 self.objectdata = {} 77 self.objectdata = {}
78
79 self._help_dialog = None
78 80
79 def _reset(self): 81 def _reset(self):
80 """ 82 """
81 resets all dynamic vars, but leaves out static ones (e.g. camera, layer) 83 resets all dynamic vars, but leaves out static ones (e.g. camera, layer)
82 84
151 153
152 def getName(self): 154 def getName(self):
153 """ plugin method """ 155 """ plugin method """
154 return "Object editor" 156 return "Object editor"
155 157
158 def _show_help(self):
159 """ shows the help dialog """
160 if self._help_dialog is not None:
161 self._help_dialog.show()
162 return
163
164 self._help_dialog = pychan.loadXML("gui/help.xml")
165 self._help_dialog.title = u"Help (Object Editor)"
166 self._help_dialog.mapEvents({
167 "closeButton" : self._help_dialog.hide,
168 })
169
170 # gimme some more space
171 _SIZE = (320,400)
172 scrollarea = self._help_dialog.findChildren(__class__=pychan.widgets.ScrollArea)[0]
173 scrollarea.size = _SIZE
174 scrollarea.min_size = _SIZE
175 scrollarea.max_size = _SIZE
176
177 f = open('lang/help_object_edit.txt', 'r')
178 self._help_dialog.findChild(name="helpText").text = unicode(f.read())
179 f.close()
180
181 self._help_dialog.show()
182
156 def create_gui(self): 183 def create_gui(self):
157 """ 184 """
158 - creates the gui skeleton by loading the xml file 185 - creates the gui skeleton by loading the xml file
159 - finds some important childs and saves their widget in the object 186 - finds some important childs and saves their widget in the object
160 187
168 195
169 'anim_left' : self.previous_anim_frame, 196 'anim_left' : self.previous_anim_frame,
170 'anim_right' : self.next_anim_frame, 197 'anim_right' : self.next_anim_frame,
171 'anim_start_pos' : self.anim_start_frame, 198 'anim_start_pos' : self.anim_start_frame,
172 'anim_end_pos' : self.anim_end_frame, 199 'anim_end_pos' : self.anim_end_frame,
200
201 'show_help' : self._show_help,
173 }) 202 })
174 203
175 self.container.findChild(name="x_offset_up").capture(self.change_offset, "mousePressed") 204 self.container.findChild(name="x_offset_up").capture(self.change_offset, "mousePressed")
176 self.container.findChild(name="x_offset_dn").capture(self.change_offset, "mousePressed") 205 self.container.findChild(name="x_offset_dn").capture(self.change_offset, "mousePressed")
177 self._gui_x_offset = self.container.findChild(name="x_offset") 206 self._gui_x_offset = self.container.findChild(name="x_offset")