16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2001-2002 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# GFDesigner.py |
# GFDesigner.py |
25 |
# |
# |
26 |
# NOTES: |
# NOTES: |
27 |
|
|
28 |
import sys, os |
import sys, os, string |
29 |
|
from gnue.common import RuntimeSettings |
30 |
|
|
31 |
###################### |
###################### |
32 |
# |
# |
64 |
from gnue.common import GDebug |
from gnue.common import GDebug |
65 |
from gnue.common.FileUtils import dyn_import |
from gnue.common.FileUtils import dyn_import |
66 |
from gnue.designer import VERSION, PACKAGE |
from gnue.designer import VERSION, PACKAGE |
67 |
from ToolSupport import SupportedTools |
from base.ToolSupport import SupportedTools |
68 |
import TemplateParser, TemplateChooser, MRUManager |
from base import TemplateParser, TemplateChooser, MRUManager |
69 |
from gnue.forms.GFConfig import ConfigOptions |
from gnue.forms.GFConfig import ConfigOptions |
70 |
from Config import ConfigOptions as DesignerConfigOptions |
from base.Config import ConfigOptions as DesignerConfigOptions |
71 |
|
|
72 |
from gnue.forms.uidrivers.wx import UIdriver as UIwxpython |
from gnue.forms.uidrivers.wx import UILoginHandler # import UIdriver as UIwxpython |
73 |
|
|
74 |
|
|
75 |
class Designer(GClientApp, wxApp): |
class Designer(GClientApp, wxApp): |
81 |
SUMMARY = _("A graphical tool for the rapid deployment of GNU Enterprise forms and reports.") |
SUMMARY = _("A graphical tool for the rapid deployment of GNU Enterprise forms and reports.") |
82 |
COMMAND_OPTIONS = [ |
COMMAND_OPTIONS = [ |
83 |
[ 'new', 'n', 'new', 1, None, 'module', |
[ 'new', 'n', 'new', 1, None, 'module', |
84 |
_('Starts up opening a new instance of <module>, where module can be form, report, etc.') ], |
_('Starts up opening a new instance of <module>, where module can be forms, reports, schema, etc.') ], |
85 |
] |
] |
86 |
|
|
87 |
USAGE = GClientApp.USAGE + " [file] [file] ..." |
USAGE = GClientApp.USAGE + " [file] [file] ..." |
95 |
self.configurationManager.registerAlias('gConfigForms', 'forms') |
self.configurationManager.registerAlias('gConfigForms', 'forms') |
96 |
self.configurationManager.registerAlias('gConfigReports', 'reports') |
self.configurationManager.registerAlias('gConfigReports', 'reports') |
97 |
|
|
98 |
self.getConnectionManager().setLoginHandler(UIwxpython.UILoginHandler()) |
self.getConnectionManager().setLoginHandler(UILoginHandler()) |
99 |
self.loadToolInformation() |
self.loadToolInformation() |
100 |
wxApp.__init__(self,0) |
wxApp.__init__(self,0) |
101 |
|
|
110 |
try: |
try: |
111 |
self.SetTopWindow(self.newInstance(self.OPTIONS['new'])) |
self.SetTopWindow(self.newInstance(self.OPTIONS['new'])) |
112 |
except ImportError: |
except ImportError: |
113 |
|
raise |
114 |
self.handleStartupError('"%s" is not a valid option for --new' % self.OPTIONS['new']) |
self.handleStartupError('"%s" is not a valid option for --new' % self.OPTIONS['new']) |
115 |
|
|
116 |
else: |
else: |
156 |
product = templateInformation['Product'] |
product = templateInformation['Product'] |
157 |
templateSupport = dyn_import('gnue.designer.%s.TemplateSupport' % product) |
templateSupport = dyn_import('gnue.designer.%s.TemplateSupport' % product) |
158 |
|
|
159 |
instance = self.newInstance(product) |
try: |
160 |
|
style = templateInformation['ProductStyle'] |
161 |
|
except: |
162 |
|
style = None |
163 |
|
|
164 |
|
instance = self.newInstance(product, style=style) |
165 |
|
|
166 |
if not TemplateParser.TemplateParser(instance, instance.rootObject, |
if not TemplateParser.TemplateParser(instance, instance.rootObject, |
167 |
instance, templateInformation).run(): |
instance, templateInformation).run(): |
207 |
return |
return |
208 |
|
|
209 |
for instance in self._instances: |
for instance in self._instances: |
210 |
instance.Destroy() |
instance.Close() |
211 |
|
# |
212 |
|
# If this Close() causes issues you can replace |
213 |
|
# with the following. |
214 |
|
# |
215 |
|
#RuntimeSettings.saveRuntimeSettings(instance) |
216 |
|
#instance.Destroy() |
217 |
|
|
218 |
def OnSaveAll(self, event): |
def OnSaveAll(self, event): |
219 |
for instance in self._instances: |
for instance in self._instances: |
221 |
instance.OnSave(event) |
instance.OnSave(event) |
222 |
|
|
223 |
def OnAbout(self, event): |
def OnAbout(self, event): |
224 |
dlg = wxMessageDialog(NULL, self.NAME + "\n" + |
imports = [] |
225 |
_("GNUe Rapid Application Development.\n\n") + |
for f in ('common','forms','reports','appserver','navigator'): |
226 |
|
try: |
227 |
|
v = {} |
228 |
|
exec 'from gnue.%s import __version__, PACKAGE' % f in v |
229 |
|
imports.append('%s Version %s' % (v['PACKAGE'], v['__version__'])) |
230 |
|
except: |
231 |
|
pass |
232 |
|
|
233 |
|
from wxPython import __version__ as v |
234 |
|
imports.append('wxPython Version %s' % v) |
235 |
|
|
236 |
|
from sys import version as v |
237 |
|
imports.append('Python Version %s' % v.replace('\n','\n ')) |
238 |
|
|
239 |
|
|
240 |
|
dlg = wxMessageDialog(NULL, self.NAME + " " + |
241 |
_("Version ") + self.VERSION + "\n\n" + |
_("Version ") + self.VERSION + "\n\n" + |
242 |
"Copyright 2001-2002 Free Software Foundation\n\n " + |
_("Copyright 2001-2003 Free Software Foundation\n\n") + |
243 |
|
_("Environment:\n %s\n\n") % string.join(imports,'\n ') + |
244 |
_("For help, email info@gnue.org."), |
_("For help, email info@gnue.org."), |
245 |
_("About ") + self.NAME, style=wxOK|wxICON_INFORMATION) |
_("About ") + self.NAME, style=wxOK|wxICON_INFORMATION) |
246 |
dlg.ShowModal() |
dlg.ShowModal() |