You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(45) |
May
(185) |
Jun
|
Jul
(36) |
Aug
(205) |
Sep
(98) |
Oct
(107) |
Nov
(6) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(1) |
Feb
(2) |
Mar
(19) |
Apr
(26) |
May
(18) |
Jun
|
Jul
(12) |
Aug
(16) |
Sep
(22) |
Oct
(7) |
Nov
(11) |
Dec
(74) |
2006 |
Jan
(14) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(14) |
Jun
(5) |
Jul
(20) |
Aug
(10) |
Sep
(1) |
Oct
|
Nov
(4) |
Dec
(1) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(14) |
Aug
|
Sep
|
Oct
(6) |
Nov
(1) |
Dec
|
From: Kevin A. <ka...@us...> - 2004-09-16 04:42:44
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1660/components Modified Files: notebook.py Log Message: added stringSelection attribute to match list, choice, etc. Index: notebook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/notebook.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** notebook.py 14 Sep 2004 17:28:45 -0000 1.1 --- notebook.py 16 Sep 2004 04:42:29 -0000 1.2 *************** *** 59,62 **** --- 59,80 ---- self._bindEvents(self._spec._events) + def _getPageNames(self): + names = [] + for i in range(self.GetPageCount()): + names.append(self.GetPageText(i)) + return names + + def _getStringSelection(self): + return self.GetPageText(self.GetSelection()) + + def _setStringSelection(self, s): + names = self._getPageNames() + try: + self.SetSelection(names.index(s)) + except: + # what kind of exception should we throw here for + # an invalid string selection? + pass + # KEA 2004-09-14 # rather than using all these methods there could *************** *** 80,83 **** --- 98,102 ---- selection = property(wx.Notebook.GetSelection, wx.Notebook.SetSelection) + stringSelection = property(_getStringSelection, _setStringSelection) |
From: Kevin A. <ka...@us...> - 2004-09-16 04:42:40
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1660/samples/testNotebook Modified Files: testNotebook.py Log Message: added stringSelection attribute to match list, choice, etc. Index: testNotebook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/testNotebook/testNotebook.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testNotebook.py 14 Sep 2004 21:07:49 -0000 1.4 --- testNotebook.py 16 Sep 2004 04:42:30 -0000 1.5 *************** *** 59,62 **** --- 59,65 ---- print "last page text: %s\n" % \ self.components.notebook.getPageText(self.components.notebook.getPageCount() - 1) + + print "stringSelection:", self.components.notebook.stringSelection + self.components.notebook.stringSelection = 'minimal' def on_notebook_pageChanging(self, event): |
From: Kevin A. <ka...@us...> - 2004-09-15 19:25:15
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16012 Modified Files: model.py Log Message: added title attribute to pageBackground Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** model.py 15 Sep 2004 18:53:19 -0000 1.185 --- model.py 15 Sep 2004 19:25:06 -0000 1.186 *************** *** 1730,1734 **** ## close = wx.Frame.Close ## getParent = wx.Frame.GetParent ! # KEA 2004-03-17 # define Python 2.2 new-style class properties --- 1730,1740 ---- ## close = wx.Frame.Close ## getParent = wx.Frame.GetParent ! ! def _getTitle(self): ! return wx.GetTopLevelParent(self).GetTitle() ! ! def _setTitle(self, aString): ! wx.GetTopLevelParent(self).SetTitle(aString) ! # KEA 2004-03-17 # define Python 2.2 new-style class properties *************** *** 1737,1741 **** position = property(_getPosition, _setPosition, doc="position of the background") size = property(_getSize, _setSize, doc="size of the background") ! ## title = property(wx.Frame.GetTitle, wx.Frame.SetTitle) visible = property(wx.Frame.IsShown, wx.Frame.Show, doc="whether the background window is visible") --- 1743,1747 ---- position = property(_getPosition, _setPosition, doc="position of the background") size = property(_getSize, _setSize, doc="size of the background") ! title = property(_getTitle, _setTitle, doc="title of the background") visible = property(wx.Frame.IsShown, wx.Frame.Show, doc="whether the background window is visible") |
From: Alex T. <ale...@us...> - 2004-09-15 18:53:28
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9726 Modified Files: model.py Log Message: Added self.topLevelParent to ease use of any other main window attributes. Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -d -r1.184 -r1.185 *** model.py 14 Sep 2004 21:07:49 -0000 1.184 --- model.py 15 Sep 2004 18:53:19 -0000 1.185 *************** *** 1197,1203 **** name=aBgRsrc.name) ! self.menuBar = wx.GetTopLevelParent(self).menuBar ! self.statusBar = wx.GetTopLevelParent(self).statusBar ! self._initLayout(aBgRsrc.components) --- 1197,1204 ---- name=aBgRsrc.name) ! self.topLevelParent = wx.GetTopLevelParent(self) ! self.menuBar = self.topLevelParent.menuBar ! self.statusBar = self.topLevelParent.statusBar ! self._initLayout(aBgRsrc.components) |
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 ---- |
From: Kevin A. <ka...@us...> - 2004-09-15 17:43:39
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27467/tools/resourceEditor/modules Modified Files: propertyEditor.py Log Message: added grid support to cursor key movement Index: propertyEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules/propertyEditor.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** propertyEditor.py 12 Sep 2004 17:28:12 -0000 1.53 --- propertyEditor.py 15 Sep 2004 17:43:29 -0000 1.54 *************** *** 144,147 **** --- 144,149 ---- self.components.wPropertyList.stringSelection = "name" self.displayProperty(wName, wClass, propName) + c = self._parent.components[wName] + self._parent.setToolTipDrag(wName, c.position, c.size) def changed(self, event): *************** *** 438,441 **** --- 440,445 ---- self.displayProperty(wName, wClass, propName) self._parent.showSizingHandles(wName) + c = self._parent.components[wName] + self._parent.setToolTipDrag(wName, c.position, c.size) def on_wPropertyList_select(self, event): *************** *** 447,450 **** --- 451,455 ---- def clearComponentList(self): self.components.wComponentList.Clear() + self.statusBar.text = '' def clearPropertyList(self): |
From: Kevin A. <ka...@us...> - 2004-09-15 15:52:13
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1466/tools/resourceEditor Modified Files: resourceEditor.py Log Message: added cursor key support for moving components Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** resourceEditor.py 10 Sep 2004 19:57:52 -0000 1.213 --- resourceEditor.py 15 Sep 2004 15:52:04 -0000 1.214 *************** *** 155,158 **** --- 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') *************** *** 573,576 **** --- 574,609 ---- ##event.skip() + # KEA 2004-09-15 + # support cursor keys to move components one pixel at a time + # the event is coming from the panel so we have to use the wx methods + def on_keyPress(self, event): + keyCode = event.GetKeyCode() + if keyCode in (wx.WXK_LEFT, wx.WXK_UP, wx.WXK_RIGHT, wx.WXK_DOWN): + # self.startName might not be set + # that may actually be a bug, but this should always work + s = self.propertyEditorWindow.components.wComponentList.stringSelection + 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 + self.showSizingHandles(name) + # 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): # protect against double-clicks in the open file dialog |
From: Kevin A. <ka...@us...> - 2004-09-15 15:52:13
|
Update of /cvsroot/pythoncard/PythonCard/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1466/docs Modified Files: changelog.txt Log Message: added cursor key support for moving components Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/changelog.txt,v retrieving revision 1.306 retrieving revision 1.307 diff -C2 -d -r1.306 -r1.307 *** changelog.txt 14 Sep 2004 17:28:46 -0000 1.306 --- changelog.txt 15 Sep 2004 15:52:04 -0000 1.307 *************** *** 3,6 **** --- 3,8 ---- Release 0.8.1 2004-09-?? + added cursor key support in resourceEditor for moving components + added FloatCanvas component and sample added Notebook component, PageBackground, and testNotebook sample added relativePath to util.py |
From: Kevin A. <ka...@us...> - 2004-09-14 23:54:38
|
Update of /cvsroot/pythoncard/PythonCard/samples/floatCanvasTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30106/samples/floatCanvasTest Modified Files: floatCanvasTest.rsrc.py Log Message: fixed missing 'command' attribute Index: floatCanvasTest.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/floatCanvasTest/floatCanvasTest.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** floatCanvasTest.rsrc.py 14 Sep 2004 23:41:14 -0000 1.1 --- floatCanvasTest.rsrc.py 14 Sep 2004 23:54:29 -0000 1.2 *************** *** 29,33 **** { 'type':'MenuItem', 'name':'menuFileExit', ! 'label':'E&xit\tAlt+X' } ] }, { 'type':'Menu', 'name':'menuEdit', --- 29,34 ---- { 'type':'MenuItem', 'name':'menuFileExit', ! 'label':'E&xit\tAlt+X', ! 'command':'exit' } ] }, { 'type':'Menu', 'name':'menuEdit', |
From: Kevin A. <ka...@us...> - 2004-09-14 23:41:23
|
Update of /cvsroot/pythoncard/PythonCard/samples/floatCanvasTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28006 Added Files: .cvsignore floatCanvasTest.py floatCanvasTest.rsrc.py Log Message: test case for FloatCanvas component --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log .DS_Store --- NEW FILE: floatCanvasTest.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/14 23:41:14 $" """ """ try: import Numeric import random import RandomArray haveNumeric = True except ImportError: haveNumeric = False """ import os import wx from PythonCard import model class Doodle(model.Background): def on_initialize(self, event): self.singleItemExpandingSizerLayout() ## getting all the colors and linestyles for random objects # don't need this since PythonCard has already called it #wx.lib.colourdb.updateColourDB() self.colors = wx.lib.colourdb.getColourList() self.DrawTest() def DrawTest(self,event=None): wx.GetApp().Yield() import random import RandomArray Range = (-10,10) colors = self.colors #self.BindAllMouseEvents() Canvas = self.components.float Canvas.ClearAll() Canvas.SetProjectionFun(None) ## Random tests of everything: # Rectangles for i in range(3): x,y = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) lw = random.randint(1,5) cf = random.randint(0,len(colors)-1) h = random.randint(1,5) w = random.randint(1,5) Canvas.AddRectangle(x,y,h,w,LineWidth = lw,FillColor = colors[cf]) # Ellipses for i in range(3): x,y = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) lw = random.randint(1,5) cf = random.randint(0,len(colors)-1) h = random.randint(1,5) w = random.randint(1,5) Canvas.AddEllipse(x,y,h,w,LineWidth = lw,FillColor = colors[cf]) ## # Dots -- Does anyone need this? ## for i in range(5): ## x,y = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) ## D = random.randint(1,50) ## lw = random.randint(1,5) ## cf = random.randint(0,len(colors)-1) ## cl = random.randint(0,len(colors)-1) ## Canvas.AddDot(x,y,D,LineWidth = lw,LineColor = colors[cl],FillColor = colors[cf]) # Circles for i in range(5): x,y = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) D = random.randint(1,5) lw = random.randint(1,5) cf = random.randint(0,len(colors)-1) cl = random.randint(0,len(colors)-1) Canvas.AddCircle(x,y,D,LineWidth = lw,LineColor = colors[cl],FillColor = colors[cf]) Canvas.AddText("Circle # %i"%(i),x,y,Size = 12,BackgroundColor = None,Position = "cc") # Lines for i in range(5): points = [] for j in range(random.randint(2,10)): point = (random.randint(Range[0],Range[1]),random.randint(Range[0],Range[1])) points.append(point) lw = random.randint(1,10) cf = random.randint(0,len(colors)-1) cl = random.randint(0,len(colors)-1) Canvas.AddLine(points, LineWidth = lw, LineColor = colors[cl]) # Polygons for i in range(3): points = [] for j in range(random.randint(2,6)): point = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) points.append(point) lw = random.randint(1,6) cf = random.randint(0,len(colors)-1) cl = random.randint(0,len(colors)-1) Canvas.AddPolygon(points, LineWidth = lw, LineColor = colors[cl], FillColor = colors[cf], FillStyle = 'Solid') ## Pointset for i in range(4): points = [] points = RandomArray.uniform(Range[0],Range[1],(100,2)) cf = random.randint(0,len(colors)-1) D = random.randint(1,4) Canvas.AddPointSet(points, Color = colors[cf], Diameter = D) # Text String = "Unscaled text" for i in range(3): ts = random.randint(10,40) cf = random.randint(0,len(colors)-1) x,y = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) Canvas.AddText(String, x, y, Size = ts, Color = colors[cf], Position = "cc") # Scaled Text String = "Scaled text" for i in range(3): ts = random.random()*3 + 0.2 cf = random.randint(0,len(colors)-1) x,y = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) Canvas.AddScaledText(String, x, y, Size = ts, Color = colors[cf], Position = "cc") Canvas.ZoomToBB() if __name__ == '__main__': app = model.Application(Doodle) app.MainLoop() --- NEW FILE: floatCanvasTest.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Doodle', 'backgrounds': [ { 'type':'Background', 'name':'bgDoodle', 'title':'Doodle PythonCard Application', 'size':( 610, 600 ), 'style':['resizeable'], 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open...\tCtrl+O' }, { 'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...' }, { 'type':'MenuItem', 'name':'fileSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X' } ] }, { 'type':'Menu', 'name':'menuEdit', 'label':'&Edit', 'items': [ { 'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C'}, { 'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V'}, { 'type':'MenuItem', 'name':'editSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuEditClear', 'label':'&Clear', 'command':'editClear'} ] } ] }, 'components': [ { 'type':'FloatCanvas', 'name':'float', 'position':(0, 30), 'size':(600, 600) }, ] } ] } } |
From: Kevin A. <ka...@us...> - 2004-09-14 23:40:19
|
Update of /cvsroot/pythoncard/PythonCard/samples/floatCanvasTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27828/floatCanvasTest Log Message: Directory /cvsroot/pythoncard/PythonCard/samples/floatCanvasTest added to the repository |
From: Kevin A. <ka...@us...> - 2004-09-14 23:37:28
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26870 Modified Files: menu.py Log Message: fixed getMenuId handling of & and Mac Quit menu item Index: menu.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/menu.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** menu.py 10 May 2004 17:24:22 -0000 1.38 --- menu.py 14 Sep 2004 23:37:19 -0000 1.39 *************** *** 361,365 **** id = -1 for m in self.menus: ! menuLabel = m.label.strip('&') if m.name == aString: id = self.FindMenu(menuLabel) --- 361,365 ---- id = -1 for m in self.menus: ! menuLabel = m.label.replace('&', '') if m.name == aString: id = self.FindMenu(menuLabel) *************** *** 367,371 **** for mi in m.items: if mi.name == aString: ! menuItemLabel = mi.label.split('\t')[0].strip('&') id = self.FindMenuItem(menuLabel, menuItemLabel) break --- 367,377 ---- for mi in m.items: if mi.name == aString: ! menuItemLabel = mi.label.split('\t')[0].replace('&', '') ! if menuItemLabel == 'Exit' and wx.Platform == '__WXMAC__': ! # KEA 2004-09-14 ! # I think this is the only label WXMAC changes ! # but I wonder if this won't work for other languages?! ! # maybe the Quit menu item would always have the same id? ! menuItemLabel = 'Quit' id = self.FindMenuItem(menuLabel, menuItemLabel) break |
From: Kevin A. <ka...@us...> - 2004-09-14 23:16:57
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22796/components Added Files: floatcanvas.py Log Message: added FloatCanvas component to work with wxPython 2.5.2.9 --- NEW FILE: floatcanvas.py --- """ +__version__ = "$Revision: 1.1 $" +__date__ = "$Date: 2004/09/14 23:16:46 $" """ import wx from PythonCard import widget # I have to do this rename to avoid a name collision from wx.lib.floatcanvas import FloatCanvas as FCanvas class FloatCanvasSpec(widget.WidgetSpec): def __init__(self): events = [] attributes = { 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, } widget.WidgetSpec.__init__(self, 'FloatCanvas', 'Widget', events, attributes ) class FloatCanvas(widget.Widget, FCanvas.FloatCanvas): _spec = FloatCanvasSpec() def __init__( self, aParent, aResource ) : FCanvas.FloatCanvas.__init__( self, aParent, widget.makeNewId(aResource.id), #wx.wxPoint(aResource.position[0], aResource.position[1]), size=aResource.size, #aResource.items, #style = wx.wxCLIP_SIBLINGS, #name = aResource.name, ProjectionFun = None, BackgroundColor = "WHITE", Debug = False, ) widget.Widget.__init__( self, aParent, aResource ) # if there are any events to bind this is where we would do it #self._bindEvents(event.WIDGET_EVENTS + CanvasEvents) # I don't think we need this anymore """ def __getattr__(self, name): if name[:3] == "Add": return FloatCanvas.FloatCanvas.__getattr__(self, name) else: return widget.Widget.__getattr__(self, name) """ import sys from PythonCard import registry registry.Registry.getInstance().register(sys.modules[__name__].FloatCanvas) |
From: Kevin A. <ka...@us...> - 2004-09-14 21:07:59
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23350/samples/testNotebook Modified Files: testNotebook.py Log Message: added wx.GetTopLevelParent(self) for menuBar and statusBar Index: testNotebook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/testNotebook/testNotebook.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testNotebook.py 14 Sep 2004 18:42:58 -0000 1.3 --- testNotebook.py 14 Sep 2004 21:07:49 -0000 1.4 *************** *** 45,49 **** setattr(self.components.notebook, pageName, win) #print self.components.notebook.GetPage(1).components.field1.text ! print self.components.notebook.minimal.components.field1.text finally: # Since we may exit via an exception, close fp explicitly. --- 45,51 ---- setattr(self.components.notebook, pageName, win) #print self.components.notebook.GetPage(1).components.field1.text ! page = self.components.notebook.minimal ! print page.components.field1.text ! print "menuFileExit enabled:", page.menuBar.getEnabled('menuFileExit') finally: # Since we may exit via an exception, close fp explicitly. |
From: Kevin A. <ka...@us...> - 2004-09-14 21:07:58
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23350 Modified Files: model.py Log Message: added wx.GetTopLevelParent(self) for menuBar and statusBar Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** model.py 14 Sep 2004 17:33:03 -0000 1.183 --- model.py 14 Sep 2004 21:07:49 -0000 1.184 *************** *** 1177,1182 **** self.setTiled(aBgRsrc.tiled) self.components = WidgetDict(self) - self.menuBar = None - self.statusBar = None ## # override for application defined position --- 1177,1180 ---- *************** *** 1199,1202 **** --- 1197,1203 ---- name=aBgRsrc.name) + self.menuBar = wx.GetTopLevelParent(self).menuBar + self.statusBar = wx.GetTopLevelParent(self).statusBar + self._initLayout(aBgRsrc.components) |
From: Kevin A. <ka...@us...> - 2004-09-14 18:43:07
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22401 Modified Files: testNotebook.py Log Message: added tests for dynamic module loading and setattr Index: testNotebook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/testNotebook/testNotebook.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testNotebook.py 14 Sep 2004 17:33:03 -0000 1.2 --- testNotebook.py 14 Sep 2004 18:42:58 -0000 1.3 *************** *** 24,31 **** ## self.components.notebook.AddPage(frame, 'frame', True) ! win = model.childWindow(self.components.notebook, minimal.Minimal) ! self.components.notebook.AddPage(win, 'minimal', True) ! print "adding page..." ! print self.components.notebook.GetPage(1).components.field1.text win2 = model.childWindow(self.components.notebook, widgets.WidgetsTest) --- 24,53 ---- ## self.components.notebook.AddPage(frame, 'frame', True) ! # let's pretend we were just given a string with the class to ! # load to see how this would be handled in the Notebook component ! # automatically ! #win = model.childWindow(self.components.notebook, minimal.Minimal) ! pageName = 'minimal' ! classString = 'minimal.Minimal' ! # assume for now that there will be one and only one ! # dot rather than something like modules.minimal.Minimal or just Minimal ! # indicating that the class is actually in the main source file ! # which would cause all sorts of problems with finding the resource file ! print "adding minimal page..." ! import imp ! moduleName, className = classString.split('.') ! fp, pathname, description = imp.find_module(moduleName) ! try: ! m = imp.load_module(moduleName, fp, pathname, description) ! win = model.childWindow(self.components.notebook, getattr(m, className)) ! self.components.notebook.AddPage(win, pageName, True) ! # now test setting the attribute for reference below ! setattr(self.components.notebook, pageName, win) ! #print self.components.notebook.GetPage(1).components.field1.text ! print self.components.notebook.minimal.components.field1.text ! finally: ! # Since we may exit via an exception, close fp explicitly. ! if fp: ! fp.close() win2 = model.childWindow(self.components.notebook, widgets.WidgetsTest) |
From: Kevin A. <ka...@us...> - 2004-09-14 17:52:27
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11724 Added Files: edit.gif tile.bmp Log Message: binary add of images --- NEW FILE: edit.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tile.bmp --- (This appears to be a binary file; contents omitted.) |
From: Kevin A. <ka...@us...> - 2004-09-14 17:51:36
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11576 Removed Files: edit.gif tile.bmp Log Message: removing files so they can be added with -kb option --- edit.gif DELETED --- --- tile.bmp DELETED --- |
From: Kevin A. <ka...@us...> - 2004-09-14 17:33:12
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7657 Modified Files: model.py Log Message: removed pageWindow, changed childWindow to handle Notebook Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** model.py 14 Sep 2004 17:28:45 -0000 1.182 --- model.py 14 Sep 2004 17:33:03 -0000 1.183 *************** *** 167,204 **** # figure out the .rsrc.py filename based on the module name stored in library.zip filename = os.path.split(sys.modules[frameClass.__module__].__file__)[1] ! filename = os.path.join(parent.application.applicationDirectory, filename) ! else: ! # figure out the .rsrc.py filename based on the module name ! filename = sys.modules[frameClass.__module__].__file__ ! # chop the .pyc or .pyo from the end ! base, ext = os.path.splitext(filename) ! filename = internationalResourceName(base) ! rsrc = resource.ResourceFile(filename).getResource() ! elif isinstance(rsrc, dict): ! rsrc = resource.Resource(rsrc) ! else: ! rsrc = resource.ResourceFile(filename).getResource() ! return frameClass(parent, rsrc.application.backgrounds[0]) ! ! ! # KEA 2004-09-14 ! # this is almost identical to childWindow above ! # but in the case of adding a page to a notebook ! # the parent is the Notebook component (wx.Notebook control) ! # which changes util.main_is_frozen code ! ! def pageWindow(parent, frameClass, filename=None, rsrc=None): ! if filename is None: ! if rsrc is None: ! if util.main_is_frozen(): ! # KEA 2004-05-20 ! # running standalone ! # need to support py2exe differently than bundlebuilder and mcmillan probably ! # but this is the py2exe 0.5 way ! # figure out the .rsrc.py filename based on the module name stored in library.zip ! filename = os.path.split(sys.modules[frameClass.__module__].__file__)[1] ! # parent will be the wx.Notebook ! parentFrame = parent.GetParent().GetParent() ! filename = os.path.join(parentFrame.application.applicationDirectory, filename) else: # figure out the .rsrc.py filename based on the module name --- 167,179 ---- # figure out the .rsrc.py filename based on the module name stored in library.zip filename = os.path.split(sys.modules[frameClass.__module__].__file__)[1] ! # KEA 2004-09-14 ! # it seems sort of dumb to duplicate this function ! # just to handle the parent differently ! # so I'm adding this check ! if isinstance(parent, wx.Notebook): ! parentFrame = parent.GetParent().GetParent() ! filename = os.path.join(parentFrame.application.applicationDirectory, filename) ! else: ! filename = os.path.join(parent.application.applicationDirectory, filename) else: # figure out the .rsrc.py filename based on the module name |
From: Kevin A. <ka...@us...> - 2004-09-14 17:33:12
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7657/samples/testNotebook Modified Files: testNotebook.py Log Message: removed pageWindow, changed childWindow to handle Notebook Index: testNotebook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/testNotebook/testNotebook.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testNotebook.py 14 Sep 2004 17:28:46 -0000 1.1 --- testNotebook.py 14 Sep 2004 17:33:03 -0000 1.2 *************** *** 24,33 **** ## self.components.notebook.AddPage(frame, 'frame', True) ! win = model.pageWindow(self.components.notebook, minimal.Minimal) self.components.notebook.AddPage(win, 'minimal', True) print "adding page..." print self.components.notebook.GetPage(1).components.field1.text ! win2 = model.pageWindow(self.components.notebook, widgets.WidgetsTest) self.components.notebook.AddPage(win2, 'widgets', True) --- 24,33 ---- ## self.components.notebook.AddPage(frame, 'frame', True) ! win = model.childWindow(self.components.notebook, minimal.Minimal) self.components.notebook.AddPage(win, 'minimal', True) print "adding page..." print self.components.notebook.GetPage(1).components.field1.text ! win2 = model.childWindow(self.components.notebook, widgets.WidgetsTest) self.components.notebook.AddPage(win2, 'widgets', True) |
From: Kevin A. <ka...@us...> - 2004-09-14 17:28:56
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6255 Modified Files: MANIFEST.in model.py widget.py Log Message: added Notebook component added PageBackground class and pageWindow function added testNotebook sample for testing component and class Index: widget.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/widget.py,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** widget.py 13 May 2004 02:40:23 -0000 1.132 --- widget.py 14 Sep 2004 17:28:45 -0000 1.133 *************** *** 249,254 **** # background.findHandler #background = self.GetParent().GetParent() ! background = wx.GetTopLevelParent(self) if wx.GetApp()._showDebugMenu: --- 249,261 ---- # background.findHandler + # KEA 2004-09-13 + # switching back to the earlier hack for finding the parent background + # in order to support the PageBackground experiments #background = self.GetParent().GetParent() ! parent = self.GetParent() ! if isinstance(parent, wx.Dialog): ! background = parent ! else: ! background = parent.GetParent() if wx.GetApp()._showDebugMenu: *************** *** 392,397 **** # handler could be somewhere else #background = self.GetParent().GetParent() ! background = wx.GetTopLevelParent(self) # this is what is in event.py --- 399,412 ---- # handler could be somewhere else + # KEA 2004-09-13 + # switching back to the earlier hack for finding the parent background + # in order to support the PageBackground experiments #background = self.GetParent().GetParent() ! ## background = wx.GetTopLevelParent(self) ! parent = self.GetParent() ! if isinstance(parent, wx.Dialog): ! background = parent ! else: ! background = parent.GetParent() # this is what is in event.py Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** model.py 26 Aug 2004 18:36:52 -0000 1.181 --- model.py 14 Sep 2004 17:28:45 -0000 1.182 *************** *** 182,185 **** --- 182,218 ---- + # KEA 2004-09-14 + # this is almost identical to childWindow above + # but in the case of adding a page to a notebook + # the parent is the Notebook component (wx.Notebook control) + # which changes util.main_is_frozen code + + def pageWindow(parent, frameClass, filename=None, rsrc=None): + if filename is None: + if rsrc is None: + if util.main_is_frozen(): + # KEA 2004-05-20 + # running standalone + # need to support py2exe differently than bundlebuilder and mcmillan probably + # but this is the py2exe 0.5 way + # figure out the .rsrc.py filename based on the module name stored in library.zip + filename = os.path.split(sys.modules[frameClass.__module__].__file__)[1] + # parent will be the wx.Notebook + parentFrame = parent.GetParent().GetParent() + filename = os.path.join(parentFrame.application.applicationDirectory, filename) + else: + # figure out the .rsrc.py filename based on the module name + filename = sys.modules[frameClass.__module__].__file__ + # chop the .pyc or .pyo from the end + base, ext = os.path.splitext(filename) + filename = internationalResourceName(base) + rsrc = resource.ResourceFile(filename).getResource() + elif isinstance(rsrc, dict): + rsrc = resource.Resource(rsrc) + else: + rsrc = resource.ResourceFile(filename).getResource() + return frameClass(parent, rsrc.application.backgrounds[0]) + + # KEA 2002-02-25 # custom event for running a pycrustrc.py file *************** *** 1139,1142 **** --- 1172,1767 ---- + PageBackgroundEvents = ( + ## ActivateEvent, + ## CloseEvent, + ## DeactivateEvent, + event.IdleEvent, + ## MaximizeEvent, + ## MinimizeEvent, + ## MoveEvent, + ## RestoreEvent, + ## SizeEvent, + ) + + class PageBackground(Scriptable, wx.Panel, event.EventSource): + """ + A window that contains Widgets. + """ + + def __init__(self, aParent, aBgRsrc): + """ + Initialize this instance. + """ + Scriptable.__init__(self, None) + event.EventSource.__init__(self) + self.id = wx.NewId() + self.resource = aBgRsrc + self.application = wx.GetApp() + self.setName(aBgRsrc.name) + self.setImage(aBgRsrc.image) + self.setTiled(aBgRsrc.tiled) + self.components = WidgetDict(self) + self.menuBar = None + self.statusBar = None + + ## # override for application defined position + ## position = configuration.getOption('defaultBackgroundPosition') + ## if position is None: + ## position = aBgRsrc.position + + ## # KEA 2004-01-18 + ## # have to explicitly declare the close box in wxPython 2.5 + ## style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX + ## if aBgRsrc.style == ['resizeable']: + ## style = wx.DEFAULT_FRAME_STYLE + # First, call the base class' __init__ method to create the frame + wx.Panel.__init__(self, aParent, + self.id, + ## aBgRsrc.title, + ## position, + size=aBgRsrc.size, + ## wx.NO_FULL_REPAINT_ON_RESIZE, + name=aBgRsrc.name) + + self._initLayout(aBgRsrc.components) + + # KEA 2004-09-14 + # force PageBackground to fit + # space provided by Notebook + self._sizer = wx.BoxSizer(wx.VERTICAL) + self._sizer.Add(self.panel, True, wx.EXPAND) + self._sizer.Fit(self) + self._sizer.SetSizeHints(self) + self.SetSizer(self._sizer) + self.Layout() + + # KEA 2001-08-13 + # can't set the colors until after the panel + # has been created. this initialization should probably work differently + self._setForegroundColor(aBgRsrc.foregroundColor) + self._setBackgroundColor(aBgRsrc.backgroundColor) + + ## self._createMenus(aBgRsrc) + ## self._createStatusBar(aBgRsrc) + + ## # AJT 20.11.2001 + ## # Add icon creation + ## self._setIcon(aBgRsrc) + + ## # 2001-11-08 + ## # hack to preserve the statusbar text + ## if self.statusBar is not None and self.menuBar is not None: + ## wx.EVT_MENU_HIGHLIGHT_ALL(self, self.menuHighlight) + + ## if aParent is None: + ## self.application.SetTopWindow(self) + ## + ## # KEA 2002-04-26 + ## # allow background window to remain hidden + ## if aBgRsrc.visible: + ## self.Show(True) + + # RDS 2004-04-14 + # Post the Background initialization event. + + self.EVT_OPEN_BACKGROUND_TYPE = wx.NewEventType() + self.id = wx.NewId() + self.Connect(self.GetId(), -1, + self.EVT_OPEN_BACKGROUND_TYPE, + self.on_initialize) + #self._dispatchOpenBackground ) + evt = wx.PyCommandEvent(self.EVT_OPEN_BACKGROUND_TYPE, self.GetId()) + evt.target = self + wx.PostEvent(self, evt) + EVT_LATENT_BACKGROUNDBIND(self, self.OnLatentBackgroundBind) + wx.PostEvent(self, wxLatentBackgroundBindEvent()) + # for some reason the Message Watcher isn't a listener yet + # so calling EventLog doesn't do anything + #event.EventLog.getInstance().log('initialize', self.name, True) + + ## self._bindWindowEvents() + + + def on_initialize(self, evt): + # override in subclass + pass + + ## def on_close(self, evt): + ## # override in subclass + ## evt.Skip() + + # KEA 2004-09-14 + # this probably doesn't work, but need to test + # since PageBackground is a wx.Panel + # that contains a wx.Panel + # and it contains a sizer to force it to expand to + # the size of the Notebook set in __init__ above + # I'm not sure if this method makes any sense for PageBackground + def singleItemExpandingSizerLayout(self): + """Convenience method for backgrounds with only a + single component on the background where the component + should expand with the background as in an editor. + + Call from within the on_initialize event handler.""" + + self.sizer = wx.BoxSizer(wx.VERTICAL) + name = self.components.order[0] + self.sizer.Add(self.components[name], True, wx.EXPAND) + self.sizer.Fit(self) + self.sizer.SetSizeHints(self) + self.panel.SetSizer(self.sizer) + self.panel.Layout() + + + # KEA 2004-05-09 + # this is _bindEvents taken from widget.Widget + # so we can see how moving this to Scriptable will impact binding + # comments have been removed + def _bindEvents(self, eventList): + ## background = wx.GetTopLevelParent(self) + background = self + + if wx.GetApp()._showDebugMenu: + bindUnusedEvents = True + else: + bindUnusedEvents = False + + self.boundEvents = {} + + self.eventIdToHandler = {} + self.wxEventIdMap = {} + + if 0: + print "\nBINDING...", self.name + + for eventClass in eventList: + self.wxEventIdMap[eventClass.id] = eventClass + if issubclass(eventClass, event.CommandTypeEvent) and self.command: + handler = background.findHandler('on_' + self.command + '_command') + if not handler: + handler = background.findHandler('on_' + self.name + '_' + eventClass.name) + else: + handler = background.findHandler('on_' + self.name + '_' + eventClass.name) + if not handler: + handler = background.findHandler('on_' + eventClass.name) + if handler or bindUnusedEvents: + if not self.boundEvents.get(eventClass.binding, None): + self.Bind(eventClass.binding, self._dispatch) + self.boundEvents[eventClass.binding] = eventClass.name + if handler: + if 0: + print " binding", self.name, eventClass.name, handler.__name__, eventClass.id + self.eventIdToHandler[eventClass.id] = handler + + if 0: + print "\n boundEvents:" + for name in self.boundEvents.values(): + print " ", name + print "\n\n" + print "\n self.eventIdToHandler:" + for id in self.eventIdToHandler: + print " ", id, self.eventIdToHandler[id] + print "\n\n" + + # KEA 2004-05-09 + # this is _dispatch taken from widget.Widget + # so we can see how moving this to Scriptable will impact dispatch + # comments have been removed + # the only line I added was self.command = None + # since I'm not sure what we should do about that attribute + # I suspect that the if test should just be changed so that instead of + # if self.command ... + # we use + # if hasattr(self, 'command') and self.command ... + # OOPS one other change + # we're still using unbound methods and after a close event + # additional events will be sent as the frame is closed and destroyed + # in particular the last event appears to be a deactivate event + # to work around this I went ahead and added code + def _dispatch(self, aWxEvent): + # this is a temporary workaround, see comment above + self.command = None + + eventType = aWxEvent.GetEventType() + eventClass = self.wxEventIdMap[eventType] + + eventClassInstance = eventClass() + aWxEvent = eventClassInstance.decorate(aWxEvent, self) + + if self.command and isinstance(eventClassInstance, event.CommandTypeEvent): + eventName = 'command ' + self.command + else: + if isinstance(eventClassInstance, event.InsteadOfTypeEvent): + eventType = eventClassInstance.translateEventType(aWxEvent) + eventName = self.wxEventIdMap[eventType].name + + eventClass = None + eventClassInstance = None + + handler = self.eventIdToHandler.get(eventType, None) + if handler: + event.EventLog.getInstance().log(eventName, self.name, True) + if 0: + print "dispatching", handler.__name__ + aWxEvent.skip = aWxEvent.Skip + + ## background = wx.GetTopLevelParent(self) + background = self + + handler(background, aWxEvent) + + aWxEvent.skip = None + handler = None + background = None + else: + event.EventLog.getInstance().log(eventName, self.name, False) + aWxEvent.Skip() + + aWxEvent.target = aWxEvent.eventObject = None + + def OnLatentBackgroundBind(self, evt): + self._bindEvents(PageBackgroundEvents) + + # KEA 2002-06-27 + # this is a way of loading the shell manually in an app + # if the shell wasn't loaded at startup, so program + # startup is quicker and take up less memory + # if the shell isn't needed + def loadShell(self): + if self.application.shell is None: + self.application.showShell() + + def loadNamespace(self): + self.loadShell() + if self.application.shell is None: + # must have been a problem loading the shell + return + if self.application.namespace is None: + self.application.showNamespace() + + def setName( self, aString ) : + self.name = aString + + def getName( self ) : + return self.name + + def setImage(self, aPath): + self.image = aPath + # Call wxPython + #raise NotImplementedError + + def setTiled(self, aBoolean): + if isinstance(aBoolean, str): + if aBoolean == 'false': + aBoolean = False + else: + aBoolean = True + self.tiled = aBoolean + # Call wxPython + #raise NotImplementedError + + def _getName(self): + return self.name + + def getImage(self): + return self.image + + def getTiled(self): + return self.tiled + + # KEA 2004-03-17 + # the get/set methods above will go away before PythonCard-1.0 + # so that we can just use new-style class properties + + def _getPosition(self): + return self.GetPositionTuple() + + def _setPosition(self, aPosition): + self.SetPosition(aPosition) + + def _getSize(self): + return self.GetSizeTuple() + + def _setSize(self, aSize): + self.SetSize(aSize) + + def _getBackgroundColor(self): + return self.panel.getBackgroundColor() + + def _setBackgroundColor(self, aColor): + self.panel.setBackgroundColor(aColor) + + def _getForegroundColor(self): + return self.panel.getForegroundColor() + + def _setForegroundColor(self, aColor): + self.panel.setForegroundColor(aColor) + + + def enableCommand(self, aString, aBoolean=True): + """ + Fined every component with a 'command' attribute + that matches aString, and enable the component. + """ + self.menuBar.enableCommand(aString, aBoolean) + + for component in self.components.itervalues(): + if component.command == aString: + component.enabled = aBoolean + + def disableCommand(self, aString): + """ + Fined every component with a 'command' attribute + that matches aString, and disable the component. + """ + self.enableCommand(aString, False) + + def _initLayout(self, aResourceList): + """ + Create the gui Widgets for this Background and lay + them out in a Frame. + """ + self.panel = widget.Panel(self, self.image, self.tiled) + + for rsrc in aResourceList: + self.components[rsrc.name] = rsrc + + ## # KEA 2002-05-02 + ## # always create at least a File menu with Quit on the Mac + ## # so we automatically get the Apple menu... + ## def _createMacMenu(self): + ## mnu = wx.Menu() + ## id = wx.NewId() + ## mnu.Append(id, 'E&xit\tAlt+X') + ## + ## menubar = self.GetMenuBar() + ## if menubar is None: + ## menubar = wx.MenuBar() + ## self.SetMenuBar(menubar) + ## menubar.Append(mnu, 'File') + ## wx.EVT_MENU(self, id, self.on_exit_command) + + ## def exit(self): + ## """Exit the application by calling close() + ## on the main application window.""" + ## + ## # regardless of whether this is a child window + ## # or primary window of the application, this should + ## # give us the right window to close to quit the application + ## appWindow = self.application.getCurrentBackground() + ## appWindow.close() + + ## def on_exit_command(self, evt): + ## self.exit() + + ## def _createMenus(self, aResource): + ## # RDS - Only create a menubar if one is defined + ## # in the stack's resource file. + ## # This is a hack, I shouldn't be accessing + ## # the stack resource's __dict)__ directly. + ## if ('menubar' in aResource.__dict__) and (aResource.menubar is not None): + ## self.menuBar = menu.MenuBar(self, aResource.menubar) + ## elif wx.Platform == '__WXMAC__' and self.GetParent() is None: + ## # always create at least a File menu with Quit on the Mac + ## # so we automatically get the Apple menu... + ## # KEA 2004-03-01 + ## # the elif was updated to make sure we only create a menubar + ## # if the background has no parent, aka is the primary app window + ## self._createMacMenu() + ## + ## # KEA and as a further hack, I now add a Debug menu + ## # to the menubar. createMenu will create a menubar + ## # if one doesn't already exist + ## if self.application._showDebugMenu and self.GetParent() == None: + ## self.application._debugMenu = debug.DebugMenu(self.application) + ## self.application._debugMenu.createMenu(self) + ## self.application._debugMenu.bindMenuEvents(self) + + ## # 2001-11-08 + ## # hack to keep the statusbar text from being wiped out + ## def menuHighlight(self, event): + ## self.statusBar.text = self.statusBar.text + ## + ## # KEA 2004-04-14 + ## # subclasses of Background can override this method + ## # if they want to have a different style of statusBar + ## # OnCreateStatusBar is defined for wxFrame + ## # in wxWidgets, but not wxPython, so ignore OnCreateStatusBar + ## # in the wxWidgets docs + ## # need to verify that we don't need a more complex arg list + ## # since that will impact the call in _createStatusBar below + ## # this method is also defined for CustomDialog + ## def createStatusBar(self): + ## return statusbar.StatusBar(self) + ## + ## # KEA 2001-12-25 + ## # method now removes any existing statusbar if the resource + ## # doesn't specify one + ## # this is mostly for the resourceEditor and should have a clearer API + ## def _createStatusBar( self, aResource ) : + ## bar = self.GetStatusBar() + ## if ('statusBar' in aResource.__dict__) and aResource.statusBar: + ## if bar is None: + ## self.statusBar = self.createStatusBar() + ## self.SetStatusBar(self.statusBar) + ## if wx.Platform == '__WXMAC__': + ## #self.statusBar.PositionStatusBar() + ## pass + ## else: + ## if bar is not None: + ## self.SetStatusBar(None) + ## bar.Destroy() + ## # the statusbar changes the window size + ## # so this will for it back + ## #self.SetSize(self.GetSizeTuple()) + ## self.Fit() + ## self.statusBar = None + ## + ## + ## def _setIcon( self, aResource ) : + ## """Set icon based on resource values""" + ## if ('icon' in aResource.__dict__) and (aResource.icon is not None): + ## try: + ## icon = wx.Icon(aResource.icon, wx.BITMAP_TYPE_ICO) + ## self.SetIcon(icon) + ## except: + ## pass + + + ## def _bindWindowEvents(self): + ## wx.EVT_CLOSE(self, self.OnClose) + ## wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) + + ## # KEA 2004-05-09 + ## # this is necessary so that we don't try and dispatch + ## # the activate event which is sent after close + ## # this might not be needed if we start using bound + ## # events, but that will require more testing + ## def OnClose(self, evt): + ## # this will be found when the on_close method above + ## # or override calls close so that we can still + ## # disconnect the deactivateevent during close + ## # otherwise trying to dispatch to + ## self.Disconnect(-1, -1, ActivateEvent.id) + ## evt.Skip() + + ## # KEA 2002-07-09 + ## # make sure wxSTC text, bitmaps, etc. aren't lost + ## # when the app exits + ## def OnDestroy(self, evt): + ## # KEA 2004-04-16 + ## # stopLogging prevents the OleFlushClipboard message + ## # from being displayed at the console when the app quits + ## if self == evt.GetEventObject(): + ## stopLogging = wx.LogNull() + ## wx.TheClipboard.Flush() + ## del stopLogging + ## evt.Skip() + + ## def GetRestoredPosition(self): + ## if self.IsIconized(): + ## return self._restoredPosition + ## else: + ## return self.GetPositionTuple() + + ## def GetRestoredSize(self): + ## if self.IsIconized(): + ## return self._restoredSize + ## else: + ## return self.GetSizeTuple() + + ## def on_minimize(self, evt): + ## #print "minimize", evt.Iconized() + ## #print evt + ## #print evt.GetTimestamp() + ## #print "iconized", evt.Iconized() + ## #print self.GetPositionTuple() + ## #print self.GetSizeTuple() + ## if evt.Iconized() and self.GetPositionTuple() != (-32000, -32000): + ## self._restoredPosition = self.GetPositionTuple() + ## self._restoredSize = self.GetSizeTuple() + ## #print self.restoredPosition, self.restoredSize + ## evt.Skip() + + ## # KEA 2004-04-24 + ## # this doesn't appear to be hooked to an event + ## # did the binding get deleted or did we just + ## # never decide whether we wanted to have a separate + ## # event to denote exiting the app versus calling close + ## # on the main background to quit the app?! + ## def OnExit(self, evt): + ## self.close(True) + + # KEA 2004-04-26 + # why do we need the methods below?! + # what is the use case for them? + # findComponentsByClass has some value + # but any app that needs it can easily do the method itself + # I blew away the same methods in CustomDialog + # getComponent, getComponents, findAllComponents, findComponentsByClass + + # RDS = new API + def getComponent( self, path ) : + return eval( 'self.components.' + path ) + + # RDS - new API + def getComponents( self ) : + return self.findAllComponents() + + # RDS - deprecated + def findAllComponents( self ) : + """ + Return a copy of the list of Components in this + Background. We're not just returning + self.components.values because we don't want + someone to inadvertently whack the internal list + of Components. + """ + components = [] + for component in self.components.itervalues() : + components.append( component ) + return components + + def findComponentsByClass( self, aComponentClass ) : + """ + Return a list of Component's that are instances + of the specified Component class. + """ + components = [] + for component in self.components.itervalues() : + if isinstance( component, aComponentClass ) : + components.append( component ) + return components + + # KEA 2001-07-31 + # we may want to put this someplace else, but we do need access + # to the componenet list + def findFocus(self): + # the wxPython widget that has focus + widgetWX = wx.Window_FindFocus() + if widgetWX is None: + return None + else: + for widget in self.components.itervalues(): + if widgetWX == widget: + return widget + # is this even possible? focus in another window maybe? + return None + + ## # KEA 2004-03-17 + ## # mixedCase aliases + ## close = wx.Frame.Close + ## getParent = wx.Frame.GetParent + + # KEA 2004-03-17 + # define Python 2.2 new-style class properties + backgroundColor = property(_getBackgroundColor, _setBackgroundColor, doc="backgroundColor of the background") + foregroundColor = property(_getForegroundColor, _setForegroundColor, doc="foregroundColor of the background") + position = property(_getPosition, _setPosition, doc="position of the background") + size = property(_getSize, _setSize, doc="size of the background") + ## title = property(wx.Frame.GetTitle, wx.Frame.SetTitle) + visible = property(wx.Frame.IsShown, wx.Frame.Show, doc="whether the background window is visible") + + class CustomDialog( Scriptable, wx.Dialog, event.EventSource): """The dialog class used by all custom dialogs.""" Index: MANIFEST.in =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/MANIFEST.in,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MANIFEST.in 18 Aug 2004 22:18:49 -0000 1.15 --- MANIFEST.in 14 Sep 2004 17:28:45 -0000 1.16 *************** *** 9,12 **** --- 9,13 ---- prune samples/counter prune samples/fpop + prune samples/testNotebook exclude docs/html/linux_installation.html exclude docs/html/macosx_installation.html |
From: Kevin A. <ka...@us...> - 2004-09-14 17:28:56
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6255/samples/testNotebook Added Files: .cvsignore edit.gif minimal.py minimal.rsrc.py readme.txt testNotebook.py testNotebook.rsrc.py tile.bmp widgets.html widgets.py widgets.rsrc.py Log Message: added Notebook component added PageBackground class and pageWindow function added testNotebook sample for testing component and class --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log .DS_Store --- NEW FILE: edit.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tile.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testNotebook.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/14 17:28:46 $" """ import os, sys import wx from PythonCard import model import minimal import widgets class TestNotebook(model.Background): def on_initialize(self, event): panel = wx.Panel(self.components.notebook, -1) panel.text1 = wx.TextCtrl(panel, -1, 'Hello Notebook', (5, 5)) self.components.notebook.AddPage(panel, 'wx panel', True) # you can't add a wx.Frame to a notebook ## frame = wx.Frame(self.components.notebook, -1) ## frame.text1 = wx.TextCtrl(frame, -1, 'Notebook 2', (5, 5)) ## self.components.notebook.AddPage(frame, 'frame', True) win = model.pageWindow(self.components.notebook, minimal.Minimal) self.components.notebook.AddPage(win, 'minimal', True) print "adding page..." print self.components.notebook.GetPage(1).components.field1.text win2 = model.pageWindow(self.components.notebook, widgets.WidgetsTest) self.components.notebook.AddPage(win2, 'widgets', True) print "number of pages:", self.components.notebook.getPageCount() print "last page text: %s\n" % \ self.components.notebook.getPageText(self.components.notebook.getPageCount() - 1) def on_notebook_pageChanging(self, event): print "pageChanging - oldSelection: %d, selection: %d" % (event.oldSelection, event.selection) event.skip() def on_notebook_pageChanged(self, event): print "pageChanged - oldSelection: %d, selection: %d" % (event.oldSelection, event.selection) event.skip() if __name__ == '__main__': app = model.Application(TestNotebook) app.MainLoop() --- NEW FILE: widgets.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Simple HTML Example</title> </head> <body> <h2>Hello HTML</h2> <table border=1> <tr><td colspan=2>simple tables</td> </tr><tr><td>images</td><td><img src="edit.gif"/></td></tr> <tr><td>and...</td><td><a href="../simpleBrowser/index.html">links</a></td></tr> <tr><td colspan=2>see the <a href="../simpleBrowser/readme.txt">readme.txt</a> for more info</td></tr> </table> </body> </html> --- NEW FILE: minimal.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Minimal', 'backgrounds': [ { 'type':'Background', 'name':'bgMin', 'title':'Minimal PythonCard Application', 'size':( 200, 100 ), 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit' } ] } ] }, 'components': [ { 'type':'TextField', 'name':'field1', 'position':(5, 5), 'size':(150, -1), 'text':'Hello PythonCard' }, ] } ] } } --- NEW FILE: minimal.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/14 17:28:46 $" """ from PythonCard import model class Minimal(model.PageBackground): pass if __name__ == '__main__': app = model.Application(Minimal) app.MainLoop() --- NEW FILE: widgets.py --- #!/usr/bin/python """ KEA notes to myself __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/14 17:28:46 $" __author__ = "Kevin Altis <al...@se...>" """ from PythonCard import dialog, model import os import inspect import wx BORDER = 5 RESIZE_LEFT = 1 RESIZE_RIGHT = 2 DRAG_X = 3 RESIZE_TOP = 4 RESIZE_BOTTOM = 5 DRAG_Y = 6 class WidgetsTest(model.PageBackground): """ All the widgets that can be changed have a three-letter prefix followed by the actual classname to distinguish them from other widgets in the background. Compare the method of changing the attribute state in on_chkEnabled_mouseClick versus on_chkVisible_mouseClick. I'm using self.components.itervalues() to iterate over a list of all the widgets at once. """ def on_initialize(self, event): self.bitmapCanvasTest() def on_sldSlider_select(self, event): self.components.fldTextField.text = str(event.target.value) """ def on_spnSpinner_spinUp(self, event): event.target.value = event.target.value + 1 def on_spnSpinner_spinDown(self, event): event.target.value = event.target.value - 1 """ def bitmapCanvasTest(self): canvas = self.components.bmpBitmapCanvas canvas.drawPoint((5, 5)) canvas.foregroundColor = 'red' canvas.drawLine((5, 10), (20, 30)) canvas.foregroundColor = 'blue' canvas.drawRectangle((25, 5), (30, 20)) canvas.drawText('Text', (5, 30)) canvas.drawRotatedText('Rotated', (60, 40), 90) canvas.foregroundColor = 'gray' canvas.setFillColor('gray') canvas.drawEllipse((80, 5), (30, 30)) def on_chkEnabled_mouseClick(self, event): checked = event.target.checked for w in self.components.itervalues(): # for btnButton, wType would be widget.Button # __class__ would be widget.Button # we can't use isinstance unless we put it in a try/except # block because isinstance requires a valid class as the # 2nd argument, so passing in "elTextField" or something like # that triggers an exception # KEA 2001-08-09 # need a better way of getting the widget prefix dynamically # I've just gone soft in the head and can't see the right way here if w.__class__.__name__.startswith(w.name[3:]): w.enabled = checked self.components.fldTextFieldNoBorder.enabled = checked def on_chkVisible_mouseClick(self, event): print "on_chkVisible_mouseClick" checked = event.target.checked for w in self.components.itervalues(): if w.__class__.__name__.startswith(w.name[3:]): w.visible = checked self.components.fldTextFieldNoBorder.visible = checked # editable only applies to TextField, PasswordField, and TextArea def on_chkEditable_mouseClick(self, event): checked = event.target.checked self.components.fldTextField.editable = checked self.components.fldPasswordField.editable = checked self.components.fldTextArea.editable = checked self.components.fldTextFieldNoBorder.editable = checked def on_btnBackgroundColor_mouseClick(self, event): result = dialog.colorDialog(self) if result.accepted: color = result.color for w in self.components.itervalues(): if w.__class__.__name__.startswith(w.name[3:]): w.backgroundColor = color self.components.fldTextFieldNoBorder.backgroundColor = color # compare this method of expliciting setting each component # one at a time compared to the for loop above def on_btnForegroundColor_mouseClick(self, event): result = dialog.colorDialog(self) if result.accepted: color = result.color # print color self.components.btnButton.foregroundColor = color self.components.fldTextField.foregroundColor = color self.components.fldPasswordField.foregroundColor = color self.components.fldTextArea.foregroundColor = color self.components.txtStaticText.foregroundColor = color self.components.chkCheckBox.foregroundColor = color self.components.chkToggleButton.foregroundColor = color self.components.radRadioGroup.foregroundColor = color self.components.popChoice.foregroundColor = color self.components.lstList.foregroundColor = color self.components.sldSlider.foregroundColor = color self.components.imgImage.foregroundColor = color self.components.imgImageButton.foregroundColor = color self.components.fldTextFieldNoBorder.foregroundColor = color self.components.calCalendar.foregroundColor = color self.components.cmbComboBox.foregroundColor = color self.components.gagGauge.foregroundColor = color self.components.spnSpinner.foregroundColor = color self.components.linStaticLine.foregroundColor = color self.components.stbStaticBox.foregroundColor = color def on_btnFont_mouseClick(self, event): result = dialog.fontDialog(self, self.components.btnButton.font) if result.accepted: #color = result.color font = result.font for w in self.components.itervalues(): if w.__class__.__name__.startswith(w.name[3:]): w.font = font self.components.fldTextFieldNoBorder.font = font def on_btnToolTip_mouseClick(self, event): result = dialog.textEntryDialog(self, 'Enter a toolTip:', 'ToolTip', 'Hello toolTip') if result.accepted: txt = result.text for w in self.components.itervalues(): if w.__class__.__name__.startswith(w.name[3:]): w.toolTip = txt def on_btnBgBackgroundColor_mouseClick(self, event): result = dialog.colorDialog(self) if result.accepted: color = result.color self.backgroundColor = color """ experimental drag and resize code hold down the control key and mouseDown to drag a widget hold down the control key and mouseDown within 5 pixels of the edge of the widget to resize This seems to work okay on Windows, but not so well on Linux. My algorithm is probably not very good. """ def on_mouseDown(self, event): global BORDER if event.controlDown: # record the starting location so, that the drags are # always relative and the widget won't jump around self.dragOffset = event.position xClick, yClick = self.dragOffset size = event.target.size rect = (0, 0, size[0] - BORDER, size[1] - BORDER) print rect print xClick, yClick if xClick < BORDER: print "resize left" self.xOp = RESIZE_LEFT elif xClick > rect[2]: print "resize right" self.xOp = RESIZE_RIGHT else: print "drag x" self.xOp = DRAG_X if yClick < BORDER: print "resize top" self.yOp = RESIZE_TOP elif yClick > rect[3]: print "resize bottom" self.yOp = RESIZE_BOTTOM else: print "drag y" self.yOp = DRAG_Y event.skip() def on_mouseDrag(self, event): target = event.target if event.controlDown: xPos, yPos = target.position width, height = target.size newWidth = width newHeight = height print "xPos %d, yPos %d" % (xPos, yPos) if self.xOp == DRAG_X and self.yOp == DRAG_Y: xOff = xPos + event.x - self.dragOffset[0] yOff = yPos + event.y - self.dragOffset[1] print "xOff %d, yOff %d" % (xOff, yOff) target.position = (xOff, yOff) else: xOff = xPos if self.xOp == RESIZE_LEFT: # both width and the x position have to change xOff = xPos + event.x - self.dragOffset[0] newWidth = width + xPos - xOff #event.x + self.dragOffset[0] elif self.xOp == RESIZE_RIGHT: # RESIZE_RIGHT #newWidth += event.x - self.dragOffset[0] #newWidth += 1 newWidth = event.x print "width %d, newWidth %d" % (width, newWidth) yOff = yPos if self.yOp == RESIZE_TOP: # both height and the y position have to change yOff = yPos + event.y - self.dragOffset[1] newHeight = height + yPos - yOff #event.y + self.dragOffset[1] elif self.yOp == RESIZE_BOTTOM: # RESIZE_BOTTOM #newHeight += event.y - self.dragOffset[1] #newHeight += 1 newHeight = event.y print "height %d, newHeight %d" % (height, newHeight) print "xOff %d, yOff %d" % (xOff, yOff) if xPos != xOff or yPos != yOff: target.position = (xOff, yOff) if width != newWidth or height != newHeight: #target._delegate.SetSize((width, height)) target.SetSize((newWidth, newHeight)) #target._delegate.SetDimensions(xOff, yOff, newWidth, newHeight) event.skip() # KEA 2002-05-07 # some methods to build up component documentation # using the built-in component specs def getAttributesList(self, attributes): names = [a for a in attributes] names.sort() listX = [] for n in names: if attributes[n].hasDefaultValueList(): listX.append([n, attributes[n].getDefaultValueList()]) else: value = attributes[n].getDefaultValue() if value == '': value = "''" listX.append([n, value]) return listX def getEventsList(self, spec): events = [e.name for e in spec.getEvents()] events.sort() return events def getMethodsList(self, object): listX = [] methods = inspect.getmembers(object, inspect.ismethod) for m in methods: if m[0][0] in "abcdefghijklmnopqrstuvwxyz": listX.append(m[0]) return listX def on_menuFileDumpWidgets_select(self, event): self.dumpDocs() def dumpDocs(self): #try: result = dialog.directoryDialog(None, 'Create widgets_documention in:', '') if result.accepted: widgetsDir = result.path else: return widgetsDir = os.path.join(widgetsDir, 'components') if not os.path.exists(widgetsDir): os.mkdir(widgetsDir) imagesDir = os.path.join(widgetsDir, 'images') if not os.path.exists(imagesDir): os.mkdir(imagesDir) toc = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' toc += '<html>\n<head><title>%s</title></head><body>\n' % 'PythonCard Components' toc += '<h1>PythonCard Components</h1>\n' componentsList = [] for w in self.components.itervalues(): if w.__class__.__name__.startswith(w.name[3:]): # document each widget name = w.__class__.__name__ spec = w._spec doc = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' doc += '<html>\n<head><title>%s</title></head><body>\n' % (name + ': PythonCard component') doc += '<h1>Component: %s</h1>' % name doc += '\n<img src="%s"><BR>\n' % ('images/' + name + '.png') doc += '\n<h2>Required Attributes</h2>\n' doc += '<table border="1">\n' doc += '<tr><td><b>Name<b></td><td><b>Default value</b></td></tr>\n' for a in self.getAttributesList(spec.getRequiredAttributes()): doc += "<tr><td>%s</td><td>%s</td></tr>\n" % (a[0], a[1]) doc += '</table>' doc += '\n\n<h2>Optional Attributes</h2>\n' doc += '<table border="1">\n' doc += '<tr><td><b>Name<b></td><td><b>Default value</b></td></tr>\n' for a in self.getAttributesList(spec.getOptionalAttributes()): doc += "<tr><td>%s</td><td>%s</td></tr>\n" % (a[0], a[1]) doc += '</table>' doc += '\n\n<h2>Events:</h2>\n' doc += '<table border="1">\n' for e in self.getEventsList(spec): doc += "<tr><td>%s</td></tr>\n" % e doc += '</table>' doc += '\n\n<h2>Methods:</h2>\n' doc += '<table border="1">\n' td = '<td><b>%s</b></td>' * 4 tr = '<tr>' + td + '</tr>\n' doc += tr % ('method', 'args', 'doc string', 'comments') for e in self.getMethodsList(w): method = getattr(w, e) docstring = inspect.getdoc(method) if docstring is None: docstring = " " comments = inspect.getcomments(method) if comments is None: comments = " " #source = inspect.getcomments(method) argspec = inspect.getargspec(method) formattedargs = inspect.formatargspec(argspec[0], argspec[1], argspec[2], argspec[3]) doc += "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n" % \ (e, formattedargs, docstring, comments) doc += '</table>' # need to decide what we want to dump from the methods # we probably don't want to dump everything including # wxPython methods, so this is where we need to decide # on the case of the first letter of the method # whatever is done here should be the same thing used # to display methods in the shell # arg lists and tooltips (docstrings) will be used here too # write out the documentation for the component doc += '\n<hr><img src="http://sourceforge.net/sflogo.php?group_id=19015&type=1" width="88" height="31" border="0" alt="SourceForge Logo">' doc += '\n</body>\n</html>' filename = name + '.html' path = os.path.join(widgetsDir, filename) f = open(path, 'w') f.write(doc) f.close() # create an image using the actual component # on screen # comment this out once you have created the images # you want bmp = wx.EmptyBitmap(w.size[0], w.size[1]) memdc = wx.MemoryDC() memdc.SelectObject(bmp) dc = wx.WindowDC(w) memdc.BlitPointSize((0, 0), w.size, dc, (0, 0)) imgfilename = os.path.join(imagesDir, name + '.png') bmp.SaveFile(imgfilename, wx.BITMAP_TYPE_PNG) dc = None memdc.SelectObject(wx.NullBitmap) memdc = None bmp = None componentsList.append('<a href="%s">%s</a><br>\n' % (filename, name)) # now create the table of contents, index.html componentsList.sort() for c in componentsList: toc += c toc += '\n<hr><img src="http://sourceforge.net/sflogo.php?group_id=19015&type=1" width="88" height="31" border="0" alt="SourceForge Logo">' toc += '\n</body>\n</html>' filename = os.path.join(widgetsDir, 'index.html') f = open(filename, 'w') f.write(toc) f.close() #except: # pass if __name__ == '__main__': app = model.Application(WidgetsTest) app.MainLoop() --- NEW FILE: testNotebook.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Minimal', 'backgrounds': [ { 'type':'Background', 'name':'bgMin', 'title':'Notebook Test', 'size':( 800, 600 ), 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit' } ] } ] }, 'components': [ { 'type':'Notebook', 'name':'notebook', 'position':(5, 5), 'size':(785, 540), }, ] } ] } } --- NEW FILE: widgets.rsrc.py --- {'application':{'type':'Application', 'name':'StackWidgetsTest', 'backgrounds': [ {'type':'Background', 'name':'bgWidgets', 'title':'Widgets Test', 'position':(5, 5), 'size':(800, 600), 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'File', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileDumpWidgets', 'label':'Create Components Docs...', }, {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit', }, ] }, ] }, 'components': [ {'type':'ToggleButton', 'name':'chkToggleButton', 'position':(100, 225), 'size':(85, -1), 'label':'ToggleButton', }, {'type':'StaticText', 'name':'labelToggleButton', 'position':(5, 230), 'text':'ToggleButton:', }, {'type':'StaticText', 'name':'labelBitmapCanvas', 'position':(476, 496), 'text':'BitmapCanvas:', }, {'type':'BitmapCanvas', 'name':'bmpBitmapCanvas', 'position':(566, 494), 'size':(112, 50), 'backgroundColor':(255, 255, 255), }, {'type':'StaticText', 'name':'labelHtmlWindow', 'position':(546, 264), 'text':'HtmlWindow:', }, {'type':'HtmlWindow', 'name':'htmHtmlWindow', 'position':(540, 288), 'size':(195, 150), 'backgroundColor':(255, 255, 255), 'text':'widgets.html', }, {'type':'StaticBox', 'name':'stbStaticBox', 'position':(563, 449), 'size':(116, 32), 'label':'A StaticBox', }, {'type':'StaticText', 'name':'labelStaticBox', 'position':(498, 460), 'text':'StaticBox:', }, {'type':'StaticText', 'name':'labelSpinner', 'position':(228, 450), 'text':'Spinner:', }, {'type':'Spinner', 'name':'spnSpinner', 'position':(310, 450), 'max':100, 'min':1, 'value':93, }, {'type':'StaticText', 'name':'labelGauge', 'position':(228, 408), 'text':'Gauge:', }, {'type':'Gauge', 'name':'gagGauge', 'position':(310, 404), 'size':(128, -1), 'layout':'horizontal', 'max':100, 'value':50, }, {'type':'Calendar', 'name':'calCalendar', 'position':(299, 200), }, {'type':'StaticText', 'name':'labelCalendar', 'position':(228, 260), 'text':'Calendar:', }, {'type':'ComboBox', 'name':'cmbComboBox', 'position':(311, 364), 'size':(125, -1), 'items':['one', 'two', 'three'], 'stringSelection':'two', 'text':'two', }, {'type':'StaticText', 'name':'labelComboBox', 'position':(228, 370), 'text':'ComboBox:', }, {'type':'StaticBox', 'name':'StaticBox1', 'position':(543, 10), 'size':(250, 242), 'label':'Attributes', }, {'type':'StaticLine', 'name':'staticMenuUnderline', 'position':(0, 0), 'size':(800, -1), 'layout':'horizontal', }, {'type':'CheckBox', 'name':'chkEnabled', 'position':(550, 30), 'checked':True, 'label':'Enabled', }, {'type':'CheckBox', 'name':'chkVisible', 'position':(550, 50), 'checked':True, 'label':'Visible', }, {'type':'CheckBox', 'name':'chkEditable', 'position':(550, 70), 'checked':True, 'label':'Editable', }, {'type':'Button', 'name':'btnBackgroundColor', 'position':(550, 95), 'label':'BackgroundColor', }, {'type':'Button', 'name':'btnForegroundColor', 'position':(550, 125), 'label':'ForegroundColor', }, {'type':'Button', 'name':'btnFont', 'position':(550, 155), 'label':'Font', }, {'type':'Button', 'name':'btnToolTip', 'position':(550, 185), 'label':'ToolTip', }, {'type':'Button', 'name':'btnBgBackgroundColor', 'position':(550, 215), 'label':'Background BackgroundColor', }, {'type':'StaticText', 'name':'labelButton', 'position':(5, 5), 'text':'Button:', }, {'type':'StaticText', 'name':'labelTextField', 'position':(5, 35), 'text':'TextField:', }, {'type':'StaticText', 'name':'labelPasswordField', 'position':(5, 65), 'text':'PasswordField:', }, {'type':'StaticText', 'name':'labelTextArea', 'position':(5, 95), 'text':'TextArea:', }, {'type':'StaticText', 'name':'labelStaticText', 'position':(5, 170), 'text':'StaticText:', }, {'type':'StaticText', 'name':'labelCheckBox', 'position':(5, 200), 'text':'CheckBox:', }, {'type':'StaticText', 'name':'labelRadioGroup', 'position':(5, 260), 'text':'RadioGroup:', }, {'type':'StaticText', 'name':'labelChoice', 'position':(5, 360), 'text':'Choice:', }, {'type':'StaticText', 'name':'labelList', 'position':(5, 390), 'text':'List:', }, {'type':'StaticText', 'name':'labelSlider', 'position':(5, 490), 'text':'Slider:', }, {'type':'StaticText', 'name':'labelStaticLine', 'position':(5, 520), 'text':'StaticLine:', }, {'type':'StaticText', 'name':'labelImage', 'position':(315, 5), 'text':'Image:', }, {'type':'StaticText', 'name':'labelImageButton', 'position':(315, 110), 'text':'ImageButton:', }, {'type':'TextField', 'name':'fldTextFieldNoBorder', 'position':(315, 150), 'size':(180, -1), 'border':'none', 'text':'TextField with no border', }, {'type':'Button', 'name':'btnButton', 'position':(100, 4), 'label':'Button', }, {'type':'TextField', 'name':'fldTextField', 'position':(100, 32), 'size':(180, -1), }, {'type':'PasswordField', 'name':'fldPasswordField', 'position':(100, 62), 'size':(180, -1), }, {'type':'TextArea', 'name':'fldTextArea', 'position':(100, 92), 'size':(180, 60), 'text':'Use the checkboxes and buttons on the right to set the attributes of the widgets on the left.\n\nThe editable attribute only applies to TextField, PasswordFiled, and TextArea.', }, {'type':'StaticText', 'name':'txtStaticText', 'position':(100, 170), 'text':'StaticText', }, {'type':'CheckBox', 'name':'chkCheckBox', 'position':(100, 200), 'label':'CheckBox', }, {'type':'RadioGroup', 'name':'radRadioGroup', 'position':(100, 260), 'items':['one', 'two', 'three'], 'label':'A RadioBox', 'layout':'vertical', 'max':1, 'stringSelection':'one', }, {'type':'Choice', 'name':'popChoice', 'position':(100, 360), 'items':['one', 'two', 'three'], 'stringSelection':'two', }, {'type':'List', 'name':'lstList', 'position':(100, 390), 'size':(-1, 70), 'items':['one', 'two', 'three'], 'stringSelection':'three', }, {'type':'Slider', 'name':'sldSlider', 'position':(100, 490), 'size':(200, 20), 'layout':'horizontal', 'max':100, 'min':1, 'value':1, }, {'type':'StaticLine', 'name':'linStaticLine', 'position':(100, 520), 'size':(200, -1), 'layout':'horizontal', }, {'type':'ImageButton', 'name':'imgImageButton', 'position':(405, 110), 'border':'transparent', 'file':'edit.gif', }, {'type':'Image', 'name':'imgImage', 'position':(385, 5), 'file':'tile.bmp', }, ] # end components } # end background ] # end backgrounds } } --- NEW FILE: readme.txt --- Until we have a Notebook integrated into some of the other samples or tools this will serve as a basic test app, but I don't expect to include it in releases. |
From: Kevin A. <ka...@us...> - 2004-09-14 17:28:55
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6255/components Added Files: notebook.py Log Message: added Notebook component added PageBackground class and pageWindow function added testNotebook sample for testing component and class --- NEW FILE: notebook.py --- """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/14 17:28:45 $" """ import wx from PythonCard import event, widget class NotebookEvent(event.Event): def decorate(self, aWxEvent, source): aWxEvent = event.Event.decorate(self, aWxEvent, source) aWxEvent.oldSelection = aWxEvent.GetOldSelection() aWxEvent.selection = aWxEvent.GetSelection() return aWxEvent class NotebookPageChangedEvent(NotebookEvent): name = 'pageChanged' binding = wx.EVT_NOTEBOOK_PAGE_CHANGED id = wx.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED class NotebookPageChangingEvent(NotebookEvent): name = 'pageChanging' binding = wx.EVT_NOTEBOOK_PAGE_CHANGING id = wx.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING NotebookEvents = (NotebookPageChangedEvent, NotebookPageChangingEvent) class NotebookSpec(widget.WidgetSpec): def __init__(self): events = list(NotebookEvents) attributes = { # KEA 2004-09-14 # we could provide an attribute for the labels #'label' : { 'presence' : 'optional', 'default':'Button' }, #'default':{'presence':'optional', 'default':0} } widget.WidgetSpec.__init__(self, 'Notebook', 'Widget', events, attributes ) class Notebook(widget.Widget, wx.Notebook): _spec = NotebookSpec() def __init__(self, aParent, aResource): wx.Notebook.__init__(self, aParent, widget.makeNewId(aResource.id), aResource.position, aResource.size, style = wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS, name = aResource.name ) widget.Widget.__init__(self, aParent, aResource) self._bindEvents(self._spec._events) # KEA 2004-09-14 # rather than using all these methods there could # be a list wrapper where the __add__, __del__, etc. # methods call the right method below # but that might be needlessly complicated # I didn't add aliases for all methods # in particular I'm not sure about image support addPage = wx.Notebook.AddPage deleteAllPages = wx.Notebook.DeleteAllPages deletePage = wx.Notebook.DeletePage getPage = wx.Notebook.GetPage getPageCount = wx.Notebook.GetPageCount getPageText = wx.Notebook.GetPageText #getSelection = wx.Notebook.GetSelection insertPage = wx.Notebook.InsertPage removePage = wx.Notebook.RemovePage setPageText = wx.Notebook.SetPageText #setSelection = wx.Notebook.SetSelection selection = property(wx.Notebook.GetSelection, wx.Notebook.SetSelection) import sys from PythonCard import registry registry.Registry.getInstance().register(sys.modules[__name__].Notebook) |
From: Kevin A. <ka...@us...> - 2004-09-14 17:28:55
|
Update of /cvsroot/pythoncard/PythonCard/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6255/docs Modified Files: changelog.txt Log Message: added Notebook component added PageBackground class and pageWindow function added testNotebook sample for testing component and class Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/changelog.txt,v retrieving revision 1.305 retrieving revision 1.306 diff -C2 -d -r1.305 -r1.306 *** changelog.txt 4 Sep 2004 11:46:39 -0000 1.305 --- changelog.txt 14 Sep 2004 17:28:46 -0000 1.306 *************** *** 3,6 **** --- 3,7 ---- Release 0.8.1 2004-09-?? + added Notebook component, PageBackground, and testNotebook sample added relativePath to util.py added colorFromString to util.py |
From: Kevin A. <ka...@us...> - 2004-09-14 17:21:10
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4863/testNotebook Log Message: Directory /cvsroot/pythoncard/PythonCard/samples/testNotebook added to the repository |