daboide Commit Revision 219 Date: 2005-10-31 17:16:55 -0800 (Mon, 31 Oct 2005) Author: paul
Changed: U trunk/wizards/AppWizardX/spec-App.py U trunk/wizards/AppWizardX/spec-main.py
Log: Modified the AppWizardX generated code to optionally instantiate MDI forms. To do this, create an application using AppWizardX, and then edit your 'main' script. Uncomment the 'dabo.settings.MDI = True' line close to the top.
If you choose an MDI setup, a main form will instantiate with one child form. If you don't go with MDI, one form will instantiate and there will be no main form.
Diff: Modified: trunk/wizards/AppWizardX/spec-App.py =================================================================== --- trunk/wizards/AppWizardX/spec-App.py 2005-10-31 06:25:17 UTC (rev 218) +++ trunk/wizards/AppWizardX/spec-App.py 2005-11-01 01:16:55 UTC (rev 219) @@ -4,7 +4,9 @@ class App(dabo.dApp): def initProperties(self): - self.MainFormClass = None + if not dabo.settings.MDI: + # no need for main form: + self.MainFormClass = None ## The following information can be used in various places in your app: self.setAppInfo("appName", "%(appName)s") @@ -15,3 +17,11 @@ self.setAppInfo("companyEmail", "Your company email") self.setAppInfo("companyUrl", "Your company url") + + def setup(self): + App.doDefault() + mf = self.MainForm + if mf: + fileMenu = mf.MenuBar.getMenu("File") + fileMenu.prependMenu(self.ui.MenFileOpen(fileMenu)) +
Modified: trunk/wizards/AppWizardX/spec-main.py =================================================================== --- trunk/wizards/AppWizardX/spec-main.py 2005-10-31 06:25:17 UTC (rev 218) +++ trunk/wizards/AppWizardX/spec-main.py 2005-11-01 01:16:55 UTC (rev 219) @@ -2,6 +2,11 @@ import sys import dabo + +## Uncomment the following line to get a MDI-interface, which should be usable +## on all platforms but is implemented better on Windows. +#dabo.settings.MDI = True + dabo.ui.loadUI("wx") from App import App import db @@ -25,8 +30,9 @@ # Set up a global connection to the database that all bizobjs will share: app.dbConnection = dabo.db.dConnection(app.dbConnectionDefs[dbConnectionDef]) + # Open one of the defined forms: -frm = ui.Frm%(tableName)s() +frm = ui.Frm%(tableName)s(app.MainForm) frm.show() # Start the application event loop:
©2005 Paul McNett |