From: Kevin A. <ka...@us...> - 2004-09-15 17:43:39
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27467/tools/resourceEditor Modified Files: resourceEditor.py Log Message: added grid support to cursor key movement Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -d -r1.214 -r1.215 *** resourceEditor.py 15 Sep 2004 15:52:04 -0000 1.214 --- resourceEditor.py 15 Sep 2004 17:43:29 -0000 1.215 *************** *** 155,159 **** wx.EVT_LEFT_UP(self.panel, self.on_mouseUp) wx.EVT_MOTION(self.panel, self.on_mouseDrag) ! wx.EVT_KEY_DOWN(self.panel, self.on_keyPress) self.configPath = os.path.join(configuration.homedir, 'resourceeditor') --- 155,159 ---- wx.EVT_LEFT_UP(self.panel, self.on_mouseUp) wx.EVT_MOTION(self.panel, self.on_mouseDrag) ! wx.EVT_CHAR(self.panel, self.on_keyPress) self.configPath = os.path.join(configuration.homedir, 'resourceeditor') *************** *** 324,328 **** self.positionSizingHandles(self.components[name].position, self.components[name].size) for sizingHandle in self.sizingHandleNames: ! self.components[sizingHandle].visible = 1 if wx.Platform == '__WXMAC__': pass --- 324,328 ---- self.positionSizingHandles(self.components[name].position, self.components[name].size) for sizingHandle in self.sizingHandleNames: ! self.components[sizingHandle].visible = True if wx.Platform == '__WXMAC__': pass *************** *** 573,577 **** self.setToolTipDrag(self.startName, self.lastPosition, self.startSize) ##event.skip() ! # KEA 2004-09-15 # support cursor keys to move components one pixel at a time --- 573,577 ---- self.setToolTipDrag(self.startName, self.lastPosition, self.startSize) ##event.skip() ! # KEA 2004-09-15 # support cursor keys to move components one pixel at a time *************** *** 585,601 **** if s: name = s.split(" : ")[0] - # might make this offset match the grid value - # but leave it at one pixel for now - offset = 1 if name in self.components: x, y = self.components[name].position ! if keyCode == wx.WXK_LEFT: ! x = x - 1 ! elif keyCode == wx.WXK_RIGHT: ! x = x + 1 ! elif keyCode == wx.WXK_UP: ! y = y - 1 ! elif keyCode == wx.WXK_DOWN: ! y = y + 1 self.components[name].position = (x, y) # make sure sizing handles follow component --- 585,610 ---- if s: name = s.split(" : ")[0] if name in self.components: x, y = self.components[name].position ! if self.alignToGrid: ! # for now I'm only going to align to grid ! # in the direction of the cursor movement ! if keyCode == wx.WXK_LEFT: ! x = (x - self.xGridSize) / self.xGridSize * self.xGridSize ! elif keyCode == wx.WXK_RIGHT: ! x = (x + self.xGridSize) / self.xGridSize * self.xGridSize ! elif keyCode == wx.WXK_UP: ! y = (y - self.yGridSize) / self.yGridSize * self.yGridSize ! elif keyCode == wx.WXK_DOWN: ! y = (y + self.yGridSize) / self.yGridSize * self.yGridSize ! else: ! if keyCode == wx.WXK_LEFT: ! x = x - 1 ! elif keyCode == wx.WXK_RIGHT: ! x = x + 1 ! elif keyCode == wx.WXK_UP: ! y = y - 1 ! elif keyCode == wx.WXK_DOWN: ! y = y + 1 self.components[name].position = (x, y) # make sure sizing handles follow component *************** *** 603,608 **** # update the position on the propertyEditor status bar self.setToolTipDrag(name, (x, y), self.components[name].size) - else: - event.Skip() def on_mouseUp(self, event): --- 612,615 ---- |