From: Arlo B. <abe...@us...> - 2004-12-31 20:44:39
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23169 Modified Files: resourceEditor.py Log Message: * Refactored some attributes from Widget up to Component. In particular, Component's spec called for name and command, yet the properties to hold these were specified only at Widget. This made it impossible to inherit directly from Component and still be instantiated via the resources. I also moved the actionBindings up from Widget to Component, as they make more sense there. Component is now clearly "anything that can be manipulated as a resource (and instantiated via a .rsrc.py)", while Widget is "anything with a user interface (a size and a position describing where it can draw)". All Widgets are Components - we want to be able to instantiate any GUI element from the resource file. In the experimentalResourceEditor branch, I fixed a number of bugs that prevented the resource editor from dealing with Components that are not Widgets. The experimentalResourceEditor now fully handles UI-less Components (you can edit their properties via the PropertyEditor, but they don't appear in the ResourceEditor pane). AB Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/resourceEditor.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** resourceEditor.py 24 Oct 2004 19:43:42 -0000 1.2 --- resourceEditor.py 31 Dec 2004 20:44:29 -0000 1.3 *************** *** 399,402 **** --- 399,404 ---- continue control = self.components[name] + if not hasattr(control, 'position'): + continue r = control.GetRect() #print ' ', control, r *************** *** 1119,1132 **** self.startName = name ! self.startPosition = self.components[self.startName].position ! self.startSize = self.components[self.startName].size self.offset = (0, 0) ! self.showSizingHandles(name) self.documentChanged = True ! c = self.components[self.startName] ! wx.EVT_LEFT_DOWN(c, self.on_mouseDown) ! wx.EVT_LEFT_UP(c, self.on_mouseUp) ! wx.EVT_MOTION(c, self.on_mouseDrag) def on_componentDuplicate_command(self, event): --- 1121,1138 ---- self.startName = name ! new_component = self.components[self.startName] ! self.startPosition = getattr(new_component, 'position', (0,0)) ! self.startSize = getattr(new_component, 'size', (0,0)) self.offset = (0, 0) ! if hasattr(new_component, 'position'): ! self.showSizingHandles(name) ! else: ! self.hideSizingHandles() self.documentChanged = True ! if hasattr(new_component, 'position'): ! wx.EVT_LEFT_DOWN(new_component, self.on_mouseDown) ! wx.EVT_LEFT_UP(new_component, self.on_mouseUp) ! wx.EVT_MOTION(new_component, self.on_mouseDrag) def on_componentDuplicate_command(self, event): |