From: Kevin A. <ka...@us...> - 2004-09-25 14:27:25
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2035/resourceEditor Modified Files: resourceEditor.py Log Message: added drawPanelGridLines but the event binding is commented out uncommment to test, needs a menu item to toggle it, before finalizing Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** resourceEditor.py 15 Sep 2004 17:43:29 -0000 1.215 --- resourceEditor.py 25 Sep 2004 14:27:07 -0000 1.216 *************** *** 1286,1293 **** --- 1286,1320 ---- self.panel.Disconnect(-1, -1, wx.wxEVT_ERASE_BACKGROUND) self.panel._bitmap = None + # KEA 2004-09-25 + # test drawing grid lines, this may become an option in the future + # wx.EVT_ERASE_BACKGROUND( self.panel, self.drawPanelGridLines) self.movingComponent = False self.resizingHandleTarget = None + def drawPanelGridLines(self, event): + dc = event.GetDC() + if not dc : + dc = wx.ClientDC(self.panel) + r = self.panel.GetUpdateRegion().GetBox() + dc.SetClippingRegion(r.x, r.y, r.width, r.height) + # need to set the background color to the default panel color + brush = dc.GetBackground() + brush.SetColour(self.panel.GetBackgroundColour()) + dc.SetBackground(brush) + dc.Clear() + # should the color be settable by the user and then save + # that in the prefs? + dc.SetPen(wx.Pen('darkgray', 1, wx.SOLID)) + w, h = self.panel.size + xgrid = self.xGridSize + ygrid = self.yGridSize + nx = w / xgrid + ny = h / ygrid + for x in range(1, nx + 1): + dc.DrawLine(x * xgrid, 0, x * xgrid, h) + for y in range(1, ny + 1): + dc.DrawLine(0, y * ygrid, w, y * ygrid) + def rebindEventsForDragging(self): for name in self.components.order: |