[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8350 - in trunk/gnue-designer/src: . base base/tools forms/PageP
From: |
jcater |
Subject: |
[gnue] r8350 - in trunk/gnue-designer/src: . base base/tools forms/PagePainter forms/PagePainter/skins ui/wx ui/wx/uihelpers/doccanvas |
Date: |
Mon, 3 Apr 2006 23:07:32 -0500 (CDT) |
Author: jcater
Date: 2006-04-03 23:07:30 -0500 (Mon, 03 Apr 2006)
New Revision: 8350
Added:
trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py
Removed:
trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/colors.py
Modified:
trunk/gnue-designer/src/Designer.py
trunk/gnue-designer/src/base/Document.py
trunk/gnue-designer/src/base/tools/EventEditor.py
trunk/gnue-designer/src/forms/PagePainter/PagePainter.py
trunk/gnue-designer/src/forms/PagePainter/skins/default.py
trunk/gnue-designer/src/forms/PagePainter/skins/term.py
trunk/gnue-designer/src/ui/wx/Instance.py
trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py
trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/widget.py
Log:
added font mapping
Modified: trunk/gnue-designer/src/Designer.py
===================================================================
--- trunk/gnue-designer/src/Designer.py 2006-04-04 02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/Designer.py 2006-04-04 04:07:30 UTC (rev 8350)
@@ -22,6 +22,7 @@
# $Id$
"""
+Main Designer class
"""
import sys, os, string
@@ -61,10 +62,12 @@
NAME = PACKAGE
VERSION = VERSION
COMMAND = "gnue-designer"
- SUMMARY = u_("A graphical tool for the rapid deployment of GNU Enterprise
forms and reports.")
+ SUMMARY = u_("A graphical tool for the rapid deployment of " + \
+ "GNU Enterprise forms and reports.")
COMMAND_OPTIONS = [
[ 'new', 'n', 'new', 1, None, 'module',
- u_('Starts up opening a new instance of <module>, where module can
be forms, reports, schema, etc.') ],
+ u_('Starts up opening a new instance of <module>, ' + \
+ 'where module can be forms, reports, schema, etc.') ],
]
USAGE = GClientApp.USAGE + " [file] [file] ..."
USE_DATABASE_OPTIONS = 1
@@ -75,14 +78,15 @@
self._instances = []
# Load the configuration information
-
self.configurationManager.loadApplicationConfig(section="designer",defaults=DesignerConfigOptions)
+ self.configurationManager.loadApplicationConfig(section="designer",
+ defaults=DesignerConfigOptions)
self.configurationManager.registerAlias('gConfigNav', 'navigator')
self.configurationManager.registerAlias('gConfigForms', 'forms')
self.configurationManager.registerAlias('gConfigReports', 'reports')
- #
==========================================================================
+ # ================================================================
# Startup functions
- #
==========================================================================
+ # ================================================================
def run(self):
"""
Startup logic for Designer.
@@ -116,7 +120,8 @@
gStartupStatus(u_('Initializing Client Library'))
print gStartupStatus
- # 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))
@@ -128,7 +133,8 @@
self.newDocument(self.OPTIONS['new'])
except ImportError:
raise
- self.handleStartupError('"%s" is not a valid option for --new'
% (
+ self.handleStartupError(
+ '"%s" is not a valid option for --new' % (
self.OPTIONS['new']))
else:
@@ -151,9 +157,9 @@
"""
gStartupStatus(u_('Loading available tool modules'))
- self.supportedModuleObjects = [] # A list of supported modules along
with their "nickname"
+ self.supportedModuleObjects = [] # (supported modules, "nickname")
self.supportedOpenWildcard = "" #
- self.moduleExtensionMapping = {} # A dictionary of {file extension:
designer module}
+ self.moduleExtensionMapping = {} # {file extension: designer module}
wildcard = []
alltypes = []
@@ -164,7 +170,8 @@
for module in SupportedModules:
- self.supportedModuleObjects.append((module.properties.nickname,
module))
+ self.supportedModuleObjects.append(
+ (module.properties.nickname, module))
## if len(module.properties.fileExtensions.keys()) > 1:
@@ -179,7 +186,8 @@
# appear before the other extensions.
wildcard += [
( module.properties.defaultFileExtension,
-
module.properties.fileExtensions[module.properties.defaultFileExtension]) ]
+ module.properties.fileExtensions[
+ module.properties.defaultFileExtension]) ]
for type in module.properties.fileExtensions.keys():
if type != module.properties.defaultFileExtension:
@@ -199,9 +207,9 @@
self.supportedOpenWildcard = wildcard + [('*',"All Files")]
- #
==========================================================================
+ # ================================================================
# Document functions
- #
==========================================================================
+ # ================================================================
def load(self, file):
"""
Loads the requested file into a new instance of the appropriate
@@ -235,7 +243,8 @@
"""
Creates an instance of the appropriate designer editor module
"""
- c = dyn_import("gnue.designer.%s.Document" % module).Document(self,
*args, **parms)
+ c = dyn_import("gnue.designer.%s.Document" % module).Document(
+ self, *args, **parms)
return c
def addDocument(self, instance):
@@ -269,9 +278,9 @@
self._instances.remove(instance)
- #
==========================================================================
+ # ================================================================
# Proxy event functions
- #
==========================================================================
+ # ================================================================
def OnWizard(self, event):
"""
Handles the request to display the wizard selection dialog
@@ -354,7 +363,8 @@
try:
v = {}
exec 'from gnue.%s import __version__, PACKAGE' % f in v
- imports.append('%s Version %s' % (v['PACKAGE'],
v['__version__']))
+ imports.append('%s Version %s' % (v['PACKAGE'],
+ v['__version__']))
except:
pass
@@ -365,16 +375,18 @@
imports.append('Python Version %s' % v.replace('\n','\n '))
- self.ui.dialogOk(self.NAME + " " +
- u_("Version ") + self.VERSION + "\n\n" +
- u_("Copyright 2001-2006 Free Software
Foundation\n\n") +
- u_("Environment:\n %s\n\n") %
string.join(imports,'\n ') +
- u_("For help, email address@hidden"),
- u_("About ") + self.NAME)
+ self.ui.dialogOk(
+ self.NAME + " " +
+ u_("Version ") + self.VERSION + "\n\n" +
+ u_("Copyright 2001-2006 Free Software Foundation\n\n") +
+ u_("Environment:\n %s\n\n") % string.join(imports,'\n ') +
+ u_("For help, email address@hidden"),
+ u_("About ") + self.NAME)
def OnNew(self, event):
"""
- Handles the request when for a new instance of a designer editor module
+ Handles the request when for a new
+ instance of a designer editor module
type event: GNUe Event
param event: The event request
@@ -382,9 +394,9 @@
self.newDocument(event.type)
- #
==========================================================================
+ # ================================================================
# Support functions
- #
==========================================================================
+ # ================================================================
def isDirty(self):
"""
@@ -420,7 +432,8 @@
"""
product = templateInformation['Product']
- templateSupport = dyn_import('gnue.designer.%s.TemplateSupport' %
product)
+ templateSupport = dyn_import(
+ 'gnue.designer.%s.TemplateSupport' % product)
try:
style = templateInformation['ProductStyle']
@@ -429,7 +442,8 @@
instance = self.newDocument(product, style=style)
- if not TemplateParser.TemplateParser(instance, instance.rootObject,
+ if not TemplateParser.TemplateParser(
+ instance, instance.rootObject,
instance.ui, templateInformation).run():
instance.ui.close()
Modified: trunk/gnue-designer/src/base/Document.py
===================================================================
--- trunk/gnue-designer/src/base/Document.py 2006-04-04 02:39:47 UTC (rev
8349)
+++ trunk/gnue-designer/src/base/Document.py 2006-04-04 04:07:30 UTC (rev
8350)
@@ -28,18 +28,18 @@
__all__ = ['BaseInstance']
-#----------------------------------------------------------------------------
+# -----------------------------------------------------------------
# System imports
-#----------------------------------------------------------------------------
+# -----------------------------------------------------------------
import sys
import os
import time
import dircache
import new
-#----------------------------------------------------------------------------
+# -----------------------------------------------------------------
# GNUe Imports
-#----------------------------------------------------------------------------
+# -----------------------------------------------------------------
from gnue.common.apps import GDebug
from gnue.common.apps import RuntimeSettings
from gnue.common.utils.FileUtils import dyn_import
@@ -57,15 +57,15 @@
from ModuleSupport import SupportedModules
-#============================================================================
+# ===================================================================
# Base document class
-#============================================================================
+# ===================================================================
class BaseDocument(EventController):
- #==========================================================================
+ # ===============================================================
# Virtual functions (Override these functions in your Instance)
- #==========================================================================
+ # ===============================================================
wizardRunner = WizardRunner
def init(self):
@@ -88,8 +88,8 @@
def loadEmpty(self, style=None):
"""
- Called to load an "empty" (new) object. Create the root object
- and any initial child objects (if appropriate)
+ Called to load an "empty" (new) object. Create the root
+ object and any initial child objects (if appropriate)
"""
return None
@@ -145,19 +145,19 @@
return {'object': self._currentObject}
- #==========================================================================
+ # ===============================================================
# Public Functions
- #==========================================================================
+ # ===============================================================
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
# Register interface elements
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
def addTool(self, id, title, baseclass, hotkey=None, menuGroup=499):
"""
Add a ToolBase instance
"""
- self._toolCache.append( (id, title, baseclass, hotkey, menuGroup) )
+ self._toolCache.append((id, title, baseclass, hotkey, menuGroup))
def registerEditor(self, baseclass, gtype, filter=None):
@@ -182,9 +182,9 @@
self._editorMapping[gtype1] = (filter, baseclass)
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
# Set the saved/unsaved status
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
def save(self):
@@ -221,8 +221,10 @@
# Place a timestamp in the XML as a comment
# TODO: Replace with Dublin Core?
fileHandle.write(('<!-- %s (%s)\n%s Saved on: %s -->\n\n' \
- % (TITLE, VERSION, (len(self.wizardName) and (" Created by " +
self.wizardName + "\n") or ""),\
- time.strftime("%Y-%m-%d %H:%M:%S",
time.localtime(time.time())))).encode('UTF-8'))
+ % (TITLE, VERSION, (len(self.wizardName) and (
+ " Created by " + self.wizardName + "\n") or ""),\
+ time.strftime("%Y-%m-%d %H:%M:%S",
+ time.localtime(time.time())))).encode('UTF-8'))
fileHandle.write(''.join(["<!--%s-->\n\n" % comment.encode('UTF-8') \
for comment in self.rootObject._rootComments]))
@@ -256,9 +258,9 @@
self.dispatchEvent('MakeClean')
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
# GObject convenience methods
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
def getNextGenericName (self, type):
return self.getUniqueName(type.capitalize() + '1')
@@ -297,9 +299,9 @@
return rv
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
# Return, or create, an ObjectList based on the xml tag
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
def getObjectList(self, tag):
try:
return self.objectLists[tag]
@@ -328,9 +330,9 @@
return list
- #==========================================================================
+ # ================================================================
# Private functions
- #==========================================================================
+ # ================================================================
def __init__(self, app, location=None, buffer=None, style=None):
EventController.__init__(self)
@@ -383,7 +385,8 @@
self.init()
# Register ourself with RuntimeSettings
- RuntimeSettings.init(configFilename="gnue-des.ini",
homeConfigDir=".gnue")
+ RuntimeSettings.init(configFilename="gnue-des.ini",
+ homeConfigDir=".gnue")
RuntimeSettings.registerInstance(self)
# Tell RuntimeSettings that we have information to save
@@ -396,7 +399,8 @@
# Set up the Undo/Redo Manager
UndoManager(self)
- # Load any files specified on the command line, or create a new
document
+ # Load any files specified on the command
+ # line, or create a new document
if location == None:
if buffer != None:
@@ -508,23 +512,42 @@
self.menubar.addMenu(location, text, grouping)
for location, event, text, hotkey, help, grouping in (
- ('File', 'RequestOpen', u_('&Open'), 'Ctrl+O', u_("Open an existing
document"), 200.1),
- ('File|Open Recent', 'XXXX', u_('&Foo'), None, u_("This is a
placeholder for the Open Recent menu"), 200.1),
- ('File|New', 'RequestNewWizard', u_('From &Wizard...'), None,
u_("Create a new document using a wizard"), 900.1),
- ('File', 'RequestSave', u_("&Save"), 'Ctrl+S', u_("Save the current
document"),300.1),
- ('File', 'RequestSaveAs', u_("Save &As..."),None, u_("Save the
current document under a new name"), 300.2),
- ('File', 'RequestSaveAll', u_("Save A&ll"),None,u_("Save all open
document"),300.3),
- ('File', 'RequestRevert', u_("Reload"), None, u_("Reload the
current document as of its last save (abandoning any changes)"), 500),
- ('File', 'RequestClose', u_("&Close"), 'Ctrl+W', u_("Close the
current document"), 990),
- ('File', 'RequestExit', u_("E&xit"), None, u_("Exit GNUe
Designer"), 995),
- ('Edit', 'RequestUndo', u_("&Undo"), 'Ctrl+Z', u_("Undo the last
action"), 100.1),
- ('Edit', 'RequestRedo', u_("&Redo"), 'Ctrl+Y', u_("Redo the last
undo action"), 100.2),
- ('Edit', 'RequestCut', u_("Cu&t"), 'Ctrl+X', u_("Cut the current
object and move to the clipboard"), 200.1),
- ('Edit', 'RequestCopy', u_("&Copy"), 'Ctrl+C', u_("Copy the current
object to the clipboard"), 200.2),
- ('Edit', 'RequestPaste', u_("&Paste"), 'Ctrl+V', u_("Paste the
current object on the clipboard"), 200.3),
- ('Edit', 'RequestPasteSpecial', u_("Paste &Special..."), None,
u_("Paste the current object on the clipboard with special attributes"), 200.4),
- ('Modify','RequestDelete', u_("&Delete Item"), 'Delete', u_("Delete
the current object"),100),
- ('Help', 'RequestAbout', u_("&About GNUe Designer"), None, u_("More
information about GNUe Designer"), 900),
+ ('File', 'RequestOpen', u_('&Open'), 'Ctrl+O',
+ u_("Open an existing document"), 200.1),
+ ('File|Open Recent', 'XXXX', u_('&Foo'), None,
+ u_("This is a placeholder for the Open Recent menu"), 200.1),
+ ('File|New', 'RequestNewWizard', u_('From &Wizard...'), None,
+ u_("Create a new document using a wizard"), 900.1),
+ ('File', 'RequestSave', u_("&Save"), 'Ctrl+S',
+ u_("Save the current document"),300.1),
+ ('File', 'RequestSaveAs', u_("Save &As..."),None,
+ u_("Save the current document under a new name"), 300.2),
+ ('File', 'RequestSaveAll', u_("Save A&ll"),None,
+ u_("Save all open document"),300.3),
+ ('File', 'RequestRevert', u_("Reload"), None,
+ u_("Reload the current document as of its last save " + \
+ "(abandoning any changes)"), 500),
+ ('File', 'RequestClose', u_("&Close"), 'Ctrl+W',
+ u_("Close the current document"), 990),
+ ('File', 'RequestExit', u_("E&xit"), None,
+ u_("Exit GNUe Designer"), 995),
+ ('Edit', 'RequestUndo', u_("&Undo"), 'Ctrl+Z',
+ u_("Undo the last action"), 100.1),
+ ('Edit', 'RequestRedo', u_("&Redo"), 'Ctrl+Y',
+ u_("Redo the last undo action"), 100.2),
+ ('Edit', 'RequestCut', u_("Cu&t"), 'Ctrl+X',
+ u_("Cut the current object and move to the clipboard"), 200.1),
+ ('Edit', 'RequestCopy', u_("&Copy"), 'Ctrl+C',
+ u_("Copy the current object to the clipboard"), 200.2),
+ ('Edit', 'RequestPaste', u_("&Paste"), 'Ctrl+V',
+ u_("Paste the current object on the clipboard"), 200.3),
+ ('Edit', 'RequestPasteSpecial', u_("Paste &Special..."), None,
+ u_("Paste the current object on the clipboard " + \
+ "with special attributes"), 200.4),
+ ('Modify','RequestDelete', u_("&Delete Item"), 'Delete',
+ u_("Delete the current object"),100),
+ ('Help', 'RequestAbout', u_("&About GNUe Designer"), None,
+ u_("More information about GNUe Designer"), 900),
):
self.menubar.addAction(location, text, event,
grouping, canDisable=True,
@@ -532,16 +555,20 @@
# Add supported tools to File|New
for tool in SupportedModules:
- self.menubar.addAction('File|New', '&%s' %
tool.properties.nickname,
- 'RequestNew', 100,
- help=u_('Create a new %s') % tool.properties.nickname.lower(),
eventdata={'type': tool.properties.module })
+ self.menubar.addAction(
+ 'File|New', '&%s' % tool.properties.nickname,
+ 'RequestNew', 100,
+ help=u_('Create a new %s') % tool.properties.nickname.lower(),
+ eventdata={'type': tool.properties.module})
# Add connections
for conn in self.connections.getAllConnectionParameters().keys():
- self.menubar.addAction('File|Connect To', conn, 'Connect:%s' %
conn,
+ self.menubar.addAction('File|Connect To', conn,
+ 'Connect:%s' % conn,
help=u_("Login to %s connection") % conn,
eventdata={'connection': conn})
- self.registerEventListeners({'Connect:%s' %
conn:self.__OnConnectTo})
+ self.registerEventListeners(
+ {'Connect:%s' % conn: self.__OnConnectTo})
def __loadFromFile(self, location):
@@ -553,7 +580,9 @@
self.makeClean()
self._isNew = 0
except IOError, msg:
- print "\n%s %s\n\nUnable to open file '%s'. \nUnexpected read
error:\n %s.\n" % (TITLE, VERSION, location, msg)
+ print "\n%s %s\n\nUnable to open file '%s'. \n" + \
+ "Unexpected read error:\n %s.\n" % (
+ TITLE, VERSION, location, msg)
sys.exit()
self.app.mru.addLocation(location)
@@ -582,9 +611,9 @@
self._isNew = True
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
#
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
#
# Used by RuntimeSettings
#
@@ -592,17 +621,17 @@
return ( self.runtime_section, self.ui.getRuntimeSettings() )
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
#
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
# Do we need to be saved?
def isDirty(self):
return self._isdirty
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
#
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
# Take an object and mangle it all up
# until it is useful to us
def __inventory (self, object):
@@ -613,7 +642,6 @@
if object != self.rootObject:
# Assign an ID if none exists
- # TODO: in the future, I want to change these to id=".." instead
of name=".."
if hasattr(object, 'name'):
if object.name == None or object.name[:3] == "__G":
object.name = self.getNextGenericName(object._type[2:])
@@ -624,7 +652,8 @@
if object._type in self._editorMapping.keys():
filter = self._editorMapping[object._type][0]
if filter is None or filter(object):
- self.ui.createEditor(object,
*self._editorMapping[object._type][1:])
+ self.ui.createEditor(object,
+ *self._editorMapping[object._type][1:])
# Now, give the tool-specific instances a chance
self.inventoryObject(object)
@@ -662,8 +691,7 @@
object = event.object
# Delete the actual object from its parent
- object.getParent ()._children.remove(object)
- ##object.getParent ()._children.pop(object.getParent
()._children.index(object))
+ object.getParent()._children.remove(object)
self.makeDirty()
@@ -679,9 +707,9 @@
print u_("Unable to connect to %s") % conn
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
#
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
def _OnSave(self, event):
if not len(self._path):
self.OnSaveAs(event)
@@ -704,19 +732,18 @@
( type, self.properties.fileExtensions[type]) ]
filterIndex.append(type)
- path = self.ui.dialogSaveFile(u_("Save %s As...") %
self.properties.description,
- wildcards = wildcards,
+ path = self.ui.dialogSaveFile(
+ u_("Save %s As...") % self.properties.description,
+ wildcards=wildcards,
parentWindow=self.ui)
if path:
-# if len(path) < 4 or not (path[-4] == '.' and path[-3:].lower() in
self.properties.fileExtensions.keys()):
-# path += "." + filterIndex[dlg.GetFilterIndex()]
-
if os.path.isfile(path):
overwrite = self.ui.dialogYesNo(
u_('The file "%s".\n' % path) +
u_("exists. Overwrite?"),
- u_("Unsaved Changes"), icon="warn", parentWindow=self.ui)
+ u_("Unsaved Changes"),
+ icon="warn", parentWindow=self.ui)
if not overwrite:
self.OnSaveAs(event)
return
@@ -740,14 +767,15 @@
return
RuntimeSettings.saveRuntimeSettings(self)
- self.app.mru.removeMenu(self.menubar.getMenu('File|Open Recent|'),
self)
+ self.app.mru.removeMenu(
+ self.menubar.getMenu('File|Open Recent|'), self)
self.app.removeDocument(self)
self.ui.close()
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
#
- #--------------------------------------------------------------------------
+ # ---------------------------------------------------------------
def loadWizards(self, package):
templates = []
@@ -765,11 +793,13 @@
templates.append(dyn_import(
'%s.%s' % (package.__name__,base)).TemplateInformation)
except ImportError, mesg:
- assert gDebug(2,"%s.%s doesn't appear to be a valid
wizard" % (package.__name__, base))
+ assert gDebug(2,
+ "%s.%s doesn't appear to be a valid wizard" % (
+ package.__name__, base))
assert gDebug(5,' --> %s' % (mesg))
except AttributeError:
assert gDebug(2,'Wizard %s for package %s is missing'
- ' an \'TemplateInformation\' attribute.' %
+ ' a \'TemplateInformation\' attribute.' %
(base,package.__name__))
for template in templates:
@@ -785,49 +815,52 @@
if location:
self.wizardRunner(template, self)
self.menubar.addAction(location=location, text=translation,
- event='Wizard:%s' %
template['BaseID'],
- grouping=grouping, canDisable=True,
- eventdata={'template':template},
help=template['Description'])
+ event='Wizard:%s' % (
+ template['BaseID']),
+ grouping=grouping,
+ canDisable=True,
+ eventdata={'template':template},
+ help=template['Description'])
except ValueError:
continue
-
-
-# ===========================================================================
+
+
+# =================================================================
# GObject Hooks
-# ===========================================================================
-def add_GObject_hooks(object, document):
+# =================================================================
+def add_GObject_hooks(object, document):
"""
- Capture the _setItemHook event, so that setting atttributes like:
-
+ Capture the _setItemHook event, so that setting atttributes like:
+
gobject['text'] = newtext
- will automatically cause ObjectModified events to fire.
+ will automatically cause ObjectModified events to fire.
- Also, add a .dispatch_designer_event method that calls the
- Document.dispatchEvent method, automatically passing in
+ Also, add a .dispatch_designer_event method that calls the
+ Document.dispatchEvent method, automatically passing in
object=self
-
+
"""
object._dispatch_designer_event = document.dispatchEvent
object.dispatch_designer_event = new.instancemethod(
_gobject_dispatch_event, object, object.__class__)
- object._setItemHook = new.instancemethod(_gobject_set_item_hook,
- object,
+ object._setItemHook = new.instancemethod(_gobject_set_item_hook,
+ object,
object.__class__)
-
-def _gobject_dispatch_event(self, event, **params):
+
+def _gobject_dispatch_event(self, event, **params):
params['object'] = self
- if not params.has_key('originator'):
+ if not params.has_key('originator'):
params['originator'] = '__inline__'
self._dispatch_designer_event(event, **params)
-def _gobject_set_item_hook(self, key, value):
+def _gobject_set_item_hook(self, key, value):
"""
Hook into the GObject._setItemHook
-
+
Here, "self" is any arbitrary GObject.
"""
dict_key = key.replace(':','__')
@@ -835,17 +868,17 @@
old_values = {key: object.__dict__[dict_key]}
except KeyError:
old_values = {}
-
+
self.__dict__[dict_key] = value
self._dispatch_designer_event('ObjectModified',
- object = self, new={key:value}, old=old_values,
+ object = self, new={key:value}, old=old_values,
originator = '__inline__')
-
-# ===========================================================================
+
+# =================================================================
# Helper class used by the tool-specific packages
-# ===========================================================================
+# =================================================================
class ModuleProperties:
xmlOpeningTag = 'undefined'
short = 'undefined'
Modified: trunk/gnue-designer/src/base/tools/EventEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/EventEditor.py 2006-04-04 02:39:47 UTC
(rev 8349)
+++ trunk/gnue-designer/src/base/tools/EventEditor.py 2006-04-04 04:07:30 UTC
(rev 8350)
@@ -186,7 +186,7 @@
self.triggerMap = {}
for name in self.namedMap.keys():
- self.triggerTypes[name] = name + ' (named)'
+ self.triggerTypes[name] = name + u_(' (named)')
mappedTriggers = {}
for child in object._children:
@@ -194,14 +194,12 @@
if hasattr(child,'src') and child.src:
mappedTriggers[child.type.upper()] = child.src
else:
- mappedTriggers[child.type.upper()] = '(Custom Trigger)'
+ mappedTriggers[child.type.upper()] = u_('(Custom Trigger)')
self.triggerMap[child.type.upper()] = child
self.mappedTriggers = mappedTriggers
- i = 0
-
-
+ i = 0
for key in self.rowList:
self.grid.SetRowLabelValue(i,self.triggerList[key])
self.grid.SetCellEditor(i, 0,
EventCellEditor(self.grid,self.triggerTypes))
@@ -225,9 +223,12 @@
try:
trigger=self.triggerMap[self.rowList[0]]
if trigger.src:
-
self.editor.dispatchEvent('TriggerSelected',object=self.namedMap[trigger.src],
originator=__name__)
+ self.editor.dispatchEvent('TriggerSelected',
+ object=self.namedMap[trigger.src],
+ originator=__name__)
else:
- self.editor.dispatchEvent('TriggerSelected',object=trigger,
originator=__name__)
+ self.editor.dispatchEvent('TriggerSelected',
+ object=trigger, originator=__name__)
except KeyError:
pass
except IndexError:
@@ -279,10 +280,7 @@
self.grid.SetSize(self.GetClientSizeTuple())
w,h = self.grid.GetClientSizeTuple()
self.grid.SetColSize(0, w - self.grid.GetRowLabelSize()-1)
- try:
- self.grid.ForceRefresh() # Added in 2.3.1
- except AttributeError:
- pass
+ self.grid.ForceRefresh() # Added in 2.3.1
# Force a grid cell into Edit mode when Double-Clicked
def OnLeftDClick(self,evt):
Modified: trunk/gnue-designer/src/forms/PagePainter/PagePainter.py
===================================================================
--- trunk/gnue-designer/src/forms/PagePainter/PagePainter.py 2006-04-04
02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/forms/PagePainter/PagePainter.py 2006-04-04
04:07:30 UTC (rev 8350)
@@ -59,7 +59,7 @@
# Determine text extents
dc = wx.PaintDC(self)
- dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
+ dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FIXED_FONT))
if not common.char_x_scale:
for char in string.digits + string.letters:
Modified: trunk/gnue-designer/src/forms/PagePainter/skins/default.py
===================================================================
--- trunk/gnue-designer/src/forms/PagePainter/skins/default.py 2006-04-04
02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/forms/PagePainter/skins/default.py 2006-04-04
04:07:30 UTC (rev 8350)
@@ -27,7 +27,8 @@
import wx
-from gnue.designer.ui.wx.uihelpers.doccanvas.colors import color_map
+from gnue.designer.ui.wx.uihelpers.doccanvas.settings import color_map
+from gnue.designer.ui.wx.uihelpers.doccanvas.settings import font_map
from common import FormWidget, ContainerWidget
import common
@@ -68,14 +69,16 @@
# This gives us an offset onto the current drawing canvas,
# accounting for any workspace margins.
- x_offset = canvas.document_origin_x
- y_offset = canvas.document_origin_y
+ x_offset = canvas.document_origin_x + common.char_x_scale // 2
+ y_offset = canvas.document_origin_y + common.char_y_scale // 2
# Right now, only Char positioning is supported.
- x = 0
- y = 0
- width = object['Char:width']
- height = object['Char:height']
+ # We're taking advantage here of the fact that
+ # Char positioning starts counting at "0".
+ x = -1 * common.char_x_scale
+ y = -1 * common.char_y_scale
+ width = object['Char:width'] + 1
+ height = object['Char:height'] + 1
# Convert from Char positions into wx positions
width *= common.char_x_scale
@@ -113,7 +116,6 @@
dc.SetBrush(wx.Brush(color_map['panel'], style=wx.SOLID))
object = self.gobject
x, y, width, height = self.draw_area.Get()
- dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
dc.DrawRectangle(x, y, width, height)
@@ -129,7 +131,7 @@
dc.SetBrush(wx.Brush(wx.WHITE, style=wx.TRANSPARENT))
object = self.gobject
x, y, width, height = self.draw_area.Get()
- dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
+ dc.SetFont(font_map['label'])
# Center each character in its cell
for char in object['text']:
text_width, text_height = dc.GetTextExtent(char)
@@ -154,8 +156,8 @@
Called when the text edit request is finished
"""
self.gobject['text'] = text
-
+
# --------------------------------------------------------------------------
# Entry
# --------------------------------------------------------------------------
@@ -178,7 +180,7 @@
dc.DrawRoundedRectangle(x, y, width, height - 1, 4)
# Draw the text, centered in the button
- dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
+ dc.SetFont(font_map['button'])
text = self.gobject['label']
text_width, text_height = dc.GetTextExtent(text)
@@ -220,7 +222,7 @@
y2 = y + height - common.char_y_scale // 2
# Draw the lines
- dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
+ dc.SetFont(font_map['box'])
text = self.gobject['label']
text_width, text_height = text_extents = dc.GetTextExtent(text)
@@ -269,5 +271,5 @@
dc.SetBrush(wx.Brush(color_map['widget'], style=wx.CROSSDIAG_HATCH))
object = self.gobject
x, y, width, height = self.draw_area.Get()
- dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
+ dc.SetFont(font_map['label'])
dc.DrawRoundedRectangle(x, y, width, height - 1, 4)
Modified: trunk/gnue-designer/src/forms/PagePainter/skins/term.py
===================================================================
--- trunk/gnue-designer/src/forms/PagePainter/skins/term.py 2006-04-04
02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/forms/PagePainter/skins/term.py 2006-04-04
04:07:30 UTC (rev 8350)
@@ -29,7 +29,7 @@
from common import FormWidget
-from gnue.designer.ui.wx.uihelpers.doccanvas.colors import colorIndex
+from gnue.designer.ui.wx.uihelpers.doccanvas.settings import color_map
# TODO
Modified: trunk/gnue-designer/src/ui/wx/Instance.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/Instance.py 2006-04-04 02:39:47 UTC (rev
8349)
+++ trunk/gnue-designer/src/ui/wx/Instance.py 2006-04-04 04:07:30 UTC (rev
8350)
@@ -56,11 +56,11 @@
title_saved_format = '%s'
title_unsaved_format = '%s (*)'
elif wx.Platform == "__WXMSW__":
- title_saved_format = '%s - GNUe Designer'
- title_unsaved_format = '%s* - GNUe Designer'
+ title_saved_format = u_('%s - GNUe Designer')
+ title_unsaved_format = u_('%s* - GNUe Designer')
else:
- title_saved_format = '%s - GNUe Designer'
- title_unsaved_format = '%s - GNUe Designer [modified]'
+ title_saved_format = u_('%s - GNUe Designer')
+ title_unsaved_format = u_('%s - GNUe Designer [modified]')
#============================================================================
# UI Instance class
@@ -121,10 +121,12 @@
# Add the toolbar to the PyAUI manager
self._auiMgr.AddPane(self.toolbar, PyAUI.PaneInfo().
- Name("PrimaryToolBar").Caption("GNUe Designer").
+ Name("PrimaryToolBar").
+ Caption(u_("GNUe Designer")).
ToolbarPane().Top())
- perspective = RuntimeSettings.get(self.document.runtime_section,
'aui-perspective','')
+ perspective = RuntimeSettings.get(self.document.runtime_section,
+ 'aui-perspective','')
if perspective:
self._auiMgr.LoadPerspective(perspective)
@@ -189,7 +191,7 @@
#notebook.SetTabHeight(20)
notebook.EnableTabGradients()
self._auiMgr.AddPane(notebook, PyAUI.PaneInfo().Name('Editor').\
- Caption('Editor').CenterPane())
#.MaxSize(10000,10000).MinSize(100,50))
+ Caption('Editor').CenterPane())
##TODO: Experimenting with tabs at the top...
##TODO: Commenting out until
@@ -227,20 +229,35 @@
tool = baseclass(id, title, self.document,
self.document.rootObject, self)
# TODO: this isn't compatable with PyAUI
- tool._docked =
RuntimeSettings.getint(self.document.runtime_section, '%s-docked' % id, pos !=
'frame')
- tool._dock_location =
RuntimeSettings.get(self.document.runtime_section, '%s-location' % id, (pos ==
'frame' and 'left' or pos))
- tool._dock_index =
RuntimeSettings.getint(self.document.runtime_section, '%s-index' % id, indx)
- tool._visible =
RuntimeSettings.getint(self.document.runtime_section, '%s-visible' % id,
tool.default_visible)
- tool._frame_x =
RuntimeSettings.getint(self.document.runtime_section, '%s-frame-x' % id, -1)
- tool._frame_y =
RuntimeSettings.getint(self.document.runtime_section, '%s-frame-y' % id, -1)
- tool._frame_width =
RuntimeSettings.getint(self.document.runtime_section, '%s-frame-width' % id,
200)
- tool._frame_height =
RuntimeSettings.getint(self.document.runtime_section, '%s-frame-height' % id,
150)
+ tool._docked = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-docked' % id, pos != 'frame')
+ tool._dock_location = RuntimeSettings.get(
+ self.document.runtime_section,
+ '%s-location' % id,
+ (pos == 'frame' and 'left' or pos))
+ tool._dock_index = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-index' % id, indx)
+ tool._visible = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-visible' % id, tool.default_visible)
+ tool._frame_x = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-frame-x' % id, -1)
+ tool._frame_y = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-frame-y' % id, -1)
+ tool._frame_width = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-frame-width' % id, 200)
+ tool._frame_height = RuntimeSettings.getint(
+ self.document.runtime_section,
+ '%s-frame-height' % id, 150)
appd = (id, title, baseclass, hotkey, pos)
- toolinfo = PyAUI.PaneInfo().Name(title).Caption(title) #.\
-
#MinSize(100,100)).PinButton().MinimizeButton().CloseButton().\
- #Floatable().Dockable().MaxSize(10000,10000)
+ toolinfo = PyAUI.PaneInfo().Name(title).Caption(title)
if tool._docked:
# Docked type
@@ -261,9 +278,14 @@
self.tools.append(tool)
# Add ourselves to the Window menu
- self.document.menubar.addAction(location='View', text=title,
event='Tool:' + id,
- grouping=group, canToggle=1, canDisable=0,
- icon=None, hotkey=hotkey)
+ self.document.menubar.addAction(location='View',
+ text=title,
+ event='Tool:' + id,
+ grouping=group,
+ canToggle=1,
+ canDisable=0,
+ icon=None,
+ hotkey=hotkey)
self.document.__dict__[id] = tool
@@ -312,7 +334,7 @@
self.SetIcon(icon)
# Just a sane default...
- self.SetMinSize(wx.Size(400, 300))
+ self.SetMinSize(wx.Size(600, 400))
# Create the status bar
self.statusbar = self.CreateStatusBar()
@@ -347,4 +369,4 @@
class MyDockArt(PyAUI.DefaultDockArt):
def __init__(self, *arg, **parm):
PyAUI.DefaultDockArt.__init__(self, *arg, **parm)
- self.SetFont(PyAUI.AUI_ART_CAPTION_FONT, wx.Font(9, wx.DEFAULT,
wx.NORMAL, wx.NORMAL, False))
+ self.SetFont(PyAUI.AUI_ART_CAPTION_FONT, wx.SMALL_FONT)
Modified: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py 2006-04-04
02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py 2006-04-04
04:07:30 UTC (rev 8350)
@@ -27,7 +27,7 @@
import wx
-from colors import color_map, build_color_map
+from settings import color_map, font_map, initialize
cursor_map = {'resize-top': wx.CURSOR_SIZENS,
'resize-bottom': wx.CURSOR_SIZENS,
@@ -57,7 +57,7 @@
super(DocumentCanvas, self).__init__(*arguments, **keywords)
# Set up the color space
- build_color_map()
+ initialize()
self.ordered_widget_list = []
@@ -599,6 +599,10 @@
mode = self.__mouse_mode
current_action = self.__mouse_current_action
+ widget = self.select_hit_test(x, y)
+ if widget:
+ widget.context_menu(x, y)
+
return True
Deleted: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/colors.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/colors.py 2006-04-04
02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/colors.py 2006-04-04
04:07:30 UTC (rev 8350)
@@ -1,54 +0,0 @@
-# GNU Enterprise Designer - Document Canvas
-#
-# Copyright 2001-2006 Free Software Foundation
-#
-# 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.
-#
-# $Id$
-
-"""
-Color mapping for DocumentCanvas
-"""
-
-import wx
-
-color_map = {}
-
-def build_color_map():
- if color_map:
- return
- color_map['selectionframe'] = wx.BLUE #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DHILIGHT)
- color_map['selectedframe'] = wx.BLUE #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_HOTLIGHT)
- color_map['workspace'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_APPWORKSPACE)
- color_map['workspaceGrid'] = wx.Colour(240,240,240) # TODO: ???
- color_map['panel'] = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
- color_map['text'] = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
- color_map['widget'] = wx.BLACK #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWFRAME)
- color_map['widgetdark'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW)
- color_map['widgetlight'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DLIGHT)
- color_map['widgetback'] = wx.WHITE
-
-def buildTermcolor_map():
- color_map['selectionframe'] = wx.BLUE #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)
- color_map['selectedframe'] = wx.BLUE #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)
- color_map['workspace'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_APPWORKSPACE)
- color_map['workspaceGrid'] = wx.Colour(240,240,240) # TODO: ???
- color_map['panel'] = wx.BLACK
- color_map['text'] = wx.WHITE
- color_map['widget'] = wx.TRANSPARENT
- color_map['widgetback'] = wx.WHITE
Copied: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py (from rev
8348, trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/colors.py)
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/colors.py 2006-04-03
23:54:54 UTC (rev 8348)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py
2006-04-04 04:07:30 UTC (rev 8350)
@@ -0,0 +1,68 @@
+# GNU Enterprise Designer - Document Canvas
+#
+# Copyright 2001-2006 Free Software Foundation
+#
+# 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.
+#
+# $Id$
+
+"""
+Color and font mappings for DocumentCanvas
+"""
+
+import wx
+
+color_map = {}
+font_map = {}
+
+def build_color_map():
+
+ global color_map
+ if color_map:
+ return
+
+ color_map['selectionframe'] = wx.BLUE #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DHILIGHT)
+ color_map['selectedframe'] = wx.BLUE #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_HOTLIGHT)
+ color_map['workspace'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_APPWORKSPACE)
+ color_map['workspaceGrid'] = wx.Colour(240,240,240) # TODO: ???
+ color_map['panel'] = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
+ color_map['text'] = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
+ color_map['widget'] = wx.BLACK #
wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWFRAME)
+ color_map['widgetdark'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW)
+ color_map['widgetlight'] =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DLIGHT)
+ color_map['widgetback'] = wx.WHITE
+
+
+def build_font_map():
+
+ global font_map
+ if font_map:
+ return
+
+ font_map['label'] = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FIXED_FONT)
+ font_map['box'] = wx.NORMAL_FONT
+ font_map['button'] = wx.NORMAL_FONT
+
+
+
+def initialize():
+ if color_map:
+ return
+
+ build_font_map()
+ build_color_map()
\ No newline at end of file
Modified: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/widget.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/widget.py 2006-04-04
02:39:47 UTC (rev 8349)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/widget.py 2006-04-04
04:07:30 UTC (rev 8350)
@@ -30,7 +30,7 @@
import wx
import dnd
-from colors import color_map
+from settings import color_map
from textedit import PopupTextEdit
# ===================================================================
@@ -349,3 +349,8 @@
Usually, there is no need for anything more than a NO-OP.
"""
pass
+
+ def context_menu(self, x, y):
+ """
+ """
+ self.canvas.PopupMenu(self.gobject._popupMenu, (x,y))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8350 - in trunk/gnue-designer/src: . base base/tools forms/PagePainter forms/PagePainter/skins ui/wx ui/wx/uihelpers/doccanvas,
jcater <=