From: Kevin A. <ka...@us...> - 2004-05-10 00:46:05
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16543 Modified Files: menu.py model.py widget.py Log Message: removed Stack class, changed self.stack.app references to self.application changed childWindow, Background, and CustomDialog inits so stack arg isn't passed in. only did minimal testing of tools and samples Index: widget.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/widget.py,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** widget.py 5 May 2004 20:27:09 -0000 1.127 --- widget.py 10 May 2004 00:45:17 -0000 1.128 *************** *** 245,253 **** background = wx.GetTopLevelParent(self) - # where should this check go? - # should we just set a "global" in the app instance such as - # self.stack.app.bindUnusedEvents - # this kind of thing isn't going to work for Rowland's compound - # components if wx.GetApp()._showDebugMenu: bindUnusedEvents = True --- 245,248 ---- Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -d -r1.168 -r1.169 *** model.py 9 May 2004 19:46:05 -0000 1.168 --- model.py 10 May 2004 00:45:17 -0000 1.169 *************** *** 151,155 **** else: rsrc = resource.ResourceFile(filename).getResource() ! return frameClass(parent.stack, parent, rsrc.stack.backgrounds[0]) --- 151,155 ---- else: rsrc = resource.ResourceFile(filename).getResource() ! return frameClass(parent, rsrc.stack.backgrounds[0]) *************** *** 337,341 **** colourdb.updateColourDB() - def showPropertyEditor(self): if self._showDebugMenu: --- 337,340 ---- *************** *** 407,415 **** self.namespaceFrame.Show(self._showNamespace) # wxWindows calls this method to initialize the application def OnInit(self): log.debug('Initializing Background...') ! self._stack = Stack(self, self.resource) ! ## bg = self._stack.getBackgrounds()[0] self.showPropertyEditor() --- 406,422 ---- self.namespaceFrame.Show(self._showNamespace) + def _initBackgrounds(self, aResource): + for bgRsrc in aResource.stack.backgrounds: + bg = self.frameClass(None, bgRsrc) + self.backgrounds.append(bg) + + def getBackgrounds(self): + return self.backgrounds + # wxWindows calls this method to initialize the application def OnInit(self): log.debug('Initializing Background...') ! self.backgrounds = [] ! self._initBackgrounds(self.resource) self.showPropertyEditor() *************** *** 421,425 **** def getCurrentBackground(self): #return self._iterator.getCurrentBackground() ! return self._stack.getBackgrounds()[0] # RDS - new API --- 428,432 ---- def getCurrentBackground(self): #return self._iterator.getCurrentBackground() ! return self.getBackgrounds()[0] # RDS - new API *************** *** 569,604 **** - class Stack( event.Changeable, Scriptable ) : - """ - Models an application written for the PythonCard environment. - """ - - def __init__( self, aApplication, aResource ) : - """ - Initialize this instance. - """ - self.id = wx.NewId() - event.Changeable.__init__( self ) - Scriptable.__init__( self, None ) - self.app = aApplication - self._name = aResource.stack.name - self.backgrounds = [] - self._initBackgrounds( aResource ) - self.curBg = self.backgrounds[ 0 ] - - def _initBackgrounds( self, aResource ) : - backgrounds = aResource.stack.backgrounds - for bgRsrc in backgrounds : - bg = self.app.frameClass(self, None, bgRsrc) - self.backgrounds.append( bg ) - - def getBackgrounds( self ) : - ## return copy.copy( self.backgrounds ) - return self.backgrounds - - def getName( self ) : - return self._name - - class Background(Scriptable, wx.Frame, event.EventSource): """ --- 576,579 ---- *************** *** 606,618 **** """ ! def __init__(self, aStack, aParent, aBgRsrc): """ Initialize this instance. """ ! Scriptable.__init__(self, aStack) event.EventSource.__init__(self) self.id = wx.NewId() - self.stack = aStack self.resource = aBgRsrc self.setName(aBgRsrc.name) self.setImage(aBgRsrc.image) --- 581,593 ---- """ ! 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) *************** *** 663,667 **** if aParent is None: ! self.stack.app.SetTopWindow(self) # KEA 2002-04-26 --- 638,642 ---- if aParent is None: ! self.application.SetTopWindow(self) # KEA 2002-04-26 *************** *** 828,851 **** # if the shell isn't needed def loadShell(self): ! if self.stack.app.shell is None: ! temp = self.stack.app._showDebugMenu ! self.stack.app._showDebugMenu = 1 ! self.stack.app.showShell() ! self.stack.app._showDebugMenu = temp # KEA 2003-07-22 # I don't think this is needed since showShell will # run the pycrustrc.py file(s) ! #self.stack.app.OnRunPycrustrc(None) def loadNamespace(self): self.loadShell() ! if self.stack.app.shell is None: # must have been a problem loading the shell return ! if self.stack.app.namespace is None: ! temp = self.stack.app._showDebugMenu ! self.stack.app._showDebugMenu = 1 ! self.stack.app.showNamespace() ! self.stack.app._showDebugMenu = temp def setName( self, aString ) : --- 803,826 ---- # if the shell isn't needed def loadShell(self): ! if self.application.shell is None: ! temp = self.application._showDebugMenu ! self.application._showDebugMenu = 1 ! self.application.showShell() ! self.application._showDebugMenu = temp # KEA 2003-07-22 # I don't think this is needed since showShell will # run the pycrustrc.py file(s) ! #self.application.OnRunPycrustrc(None) 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: ! temp = self.application._showDebugMenu ! self.application._showDebugMenu = 1 ! self.application.showNamespace() ! self.application._showDebugMenu = temp def setName( self, aString ) : *************** *** 958,962 **** # or primary window of the application, this should # give us the right window to close to quit the application ! appWindow = self.stack.app.getCurrentBackground() appWindow.close() --- 933,937 ---- # 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() *************** *** 982,989 **** # to the menubar. createMenu will create a menubar # if one doesn't already exist ! if self.stack.app._showDebugMenu and self.GetParent() == None: ! self.stack.app._debugMenu = debug.DebugMenu(self.stack.app) ! self.stack.app._debugMenu.createMenu(self) ! self.stack.app._debugMenu.bindMenuEvents(self) # 2001-11-08 --- 957,964 ---- # 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 *************** *** 1177,1183 **** Initialize this instance. """ ! Scriptable.__init__( self, aBg.stack ) self.parent = aBg # KEA 2002-09-13 --- 1152,1159 ---- Initialize this instance. """ ! Scriptable.__init__( self, None) self.parent = aBg + self.application = wx.GetApp() # KEA 2002-09-13 Index: menu.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/menu.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** menu.py 6 May 2004 17:33:13 -0000 1.36 --- menu.py 10 May 2004 00:45:17 -0000 1.37 *************** *** 95,103 **** background = aScriptable - # where should this check go? - # should we just set a "global" in the app instance such as - # self.stack.app.bindUnusedEvents - # this kind of thing isn't going to work for Rowland's compound - # components if wx.GetApp()._showDebugMenu: bindUnusedEvents = True --- 95,98 ---- |