[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7270 - in trunk/gnue-designer/src: . base base/tools reports/Sta
From: |
jcater |
Subject: |
[gnue] r7270 - in trunk/gnue-designer/src: . base base/tools reports/Standard schema uidrivers uidrivers/kde uidrivers/qt uidrivers/wx uidrivers/wx/startup |
Date: |
Mon, 28 Mar 2005 23:55:32 -0600 (CST) |
Author: jcater
Date: 2005-03-28 23:55:30 -0600 (Mon, 28 Mar 2005)
New Revision: 7270
Added:
trunk/gnue-designer/src/uidrivers/
trunk/gnue-designer/src/uidrivers/__init__.py
trunk/gnue-designer/src/uidrivers/kde/
trunk/gnue-designer/src/uidrivers/kde/Base.py
trunk/gnue-designer/src/uidrivers/kde/__init__.py
trunk/gnue-designer/src/uidrivers/qt/
trunk/gnue-designer/src/uidrivers/qt/Base.py
trunk/gnue-designer/src/uidrivers/qt/__init__.py
trunk/gnue-designer/src/uidrivers/wx/
trunk/gnue-designer/src/uidrivers/wx/Base.py
trunk/gnue-designer/src/uidrivers/wx/__init__.py
trunk/gnue-designer/src/uidrivers/wx/docks/
trunk/gnue-designer/src/uidrivers/wx/startup/
trunk/gnue-designer/src/uidrivers/wx/uihelpers/
Removed:
trunk/gnue-designer/src/base/docks/
trunk/gnue-designer/src/base/startup/
trunk/gnue-designer/src/base/uihelpers/
Modified:
trunk/gnue-designer/src/Designer.py
trunk/gnue-designer/src/base/Instance.py
trunk/gnue-designer/src/base/MenuBar.py
trunk/gnue-designer/src/base/tools/EventEditor.py
trunk/gnue-designer/src/reports/Standard/GroupEditor.py
trunk/gnue-designer/src/schema/TableEditor.py
trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py
Log:
started on modularizing/cleaning up Designer's usage of wxWidgets
Modified: trunk/gnue-designer/src/Designer.py
===================================================================
--- trunk/gnue-designer/src/Designer.py 2005-03-28 09:19:21 UTC (rev 7269)
+++ trunk/gnue-designer/src/Designer.py 2005-03-29 05:55:30 UTC (rev 7270)
@@ -19,7 +19,7 @@
# Copyright 2001-2005 Free Software Foundation
#
# FILE:
-# GFDesigner.py
+# Designer.py
#
# DESCRIPTION:
#
@@ -29,7 +29,7 @@
from gnue.common.apps import RuntimeSettings
from StringIO import StringIO
-from wxPython.wx import *
+#from wxPython.wx import *
from gnue.common.apps.GClientApp import GClientApp
from gnue.common.apps import GDebug
from gnue.common.utils.FileUtils import dyn_import
@@ -38,11 +38,10 @@
from base import TemplateParser, TemplateChooser, MRUManager
from gnue.forms.GFConfig import ConfigOptions
from base.Config import ConfigOptions as DesignerConfigOptions
-from gnue.forms.uidrivers.wx.GFwxApp import setWxApp
import time
-class Designer(GClientApp, wxApp):
+class Designer(GClientApp):
# GClientApp stuff...
NAME = PACKAGE
@@ -56,7 +55,7 @@
USAGE = GClientApp.USAGE + " [file] [file] ..."
USE_DATABASE_OPTIONS = 1
- def __init__(self):
+ def __init__(self):
GClientApp.__init__(self, application="forms",defaults=ConfigOptions)
self._instances = []
@@ -66,74 +65,72 @@
self.configurationManager.registerAlias('gConfigNav', 'navigator')
self.configurationManager.registerAlias('gConfigForms', 'forms')
self.configurationManager.registerAlias('gConfigReports', 'reports')
-
- # Setup the Most Recently Used URL manager
- self.mru = MRUManager.MRUManager(self)
-
- # Set Form's wxApp, so it doesn't try to create another.
- setWxApp(self)
-
- # Reuse the login handler from Form's wx driver
- # This has to happen after setWxApp, otherwise bad things happen
- from gnue.forms.uidrivers.wx import UILoginHandler
- self.getConnectionManager().setLoginHandler(UILoginHandler())
-
- # get list of available modules
- self.loadModuleInformation()
- wxApp.__init__(self,0) # 0 prevents IO redirect
-
# ==========================================================================
# Startup functions
- # ==========================================================================
+ # ==========================================================================
def run(self):
"""
- Startup logic for Designer. Currently just a wrapper for wxPython's
wxApp.MainLoop()
+ Startup logic for Designer.
"""
- self.MainLoop()
-
- def OnInit(self):
+ print "Running"
+
+ # TODO: make a startup/GConfig parameter, and/or do auto-detection
+ from gnue.designer.uidrivers.wx.Base import UIBase
+
+ self.ui = UIBase(self)
+
+
+ # Setup the Most Recently Used URL manager
+ self.mru = MRUManager.MRUManager(self)
+
+ # get list of available modules
+ self.loadModuleInformation()
+
+ self.ui.run()
+
+
+ def init(self):
"""
- Standard wxApp OnInit function.
- Designer uses it to display the startup screen and
- load the initial editor instance
-
- @rtype: boolean
- @return: Always true
+ Called by the UI Driver after the graphics subsystem is ready.
+ At this point, we can start loading/drawing.
"""
- wxInitAllImageHandlers()
+ print "Init'ing"
# Init the splashscreen
- from base.startup import Startup
- self.startup = Startup()
+ self.ui.createStartupSplash()
gStartupStatus(_('Initializing Client Library'))
- # Load the specified file, a requested new instance, or the default empty
instance
+ # Load the specified file, a requested new instance, or the default empty
instance
if len(self.ARGUMENTS):
for arg in self.ARGUMENTS:
- self.SetTopWindow(self.load(arg))
-
+ #self.SetTopWindow(self.load(arg))
+ self.load(arg)
+
elif self.OPTIONS['new']:
try:
- self.SetTopWindow(self.newInstance(self.OPTIONS['new']))
+ #self.SetTopWindow(self.newInstance(self.OPTIONS['new']))
+ self.newInstance(self.OPTIONS['new'])
except ImportError:
raise
- 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']))
else:
# TODO: What to do when no object is specified on command line?
# TODO: jcater thinks of some task selector like kword uses,
# TODO: or, restore the session to the way it was (same files, etc)
- self.SetTopWindow(self.newInstance('forms'))
+ #self.SetTopWindow(self.newInstance('forms'))
+ self.newInstance('forms')
# Close startup screen
- self.startup.pauseAndClose()
- return true
+ self.ui.closeStartupSplash()
+ return True
def loadModuleInformation(self):
"""
- Loads all the available editor modules into memory and
+ Loads all the available editor modules into memory and
extracts from them a list of file types/extensions
that they support
"""
@@ -143,14 +140,14 @@
self.supportedOpenWildcard = "" #
self.moduleExtensionMapping = {} # A dictionary of {file extension:
designer module}
- wildcard = ""
+ wildcard = []
alltypes = []
# TODO: wxWidgets currently doesn't consistently support multiple file
# TODO: extension wildcards (e.g., "All GNUe Form Files (*.gfd,*.gfl)").
# TODO: However, the code is left commented out in case some day it does.
-
+
for module in SupportedModules:
self.supportedModuleObjects.append((module.properties.nickname, module))
@@ -165,15 +162,14 @@
# Make the "default" file extension for a module
# appear before the other extensions.
- wildcard += "%s (*.%s)|*.%s|" % \
- (
module.properties.fileExtensions[module.properties.defaultFileExtension],
- module.properties.defaultFileExtension,
- module.properties.defaultFileExtension)
+ wildcard += [
+ ( module.properties.defaultFileExtension,
+
module.properties.fileExtensions[module.properties.defaultFileExtension]) ]
for type in module.properties.fileExtensions.keys():
if type != module.properties.defaultFileExtension:
- wildcard += "%s (*.%s)|*.%s|" % \
- ( module.properties.fileExtensions[type], type, type)
+ wildcard += [
+ ( type, module.properties.fileExtensions[type]) ]
alltypes.append(type)
# Keep a dict of Extension::Handler mappings
@@ -185,20 +181,19 @@
## string.join(alltypes,';*.') ) \
## + wildcard \
## + "All Files (*.*)|*.*"
- self.supportedOpenWildcard = wildcard \
- + "All Files (*.*)|*.*"
+ self.supportedOpenWildcard = wildcard + [('*',"All Files")]
# ==========================================================================
# Instance functions
- # ==========================================================================
+ # ==========================================================================
def load(self, file):
"""
- Loads the requested file into a new instance of the appropriate
+ Loads the requested file into a new instance of the appropriate
designer module if the extension is recognized.
-
+
@type file: string
@param file: The url of the file to open.
@rtype: designer editor instance
- @return: An instance of the appropriate editor module or None if
+ @return: An instance of the appropriate editor module or None if
an error is encountered
"""
gStartupStatus(_('Loading document'))
@@ -212,26 +207,26 @@
# TODO: (gnue.designer.SupportedModules).properties object.
# TODO: [gnue.designer.SupportedModules is a list]
- # TODO: Shouldn't this display graphically?
+ # TODO: Shouldn't this display graphically?
print "I do not know what to do with a .%s file!" % extension
return None
return self.newInstance(self.moduleExtensionMapping[extension], file)
-
+
def newInstance(self, module, *args, **parms):
"""
Creates an instance of the appropriate designer editor module
"""
- c = dyn_import("gnue.designer.%s.Instance" % module).Instance
- return c(self, *args, **parms)
+ c = dyn_import("gnue.designer.%s.Instance" % module).Instance(self, *args,
**parms)
+ return c
def addInstance(self, instance):
"""
Adds a newly created instance to the list of open instances
- Sets several event handlers in the instance to point back to
+ Sets several event handlers in the instance to point back to
this class so it can proxy the events for the instance.
-
+
@type instance: Designer Editor Module
@param instance: An instance of a designer module
"""
@@ -250,20 +245,20 @@
def removeInstance(self, instance):
"""
Removes an instance from the list of open instances
-
+
@type instance: Designer Editor Module
@param instance: An instance of a designer module
- """
+ """
self._instances.remove(instance)
-
+
# ==========================================================================
# Proxy event functions
- # ==========================================================================
+ # ==========================================================================
def OnWizard(self, event):
"""
Handles the request to display the wizard selection dialog
-
+
type event: GNUe Event
param event: The event request
"""
@@ -274,29 +269,25 @@
def OnOpen(self, event):
"""
Handles the request to open a file
-
+
type event: GNUe Event
param event: The event request
"""
- print dir(event)
- dlg = wxFileDialog(NULL, _("Open GNUe File..."), defaultDir=os.getcwd(),
- wildcard = self.supportedOpenWildcard,
- style=wxOPEN)
- if dlg.ShowModal() == wxID_OK:
- if self.isFileOpened(dlg.GetPath()):
- # TODO: Um, something better than this!!!
- print "File is already opened!"
+ path = self.ui.dialogOpenFile(_("Open GNUe File..."),
+ wildcards = self.supportedOpenWildcard)
+
+ if path:
+ if self.isFileOpened(path):
+ self.ui.dialogOk( _("File is already opened."), _("Notice"))
else:
- self.load(dlg.GetPath())
+ self.load(path)
- dlg.Destroy()
-
def OnOpenRecent(self, event):
"""
Handles the request to open a recent opened URL
-
+
type event: GNUe Event
param event: The event request
"""
@@ -308,7 +299,7 @@
def OnExit(self, event=None):
"""
Handles the request for application exit
-
+
type event: GNUe Event
param event: The event request
"""
@@ -324,7 +315,7 @@
def OnSaveAll(self, event):
"""
Handles the request for all instances to save their files
-
+
type event: GNUe Event
param event: The event request
"""
@@ -335,11 +326,11 @@
def OnAbout(self, event):
"""
Handles the request for an about box
-
+
type event: GNUe Event
param event: The event request
"""
-
+
imports = []
for f in ('common','forms','reports','appserver','navigator'):
try:
@@ -356,61 +347,59 @@
imports.append('Python Version %s' % v.replace('\n','\n '))
- dlg = wxMessageDialog(NULL, self.NAME + " " +
- _("Version ") + self.VERSION + "\n\n" +
- _("Copyright 2001-2005 Free Software
Foundation\n\n") +
- _("Environment:\n %s\n\n") %
string.join(imports,'\n ') +
- _("For help, email address@hidden"),
- _("About ") + self.NAME,
style=wxOK|wxICON_INFORMATION)
- dlg.ShowModal()
- dlg.Destroy()
+ self.ui.dialogOk(self.NAME + " " +
+ _("Version ") + self.VERSION + "\n\n" +
+ _("Copyright 2001-2005 Free Software Foundation\n\n") +
+ _("Environment:\n %s\n\n") % string.join(imports,'\n ')
+
+ _("For help, email address@hidden"),
+ _("About ") + self.NAME)
def OnNew(self, event):
"""
Handles the request when for a new instance of a designer editor module
-
+
type event: GNUe Event
param event: The event request
"""
self.newInstance(event.type)
-
+
# ==========================================================================
# Support functions
# ==========================================================================
-
+
def isDirty(self):
"""
Determines if all instances currently have unsaved edits.
-
+
@rtype: boolean
@return: True if any instance contains unsaved information
- False if all instances are saved
+ False if all instances are saved
"""
- isdirty = false
+ isdirty = False
for instance in self._instances:
if instance.isDirty():
isdirty = true
break
return isdirty
-
+
def isFileOpened(self, location):
"""
Determines if an instance already has the requested file open.
- TODO: Currently this function is not implemented. It always
+ TODO: Currently this function is not implemented. It always
returns false.
-
+
@rtype: boolean
@return: True if any instance contains the requested file
False if the file is not currently loaded
"""
- return false
+ return False
def RunWizard(self, templateInformation):
"""
-
+
"""
product = templateInformation['Product']
templateSupport = dyn_import('gnue.designer.%s.TemplateSupport' % product)
Modified: trunk/gnue-designer/src/base/Instance.py
===================================================================
--- trunk/gnue-designer/src/base/Instance.py 2005-03-28 09:19:21 UTC (rev
7269)
+++ trunk/gnue-designer/src/base/Instance.py 2005-03-29 05:55:30 UTC (rev
7270)
@@ -39,7 +39,6 @@
from gnue.designer.base.MenuBar import MenuBar
from gnue.designer.base.UndoManager import UndoManager
from gnue.designer.base.ToolBase import ToolBase
-from gnue.designer.base.docks.Docker import Docker
from gnue.designer.base.ObjectList import ObjectList
from gnue.designer.base import TemplateBase
from gnue.designer.base.TemplateParser import WizardRunner
@@ -48,6 +47,8 @@
from ModuleSupport import SupportedModules
from gnue.designer.base import Goat
+from gnue.designer.uidrivers.wx.docks.Docker import Docker
+
TITLE=PACKAGE
class BaseInstance(wxFrame, EventController):
@@ -139,7 +140,7 @@
self._makeBackup = True
self._isNew = True
- self._app = app
+ self._app = self.base = app
self.connections = app.connections
self.nameMappings = {}
self.usedNames = []
@@ -181,11 +182,12 @@
if not os.access (location, os.R_OK):
self.Show(True)
- if wxMessageDialog(self,
+ if not self.base.ui.dialogYesNo(
_('The requested file does not exist.\n') +
_('Do you want to create this file?') +
_('\n\nFile: %s') \
- % location, _("File Not Found"), wxYES_NO|wxICON_QUESTION
).ShowModal() == wxID_NO:
+ % location, _("File Not Found"), self):
+ # TODO: Is this right?
sys.exit()
self.Show(0)
self.__createEmptyInstance(style)
@@ -194,11 +196,12 @@
elif not os.access (location, os.W_OK):
self.Show(True)
- if wxMessageDialog(self, \
+ if not self.base.ui.dialogCancel(
_('The requested file is Read Only.\n') +
_('To save any changes, you will \n') +
_('be required to do a "Save As..."\n\nFile: %s') \
- % location, _("Read Only Warning"),
wxOK|wxCANCEL|wxICON_EXCLAMATION ).ShowModal() == wxID_CANCEL:
+ % location, _("Read Only Warning"), self) :
+ # TODO: Is this right?
sys.exit()
self.Show(0)
self.__loadFromFile(location)
@@ -311,7 +314,8 @@
# Add supported tools to File|New
for tool in SupportedModules:
- self.menubar.addAction('File|New', '&%s' %
tool.properties.nickname,'RequestNew', 100,
+ self.menubar.addAction('File|New', '&%s' % tool.properties.nickname,
+ 'RequestNew', 100,
help=_('Create a new %s') % string.lower(tool.properties.nickname),
eventdata={'type': tool.properties.module })
# Add connections
@@ -599,38 +603,34 @@
def OnSaveAs(self, event):
- wildcard = ""
+ wildcards = []
# Make the "default" file extension for a tool
# appear before the other extensions.
filterIndex = [self.properties.defaultFileExtension]
- wildcard += "%s (*.%s)|*.%s|" % \
- ( self.properties.fileExtensions[self.properties.defaultFileExtension],
- self.properties.defaultFileExtension,
- self.properties.defaultFileExtension)
+ wildcards += [
+ ( self.properties.defaultFileExtension,
+ self.properties.fileExtensions[self.properties.defaultFileExtension]) ]
for type in self.properties.fileExtensions.keys():
if type != self.properties.defaultFileExtension:
- wildcard += "%s (*.%s)|*.%s|" % \
- ( self.properties.fileExtensions[type], type, type)
+ wildcards += [
+ ( type, self.properties.fileExtensions[type]) ]
filterIndex.append(type)
- dlg = wxFileDialog(self, _("Save %s As...") % self.properties.description,
defaultDir=os.getcwd(),
- wildcard = wildcard,
- style=wxSAVE)
+ path = self.base.ui.dialogSaveFile(_("Save %s As...") %
self.properties.description,
+ wildcards = wildcards,
+ parentWindow=self)
- if dlg.ShowModal() == wxID_OK:
- path = dlg.GetPath()
- if len(path) < 4 or not (path[-4] == '.' and string.lower(path[-3:]) in
self.properties.fileExtensions.keys()):
- path += "." + filterIndex[dlg.GetFilterIndex()]
+ if path:
+# if len(path) < 4 or not (path[-4] == '.' and string.lower(path[-3:])
in self.properties.fileExtensions.keys()):
+# path += "." + filterIndex[dlg.GetFilterIndex()]
if os.path.isfile(path):
- dlg = wxMessageDialog(NULL,
+ path = self.base.ui.dialogYesNo(
_('The file "%s".\n' % path) +
_("exists. Overwrite?"),
- _("Unsaved Changes"), style=wxYES_NO|wxICON_WARNING)
- save = dlg.ShowModal()
- dlg.Destroy()
- if save == wxID_NO:
+ _("Unsaved Changes"), icon="warn")
+ if not path:
self.OnSaveAs(event)
return
@@ -638,20 +638,17 @@
self.SetTitle (TITLE + " - " + self._path)
self.save()
- dlg.Destroy()
def OnClose(self, event):
if self.isDirty():
- dlg = wxMessageDialog(NULL,
+ save = self.base.ui.dialogYesNoCancel(
_("This document has unsaved changes.\n") +
_("Save changes before closing?"),
- _("Unsaved Changes"), style=wxYES_NO|wxCANCEL|wxICON_WARNING)
- save = dlg.ShowModal()
- dlg.Destroy()
- if save == wxID_YES:
+ _("Unsaved Changes"), icon="warn")
+ if save == True:
self.OnSave(event)
- elif save == wxID_CANCEL:
+ elif save == -1:
event.Veto()
return
Modified: trunk/gnue-designer/src/base/MenuBar.py
===================================================================
--- trunk/gnue-designer/src/base/MenuBar.py 2005-03-28 09:19:21 UTC (rev
7269)
+++ trunk/gnue-designer/src/base/MenuBar.py 2005-03-29 05:55:30 UTC (rev
7270)
@@ -132,14 +132,14 @@
item = wxMenuItem(menu, mid, text, help,
(canToggle and [wxITEM_CHECK] or [wxITEM_NORMAL])[0])
if canToggle:
- EVT_MENU(self.instance._app, mid,
+ EVT_MENU(self.instance.base.ui, mid,
lambda event, l=self.instance, m=item, e=action, x=eventdata:
l.dispatchEvent('%s:%s' % (m.IsChecked() and 'Show' or
'Hide',e), **x))
self.instance.registerEventListeners( {
'Show:%s' % action: lambda event, m=item: m.Check(1),
'Hide:%s' % action: lambda event, m=item: m.Check(0) })
else:
- EVT_MENU(self.instance._app, mid,
+ EVT_MENU(self.instance.base.ui, mid,
lambda event, l=self.instance, e=action, x=eventdata:
l.dispatchEvent(e, **x))
if canDisable:
Modified: trunk/gnue-designer/src/base/tools/EventEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/EventEditor.py 2005-03-28 09:19:21 UTC
(rev 7269)
+++ trunk/gnue-designer/src/base/tools/EventEditor.py 2005-03-29 05:55:30 UTC
(rev 7270)
@@ -35,7 +35,7 @@
from gnue.common.logic.GTrigger import GTrigger
from gnue.common.definitions.GParserHelpers import GContent
from gnue.designer.base.ToolBase import *
-from gnue.designer.base.uihelpers.GridCellEditors import CharCellEditor
+from gnue.designer.uidrivers.wx.uihelpers.GridCellEditors import CharCellEditor
class EventEditor (ToolBase):
Modified: trunk/gnue-designer/src/reports/Standard/GroupEditor.py
===================================================================
--- trunk/gnue-designer/src/reports/Standard/GroupEditor.py 2005-03-28
09:19:21 UTC (rev 7269)
+++ trunk/gnue-designer/src/reports/Standard/GroupEditor.py 2005-03-29
05:55:30 UTC (rev 7270)
@@ -34,7 +34,7 @@
from gnue.common.formatting import GTypecast
from gnue.common.logic.GTrigger import GTrigger
from gnue.common.definitions.GParserHelpers import GContent
-from gnue.designer.base.uihelpers.GridCellEditors import *
+from gnue.designer.uidrivers.wx.uihelpers.GridCellEditors.GridCellEditors
import *
from gnue.designer.base.ToolBase import *
Columns = [ ('name','Name'),
Modified: trunk/gnue-designer/src/schema/TableEditor.py
===================================================================
--- trunk/gnue-designer/src/schema/TableEditor.py 2005-03-28 09:19:21 UTC
(rev 7269)
+++ trunk/gnue-designer/src/schema/TableEditor.py 2005-03-29 05:55:30 UTC
(rev 7270)
@@ -35,7 +35,7 @@
from gnue.common.logic.GTrigger import GTrigger
from gnue.common.definitions.GParserHelpers import GContent
from gnue.designer.base.ToolBase import *
-from gnue.designer.base.uihelpers.GridCellEditors import *
+from gnue.designer.uidrivers.wx.uihelpers.GridCellEditors import *
Columns = [ ('name','Name'),
('type','Data Type'),
Added: trunk/gnue-designer/src/uidrivers/__init__.py
===================================================================
Added: trunk/gnue-designer/src/uidrivers/kde/Base.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/kde/Base.py 2005-03-28 09:19:21 UTC
(rev 7269)
+++ trunk/gnue-designer/src/uidrivers/kde/Base.py 2005-03-29 05:55:30 UTC
(rev 7270)
@@ -0,0 +1,31 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2005 Free Software Foundation
+#
+# FILE:
+# Base.py
+#
+# DESCRIPTION:
+"""
+UI Driver for KDE 3.x -- Primarily reuses the QT driver with KDE dialogs
+"""
+# NOTES:
+#
+
+from gnue.designer.uidrivers.qt.Base import *
Added: trunk/gnue-designer/src/uidrivers/kde/__init__.py
===================================================================
Added: trunk/gnue-designer/src/uidrivers/qt/Base.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/qt/Base.py 2005-03-28 09:19:21 UTC
(rev 7269)
+++ trunk/gnue-designer/src/uidrivers/qt/Base.py 2005-03-29 05:55:30 UTC
(rev 7270)
@@ -0,0 +1,29 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2005 Free Software Foundation
+#
+# FILE:
+# Base.py
+#
+# DESCRIPTION:
+"""
+UI Driver for QT 3
+"""
+# NOTES:
+#
Added: trunk/gnue-designer/src/uidrivers/qt/__init__.py
===================================================================
Added: trunk/gnue-designer/src/uidrivers/wx/Base.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/Base.py 2005-03-28 09:19:21 UTC
(rev 7269)
+++ trunk/gnue-designer/src/uidrivers/wx/Base.py 2005-03-29 05:55:30 UTC
(rev 7270)
@@ -0,0 +1,241 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2005 Free Software Foundation
+#
+# FILE:
+# Base.py
+#
+# DESCRIPTION:
+"""
+UI Driver for wxWidgets 2.4
+"""
+# NOTES:
+#
+
+import sys, os, string
+from wxPython.wx import *
+from startup.Startup import Startup
+from gnue.forms.uidrivers.wx.GFwxApp import setWxApp
+
+class UIBase(wxApp):
+
+
+ ######################################################################
+ ######################################################################
+ ######################################################################
+ ###
+ ### Public methods
+ ###
+ ######################################################################
+ ######################################################################
+ ######################################################################
+
+ def run(self):
+
+ # Set form's wx app to be us
+ setWxApp(self)
+
+ # Reuse the login handler from Form's wx driver
+ # This has to happen after setWxApp, otherwise bad things happen
+ from gnue.forms.uidrivers.wx import UILoginHandler
+ self.app.getConnectionManager().setLoginHandler(UILoginHandler())
+
+ # Call wx's MainLoop
+ self.app.init()
+ self.MainLoop()
+
+
+ ######################################################################
+ #
+ # Startup Splash Screen
+ #
+ ######################################################################
+ def createStartupSplash(self):
+ self.__splash = Startup()
+
+ def closeStartupSplash(self):
+ self.__splash.pauseAndClose()
+
+ ######################################################################
+ #
+ # Common dialogs
+ #
+ ######################################################################
+ def dialogOk(self, text, title, parentWindow=None, icon="information",
_cancel=False):
+ """
+ icon can be "question", "information", or "warn"
+ @rtype: boolean
+ @returns: True
+ """
+ if _cancel:
+ buttonStyle = wxOK|wxCANCEL
+ else:
+ buttonStyle = wxOK
+
+ if icon == 'question':
+ iconStyle = wxICON_QUESTION
+ elif icon == "warn":
+ iconStyle = wxICON_EXCLAMATION
+ elif icon == 'information':
+ iconStyle = wxICON_INFORMATION
+ else:
+ # TODO: assert? error?
+ iconStyle = wxICON_INFORMATION
+ return wxMessageDialog(parentWindow or NULL, text, title,
+ buttonStyle|iconStyle ).ShowModal() == wxID_OK
+
+
+ def dialogCancel(self, text, title, parentWindow=None, icon="warn"):
+ """
+ icon can be "question", "information", or "warn"
+ @rtype: boolean
+ @returns: True
+ """
+ return self.dialogOk(text, title. parentWindow, icon, _cancel=True)
+
+
+ def dialogYesNo(self, text, title, parentWindow=None, icon="question"):
+ """
+ icon can be "question", "information", or "warn"
+ @rtype: boolean
+ @returns: True if user selected Yes, False otherwise.
+ """
+ if icon == 'question':
+ iconStyle = wxICON_QUESTION
+ elif icon == "warn":
+ iconStyle = wxICON_EXCLAMATION
+ elif icon == 'information':
+ iconStyle = wxICON_INFORMATION
+ else:
+ # TODO: assert? error?
+ iconStyle = wxICON_INFORMATION
+
+ return wxMessageDialog(parentWindow or NULL, text, title,
+ wxYES_NO|iconStyle ).ShowModal() == wxID_YES
+
+ def dialogYesNoCancel(self, text, title, parentWindow=None, icon="question"):
+ """
+ icon can be "question", "information", or "warn"
+ @rtype: int
+ @returns: True (1) if user selected Yes, False (0) if No, -1 if canceled.
+ """
+ if icon == 'question':
+ iconStyle = wxICON_QUESTION
+ elif icon == "warn":
+ iconStyle = wxICON_EXCLAMATION
+ elif icon == 'information':
+ iconStyle = wxICON_INFORMATION
+ else:
+ # TODO: assert? error?
+ iconStyle = wxICON_INFORMATION
+
+ rv = wxMessageDialog(parentWindow or NULL, text, title,
+ wxYES_NO|wxCANCEL|iconStyle ).ShowModal()
+ if rv == wxID_YES:
+ return True
+ elif rv == wxID_NO:
+ return False
+ else:
+ return -1
+
+ def dialogOpenFile(self, title, wildcards, parentWindow=None):
+ """
+ Prompts the user for a file to open.
+
+ wildcards is a tuple of tuples, such as:
+ (('*.*','All Files'), ('*.py','Python Scripts'))
+
+ @rtype: string
+ @returns: None if no file selected, or a full
+ path name otherwise.
+ """
+
+ wcstring = ""
+ for extension, description in wildcards:
+ wcstring += "%s (*.%s)|*.%s|" % (description, extension, extension)
+
+ dlg = wxFileDialog(parentWindow or NULL, title, defaultDir=os.getcwd(),
+ wildcard = wcstring,
+ style=wxOPEN)
+ if dlg.ShowModal() != wxID_OK:
+ return None
+ else:
+ return dlg.GetPath()
+
+ def dialogSaveFile(self,title, wildcards, parentWindow=None):
+ """
+ Prompts the user for a file name to save as.
+
+ @rtype: string
+ @returns: None if no file selected, or a full
+ path name otherwise.
+ """
+ wcstring = ""
+ for extension, description in wildcards:
+ wcstring += "%s (*.%s)|*.%s|" % (description, extension, extension)
+
+ dlg = wxFileDialog(parentWindow or NULL, title,
+ defaultDir=os.getcwd(),
+ wildcard = wcstring,
+ style=wxSAVE)
+ if dlg.ShowModal() != wxID_OK:
+ return None
+ else:
+ return dlg.GetPath()
+
+
+ ##########################################################
+ ##########################################################
+ ##########################################################
+ ###
+ ### Internal Methods
+ ###
+ ##########################################################
+ ##########################################################
+ ##########################################################
+
+ ##########################################################
+ #
+ # wxApp methods
+ #
+ ##########################################################
+ def OnInit(self):
+ """
+ Standard wxApp OnInit function.
+ Designer uses it to display the startup screen and
+ load the initial editor instance
+
+ @rtype: boolean
+ @return: Always true
+ """
+ return True
+
+ ##########################################################
+ #
+ # Misc internal methods
+ #
+ ##########################################################
+
+ def __init__(self, app):
+ print "__init__"
+ self.app = app
+ wxApp.__init__(self, False) # prevents IO redirect
+ wxInitAllImageHandlers()
+
+
Added: trunk/gnue-designer/src/uidrivers/wx/__init__.py
===================================================================
Copied: trunk/gnue-designer/src/uidrivers/wx/docks (from rev 7269,
trunk/gnue-designer/src/base/docks)
Copied: trunk/gnue-designer/src/uidrivers/wx/startup (from rev 7269,
trunk/gnue-designer/src/base/startup)
Modified: trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py
===================================================================
--- trunk/gnue-designer/src/base/startup/Startup.py 2005-03-28 09:19:21 UTC
(rev 7269)
+++ trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py 2005-03-29
05:55:30 UTC (rev 7270)
@@ -1,3 +1,29 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2005 Free Software Foundation
+#
+# FILE:
+# Startup.py
+#
+# DESCRIPTION:
+#
+# NOTES:
from wxPython.wx import *
@@ -8,11 +34,12 @@
__builtin__.__dict__['gStartupStatus'] = lambda string:string
splashloc =
os.path.join(GConfig.getInstalledBase('designer_images','common_images')
,'designer', 'splash.png')
-splashbitmap = wxImage(splashloc,
- wxBITMAP_TYPE_PNG).ConvertToBitmap()
class Startup(wxSplashScreen):
def __init__(self):
+ splashbitmap = wxImage(splashloc,
+ wxBITMAP_TYPE_PNG).ConvertToBitmap()
+
__builtin__.__dict__['gStartupStatus'] = self.startupStatus
wxSplashScreen.__init__(self, splashbitmap,
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,400, None, -1,
Copied: trunk/gnue-designer/src/uidrivers/wx/uihelpers (from rev 7269,
trunk/gnue-designer/src/base/uihelpers)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7270 - in trunk/gnue-designer/src: . base base/tools reports/Standard schema uidrivers uidrivers/kde uidrivers/qt uidrivers/wx uidrivers/wx/startup,
jcater <=