[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8201 - in trunk/gnue-designer/src: . base base/tools forms forms
From: |
jcater |
Subject: |
[gnue] r8201 - in trunk/gnue-designer/src: . base base/tools forms forms/LayoutEditor forms/LayoutEditor/renderers/Base forms/LayoutEditor/renderers/native navigator reports reports/Char reports/Standard schema schema/DiaEditor templates/forms uidrivers/wx uidrivers/wx/docks uidrivers/wx/startup uidrivers/wx/uihelpers |
Date: |
Fri, 3 Mar 2006 19:23:03 -0600 (CST) |
Author: jcater
Date: 2006-03-03 19:22:59 -0600 (Fri, 03 Mar 2006)
New Revision: 8201
Added:
trunk/gnue-designer/src/uidrivers/wx/uihelpers/AdvancedSplash.py
trunk/gnue-designer/src/uidrivers/wx/uihelpers/PyAUI.py
trunk/gnue-designer/src/uidrivers/wx/uihelpers/PythonEditor.py
trunk/gnue-designer/src/uidrivers/wx/uihelpers/README.txt
Modified:
trunk/gnue-designer/src/Designer.py
trunk/gnue-designer/src/base/Goat.py
trunk/gnue-designer/src/base/Icons.py
trunk/gnue-designer/src/base/Instance.py
trunk/gnue-designer/src/base/MRUManager.py
trunk/gnue-designer/src/base/MenuBar.py
trunk/gnue-designer/src/base/MultiObjectGridEditor.py
trunk/gnue-designer/src/base/PopupMenu.py
trunk/gnue-designer/src/base/TemplateBase.py
trunk/gnue-designer/src/base/TemplateChooser.py
trunk/gnue-designer/src/base/TemplateParser.py
trunk/gnue-designer/src/base/ToolBar.py
trunk/gnue-designer/src/base/ToolBase.py
trunk/gnue-designer/src/base/tools/DataSourceEditor.py
trunk/gnue-designer/src/base/tools/EventEditor.py
trunk/gnue-designer/src/base/tools/PropertyEditor.py
trunk/gnue-designer/src/base/tools/SchemaNavigator.py
trunk/gnue-designer/src/base/tools/SchemaViewer.py
trunk/gnue-designer/src/base/tools/TreeView.py
trunk/gnue-designer/src/base/tools/TriggerEditor.py
trunk/gnue-designer/src/forms/BlockEditor.py
trunk/gnue-designer/src/forms/Debugger.py
trunk/gnue-designer/src/forms/EventEditor.py
trunk/gnue-designer/src/forms/Instance.py
trunk/gnue-designer/src/forms/LayoutEditor/DisplayDropTarget.py
trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditor.py
trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py
trunk/gnue-designer/src/forms/LayoutEditor/PopupEditor.py
trunk/gnue-designer/src/forms/LayoutEditor/PropertyBar.py
trunk/gnue-designer/src/forms/LayoutEditor/Utils.py
trunk/gnue-designer/src/forms/LayoutEditor/WidgetFocusTab.py
trunk/gnue-designer/src/forms/LayoutEditor/WidgetHandler.py
trunk/gnue-designer/src/forms/LayoutEditor/WidgetHighlighter.py
trunk/gnue-designer/src/forms/LayoutEditor/Workspace.py
trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/Driver.py
trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/GridPane.py
trunk/gnue-designer/src/forms/LayoutEditor/renderers/native/WidgetHandler.py
trunk/gnue-designer/src/forms/PropertyEditor.py
trunk/gnue-designer/src/forms/TreeView.py
trunk/gnue-designer/src/navigator/LayoutEditor.py
trunk/gnue-designer/src/reports/Char/LayoutEditor.py
trunk/gnue-designer/src/reports/Standard/GroupEditor.py
trunk/gnue-designer/src/reports/Standard/LayoutEditor.py
trunk/gnue-designer/src/reports/TreeView.py
trunk/gnue-designer/src/schema/DiaEditor/VisualEditor.py
trunk/gnue-designer/src/schema/DiaEditor/VisualTable.py
trunk/gnue-designer/src/schema/LayoutEditor.py
trunk/gnue-designer/src/schema/TableEditor.py
trunk/gnue-designer/src/schema/TreeView.py
trunk/gnue-designer/src/templates/forms/FormBuilder.py
trunk/gnue-designer/src/templates/forms/Simple.py
trunk/gnue-designer/src/uidrivers/wx/Base.py
trunk/gnue-designer/src/uidrivers/wx/Instance.py
trunk/gnue-designer/src/uidrivers/wx/MenuBar.py
trunk/gnue-designer/src/uidrivers/wx/docks/BasePane.py
trunk/gnue-designer/src/uidrivers/wx/docks/DockedPane.py
trunk/gnue-designer/src/uidrivers/wx/docks/Docker.py
trunk/gnue-designer/src/uidrivers/wx/docks/FloatingPane.py
trunk/gnue-designer/src/uidrivers/wx/docks/SplitDock.py
trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py
trunk/gnue-designer/src/uidrivers/wx/uihelpers/GridCellEditors.py
Log:
Move to wx2.6; Changed the underlying docking system; (CORRUPTS DISPLAY, SO NOT
USABLE)
Modified: trunk/gnue-designer/src/Designer.py
===================================================================
--- trunk/gnue-designer/src/Designer.py 2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/Designer.py 2006-03-04 01:22:59 UTC (rev 8201)
@@ -29,7 +29,7 @@
from gnue.common.apps import RuntimeSettings
from StringIO import StringIO
-#from wxPython.wx import *
+#import wx
from gnue.common.apps.GClientApp import GClientApp
from gnue.common.apps import GDebug
from gnue.common.utils.FileUtils import dyn_import
@@ -394,7 +394,7 @@
isdirty = False
for instance in self._instances:
if instance.isDirty():
- isdirty = true
+ isdirty = True
break
return isdirty
@@ -403,7 +403,7 @@
Determines if an instance already has the requested file open.
TODO: Currently this function is not implemented. It always
- returns false.
+ returns False.
@rtype: boolean
@return: True if any instance contains the requested file
Modified: trunk/gnue-designer/src/base/Goat.py
===================================================================
--- trunk/gnue-designer/src/base/Goat.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/Goat.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -1,8 +1,8 @@
#----------------------------------------------------------------------
# This file was generated by /usr/bin/img2py
#
-from wxPython.wx import wxImageFromStream, wxBitmapFromImage
-from wxPython.wx import wxEmptyIcon
+from wx import ImageFromStream, BitmapFromImage
+from wx import EmptyIcon
import cStringIO
@@ -91,14 +91,14 @@
\xf7\xd9\xfe\x07 \xf45f\x18k\x97o\x00\x00\x00\x00IEND\xaeB`\x82'
def getGoatBitmap():
- return wxBitmapFromImage(getGoatImage())
+ return BitmapFromImage(getGoatImage())
def getGoatImage():
stream = cStringIO.StringIO(getGoatData())
- return wxImageFromStream(stream)
+ return ImageFromStream(stream)
def getGoatIcon():
- icon = wxEmptyIcon()
+ icon = EmptyIcon()
icon.CopyFromBitmap(getGoatBitmap())
return icon
Modified: trunk/gnue-designer/src/base/Icons.py
===================================================================
--- trunk/gnue-designer/src/base/Icons.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/Icons.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -27,25 +27,25 @@
#
import os, sys
-from wxPython.wx import *
+import wx
from wxPython import __version__
from gnue.common.apps import GConfig
# Nasty hack to get around wxPython bug (still in 2.3.1)
-class myImageList(wxImageList):
+class myImageList(wx.ImageList):
def __del__(self):
pass
treeIconMap = {}
-treeIconList = myImageList(18,18,false)
+treeIconList = myImageList(18,18,False)
iconlocation =
os.path.join(GConfig.getInstalledBase('designer_images','common_images'),'designer')
if sys.platform != 'win32':
- icontype = wxBITMAP_TYPE_XPM
+ icontype = wx.BITMAP_TYPE_XPM
iconextension = 'xpm'
else:
- icontype = wxBITMAP_TYPE_ICO
+ icontype = wx.BITMAP_TYPE_ICO
iconextension = 'ico'
if __version__ < '2.3.0': # TODO: wxPython 2.2.x seems to segfault with icons
@@ -57,7 +57,7 @@
'page','trigger','properties'):
if os.path.isfile('%s/destree_%s.%s' % (iconlocation, f,iconextension)):
treeIconMap[f] = treeIconList.AddIcon(
- wxIcon('%s/destree_%s.%s' % (iconlocation, f,iconextension),
+ wx.Icon('%s/destree_%s.%s' % (iconlocation, f,iconextension),
icontype))
else:
- treeIconMap[f] = treeIconList.AddIcon(wxNullIcon)
+ treeIconMap[f] = treeIconList.AddIcon(wx.NullIcon)
Modified: trunk/gnue-designer/src/base/Instance.py
===================================================================
--- trunk/gnue-designer/src/base/Instance.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/Instance.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -47,7 +47,7 @@
class BaseInstance(EventController):
- ########################################################################
+ # ------------------------------------------------------------
#
# Virtual functions...
#
@@ -382,9 +382,9 @@
if not self._isdirty:
self._isdirty = True
if self._path == "":
- self.uiinstance.setTitle( _("<New %s> *") % self.properties.nickname)
+ self.uiinstance.setTitle( _("Untitled %s*") % self.properties.nickname)
else:
- self.uiinstance.setTitle(self._path + " *")
+ self.uiinstance.setTitle(self._path + "*")
self.dispatchEvent('MakeDirty')
# Mark our form as "clean" (no unsaved changes)
@@ -392,7 +392,7 @@
self._isdirty = 0
self._isnew = 0
if self._path == "":
- self.uiinstance.setTitle( _("<New %s>") % self.properties.nickname)
+ self.uiinstance.setTitle( _("Untitled %s") % self.properties.nickname)
else:
self.uiinstance.setTitle( self._path)
self.dispatchEvent('MakeClean')
@@ -527,14 +527,14 @@
for comment in self.rootObject._rootComments:
if comment.find(TITLE) > 0:
self.rootObject._rootComments.remove(comment)
-
+
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()))))
fileHandle.write(''.join(["<!--%s-->\n\n" %
comment.encode(gConfig('textEncoding')) \
for comment in self.rootObject._rootComments]))
-
+
fileHandle.write(self.rootObject.dumpXML(treeDump=True).encode(gConfig('textEncoding')))
fileHandle.close()
Modified: trunk/gnue-designer/src/base/MRUManager.py
===================================================================
--- trunk/gnue-designer/src/base/MRUManager.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/MRUManager.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -105,9 +105,9 @@
def addMenu(self, menu, instance):
"""
- Adds a link to a wxMenu that needs maintained.
+ Adds a link to a wx.Menu that needs maintained.
- @type menu: wxMenu instance
+ @type menu: wx.Menu instance
@param menu: A menu that needs maintained
@type instance: BaseInstance or child
@param instance: A designer instance to which this menu belongs. Designer
creates
@@ -119,10 +119,10 @@
def removeMenu(self, menu, instance):
"""
- Removes a wxMenu from the list of wxMenus that
+ Removes a wx.Menu from the list of wx.Menus that
contain recently opened files.
- @type menu: wxMenu instance
+ @type menu: wx.Menu instance
@param menu: Menu that needs removed
@type instance: BaseInstance
@param instance: A designer instance to which this menu belongs. Designer
creates
@@ -133,16 +133,16 @@
def refreshMenus(self):
"""
- Iterates through all the wxMenus under management and refreshes
+ Iterates through all the wx.Menus under management and refreshes
their list.
"""
map(self.refreshMenu, self._menus)
def refreshMenu(self, menu):
"""
- Resets and updates the wxMenu that displays the MRU list.
+ Resets and updates the wx.Menu that displays the MRU list.
"""
- # Purge all entries from the existing wxMenu and
+ # Purge all entries from the existing wx.Menu and
# reset the menu mapping
self.mruMenuMap = {}
for i in menu.GetMenuItems():
@@ -151,7 +151,7 @@
# Rebuild the menu with the current items.
i = 0
for location in self.menulist:
- tid = wx.wxNewId()
+ tid = wx.wx.NewId()
menu.Append ( tid, '&%s %s' % (i+1, location),
_('Open "%s" in a new window') % self._locations[i] )
Modified: trunk/gnue-designer/src/base/MenuBar.py
===================================================================
--- trunk/gnue-designer/src/base/MenuBar.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/MenuBar.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -141,7 +141,7 @@
return None
#
- # Return the wxMenu(Item) associated with a location
+ # Return the wx.Menu(Item) associated with a location
def getMenu(self, location):
return self.uimenu.getMenu(location)
Modified: trunk/gnue-designer/src/base/MultiObjectGridEditor.py
===================================================================
--- trunk/gnue-designer/src/base/MultiObjectGridEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/base/MultiObjectGridEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -32,12 +32,12 @@
import sys, os, cPickle, traceback, StringIO, string
import weakref, types
-from wxPython.wx import *
-from wxPython.grid import *
+import wx
+from wx.grid import *
from gnue.common.apps import GDebug, RuntimeSettings
-class MultiObjectGridEditor(wxGrid):
+class MultiObjectGridEditor(Grid):
##
## Stuff that needs to be implemented by the subclasses
@@ -58,7 +58,7 @@
## Internal Stuff
##
def __init__(self, parent, instance):
- wxGrid.__init__(self, parent, -1)
+ Grid.__init__(self, parent, -1)
self.instance = instance
self.objects = []
@@ -94,14 +94,14 @@
self.CreateGrid(1,len(columns))
# self.SetEditable(1)
- self.SetSelectionMode(wxGrid.wxGridSelectRows)
+# self.SetSelectionMode(GridSelectRows)
self.BeginBatch()
self.SetRowLabelSize(0)
index = 0
for column in columns:
- attr = wxGridCellAttr()
+ attr = GridCellAttr()
try:
readonly = column['ReadOnly']
attr.SetReadOnly(column['ReadOnly'])
Modified: trunk/gnue-designer/src/base/PopupMenu.py
===================================================================
--- trunk/gnue-designer/src/base/PopupMenu.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/PopupMenu.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -26,7 +26,7 @@
# NOTES:
import sys, os, time, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.definitions import GObjects
from gnue.common.logic import GTrigger
@@ -34,15 +34,15 @@
-class ActionMenu(wxMenu):
+class ActionMenu(wx.Menu):
def __init__(self, instance, object, parent=None, text=None,
parentText=None):
- wxMenu.__init__(self, text)
+ wx.Menu.__init__(self, text)
self.instance = instance
self.__parent = parent
self._object = object
self._newMap = {}
if parent:
- parent.AppendMenu(wxNewId(), parentText, self)
+ parent.AppendMenu(wx.NewId(), parentText, self)
if object == None:
@@ -57,39 +57,39 @@
CreateObjectMenu(instance, object, self)
# Properties
- id = wxNewId()
+ id = wx.NewId()
self.Append(id, _("&Properties..."))
- EVT_MENU(self, id, self.OnEditProperties)
+ wx.EVT_MENU(self, id, self.OnEditProperties)
if not isinstance (object, GFForm.GFForm):
# Delete
- id = wxNewId()
+ id = wx.NewId()
self.Append(id, _("&Delete %s") % object._type[2:])
- EVT_MENU(self, id, self.OnDeleteObject)
+ wx.EVT_MENU(self, id, self.OnDeleteObject)
self.AppendSeparator()
# Events >
if isinstance (object, GTrigger.GTriggerExtension):
- menu = wxMenu(_("Events..."))
+ menu = wx.Menu(_("Events..."))
self._triggerMap = {}
keys = object._validTriggers.keys()
keys.sort()
for trigger in (keys):
- tid = wxNewId()
+ tid = wx.NewId()
self._triggerMap[tid] = trigger
menu.Append(tid, object._validTriggers[trigger] + "...")
- EVT_MENU(menu, tid, self.OnEditEvent)
- self.AppendMenu(wxNewId(), _("&Events"), menu)
+ wx.EVT_MENU(menu, tid, self.OnEditEvent)
+ self.AppendMenu(wx.NewId(), _("&Events"), menu)
if isinstance(object, GFObjects.GFPage) or \
isinstance(object, GFObjects.GFBlock):
self.AppendSeparator()
# Reorder
- id = wxNewId()
+ id = wx.NewId()
self.Append(id, _("&Reorder by Location"))
- EVT_MENU(self, id, self.OnReorderLayout)
+ wx.EVT_MENU(self, id, self.OnReorderLayout)
def addChildObjectMenu(self):
@@ -98,17 +98,17 @@
self.AppendSeparator()
for child in object._children:
if isinstance (child, GObjects.GObj):
- self.AppendMenu(wxNewId(), hasattr(child,'name') and child.name or \
+ self.AppendMenu(wx.NewId(), hasattr(child,'name') and child.name or \
string.upper(child._type[2]) + \
string.lower(child._type[3:]),
PageMenu(self.instance, child, self.x, self.y))
def addCreateTag(self, tag, text):
- tid = wxNewId()
+ tid = wx.NewId()
self._newMap[tid] = tag
self.Append(tid, text)
- EVT_MENU(self.instance.uiinstance, tid, self.OnCreateObject)
+ wx.EVT_MENU(self.instance.uiinstance, tid, self.OnCreateObject)
def OnEditProperties(self, event):
Modified: trunk/gnue-designer/src/base/TemplateBase.py
===================================================================
--- trunk/gnue-designer/src/base/TemplateBase.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/TemplateBase.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -38,7 +38,7 @@
You can be guaranteed to have an empty <form|report>
object passed to the Start method. If you successfully
created your object, you should return a TRUE value in
- GetFinal. Otherwise, return false. If a TRUE value is
+ GetFinal. Otherwise, return False. If a TRUE value is
returned, Designer assumes that the passed <Form|Report>
object now contains a valid object.
@@ -67,7 +67,7 @@
# Designer calls Start(), then calls
# GetStep() to get a step. After a user
# clicks next, Designer calls ValidateStep()
- # and if this returns true, calls GetStep()
+ # and if this returns True, calls GetStep()
# if there are more steps to complete,
# or, if no more steps, calls GetFinal().
Modified: trunk/gnue-designer/src/base/TemplateChooser.py
===================================================================
--- trunk/gnue-designer/src/base/TemplateChooser.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/TemplateChooser.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -26,7 +26,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.designer.base import TemplateBase
from gnue.designer.templates import GetAvailablePackages, GetAvailableTemplates
@@ -40,16 +40,16 @@
def run(self):
- self.chooser = wxDialog(None, -1, _('Choose Wizard to Run...'),
- style=wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
+ self.chooser = wx.Dialog(None, -1, _('Choose Wizard to Run...'),
+ style=wx.DEFAULT_DIALOG_STYLE|wx.DIALOG_MODAL)
- self.panel = wxPanel(self.chooser, -1, wxPoint(0,0), wxSize(400,340))
- self.notebook = wxNotebook(self.panel, -1)
- self.chooser.SetClientSize(wxSize(400,340))
+ self.panel = wx.Panel(self.chooser, -1, wx.Point(0,0), wx.Size(400,340))
+ self.notebook = wx.Notebook(self.panel, -1)
+ self.chooser.SetClientSize(wx.Size(400,340))
- self.chooseButton = wxButton(self.panel, -1, _('Run Wizard'))
- self.cancelButton = wxButton(self.panel, -1, _('Cancel'))
+ self.chooseButton = wx.Button(self.panel, -1, _('Run Wizard'))
+ self.cancelButton = wx.Button(self.panel, -1, _('Cancel'))
self.chooseButton.SetDefault()
@@ -63,19 +63,19 @@
self.chooseButton.SetPosition( (x - dx, y) )
- EVT_BUTTON(self.chooser,self.chooseButton.GetId(), self.OnSelected)
- EVT_BUTTON(self.chooser,self.cancelButton.GetId(), self.OnCancel)
+ wx.EVT_BUTTON(self.chooser,self.chooseButton.GetId(), self.OnSelected)
+ wx.EVT_BUTTON(self.chooser,self.cancelButton.GetId(), self.OnCancel)
- EVT_CLOSE(self.chooser, self.OnCancel)
+ wx.EVT_CLOSE(self.chooser, self.OnCancel)
-# self.title = wxStaticText(self.panel, -1, "Wizard Header",
pos=wxPoint(10,10))
+# self.title = wx.StaticText(self.panel, -1, "Wizard Header",
pos=wx.Point(10,10))
# font = self.title.GetFont()
# font.SetPointSize(int(self.title.GetFont().GetPointSize()*1.5))
-# font.SetStyle(wxITALIC)
-# self.title.SetForegroundColour(wxColour(255,255,255))
+# font.SetStyle(wx.ITALIC)
+# self.title.SetForegroundColour(wx.Colour(255,255,255))
# self.title.SetFont(font)
-# self.title2 = wxStaticText(self.panel, -1, "Wizard Header",
pos=wxPoint(11,11))
-# self.title2.SetForegroundColour(wxColour(0,0,102))
+# self.title2 = wx.StaticText(self.panel, -1, "Wizard Header",
pos=wx.Point(11,11))
+# self.title2.SetForegroundColour(wx.Colour(0,0,102))
# self.title2.SetFont(font)
self.chooser.Fit()
@@ -88,7 +88,7 @@
# self.chooserPage.SetSize((w,h))
# self.chooserPage.SetBackgroundColour(
-# wxColour(
+# wx.Colour(
# self.panel.GetBackgroundColour().Red() + 32,
# self.panel.GetBackgroundColour().Green() + 32,
# self.panel.GetBackgroundColour().Blue() + 32) )
@@ -98,21 +98,21 @@
lookupIndex = 0
self.lookup = {}
for package in self.packages:
-# page = wxPanel(self.notebook, -1, wxPoint(0,0), \
+# page = wx.Panel(self.notebook, -1, wx.Point(0,0), \
# self.notebook.GetClientSize())
# w,h = page.GetClientSizeTuple()
-# ctrl = wxListCtrl(page, -1,wxPoint(5,5), wxSize(w-10,h-10),
-# style=wxLC_REPORT|wxLC_SINGLE_SEL|wxSTATIC_BORDER)
#wxLC_HRULES|wxLC_VRULES|)
- ctrl = wxListCtrl(self.notebook, -1,wxPoint(5,5), wxSize(w-10,h-10),
- style=wxLC_REPORT|wxLC_SINGLE_SEL|wxSTATIC_BORDER)
#wxLC_HRULES|wxLC_VRULES|)
- ctrl.InsertColumn(0, _("Name"), format=wxLIST_FORMAT_LEFT, width=-1)
- ctrl.InsertColumn(1, _("Description"), format=wxLIST_FORMAT_LEFT,
width=-1)
- ctrl.InsertColumn(2, _("Type"), format=wxLIST_FORMAT_LEFT, width=-1)
- ctrl.InsertColumn(3, _("Author"), format=wxLIST_FORMAT_LEFT, width=-1)
- ctrl.InsertColumn(4, _("Version"), format=wxLIST_FORMAT_LEFT, width=-1)
+# ctrl = wx.ListCtrl(page, -1,wx.Point(5,5), wx.Size(w-10,h-10),
+# style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.STATIC_BORDER)
#wx.LC_HRULES|wx.LC_VRULES|)
+ ctrl = wx.ListCtrl(self.notebook, -1,wx.Point(5,5), wx.Size(w-10,h-10),
+ style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.STATIC_BORDER)
#wx.LC_HRULES|wx.LC_VRULES|)
+ ctrl.InsertColumn(0, _("Name"), format=wx.LIST_FORMAT_LEFT, width=-1)
+ ctrl.InsertColumn(1, _("Description"), format=wx.LIST_FORMAT_LEFT,
width=-1)
+ ctrl.InsertColumn(2, _("Type"), format=wx.LIST_FORMAT_LEFT, width=-1)
+ ctrl.InsertColumn(3, _("Author"), format=wx.LIST_FORMAT_LEFT, width=-1)
+ ctrl.InsertColumn(4, _("Version"), format=wx.LIST_FORMAT_LEFT, width=-1)
- EVT_LIST_ITEM_SELECTED(self.chooser, ctrl.GetId(), self.OnSelect)
- EVT_LIST_ITEM_ACTIVATED(self.chooser, ctrl.GetId(), self.OnSelected)
+ wx.EVT_LIST_ITEM_SELECTED(self.chooser, ctrl.GetId(), self.OnSelect)
+ wx.EVT_LIST_ITEM_ACTIVATED(self.chooser, ctrl.GetId(), self.OnSelected)
# self.notebook.AddPage(page, package.PACKAGE)
self.notebook.AddPage(ctrl, package.PACKAGE)
@@ -149,7 +149,7 @@
lookupIndex += 1
if i:
- ctrl.SetColumnWidth(0,wxLIST_AUTOSIZE)
+ ctrl.SetColumnWidth(0,wx.LIST_AUTOSIZE)
lookupIndex = 0
notebookIndex += 1
Modified: trunk/gnue-designer/src/base/TemplateParser.py
===================================================================
--- trunk/gnue-designer/src/base/TemplateParser.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/TemplateParser.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -27,7 +27,7 @@
# NOTES:
import string
-from wxPython.wx import *
+import wx
from gnue.designer.base import TemplateBase
from gnue.common.utils.FileUtils import dyn_import
from gnue.common.utils import TextUtils
@@ -63,17 +63,17 @@
if self.templateInformation['Behavior'] == TemplateBase.TEMPLATE:
return self.template.Finalize()
- self.wizard = wxDialog(self.parent, -1, self.templateInformation['Name'],
- style=wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
+ self.wizard = wx.Dialog(self.parent, -1,
self.templateInformation['Name'],
+ style=wx.DEFAULT_DIALOG_STYLE|wx.DIALOG_MODAL)
- self.panel = wxPanel(self.wizard, -1, wxPoint(0,0), wxSize(400,400))
- self.wizard.SetClientSize(wxSize(400,400))
+ self.panel = wx.Panel(self.wizard, -1, wx.Point(0,0), wx.Size(400,400))
+ self.wizard.SetClientSize(wx.Size(400,400))
self.wizardPage = WizardPage(self, self.panel)
- self.prevButton = wxButton(self.panel, -1, _('< Back'))
- self.nextButton = wxButton(self.panel, -1, _('Continue >'))
- self.cancelButton = wxButton(self.panel, -1, _('Cancel'))
+ self.prevButton = wx.Button(self.panel, -1, _('< Back'))
+ self.nextButton = wx.Button(self.panel, -1, _('Continue >'))
+ self.cancelButton = wx.Button(self.panel, -1, _('Cancel'))
self.nextButton.SetDefault()
@@ -88,21 +88,21 @@
self.nextButton.SetPosition( (x - dx, y) )
self.prevButton.SetPosition( (x - dx*2, y) )
- EVT_BUTTON(self.wizard,self.prevButton.GetId(),
self.wizardPage.OnPrevStep)
- EVT_BUTTON(self.wizard,self.nextButton.GetId(),
self.wizardPage.OnNextStep)
- EVT_BUTTON(self.wizard,self.cancelButton.GetId(),
self.wizardPage.OnCancel)
+ wx.EVT_BUTTON(self.wizard,self.prevButton.GetId(),
self.wizardPage.OnPrevStep)
+ wx.EVT_BUTTON(self.wizard,self.nextButton.GetId(),
self.wizardPage.OnNextStep)
+ wx.EVT_BUTTON(self.wizard,self.cancelButton.GetId(),
self.wizardPage.OnCancel)
- EVT_CLOSE(self.wizard, self.wizardPage.OnCancel)
+ wx.EVT_CLOSE(self.wizard, self.wizardPage.OnCancel)
- self.title = wxStaticText(self.panel, -1, _("Wizard Header"),
pos=wxPoint(10,10))
+ self.title = wx.StaticText(self.panel, -1, _("Wizard Header"),
pos=wx.Point(10,10))
font = self.title.GetFont()
font.SetPointSize(int(self.title.GetFont().GetPointSize()*1.5))
- font.SetStyle(wxITALIC)
-# font.SetWeight(wxBOLD)
- self.title.SetForegroundColour(wxColour(255,255,255))
+ font.SetStyle(wx.ITALIC)
+# font.SetWeight(wx.BOLD)
+ self.title.SetForegroundColour(wx.Colour(255,255,255))
self.title.SetFont(font)
- self.title2 = wxStaticText(self.panel, -1, _("Wizard Header"),
pos=wxPoint(11,11))
- self.title2.SetForegroundColour(wxColour(0,0,102))
+ self.title2 = wx.StaticText(self.panel, -1, _("Wizard Header"),
pos=wx.Point(11,11))
+ self.title2.SetForegroundColour(wx.Colour(0,0,102))
self.title2.SetFont(font)
self.wizard.Fit()
@@ -118,7 +118,7 @@
b = self.panel.GetBackgroundColour().Blue()
self.wizardPage.SetBackgroundColour(
- wxColour(
+ wx.Colour(
(r <= 223 and r or 223) + 32,
(g <= 223 and g or 223) + 32,
(b <= 223 and b or 223) + 32) )
@@ -135,9 +135,9 @@
else:
msg = ""
- dlg = wxMessageDialog(NULL,
+ dlg = wx.MessageDialog(None,
_("Unable to perform the requested action.") + msg,
- _("Wizard Error"), style=wxOK|wxICON_WARNING)
+ _("Wizard Error"), style=wx.OK|wx.ICON_WARNING)
dlg.ShowModal()
dlg.Destroy()
@@ -153,9 +153,9 @@
self.wizard.EndModal(0)
-class WizardPage(wxPanel):
+class WizardPage(wx.Panel):
def __init__(self, parser, parent):
- wxPanel.__init__(self, parent, -1, pos=wxPoint(0,0), size=wxSize(400,250),
style=wxSIMPLE_BORDER)
+ wx.Panel.__init__(self, parent, -1, pos=wx.Point(0,0),
size=wx.Size(400,250), style=wx.SIMPLE_BORDER)
self.parser = parser
self.parent = parent
self.panel = None
@@ -205,10 +205,10 @@
# Whoop! The user forgot something... inform them
if validation:
# Give feedback
- dlg = wxMessageDialog(self.parser.wizard,
+ dlg = wx.MessageDialog(self.parser.wizard,
_("Please correct the following mistakes before continuing:\n\n
- ") + \
string.join(validation,'\n - '),
- _("Wizard Error"), style=wxOK|wxICON_WARNING)
+ _("Wizard Error"), style=wx.OK|wx.ICON_WARNING)
dlg.ShowModal()
dlg.Destroy()
@@ -273,7 +273,7 @@
width = self.GetSize().x - xMargin * 2
o = WrappedStaticText(self, -1, object.text, width,
- pos=wxPoint(xMargin, nextY))
+ pos=wx.Point(xMargin, nextY))
nextY = nextY + ySpacing + o.GetSize().y
@@ -281,7 +281,7 @@
x = xMarginInput
if object.label != None:
- o = wxStaticText(self, -1, object.label, pos=wxPoint(x, nextY+3))
+ o = wx.StaticText(self, -1, object.label, pos=wx.Point(x, nextY+3))
x = x + xSpacing + o.GetSize().x
size = (self.GetClientSize().x - x - xMarginInput,-1)
@@ -291,13 +291,13 @@
x = xMarginInput
nextY = nextY + ySpacing + o.GetSize().y
size = (self.GetClientSize().x - x - xMarginInput,-1)
- o = SortableListField(object, self, pos=wxPoint(x, nextY),
size=size)
+ o = SortableListField(object, self, pos=wx.Point(x, nextY),
size=size)
elif object.lines > 1 or object.maxSelections != 1:
- o = ListField(object, self, pos=wxPoint(x, nextY), size=size)
+ o = ListField(object, self, pos=wx.Point(x, nextY), size=size)
else:
- o = ComboField(object, self, pos=wxPoint(x, nextY), size=size)
+ o = ComboField(object, self, pos=wx.Point(x, nextY), size=size)
else:
- o = TextField(object, self, pos=wxPoint(x, nextY), size=size)
+ o = TextField(object, self, pos=wx.Point(x, nextY), size=size)
self.editorMappings[o] = object
@@ -306,7 +306,7 @@
nextY = nextY + ySpacing + o.GetSize().y
- EVT_CHAR(o, FieldHandler(self, MyId).fieldEventTrap)
+ wx.EVT_CHAR(o, FieldHandler(self, MyId).fieldEventTrap)
if self.parser.template.variables.has_key(object.variable):
o.set(self.parser.template.variables[object.variable])
@@ -323,10 +323,10 @@
-class TextField(wxTextCtrl):
+class TextField(wx.TextCtrl):
def __init__(self, source, parent,
- pos=wxDefaultPosition, size=wxDefaultSize):
- wxTextCtrl.__init__(self, parent, -1, pos=pos, size=size)
+ pos=wx.DefaultPosition, size=wx.DefaultSize):
+ wx.TextCtrl.__init__(self, parent, -1, pos=pos, size=size)
self.source = source
self.parent = parent
@@ -334,9 +334,9 @@
self.forcelower = self.source.forcelower
if self.forceupper:
- EVT_CHAR(wxTextCtrl, self.OnCharUpper)
+ wx.EVT_CHAR(wx.TextCtrl, self.OnCharUpper)
if self.forcelower:
- EVT_CHAR(wxTextCtrl, self.OnCharLower)
+ wx.EVT_CHAR(wx.TextCtrl, self.OnCharLower)
def get(self):
@@ -345,19 +345,19 @@
def set(self, value):
self.SetValue(value)
- # TODO: This EVT_CHAR should convert the text to uppercase
+ # TODO: This wx.EVT_CHAR should convert the text to uppercase
def OnCharUpper(self, event):
event.Skip()
- # TODO: This EVT_CHAR should convert the text to lowercase
+ # TODO: This wx.EVT_CHAR should convert the text to lowercase
def OnCharLower(self, event):
event.Skip()
-class ComboField(wxComboBox):
- def __init__(self, source, parent, pos=wxDefaultPosition,
size=wxDefaultSize):
- wxComboBox.__init__(self, parent, -1, pos=pos, size=size)
+class ComboField(wx.ComboBox):
+ def __init__(self, source, parent, pos=wx.DefaultPosition,
size=wx.DefaultSize):
+ wx.ComboBox.__init__(self, parent, -1, pos=pos, size=size)
self.source = source
self.parent = parent
self.mapping = {}
@@ -379,15 +379,15 @@
-class ListField(wxListBox):
- def __init__(self, source, parent, pos=wxDefaultPosition,
size=wxDefaultSize):
+class ListField(wx.ListBox):
+ def __init__(self, source, parent, pos=wx.DefaultPosition,
size=wx.DefaultSize):
if source.maxSelections != 1:
- style = wxLB_MULTIPLE
+ style = wx.LB_MULTIPLE
else:
- style = wxLB_SINGLE
+ style = wx.LB_SINGLE
- wxListBox.__init__(self, parent, -1, pos=pos, size=size, \
- style=style|wxLB_HSCROLL|wxLB_NEEDED_SB)
+ wx.ListBox.__init__(self, parent, -1, pos=pos, size=size, \
+ style=style|wx.LB_HSCROLL|wx.LB_NEEDED_SB)
self.source = source
self.parent = parent
@@ -427,21 +427,21 @@
pass
-class SortableListField(wxPanel):
- def __init__(self, source, parent, pos=wxDefaultPosition,
- size=wxDefaultSize):
+class SortableListField(wx.Panel):
+ def __init__(self, source, parent, pos=wx.DefaultPosition,
+ size=wx.DefaultSize):
- wxPanel.__init__(self, parent, -1, pos=pos, size=size,
- style=wxSIMPLE_BORDER)
+ wx.Panel.__init__(self, parent, -1, pos=pos, size=size,
+ style=wx.SIMPLE_BORDER)
self.source = source
self.parent = parent
- self.addButton = wxButton(self, -1, _(" Add >"))
- self.delButton = wxButton(self, -1, _("< Remove "))
- self.upButton = wxButton(self, -1, _("Move Up"))
- self.downButton = wxButton(self, -1, _("Move Down"))
- self.selectAllButton = wxButton(self, -1, _("Select All"))
+ self.addButton = wx.Button(self, -1, _(" Add >"))
+ self.delButton = wx.Button(self, -1, _("< Remove "))
+ self.upButton = wx.Button(self, -1, _("Move Up"))
+ self.downButton = wx.Button(self, -1, _("Move Down"))
+ self.selectAllButton = wx.Button(self, -1, _("Select All"))
self.addButton.SetSize(self.downButton.GetSize())
self.delButton.SetSize(self.downButton.GetSize())
@@ -454,11 +454,11 @@
self.downButton.Enable(0)
self.selectAllButton.Enable(1)
- self.list1 = wxListBox(self, -1, wxPoint(6,6), \
- style=wxLB_MULTIPLE|wxLB_HSCROLL|wxLB_NEEDED_SB)
+ self.list1 = wx.ListBox(self, -1, wx.Point(6,6), \
+ style=wx.LB_MULTIPLE|wx.LB_HSCROLL|wx.LB_NEEDED_SB)
- self.list2 = wxListBox(self, -1, \
- style=wxLB_MULTIPLE|wxLB_HSCROLL|wxLB_NEEDED_SB)
+ self.list2 = wx.ListBox(self, -1, \
+ style=wx.LB_MULTIPLE|wx.LB_HSCROLL|wx.LB_NEEDED_SB)
self.included = []
self.excluded = []
@@ -469,29 +469,29 @@
bw, bh = self.delButton.GetSizeTuple()
lw, lh = self.list1.GetSizeTuple()
- self.addButton.SetPosition(wxPoint(lw + 12, 12))
- self.delButton.SetPosition(wxPoint(lw + 12, 16 + bh))
- self.upButton.SetPosition(wxPoint(lw + 12, 26 + bh*2))
- self.downButton.SetPosition(wxPoint(lw + 12, 30 + bh*3))
- self.selectAllButton.SetPosition(wxPoint(lw + 12, 34 + bh*4))
+ self.addButton.SetPosition(wx.Point(lw + 12, 12))
+ self.delButton.SetPosition(wx.Point(lw + 12, 16 + bh))
+ self.upButton.SetPosition(wx.Point(lw + 12, 26 + bh*2))
+ self.downButton.SetPosition(wx.Point(lw + 12, 30 + bh*3))
+ self.selectAllButton.SetPosition(wx.Point(lw + 12, 34 + bh*4))
- self.list1.SetSize(wxSize(self.list1.GetSizeTuple()[0],
+ self.list1.SetSize(wx.Size(self.list1.GetSizeTuple()[0],
50 + bh*4))
self.list2.SetSize(self.list1.GetSize())
- self.list2.SetPosition(wxPoint(lw+bw+18,6))
+ self.list2.SetPosition(wx.Point(lw+bw+18,6))
lw, lh = self.list1.GetSizeTuple()
- self.SetSize(wxSize(lw*2+bw+25, lh + 13))
+ self.SetSize(wx.Size(lw*2+bw+25, lh + 13))
- EVT_BUTTON(self, self.addButton.GetId(), self.OnAdd)
- EVT_BUTTON(self, self.delButton.GetId(), self.OnRemove)
- EVT_BUTTON(self, self.upButton.GetId(), self.OnMoveUp)
- EVT_BUTTON(self, self.downButton.GetId(), self.OnMoveDown)
- EVT_BUTTON(self, self.selectAllButton.GetId(), self.OnSelectAll)
+ wx.EVT_BUTTON(self, self.addButton.GetId(), self.OnAdd)
+ wx.EVT_BUTTON(self, self.delButton.GetId(), self.OnRemove)
+ wx.EVT_BUTTON(self, self.upButton.GetId(), self.OnMoveUp)
+ wx.EVT_BUTTON(self, self.downButton.GetId(), self.OnMoveDown)
+ wx.EVT_BUTTON(self, self.selectAllButton.GetId(), self.OnSelectAll)
- EVT_LISTBOX(self, self.list1.GetId(), self.OnSelectLeft)
- EVT_LISTBOX(self, self.list2.GetId(), self.OnSelectRight)
+ wx.EVT_LISTBOX(self, self.list1.GetId(), self.OnSelectLeft)
+ wx.EVT_LISTBOX(self, self.list2.GetId(), self.OnSelectRight)
for choice in source.set:
key, descr = choice
@@ -656,9 +656,9 @@
def finalize(self):
pass
-class WrappedStaticText(wxStaticText):
+class WrappedStaticText(wx.StaticText):
def __init__(self, parent, id, label, width, *args, **params):
- wxStaticText.__init__(self, parent, id, "bah!", *args, **params)
+ wx.StaticText.__init__(self, parent, id, "bah!", *args, **params)
textSoFar = ""
Modified: trunk/gnue-designer/src/base/ToolBar.py
===================================================================
--- trunk/gnue-designer/src/base/ToolBar.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/ToolBar.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -26,7 +26,7 @@
# NOTES:
import os, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug, GConfig
from gnue.common.events import Event, EventAware
@@ -34,10 +34,10 @@
iconlocation =
os.path.join(GConfig.getInstalledBase('designer_images','common_images')
,'designer')
def getIcon(name, w, h):
- return wxImage(os.path.join(iconlocation,"%s-%sx%s.png" % (name,w, h)),
- wxBITMAP_TYPE_PNG).ConvertToBitmap()
+ return wx.Image(os.path.join(iconlocation,"%s-%sx%s.png" % (name,w, h)),
+ wx.BITMAP_TYPE_PNG).ConvertToBitmap()
-class BaseToolBar(wxToolBar, EventAware):
+class BaseToolBar(wx.ToolBar, EventAware):
ICON_SIZE = (24,24)
@@ -49,10 +49,11 @@
def __init__(self, parent, instance):
self.instance = instance
- wxToolBar.__init__(self, parent, -1)
+ wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize,
+ wx.TB_FLAT | wx.TB_NODIVIDER)
EventAware.__init__(self, instance)
self.mapping = {}
- self.SetToolBitmapSize(wxSize(*self.ICON_SIZE))
+ self.SetToolBitmapSize(wx.Size(*self.ICON_SIZE))
self.init()
self.Realize()
@@ -77,7 +78,7 @@
shortHelp = ""
longHelp = ""
- id = wxNewId()
+ id = wx.NewId()
self.mapping[id] = handle
self.mapping[handle] = id
@@ -93,7 +94,7 @@
self.SetToolClientData(id, handle)
- EVT_TOOL(self, id, self.OnButtonSelected)
+ wx.EVT_TOOL(self, id, self.OnButtonSelected)
def resetTool(self, mode):
Modified: trunk/gnue-designer/src/base/ToolBase.py
===================================================================
--- trunk/gnue-designer/src/base/ToolBase.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/base/ToolBase.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -29,12 +29,12 @@
__all__ = ['ToolBase']
-from wxPython.wx import *
+import wx
from gnue.common.apps import RuntimeSettings
from gnue.common import events
-class ToolBase (wxPanel, events.EventAware):
+class ToolBase (wx.Panel, events.EventAware):
default_visible = 1
default_dock = 'frame'
@@ -43,12 +43,12 @@
uses_toolbar = 0
def __init__(self, id, title, instance, rootObject, parentWindow):
- wxPanel.__init__(self,parentWindow,-1)
+ wx.Panel.__init__(self,parentWindow,-1)
events.EventAware.__init__(self, instance)
self.id = id
self.title = title
- self.dockpane = parentWindow
+# self.dockpane = parentWindow
self.instance = instance
self.rootObject = rootObject
self.instance.globalAcceleratorListeners.append(self)
@@ -62,16 +62,17 @@
def saveRuntimeSettings(self):
return (self.runtime_section, {})
- def setFeedback(self, text):
+# def setFeedback(self, text):
+ print "TODO: setFeedback"
self.dockpane.setFeedback(text)
def __show(self, event):
- self._visible = 1
- self.dockpane.show()
+ self._visible = True
+# self.dockpane.show()
def __hide(self, event):
- self._visible = 0
- self.dockpane.hide()
+ self._visible = False
+# self.dockpane.hide()
Modified: trunk/gnue-designer/src/base/tools/DataSourceEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/DataSourceEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/base/tools/DataSourceEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -28,7 +28,7 @@
#
import sys, os, cPickle, traceback, StringIO, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug, GConfig, RuntimeSettings
from gnue.common.datasources import GDataSource
from gnue.common import events
@@ -41,19 +41,19 @@
def init(self):
self.connections = self.instance._app.connections
- self.combopanel = wxPanel(self, -1, pos=wxPoint(0,0))
- self.splitter = wxSplitterWindow(self, -1, style=wxSP_3D)
+ self.combopanel = wx.Panel(self, -1, pos=wx.Point(0,0))
+ self.splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D)
## self.toolBar = ToolBar(self, parentWindow)
- self.list = wxListCtrl(self.splitter, -1, pos=wxPoint(0,0),
- style=wxLC_REPORT| # wxLC_EDIT_LABELS|
- wxLC_HRULES|wxLC_VRULES|wxLC_SINGLE_SEL)
+ self.list = wx.ListCtrl(self.splitter, -1, pos=wx.Point(0,0),
+ style=wx.LC_REPORT| # wx.LC_EDIT_LABELS|
+ wx.LC_HRULES|wx.LC_VRULES|wx.LC_SINGLE_SEL)
self.list.InsertColumn(0,_('Name'))
self.list.InsertColumn(1,_('Source'))
self.list.InsertColumn(2,_('Connection'))
- self.notebook = wxNotebook(self.splitter, -1, style=wxNB_BOTTOM)
+ self.notebook = wx.Notebook(self.splitter, -1, style=wx.NB_BOTTOM)
self.propertyPanel = PropertyViewer(self, self.notebook)
self.referencesPanel = ReferencesViewer(self, self.notebook)
@@ -65,7 +65,7 @@
self.splitter.SplitHorizontally(self.list, self.notebook,200)
- EVT_SIZE(self, self.OnSize)
+ wx.EVT_SIZE(self, self.OnSize)
self.datasourceMap = {}
self.datasources = []
@@ -84,7 +84,7 @@
'ObjectDeleted' : self.onDeleteObject,
})
- EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnDSSelected)
+ wx.EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnDSSelected)
self._setCurrent(self.current)
self.finalized = 0
@@ -195,8 +195,8 @@
self.current = object
self.list.SetItemState ( object.__listIndex,
- wxLIST_STATE_SELECTED,
- wxLIST_STATE_SELECTED)
+ wx.LIST_STATE_SELECTED,
+ wx.LIST_STATE_SELECTED)
self.list.EnsureVisible(object.__listIndex)
@@ -356,30 +356,30 @@
#
#
#
-class ToolBar (wxToolBar):
+class ToolBar (wx.ToolBar):
def __init__(self, editor, parent):
- wxToolBar.__init__(self, parent, -1, style=wxTB_DOCKABLE)
+ wx.ToolBar.__init__(self, parent, -1, style=wx.TB_DOCKABLE)
self.editor = editor
parent.SetToolBar(self)
- self.addButtonId = wxNewId()
- self.deleteButtonId = wxNewId()
+ self.addButtonId = wx.NewId()
+ self.deleteButtonId = wx.NewId()
self.AddSimpleTool(self.addButtonId,
- wxImage(images_dir+gConfig('tb_insert'),
- wxBITMAP_TYPE_PNG).ConvertToBitmap(),
+ wx.Image(images_dir+gConfig('tb_insert'),
+ wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
_("Create Data Source"),
_("Create a new data source"))
self.AddSimpleTool(self.deleteButtonId,
- wxImage(images_dir+gConfig('tb_delete'),
- wxBITMAP_TYPE_PNG).ConvertToBitmap(),
+ wx.Image(images_dir+gConfig('tb_delete'),
+ wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
_("Delete Data Source"),
_("Delete the currently selected data source"))
- EVT_TOOL(self, self.addButtonId, editor.OnAddDSSelected)
- EVT_TOOL(self, self.deleteButtonId, editor.OnDeleteDSSelected)
+ wx.EVT_TOOL(self, self.addButtonId, editor.OnAddDSSelected)
+ wx.EVT_TOOL(self, self.deleteButtonId, editor.OnDeleteDSSelected)
self.dblinks = []
@@ -390,12 +390,12 @@
# Properties Tab
#
-class PropertyViewer(wxPanel):
+class PropertyViewer(wx.Panel):
def __init__(self, editor, parentWindow):
- wxPanel.__init__(self, parentWindow, -1)
+ wx.Panel.__init__(self, parentWindow, -1)
self.editor = editor
- EVT_SIZE(self, self.OnSize)
+ wx.EVT_SIZE(self, self.OnSize)
def setCurrent(self, object):
@@ -418,19 +418,19 @@
REF_TYPE = 2
REF_COLUMNS = REF_TYPE + 1
-class ReferencesViewer(wxPanel):
+class ReferencesViewer(wx.Panel):
def __init__(self, editor, parentWindow):
- wxPanel.__init__(self, parentWindow, -1)
+ wx.Panel.__init__(self, parentWindow, -1)
self.editor = editor
- self.list = wxListCtrl(self, -1, pos=wxPoint(0,0),
- style=wxLC_REPORT|wxLC_HRULES|wxLC_VRULES)
+ self.list = wx.ListCtrl(self, -1, pos=wx.Point(0,0),
+ style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES)
self.list.InsertColumn(REF_NAME, _('Reference'))
self.list.InsertColumn(REF_REFR, _('Referrer'))
- self.list.InsertColumn(REF_TYPE, _('Type'), wxLIST_FORMAT_RIGHT)
+ self.list.InsertColumn(REF_TYPE, _('Type'), wx.LIST_FORMAT_RIGHT)
- EVT_SIZE(self, self.OnSize)
+ wx.EVT_SIZE(self, self.OnSize)
def setCurrent(self, object):
if isinstance(object, GDataSource.GDataSource):
@@ -530,24 +530,24 @@
SCH_REQ = 4
SCH_COLUMNS = SCH_REQ + 1
-class SchemaViewer(wxPanel):
+class SchemaViewer(wx.Panel):
def __init__(self, editor, parentWindow):
- wxPanel.__init__(self, parentWindow, -1)
+ wx.Panel.__init__(self, parentWindow, -1)
self.editor = editor
- self.list = wxListCtrl(self, -1, pos=wxPoint(0,0),
- style=wxLC_REPORT|wxLC_HRULES|wxLC_VRULES)
+ self.list = wx.ListCtrl(self, -1, pos=wx.Point(0,0),
+ style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES)
self.list.InsertColumn(SCH_FIELD, _('Field'))
self.list.InsertColumn(SCH_TYPE, _('Base Type'))
- self.list.InsertColumn(SCH_SIZE, _('Size'), wxLIST_FORMAT_RIGHT)
+ self.list.InsertColumn(SCH_SIZE, _('Size'), wx.LIST_FORMAT_RIGHT)
self.list.InsertColumn(SCH_NATIVE,_('Native Type'))
self.list.InsertColumn(SCH_REQ, _('Required'))
self.schemaMap = []
- EVT_SIZE(self, self.OnSize)
- EVT_LIST_BEGIN_DRAG(self, self.list.GetId(), self.OnBeginDrag)
+ wx.EVT_SIZE(self, self.OnSize)
+ wx.EVT_LIST_BEGIN_DRAG(self, self.list.GetId(), self.OnBeginDrag)
def fillList(self):
@@ -627,8 +627,8 @@
# Cycle through each selected item
while 1:
item = self.list.GetNextItem(item,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ wx.LIST_NEXT_ALL,
+ wx.LIST_STATE_SELECTED);
if item == -1:
break
@@ -663,21 +663,21 @@
"Label": label})
- do = wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ do =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
do.SetData(cPickle.dumps(data,1))
- dropSource = wxDropSource(self)
+ dropSource = wx.DropSource(self)
dropSource.SetData(do)
- result = dropSource.DoDragDrop(false)
+ result = dropSource.DoDragDrop(False)
# Get around a few wx 2.2.x shortcomings:
try:
- wxLC_HRULES
- wxLC_VRULES
+ wx.LC_HRULES
+ wx.LC_VRULES
except NameError:
- wxLC_HRULES=0
- wxLC_VRULES=0
+ wx.LC_HRULES=0
+ wx.LC_VRULES=0
# Shortcut
Modified: trunk/gnue-designer/src/base/tools/EventEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/EventEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/tools/EventEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -28,8 +28,8 @@
import sys, os, string
-from wxPython.wx import *
-from wxPython.grid import *
+import wx
+from wx.grid import *
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
from gnue.common.logic.GTrigger import GTrigger
@@ -44,8 +44,8 @@
default_dock = 'left-2'
def init(self):
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
- self.notebook = wxNotebook(self.panel, -1, style=wxNB_BOTTOM)
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
+ self.notebook = wx.Notebook(self.panel, -1, style=wx.NB_BOTTOM)
self.object = None
@@ -59,7 +59,7 @@
})
self.supplemental = []
- EVT_SIZE(self, self.onSize)
+ wx.EVT_SIZE(self, self.onSize)
self.main = self.createMainPage()
self.notebook.AddPage(self.main,'Properties')
@@ -134,14 +134,14 @@
#
#
#
-class InspectorPanel(wxPanel):
+class InspectorPanel(wx.Panel):
NAMESPACE = ""
def __init__(self, editor, parent):
- wxPanel.__init__(self, parent, -1)
+ wx.Panel.__init__(self, parent, -1)
self.editor = editor
self.object = None
@@ -151,7 +151,7 @@
self.rowList = []
# Set up our grid
- self.grid = wxGrid(self, -1, pos=wxPoint(0,0))
+ self.grid = Grid(self, -1, pos=wx.Point(0,0))
self.grid.CreateGrid(1,1)
self.grid.SetColLabelSize(0)
@@ -160,7 +160,7 @@
EVT_GRID_SELECT_CELL(self.grid, self.OnCellSelected)
EVT_GRID_CELL_CHANGE(self.grid, self.OnCellChange)
EVT_GRID_CELL_LEFT_DCLICK(self.grid, self.OnLeftDClick)
- EVT_SIZE(self, self.onSize)
+ wx.EVT_SIZE(self, self.onSize)
self.editor.rootObject.walk(self.inventoryObject)
@@ -265,7 +265,7 @@
try:
if handler != __name__ and self.object == object:
self._setCurrent(object)
- except wxPyDeadObjectError:
+ except wx.PyDeadObjectError:
pass
@@ -413,7 +413,7 @@
def Create(self, parent, id, evtHandler):
assert gDebug(10,'Creating CharCellEditor')
- self._tc = wxComboBox(parent, id, "", style=wxCB_READONLY,
+ self._tc = wx.ComboBox(parent, id, "", style=wx.CB_READONLY,
choices=self.selectionList)
self.SetControl(self._tc)
if evtHandler:
@@ -425,11 +425,11 @@
self._tc.SetFocus()
def EndEdit(self, row, col, grid):
- changed = false
+ changed = False
val = self.valueList[self._tc.GetSelection()]
if val != self.startValue:
- changed = true
+ changed = True
grid.GetTable().SetValue(row, col, "%s" % val) # update the table
self.startValue = ''
Modified: trunk/gnue-designer/src/base/tools/PropertyEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/PropertyEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/base/tools/PropertyEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -29,8 +29,8 @@
__all__ = ['PropertyEditor']
import sys, os, string
-from wxPython.wx import *
-from wxPython.grid import *
+import wx
+from wx.grid import *
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
from gnue.designer.base.ToolBase import *
@@ -42,8 +42,8 @@
default_dock = 'left-1'
def init(self):
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
- self.notebook = wxNotebook(self.panel, -1, style=wxNB_BOTTOM)
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
+ self.notebook = wx.Notebook(self.panel, -1, style=wx.NB_BOTTOM)
self.object = None
@@ -56,7 +56,7 @@
})
self.supplemental = []
- EVT_SIZE(self, self.__onSize)
+ wx.EVT_SIZE(self, self.__onSize)
self.main = self.createMainPage()
self.notebook.AddPage(self.main,'Properties')
@@ -123,13 +123,13 @@
#
#
#
-class InspectorPanel(wxScrolledWindow):
+class InspectorPanel(wx.ScrolledWindow):
NAMESPACE = ""
def __init__(self, editor, parent):
- wxScrolledWindow.__init__(self, parent, -1, style = wxHSCROLL)
- self.splitter = splitter = wxSplitterWindow(self, -1, style=wxSP_3DSASH |
wxSP_NOBORDER)
+ wx.ScrolledWindow.__init__(self, parent, -1, style = wx.HSCROLL)
+ self.splitter = splitter = wx.SplitterWindow(self, -1, style=wx.SP_3DSASH
| wx.SP_NOBORDER)
self.object = None
self.editor = editor
self.fields = []
@@ -139,11 +139,11 @@
self.maxy = 0
self.maxLabel = 0
- self.labelPanel = wxPanel(splitter, -1)
- self.fieldPanel = wxPanel(splitter, -1)
+ self.labelPanel = wx.Panel(splitter, -1)
+ self.fieldPanel = wx.Panel(splitter, -1)
splitter.SplitVertically(self.labelPanel, self.fieldPanel)
- EVT_SPLITTER_SASH_POS_CHANGED(self, self.splitter.GetId(),self.__onSize)
- EVT_SIZE(self, self.__onSize)
+ wx.EVT_SPLITTER_SASH_POS_CHANGED(self, self.splitter.GetId(),self.__onSize)
+ wx.EVT_SIZE(self, self.__onSize)
def getAttributes(self, object):
@@ -211,7 +211,7 @@
text += ':'
try:
- label = wxStaticText (self.labelPanel, -1, text)
+ label = wx.StaticText (self.labelPanel, -1, text)
except:
pass
@@ -219,22 +219,22 @@
# (Integer, Boolean, Dropdown, Char)
if self.attributes[key].has_key('ValueSet'):
field = LimitedSetEditor(self.fieldPanel,self.attributes[key])
- EVT_COMBOBOX(field, field.GetId(), self.__valueModified)
+ wx.EVT_COMBOBOX(field, field.GetId(), self.__valueModified)
elif self.attributes[key].has_key('References'):
tag, attr = self.attributes[key]['References'].split('.')
objectList = self.editor.instance.getObjectList(tag)
field = LinkedTextEditor(self.fieldPanel, self.attributes[key],
objectList, attr)
- EVT_COMBOBOX(field, field.GetId(), self.__valueModified)
+ wx.EVT_COMBOBOX(field, field.GetId(), self.__valueModified)
elif self.attributes[key]['Typecast'] == GTypecast.boolean:
field = BoolEditor(self.fieldPanel,self.attributes[key])
- EVT_COMBOBOX(field, field.GetId(), self.__valueModified)
+ wx.EVT_COMBOBOX(field, field.GetId(), self.__valueModified)
elif self.attributes[key]['Typecast'] in (GTypecast.integer,
GTypecast.number, GTypecast.whole):
field = IntEditor(self.fieldPanel,self.attributes[key])
- EVT_SPINCTRL(field, field.GetId(), self.__valueModified)
+ wx.EVT_SPINCTRL(field, field.GetId(), self.__valueModified)
else:
field = TextEditor(self.fieldPanel,self.attributes[key])
- EVT_TEXT(field, field.GetId(), self.__valueModified)
+ wx.EVT_TEXT(field, field.GetId(), self.__valueModified)
# Generate a tooltip from the description.
# Note that tooltips can have {Name} tokens
@@ -249,7 +249,7 @@
tt = tt.replace('{N}','"False"')
tt = tt.replace('{','"')
tt = tt.replace('}','"')
- field.SetToolTip(wxToolTip(tt))
+ field.SetToolTip(wx.ToolTip(tt))
except KeyError:
pass
@@ -350,7 +350,7 @@
new=newVal)
except ValueError:
- wxBell()
+ wx.Bell()
event.Skip()
@@ -358,10 +358,10 @@
#
# Property Editor derived from an attribute's ValueSet
#
-class LimitedSetEditor(wxComboBox):
+class LimitedSetEditor(wx.ComboBox):
def __init__(self, parent, attributes):
- wxComboBox.__init__(self, parent, -1,
- style=wxTE_PROCESS_ENTER|wxCB_DROPDOWN|wxCB_READONLY)
+ wx.ComboBox.__init__(self, parent, -1,
+ style=wx.TE_PROCESS_ENTER|wx.CB_DROPDOWN|wx.CB_READONLY)
self.attributes = attributes
self.selectionList = []
@@ -403,10 +403,10 @@
#
# Property Editor whose selections are linked to lists of other objects
#
-class LinkedTextEditor(wxComboBox):
+class LinkedTextEditor(wx.ComboBox):
def __init__(self, parent, attributes, objectList, attr):
- wxComboBox.__init__(self, parent, -1,
- style=wxTE_PROCESS_ENTER|wxCB_DROPDOWN|wxCB_SORT)
+ wx.ComboBox.__init__(self, parent, -1,
+ style=wx.TE_PROCESS_ENTER|wx.CB_DROPDOWN|wx.CB_SORT)
self.attributes = attributes
self.objectList = objectList
self.attr = attr
@@ -415,18 +415,18 @@
def Destroy(self):
self.objectList.removeListener(self.updateList)
- wxComboBox.Destroy(self)
+ wx.ComboBox.Destroy(self)
def GetValue(self):
- return wxComboBox.GetValue(self) or None
+ return wx.ComboBox.GetValue(self) or None
def SetValue(self, value):
if value in self.list:
self.SetSelection(self.list.index(value))
elif value is None:
- wxComboBox.SetValue(self, "")
+ wx.ComboBox.SetValue(self, "")
else:
- wxComboBox.SetValue(self, value)
+ wx.ComboBox.SetValue(self, value)
def updateList(self):
try:
@@ -438,7 +438,7 @@
for v in self.objectList:
self.list.append(v[self.attr])
self.Append("%s" % v[self.attr])
- except wxPyDeadObjectError:
+ except wx.PyDeadObjectError:
# TODO: why are we getting this exception?
# TODO: Destroy() is being explicitly called. :(
pass
@@ -446,10 +446,10 @@
#
# Property editor for boolean types
#
-class BoolEditor(wxComboBox):
+class BoolEditor(wx.ComboBox):
def __init__(self, parent, attributes):
- wxComboBox.__init__(self, parent, -1,
- style=wxTE_PROCESS_ENTER|wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT)
+ wx.ComboBox.__init__(self, parent, -1,
+ style=wx.TE_PROCESS_ENTER|wx.CB_DROPDOWN|wx.CB_READONLY|wx.CB_SORT)
self.attributes = attributes
if not (self.attributes.has_key('Required') and
self.attributes['Required'] ):
@@ -460,45 +460,45 @@
except KeyError:
default = None
- self.true = _('Yes') + (default and '*' or '')
- self.false = _('No') + (not default and '*' or '')
+ self.True = _('Yes') + (default and '*' or '')
+ self.False = _('No') + (not default and '*' or '')
- self.Append(self.true)
- self.Append(self.false)
+ self.Append(self.True)
+ self.Append(self.False)
def GetValue(self):
- v = wxComboBox.GetValue(self)
+ v = wx.ComboBox.GetValue(self)
if v == '':
return None
else:
- return v == self.true
+ return v == self.True
def SetValue(self, value):
if value == None:
- wxComboBox.SetValue(self,'')
+ wx.ComboBox.SetValue(self,'')
elif value:
- wxComboBox.SetValue(self,self.true)
+ wx.ComboBox.SetValue(self,self.True)
else:
- wxComboBox.SetValue(self,self.false)
+ wx.ComboBox.SetValue(self,self.False)
#
#
#
-class IntEditor(wxSpinCtrl):
+class IntEditor(wx.SpinCtrl):
def __init__(self, parent, attributes):
- wxSpinCtrl.__init__(self, parent, -1, style=wxTE_PROCESS_ENTER)
+ wx.SpinCtrl.__init__(self, parent, -1, style=wx.TE_PROCESS_ENTER)
self.attributes = attributes
#
#
#
-class TextEditor(wxTextCtrl):
+class TextEditor(wx.TextCtrl):
def __init__(self, parent, attributes):
- wxTextCtrl.__init__(self, parent, -1, style=wxTE_PROCESS_ENTER)
+ wx.TextCtrl.__init__(self, parent, -1, style=wx.TE_PROCESS_ENTER)
self.attributes = attributes
def SetValue(self, value):
if value == None:
value = ""
- wxTextCtrl.SetValue(self, wxEncode(value))
+ wx.TextCtrl.SetValue(self, wxEncode(value))
Modified: trunk/gnue-designer/src/base/tools/SchemaNavigator.py
===================================================================
--- trunk/gnue-designer/src/base/tools/SchemaNavigator.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/base/tools/SchemaNavigator.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -48,9 +48,9 @@
__all__ = ['SchemaNavigator']
import sys, os, cPickle, traceback, StringIO, string, types
-from wxPython.wx import *
-from wxPython.gizmos import *
-from wxPython.wx import __version__ as wxversion
+import wx
+from wx.gizmos import *
+from wx import __version__ as wxversion
from gnue.common.apps import GDebug
from gnue.common.datasources import GDataSource
from gnue.common.apps import RuntimeSettings
@@ -82,8 +82,8 @@
ConnectionNode(self, tree, root, connection=connection)
## tree.Expand(root)
- sizer = wxBoxSizer(wxVERTICAL)
- sizer.Add(tree, 1, wxEXPAND|wxALL, 6)
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ sizer.Add(tree, 1, wx.EXPAND|wx.ALL, 6)
self.SetAutoLayout(True)
self.SetSizer(sizer)
@@ -97,9 +97,9 @@
## })
self.expanded = 1
- EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnSelectionChange)
- EVT_TREE_BEGIN_DRAG(self, self.tree.GetId(), self.OnBeginDrag)
- EVT_TREE_BEGIN_RDRAG(self, self.tree.GetId(), self.OnBeginRDrag)
+ wx.EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnSelectionChange)
+ wx.EVT_TREE_BEGIN_DRAG(self, self.tree.GetId(), self.OnBeginDrag)
+ wx.EVT_TREE_BEGIN_RDRAG(self, self.tree.GetId(), self.OnBeginRDrag)
self.Layout()
@@ -112,14 +112,14 @@
return ""
def OnBeginDrag(self, event, right=0):
- do = wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ do =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
do.SetData(cPickle.dumps(self.buildDataObject(right),1))
- dropSource = wxDropSource(self)
+ dropSource = wx.DropSource(self)
dropSource.SetData(do)
self.instance.dispatchEvent('BeginUndoGroup')
- # win32 needs wxDrag_AllowMove to really enable DnD...
- result = dropSource.DoDragDrop(wxDrag_CopyOnly | wxDrag_AllowMove)
+ # win32 needs wx.Drag_AllowMove to really enable DnD...
+ result = dropSource.DoDragDrop(wx.Drag_CopyOnly | wx.Drag_AllowMove)
self.instance.dispatchEvent('EndUndoGroup')
def OnBeginRDrag(self, event):
@@ -197,17 +197,17 @@
return [{'Type': 'SchemaDrop', 'Data': rs, 'ShowMenu': right}]
-class TreeCtrl(wxTreeCtrl):
+class TreeCtrl(wx.TreeCtrl):
def __init__(self, parent, tool):
- wxTreeCtrl.__init__(self, parent, -1,
-## style=wxTR_HAS_BUTTONS|wxTR_NO_LINES| wxTR_HIDE_ROOT|
-## wxNO_BORDER|wxTR_MULTIPLE|wxTR_ROW_LINES)
- style=wxTR_HAS_BUTTONS|wxTR_HIDE_ROOT|wxTR_LINES_AT_ROOT|
- wxSIMPLE_BORDER|wxTR_MULTIPLE|wxTR_FULL_ROW_HIGHLIGHT )
+ wx.TreeCtrl.__init__(self, parent, -1,
+## style=wx.TR_HAS_BUTTONS|wx.TR_NO_LINES| wx.TR_HIDE_ROOT|
+## wx.NO_BORDER|wx.TR_MULTIPLE|wx.TR_ROW_LINES)
+ style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_LINES_AT_ROOT|
+ wx.SIMPLE_BORDER|wx.TR_MULTIPLE|wx.TR_FULL_ROW_HIGHLIGHT )
self.tool = tool
- EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.__OnExpand)
+ wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.__OnExpand)
def __OnExpand(self, event):
Modified: trunk/gnue-designer/src/base/tools/SchemaViewer.py
===================================================================
--- trunk/gnue-designer/src/base/tools/SchemaViewer.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/tools/SchemaViewer.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -28,7 +28,7 @@
#
import sys, os, cPickle, traceback, StringIO, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.datasources import GDataSource
from gnue.common.apps import RuntimeSettings
@@ -49,11 +49,11 @@
## self.toolBar = ToolBar(self, parentWindow)
- self.splitter = wxSplitterWindow(self, -1, style=wxSP_3D,
point=wxPoint(0,32))
+ self.splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D,
point=wx.Point(0,32))
- self.list = wxListCtrl(self.splitter, -1, pos=wxPoint(0,0),
- style=wxLC_REPORT|
- wxLC_HRULES|wxLC_VRULES|wxLC_SINGLE_SEL)
+ self.list = wx.ListCtrl(self.splitter, -1, pos=wx.Point(0,0),
+ style=wx.LC_REPORT|
+ wx.LC_HRULES|wx.LC_VRULES|wx.LC_SINGLE_SEL)
self.list.InsertColumn(0,_('Name'))
self.list.InsertColumn(1,_('Type'))
@@ -62,7 +62,7 @@
self.splitter.SplitHorizontally(self.list, self.schemaPanel,200)
- EVT_SIZE(self, self.OnSize)
+ wx.EVT_SIZE(self, self.OnSize)
self.current = None
@@ -78,25 +78,25 @@
#
# Set up the "selection" panel
#
- self.combopanel = wxPanel(self, -1, pos=wxPoint(0,0), size=wxSize(32,32),
- style=wxRAISED_BORDER|wxCLIP_CHILDREN)
+ self.combopanel = wx.Panel(self, -1, pos=wx.Point(0,0),
size=wx.Size(32,32),
+ style=wx.RAISED_BORDER|wx.CLIP_CHILDREN)
- self.connLabel = wxStaticText(self.combopanel, -1, _("Connection: "),
- pos=wxPoint(4,6))
- self.connCombo = wxComboBox(self.combopanel, -1,
- pos=wxPoint(self.connLabel.GetSize().width + 10,4),
+ self.connLabel = wx.StaticText(self.combopanel, -1, _("Connection: "),
+ pos=wx.Point(4,6))
+ self.connCombo = wx.ComboBox(self.combopanel, -1,
+ pos=wx.Point(self.connLabel.GetSize().width + 10,4),
# size=self.connLabel.GetSize(),
- style=wxCB_READONLY)
- self.typeLabel = wxStaticText(self.combopanel, -1, _("Show: "),
- pos=wxPoint(self.connCombo.GetPosition().x + \
+ style=wx.CB_READONLY)
+ self.typeLabel = wx.StaticText(self.combopanel, -1, _("Show: "),
+ pos=wx.Point(self.connCombo.GetPosition().x + \
self.connCombo.GetSize().width + 20,6))
- self.typeCombo = wxComboBox(self.combopanel, -1,
- pos=wxPoint(self.typeLabel.GetPosition().x + \
+ self.typeCombo = wx.ComboBox(self.combopanel, -1,
+ pos=wx.Point(self.typeLabel.GetPosition().x + \
self.typeLabel.GetSize().width + 10,4),
- style=wxCB_READONLY)
+ style=wx.CB_READONLY)
- self.combopanel.SetSize(wxSize(32, self.typeCombo.GetSize().height+12))
+ self.combopanel.SetSize(wx.Size(32, self.typeCombo.GetSize().height+12))
self.splitter.SetPosition((0,self.combopanel.GetSize().height))
self.connCombo.Append('')
@@ -105,11 +105,11 @@
for name in self.connectionNames:
self.connCombo.Append(name)
- EVT_COMBOBOX(self, self.connCombo.GetId(), self.OnConnectionSelected)
+ wx.EVT_COMBOBOX(self, self.connCombo.GetId(), self.OnConnectionSelected)
- EVT_LIST_BEGIN_DRAG(self, self.list.GetId(), self.OnBeginDrag)
- EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnTableSelected)
+ wx.EVT_LIST_BEGIN_DRAG(self, self.list.GetId(), self.OnBeginDrag)
+ wx.EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnTableSelected)
self.finalized = 0
self.splitter.SetSize(self.GetSize())
@@ -193,8 +193,8 @@
self.splitter.SetSize(self.GetSize())
w,h = self.GetClientSizeTuple()
- self.combopanel.SetSize(wxSize(w,self.combopanel.GetSize().height))
- self.splitter.SetSize(wxSize(w,h-self.combopanel.GetSize().height))
+ self.combopanel.SetSize(wx.Size(w,self.combopanel.GetSize().height))
+ self.splitter.SetSize(wx.Size(w,h-self.combopanel.GetSize().height))
# Runtime Setting Support
@@ -271,12 +271,12 @@
object = self.connectionCache[self.connectionName][1]\
[self.list.HitTest(event.GetPoint())[0]]
- do = wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ do =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
do.SetData(cPickle.dumps(self.buildDataObject(object),1))
- dropSource = wxDropSource(self)
+ dropSource = wx.DropSource(self)
dropSource.SetData(do)
- result = dropSource.DoDragDrop(false)
+ result = dropSource.DoDragDrop(False)
def buildDataObject(self, object):
@@ -314,24 +314,24 @@
SCH_REQ = 4
SCH_COLUMNS = SCH_REQ + 1
-class ChildSchemaViewer(wxPanel):
+class ChildSchemaViewer(wx.Panel):
def __init__(self, editor, parentWindow):
- wxPanel.__init__(self, parentWindow, -1)
+ wx.Panel.__init__(self, parentWindow, -1)
self.editor = editor
- self.list = wxListCtrl(self, -1, pos=wxPoint(0,0),
- style=wxLC_REPORT|wxLC_HRULES|wxLC_VRULES)
+ self.list = wx.ListCtrl(self, -1, pos=wx.Point(0,0),
+ style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES)
self.list.InsertColumn(SCH_FIELD, _('Field'))
self.list.InsertColumn(SCH_TYPE, _('Base Type'))
- self.list.InsertColumn(SCH_SIZE, _('Size'), wxLIST_FORMAT_RIGHT)
+ self.list.InsertColumn(SCH_SIZE, _('Size'), wx.LIST_FORMAT_RIGHT)
self.list.InsertColumn(SCH_NATIVE,_('Native Type'))
self.list.InsertColumn(SCH_REQ, _('Required'))
- EVT_SIZE(self, self.OnSize)
- EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnFieldSelected)
- EVT_LIST_BEGIN_DRAG(self, self.list.GetId(), self.OnBeginDrag)
+ wx.EVT_SIZE(self, self.OnSize)
+ wx.EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnFieldSelected)
+ wx.EVT_LIST_BEGIN_DRAG(self, self.list.GetId(), self.OnBeginDrag)
def clear(self):
@@ -410,8 +410,8 @@
# Cycle through each selected item
while 1:
item = self.list.GetNextItem(item,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ wx.LIST_NEXT_ALL,
+ wx.LIST_STATE_SELECTED);
if item == -1:
break
@@ -461,19 +461,19 @@
"DefaultInfo": defaultval
} )
- do = wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ do =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
do.SetData(cPickle.dumps(data,1))
- dropSource = wxDropSource(self)
+ dropSource = wx.DropSource(self)
dropSource.SetData(do)
- result = dropSource.DoDragDrop(false)
+ result = dropSource.DoDragDrop(False)
# Get around a few wx 2.2.x shortcomings:
try:
- wxLC_HRULES
- wxLC_VRULES
+ wx.LC_HRULES
+ wx.LC_VRULES
except NameError:
- wxLC_HRULES=0
- wxLC_VRULES=0
+ wx.LC_HRULES=0
+ wx.LC_VRULES=0
Modified: trunk/gnue-designer/src/base/tools/TreeView.py
===================================================================
--- trunk/gnue-designer/src/base/tools/TreeView.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/tools/TreeView.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -28,12 +28,12 @@
# TODO: * all the SetItemImage lines in this file have been commented
# out as on win32 it was segfaulting
# * make TreeView more stable, at the moment it fires OnTreeItemSelected
-# events while beeing destroyed, which is causing segfaults on wxPy<2.3
-# (wxPy 2.3 raises exceptions) when TreeView is not the first tool to
+# events while beeing destroyed, which is causing segfaults on
wx.Py<2.3
+# (wx.Py 2.3 raises exceptions) when TreeView is not the first tool to
# be removed
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.logic import GTrigger
from gnue.forms import GFForm, GFObjects, GFLibrary
@@ -56,25 +56,25 @@
'ObjectDeleted' : self.onDeleteObject,
})
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
- EVT_SIZE(self, self.onSize)
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
+ wx.EVT_SIZE(self, self.onSize)
- self.tree = wxTreeCtrl(self.panel, wxNewId(),
- style=wxTR_HAS_BUTTONS|#wxTR_EDIT_LABELS|
- wxTR_FULL_ROW_HIGHLIGHT)#|wxTR_HIDE_ROOT)
+ self.tree = wx.TreeCtrl(self.panel, wx.NewId(),
+ style=wx.TR_HAS_BUTTONS|#wx.TR_EDIT_LABELS|
+ wx.TR_FULL_ROW_HIGHLIGHT)#|wx.TR_HIDE_ROOT)
self._handler = None
self.tree.SetImageList(treeIconList)
- EVT_TREE_BEGIN_LABEL_EDIT(self, self.tree.GetId(), self.OnTreeLabelEdit)
- EVT_TREE_END_LABEL_EDIT(self, self.tree.GetId(), self.OnTreeLabelEditEnd)
- EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnTreeItemSelected)
+ wx.EVT_TREE_BEGIN_LABEL_EDIT(self, self.tree.GetId(), self.OnTreeLabelEdit)
+ wx.EVT_TREE_END_LABEL_EDIT(self, self.tree.GetId(),
self.OnTreeLabelEditEnd)
+ wx.EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnTreeItemSelected)
root = self.rootObject._treeItem = self.tree.AddRoot(self.rootDescr)
self.tree.SetPyData(self.rootObject._treeItem, self.rootObject)
- EVT_RIGHT_DOWN(self, self.OnRightDown)
- EVT_LEFT_DCLICK(self, self.OnEditProperties)
+ wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
+ wx.EVT_LEFT_DCLICK(self, self.OnEditProperties)
self.inittree()
self.rootObject.walk(self.inventoryObject)
Modified: trunk/gnue-designer/src/base/tools/TriggerEditor.py
===================================================================
--- trunk/gnue-designer/src/base/tools/TriggerEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/base/tools/TriggerEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -21,15 +21,17 @@
# $Id$
-from wxPython.wx import *
from gnue.common.apps import GDebug
from gnue.common.definitions import GParserHelpers
from gnue.common.logic import GTrigger
from gnue.designer.base.ToolBase import *
-import keyword, string
+from gnue.designer.uidrivers.wx.uihelpers.PythonEditor import PythonSTC
+import wx
+import wx.stc
+
# What Mode are we in?
NAMED_TRIGGER = 1
EVENT_TRIGGER = 0
@@ -38,17 +40,13 @@
class TriggerEditor (ToolBase):
runtime_section = "TriggerEditor"
- default_width = int(wxSystemSettings_GetSystemMetric( wxSYS_SCREEN_X )/3)
- default_height = int(wxSystemSettings_GetSystemMetric( wxSYS_SCREEN_Y )/3)
+ default_width = int(wx.SystemSettings_GetMetric( wx.SYS_SCREEN_X )/3)
+ default_height = int(wx.SystemSettings_GetMetric( wx.SYS_SCREEN_Y )/3)
default_dock = 'right-2'
def init(self):
- if USE_STC:
- EditorCtrl = PythonEditorControl
- else:
- EditorCtrl = FallbackPythonEditorControl
- self.editor = EditorCtrl(self,-1, pos=wxPoint(0,32))
+ self.editor = PythonEditorControl(self,-1, pos=wx.Point(0,32))
self.editor.InEditMode = 0
@@ -61,22 +59,22 @@
self.editor.SetReadOnly(1)
- EVT_SIZE(self, self._onSize)
- EVT_KILL_FOCUS(self.editor, self.OnKillFocus)
+ wx.EVT_SIZE(self, self._onSize)
+ wx.EVT_KILL_FOCUS(self.editor, self.OnKillFocus)
self.__ignoreevent = 0
self.mode = NAMED_TRIGGER
- self.toolpanel = wxPanel(self, -1, pos=wxPoint(0,0), size=wxSize(32,32),
style=wxRAISED_BORDER|wxCLIP_CHILDREN)
+ self.toolpanel = wx.Panel(self, -1, pos=wx.Point(0,0),
size=wx.Size(32,32), style=wx.RAISED_BORDER|wx.CLIP_CHILDREN)
- self.namedNameLabel = wxStaticText(self.toolpanel, -1, _("Trigger: "),
pos=wxPoint(4,6))
- self.triggerCombo = wxComboBox(self.toolpanel, -1, choices=['This is to
make the combo box big enough'],pos=wxPoint(self.namedNameLabel.GetSize().width
+ 10,4), style=wxCB_READONLY)
+ self.namedNameLabel = wx.StaticText(self.toolpanel, -1, _("Trigger: "),
pos=wx.Point(4,6))
+ self.triggerCombo = wx.ComboBox(self.toolpanel, -1, choices=['This is to
make the combo box big
enough'],pos=wx.Point(self.namedNameLabel.GetSize().width + 10,4),
style=wx.CB_READONLY)
self.toolh = max(self.namedNameLabel.GetSizeTuple()[1],
self.triggerCombo.GetSizeTuple()[1]) + 12
self.triggerCombo.Clear()
self.triggerCombo.Append('')
self.editor.SetPosition((0, self.toolh))
- EVT_COMBOBOX(self, self.triggerCombo.GetId(), self.OnTriggerSelected)
+ wx.EVT_COMBOBOX(self, self.triggerCombo.GetId(), self.OnTriggerSelected)
# EventAware provided by ToolBase
@@ -97,11 +95,11 @@
s= event.GetSelection()
if s:
trigger = self.triggerMap[self.triggerList[s-1]]
- wxCallAfter(self.dispatchEvent,'TriggerSelected',
+ wx.CallAfter(self.dispatchEvent,'TriggerSelected',
object = trigger,
originator = None)
if trigger.type.upper() != 'NAMED':
- wxCallAfter(self.dispatchEvent,'ObjectSelected',
+ wx.CallAfter(self.dispatchEvent,'ObjectSelected',
object = trigger.getParent (),
originator = None)
@@ -118,8 +116,8 @@
def _onSize(self, event):
w,h = self.GetClientSizeTuple()
- self.toolpanel.SetSize(wxSize(w,self.toolh))
- self.editor.SetSize(wxSize(w,h-self.toolh+1))
+ self.toolpanel.SetSize(wx.Size(w,self.toolh))
+ self.editor.SetSize(wx.Size(w,h-self.toolh+1))
def onSetCurrentObject (self, event):
@@ -250,339 +248,26 @@
self.refillTriggerCombo()
-try:
- if gConfig('ForceSimpleEditor',section="designer") == True:
- raise ImportError
-
- from wxPython.stc import *
- USE_STC = 1
-
-
-#
-# A Python Editor Control using wxPython's Scintilla support.
-# This class is largely based on demo code from wxPython
-#
-
- class PythonEditorControl(wxStyledTextCtrl):
+class PythonEditorControl(PythonSTC):
def __init__(self, parent, *args, **parms):
- wxStyledTextCtrl.__init__(self, parent, *args, **parms)
+ PythonSTC.__init__(self, parent, *args, **parms)
+ self.__makeDirty = parent.instance.makeDirty
+ self.__parent = parent
- self.instance = parent.instance
- self.parent = parent
+ # TODO: FInd a better way...
+ wx.stc.EVT_STC_MODIFIED(self, self.GetId(), self.__OnChange)
- self.CmdKeyAssign(ord('B'), wxSTC_SCMOD_CTRL, wxSTC_CMD_ZOOMIN)
- self.CmdKeyAssign(ord('N'), wxSTC_SCMOD_CTRL, wxSTC_CMD_ZOOMOUT)
-
- self.SetLexer(wxSTC_LEX_PYTHON)
- self.SetKeyWords(0, string.join(keyword.kwlist))
-
- self.SetProperty("fold", "1")
- self.SetProperty("tab.timmy.whinge.level", "1")
- self.SetMargins(0,0)
-
- self.SetViewWhiteSpace(false)
- #self.SetBufferedDraw(false)
-
- self.SetEdgeMode(wxSTC_EDGE_BACKGROUND)
- self.SetEdgeColumn(78)
-
- # Setup a margin to hold fold markers
- #self.SetFoldFlags(16) ### WHAT IS THIS VALUE? WHAT ARE THE OTHER
FLAGS? DOES IT MATTER?
- self.SetMarginType(2, wxSTC_MARGIN_SYMBOL)
- self.SetMarginMask(2, wxSTC_MASK_FOLDERS)
- self.SetMarginSensitive(2, true)
- self.SetMarginWidth(2, 15)
- self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_ARROW, "navy", "navy")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "navy",
"navy")
-## self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE , "navy",
"navy")
-
-
-## self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, 0, "navy", "navy") #
Collapsed
-## self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, 0, "navy", "navy") # Collapsed
-## self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_VLINE,
"navy", "navy") # Expanded
-## self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_VLINE, "navy",
"navy") # End of Nested Folder
- # Inside of Folder Marker
-
-
- EVT_STC_UPDATEUI(self, self.GetId(), self.OnUpdateUI)
- EVT_STC_MARGINCLICK(self, self.GetId(), self.OnMarginClick)
- EVT_STC_MODIFIED(self, self.GetId(), self.OnChange)
-
-
- # Make some styles, The lexer defines what each style is used for, we
- # just have to define what each style looks like. This set is adapted from
- # Scintilla sample property files.
-
- self.StyleClearAll()
-
-
- # TODO: A lot of this should be configurable
-
- if gConfig('ColorizeCode',section="designer") == True:
-
- # Global default styles for all languages
- self.StyleSetSpec(wxSTC_STYLE_DEFAULT, "face:%(helv)s,size:%(size)d"
% faces)
- self.StyleSetSpec(wxSTC_STYLE_LINENUMBER,
"back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces)
- self.StyleSetSpec(wxSTC_STYLE_CONTROLCHAR, "face:%(other)s" % faces)
- self.StyleSetSpec(wxSTC_STYLE_BRACELIGHT,
"fore:#FFFFFF,back:#0000FF,bold")
- self.StyleSetSpec(wxSTC_STYLE_BRACEBAD,
"fore:#000000,back:#FF0000,bold")
-
- # Python styles
- # White space
- self.StyleSetSpec(wxSTC_P_DEFAULT,
"fore:#808080,face:%(helv)s,size:%(size)d" % faces)
- # Comment
- self.StyleSetSpec(wxSTC_P_COMMENTLINE,
"fore:#007F00,face:%(other)s,size:%(size)d" % faces)
- # Number
- self.StyleSetSpec(wxSTC_P_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
- # String
- self.StyleSetSpec(wxSTC_P_STRING,
"fore:#7F007F,italic,face:%(times)s,size:%(size)d" % faces)
- # Single quoted string
- self.StyleSetSpec(wxSTC_P_CHARACTER,
"fore:#7F007F,italic,face:%(times)s,size:%(size)d" % faces)
- # Keyword
- self.StyleSetSpec(wxSTC_P_WORD, "fore:#00007F,bold,size:%(size)d" %
faces)
- # Triple quotes
- self.StyleSetSpec(wxSTC_P_TRIPLE, "fore:#7F0000,size:%(size)d" % faces)
- # Triple double quotes
- self.StyleSetSpec(wxSTC_P_TRIPLEDOUBLE, "fore:#7F0000,size:%(size)d" %
faces)
- # Class name definition
- self.StyleSetSpec(wxSTC_P_CLASSNAME,
"fore:#0000FF,bold,underline,size:%(size)d" % faces)
- # Function or method name definition
- self.StyleSetSpec(wxSTC_P_DEFNAME, "fore:#007F7F,bold,size:%(size)d" %
faces)
- # Operators
- self.StyleSetSpec(wxSTC_P_OPERATOR, "bold,size:%(size)d" % faces)
- # Identifiers
- self.StyleSetSpec(wxSTC_P_IDENTIFIER,
"fore:#202020,face:%(helv)s,size:%(size)d" % faces)
- # Comment-blocks
- self.StyleSetSpec(wxSTC_P_COMMENTBLOCK, "fore:#7F7F7F,size:%(size)d" %
faces)
- # End of line where string is not closed
- self.StyleSetSpec(wxSTC_P_STRINGEOL,
"fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled,size:%(size)d" % faces)
-
- self.SetCaretForeground("BLUE")
-
- EVT_KEY_DOWN(self, self.OnKeyPressed)
-
-
- def OnKeyPressed(self, event):
- key = event.KeyCode()
- if key == 32 and event.ControlDown():
- pos = self.GetCurrentPos()
- # Tips
- if event.ShiftDown():
-
- # TODO: Implement ToolTips
-
- self.CallTipSetBackground("yellow")
- self.CallTipShow(pos, 'param1, param2')
- # Code completion
- else:
-
- # TODO: Implement AutoComplete
-
- #lst = []
- #for x in range(50000):
- # lst.append('%05d' % x)
- #st = string.join(lst)
- #print len(st)
- #self.AutoCompShow(0, st)
-
- kw = keyword.kwlist[:]
- kw.append("zzzzzz")
- kw.append("aaaaa")
- kw.append("__init__")
- kw.append("zzaaaaa")
- kw.append("zzbaaaa")
- kw.append("this_is_a_longer_value")
- kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")
-
- kw.sort() # Python sorts are case sensitive
- self.AutoCompSetIgnoreCase(false) # so this needs to match
-
- self.AutoCompShow(0, string.join(kw))
- else:
- event.Skip()
-
- def OnChange(self, evt):
+ def __OnChange(self, evt):
if self.InEditMode:
- self.instance.makeDirty()
- self.parent.object._children[0]._content = self.GetText()
+ self.__makeDirty()
+ self.__parent.object.children[0]._content = self.GetText()
- def OnUpdateUI(self, evt):
- # check for matching braces
- braceAtCaret = -1
- braceOpposite = -1
- charBefore = None
- caretPos = self.GetCurrentPos()
- if caretPos > 0:
- charBefore = self.GetCharAt(caretPos - 1)
- styleBefore = self.GetStyleAt(caretPos - 1)
-
- # check before
- if charBefore and chr(charBefore) in "[]{}()" and styleBefore ==
wxSTC_P_OPERATOR:
- braceAtCaret = caretPos - 1
-
- # check after
- if braceAtCaret < 0:
- charAfter = self.GetCharAt(caretPos)
- styleAfter = self.GetStyleAt(caretPos)
- if charAfter and chr(charAfter) in "[]{}()" and styleAfter ==
wxSTC_P_OPERATOR:
- braceAtCaret = caretPos
-
- if braceAtCaret >= 0:
- braceOpposite = self.BraceMatch(braceAtCaret)
-
- if braceAtCaret != -1 and braceOpposite == -1:
- self.BraceBadLight(braceAtCaret)
- else:
- self.BraceHighlight(braceAtCaret, braceOpposite)
- #pt = self.PointFromPosition(braceOpposite)
- #self.Refresh(true, wxRect(pt.x, pt.y, 5,5))
- #print pt
- #self.Refresh(false)
-
-
- def OnMarginClick(self, evt):
- # fold and unfold as needed
- if evt.GetMargin() == 2:
- if evt.GetShift() and evt.GetControl():
- self.FoldAll()
- else:
- lineClicked = self.LineFromPosition(evt.GetPosition())
- if self.GetFoldLevel(lineClicked) & wxSTC_FOLDLEVELHEADERFLAG:
- if evt.GetShift():
- self.SetFoldExpanded(lineClicked, true)
- self.Expand(lineClicked, true, true, 1)
- elif evt.GetControl():
- if self.GetFoldExpanded(lineClicked):
- self.SetFoldExpanded(lineClicked, false)
- self.Expand(lineClicked, false, true, 0)
- else:
- self.SetFoldExpanded(lineClicked, true)
- self.Expand(lineClicked, true, true, 100)
- else:
- self.ToggleFold(lineClicked)
-
-
- def FoldAll(self):
- lineCount = self.GetLineCount()
- expanding = true
-
- # find out if we are folding or unfolding
- for lineNum in range(lineCount):
- if self.GetFoldLevel(lineNum) & wxSTC_FOLDLEVELHEADERFLAG:
- expanding = not self.GetFoldExpanded(lineNum)
- break;
-
- lineNum = 0
- while lineNum < lineCount:
- level = self.GetFoldLevel(lineNum)
- if level & wxSTC_FOLDLEVELHEADERFLAG and \
- (level & wxSTC_FOLDLEVELNUMBERMASK) == wxSTC_FOLDLEVELBASE:
-
- if expanding:
- self.SetFoldExpanded(lineNum, true)
- lineNum = self.Expand(lineNum, true)
- lineNum = lineNum - 1
- else:
- lastChild = self.GetLastChild(lineNum, -1)
- self.SetFoldExpanded(lineNum, false)
- if lastChild > lineNum:
- self.HideLines(lineNum+1, lastChild)
-
- lineNum = lineNum + 1
-
-
- def Expand(self, line, doExpand, force=false, visLevels=0, level=-1):
- lastChild = self.GetLastChild(line, level)
- line = line + 1
- while line <= lastChild:
- if force:
- if visLevels > 0:
- self.ShowLines(line, line)
- else:
- self.HideLines(line, line)
- else:
- if doExpand:
- self.ShowLines(line, line)
-
- if level == -1:
- level = self.GetFoldLevel(line)
-
- if level & wxSTC_FOLDLEVELHEADERFLAG:
- if force:
- if visLevels > 1:
- self.SetFoldExpanded(line, true)
- else:
- self.SetFoldExpanded(line, false)
- line = self.Expand(line, doExpand, force, visLevels-1)
-
- else:
- if doExpand and self.GetFoldExpanded(line):
- line = self.Expand(line, true, force, visLevels-1)
- else:
- line = self.Expand(line, false, force, visLevels-1)
- else:
- line = line + 1;
-
- return line
-
-
# The old code used SetEnabled, so we emulate that call here
+ # TODO: See if this still matters
def SetEnabled(self, bool):
self.SetReadOnly(bool)
-except ImportError:
- USE_STC = 0
- assert gDebug (1,
- 'Unable to load wxPython.stc, using fallback text editor')
-#
-# <cough>Hack!<cough>
-#
-# TODO: A lot of this should be configurable
-if wxPlatform == '__WXMSW__':
- faces = { 'times': 'Courier New',
- 'mono' : 'Courier New',
- 'helv' : 'Courier New',
- 'other': 'Courier New',
- 'size' : 10,
- 'size2': 10,
- }
-else:
-# faces = { 'times': 'Times',
-# 'mono' : 'Courier',
-# 'helv' : 'Helvetica',
-# 'other': 'Courier',
-# 'size' : 10,
-# 'size2': 8,
-# }
- faces = { 'times': 'Courier',
- 'mono' : 'Courier',
- 'helv' : 'Courier',
- 'other': 'Courier',
- 'size' : 10,
- 'size2': 10,
- }
-
-#
-# This provides a "fallback" control for platforms not supporting wxPython.stc
-#
-class FallbackPythonEditorControl(wxTextCtrl):
-
- def __init__(self, *args, **parms):
- wxTextCtrl.__init__(self, *args, **parms)
- self.GetText = self.GetValue
- self.SetText = self.SetValue
- self.Colourise = self.__ignore
- self.ClearUndoBuffer = self.__ignore
- self.EmptyUndoBuffer = self.__ignore
-
- def SetReadOnly(self, bool):
- self.SetEditable(not bool)
-
- def __ignore(self, *args, **params):
- pass
-
-
Modified: trunk/gnue-designer/src/forms/BlockEditor.py
===================================================================
--- trunk/gnue-designer/src/forms/BlockEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/forms/BlockEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -35,7 +35,7 @@
from gnue.designer.base.ToolBar import BaseToolBar
from gnue.forms.GFObjects.GFBlock import GFBlock
from gnue.common.datasources.GDataSource import GDataSource
-from wxPython.wx import *
+import wx
class BlockEditor(ToolBase):
@@ -46,7 +46,7 @@
def init(self):
self.grid = _BlockEditorGrid(self, self.instance)
- EVT_SIZE(self, self.__OnSize)
+ wx.EVT_SIZE(self, self.__OnSize)
def __OnSize(self, event):
self.grid.SetSize(self.GetClientSize())
Modified: trunk/gnue-designer/src/forms/Debugger.py
===================================================================
--- trunk/gnue-designer/src/forms/Debugger.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/forms/Debugger.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -25,7 +25,7 @@
"""
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.apps.GClientApp import GClientApp
from gnue.forms import GFForm, GFInstance, GFParser
@@ -46,10 +46,10 @@
#~ #Open output window to show debug messages there
#~ #instead of the console
- #~ outputWindow = wxFrame(caller, -1, _("Console Output"),
- #~ size=wxSize(300,50))
- #~ outputWindow.text = wxTextCtrl(outputWindow, -1, style=wxTE_MULTILINE)
- #~ outputWindow.Show(true)
+ #~ outputWindow = wx.Frame(caller, -1, _("Console Output"),
+ #~ size=wx.Size(300,50))
+ #~ outputWindow.text = wx.TextCtrl(outputWindow, -1, style=wx.TE_MULTILINE)
+ #~ outputWindow.Show(True)
#~ caller.outputWindow = outputWindow
#~ self.outputWindow = outputWindow
Modified: trunk/gnue-designer/src/forms/EventEditor.py
===================================================================
--- trunk/gnue-designer/src/forms/EventEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/forms/EventEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -29,7 +29,7 @@
import sys, os, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
from gnue.designer.base.tools.EventEditor import EventEditor as BaseEventEditor
Modified: trunk/gnue-designer/src/forms/Instance.py
===================================================================
--- trunk/gnue-designer/src/forms/Instance.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/forms/Instance.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -22,7 +22,7 @@
__all__ = ['Instance']
-from wxPython.wx import *
+import wx
from gnue.designer.forms import properties as formProperties
from gnue.designer.base.Instance import BaseInstance
@@ -313,12 +313,12 @@
valid = 0 # No blocks! :(
if not valid:
- if wxMessageDialog(None,
+ if wx.MessageDialog(None,
_('The form definition you are about to save\n' + \
'does not appear to be a workable definition.' + \
'\n\nIf you save an incomplete definition, you\n' + \
'may not be able to reopen it in Designer.\n\nSave anyway?'),
- _("Incomplete Form Definition"), wxYES_NO|wxICON_QUESTION
).ShowModal() == wxID_NO:
+ _("Incomplete Form Definition"), wx.YES_NO|wx.ICON_QUESTION
).ShowModal() == wx.ID_NO:
return 1
# Reorder the children so items of same class are grouped
@@ -358,7 +358,7 @@
tmpRez = ''
tmpMessage = _("Please enter debugging level - integer numbers [0..n]")
tmpCaption = _("Choose debug level")
- tmpRez = wxGetTextFromUser(tmpMessage, tmpCaption, tmpLevel, NULL)
+ tmpRez = wx.GetTextFromUser(tmpMessage, tmpCaption, tmpLevel, None)
if (tmpRez != ''):
self.debugLevel = tmpRez
@@ -368,11 +368,11 @@
#TODO: No, not just you. I mean EVERYONE!!!
GDebug.setDebug(str(self.debugLevel), "")
DebugSession(self)
- #~ wxMessageDialog(self,
+ #~ wx.MessageDialog(self,
#~ _('Running a form within GNUe Designer is\n' + \
#~ 'not implemented yet.' + \
#~ '\n\nPlease save the form and run it using\n' + \
#~ 'the GNUe Forms tool (gnue-forms).'),
- #~ _("NOT IMPLEMENTED"), wxOK|wxICON_EXCLAMATION ).ShowModal()
+ #~ _("NOT IMPLEMENTED"), wx.OK|wx.ICON_EXCLAMATION ).ShowModal()
Modified: trunk/gnue-designer/src/forms/LayoutEditor/DisplayDropTarget.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/DisplayDropTarget.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/DisplayDropTarget.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from Utils import *
from gnue.common.apps import GDebug
@@ -35,17 +35,17 @@
#
# Drag and Drop support for our grid
#
-class DisplayDropTarget(wxPyDropTarget):
+class DisplayDropTarget(wx.PyDropTarget):
TYPEMAP = {'date' : 'date',
'datetime': 'date',
'time' : 'date',
'number' : 'number'}
def __init__(self, editor):
- wxPyDropTarget.__init__(self)
+ wx.PyDropTarget.__init__(self)
self.editor = editor
- self.data =
wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ self.data =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
self.SetDataObject(self.data)
def OnEnter(self, x, y, d):
@@ -60,7 +60,7 @@
def OnDragOver(self, x, y, d):
return d
- # Called when OnDrop returns true. We need to get the data and
+ # Called when OnDrop returns True. We need to get the data and
# do something with it.
def OnData(self, bx, by, d):
@@ -109,15 +109,15 @@
break
if parent is None:
- dlg = wxMessageDialog(NULL,
+ dlg = wx.MessageDialog(None,
"The current page does not have a block\n"
"corresponding to Data Source %s.\n"
"Create a new block on the current page?" % \
attributes['datasource'],
- "No Target Block Found", style=wxYES_NO|wxICON_WARNING)
+ "No Target Block Found", style=wx.YES_NO|wx.ICON_WARNING)
save = dlg.ShowModal()
dlg.Destroy()
- if save == wxID_NO:
+ if save == wx.ID_NO:
return d # TODO: This should actually return a failure
# Create a parent block
@@ -278,45 +278,45 @@
self.schemaDrop_Create(table, fields, x, y)
else:
# Present a menu of options
- menu = wxMenu()
+ menu = wx.Menu()
current = 0
if blocks and blocks[0] == self.editor.block:
- wid = wxNewId()
+ wid = wx.NewId()
menu.Append(wid, _('Add Fields to Current Block'))
current = 1
- EVT_MENU(menu, wid,
+ wx.EVT_MENU(menu, wid,
lambda event, s=self, t=table, f=fields, x=x, y=y,
b=blocks[0]: s.schemaDrop_Add(t, f, b, x, y) )
- wid = wxNewId()
+ wid = wx.NewId()
menu.Append(wid, _('Add Fields to New Block'))
- EVT_MENU(menu, wid, lambda event, s=self, t=table, x=x, y=y,
+ wx.EVT_MENU(menu, wid, lambda event, s=self, t=table, x=x, y=y,
f=fields: s.schemaDrop_Create(t, f, x, y) )
if len(blocks) > 1 + current:
- smenu = wxMenu()
- menu.AppendMenu(wxNewId(), _("Add Fields to Block"), smenu)
+ smenu = wx.Menu()
+ menu.AppendMenu(wx.NewId(), _("Add Fields to Block"), smenu)
for block in blocks[1:]:
- wid = wxNewId()
+ wid = wx.NewId()
smenu.Append(wid, block.name)
- EVT_MENU(smenu, wid,
+ wx.EVT_MENU(smenu, wid,
lambda event, s=self, t=table, f=fields, x=x, y=y,
b=block: s.schemaDrop_Add(t, f, b, x, y) )
## TODO: Finish schemaDrop_Dropdown
## menu.AppendSeparator()
-## wid = wxNewId()
+## wid = wx.NewId()
## menu.Append(wid, _("Add as a dropdown to current block"))
-## EVT_MENU(menu, wid,
+## wx.EVT_MENU(menu, wid,
## lambda event, s=self, t=table, x=x, y=y,
## f=fields: s.schemaDrop_Dropdown(t, f, x, y) )
menu.AppendSeparator()
- wid = wxNewId()
+ wid = wx.NewId()
menu.Append(wid, _("Create Block (no fields)"))
- EVT_MENU(menu, wid, lambda event, s=self, t=table,
+ wx.EVT_MENU(menu, wid, lambda event, s=self, t=table,
f=fields: s.schemaDrop_Block(t, f, select=1) )
- wid = wxNewId()
+ wid = wx.NewId()
menu.Append(wid, _("Create Data Source (no bound block)"))
- EVT_MENU(menu, wid, lambda event, s=self, t=table,
+ wx.EVT_MENU(menu, wid, lambda event, s=self, t=table,
f=fields: s.schemaDrop_Datasource(t, f,
select=1) )
# Show the popup menu
Modified: trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditor.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -31,7 +31,7 @@
__all__ = ['LayoutEditor']
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.forms import GFObjects
from gnue.forms.uidrivers.wx import UIdriver as UIwxpython
@@ -88,11 +88,11 @@
del self.widgets['GFPage']
- self.notebook = wxNotebook(self, -1, pos=wxPoint(4, 4), size=wxSize(32,32))
- self.backcolor = wxWHITE
+ self.notebook = wx.Notebook(self, -1, pos=wx.Point(4, 4),
size=wx.Size(32,32))
+ self.backcolor = wx.WHITE
- EVT_RIGHT_DOWN(self.notebook, self.onRightDown)
- EVT_SIZE(self, self.OnSize)
+ wx.EVT_RIGHT_DOWN(self.notebook, self.onRightDown)
+ wx.EVT_SIZE(self, self.OnSize)
self._currentObject = None
self.mode = 'move'
@@ -126,7 +126,7 @@
self.instance.rootObject.walk (self.inventoryObject)
# don't put this before walk on win32...
- EVT_NOTEBOOK_PAGE_CHANGED(self,self.notebook.GetId(), self.OnPageSelected)
+ wx.EVT_NOTEBOOK_PAGE_CHANGED(self,self.notebook.GetId(),
self.OnPageSelected)
try:
self._setCurrentPage(self._notebookMap[0])
except KeyError:
@@ -139,7 +139,7 @@
def createToolbar(self, parent):
self.toolbar = LayoutEditorTools(parent, self.instance)
self.blockCombo = self.toolbar.blockCombo
- EVT_COMBOBOX(self.toolbar, self.blockCombo.GetId(), self.OnBlockSelected)
+ wx.EVT_COMBOBOX(self.toolbar, self.blockCombo.GetId(),
self.OnBlockSelected)
self._rebuildBlockCombo()
return self.toolbar
@@ -159,16 +159,16 @@
self._notebookMap[object] = index
self._notebookMap[index] = object
- self.workspacescroll = wxScrolledWindow(self.notebook, -1,
- pos=wxPoint(0,0),
- style=wxCLIP_CHILDREN|wxHSCROLL|wxVSCROLL|wxSUNKEN_BORDER)
+ self.workspacescroll = wx.ScrolledWindow(self.notebook, -1,
+ pos=wx.Point(0,0),
+ style=wx.CLIP_CHILDREN|wx.HSCROLL|wx.VSCROLL|wx.SUNKEN_BORDER)
- self.workspace = wxPanel(self.workspacescroll,-1)
+ self.workspace = wx.Panel(self.workspacescroll,-1)
self.workspace.SetBackgroundColour(self.backcolor)
self.notebook.AddPage(self.workspacescroll, wxEncode(object.name))
# don't put this before AddPage on win32...
- EVT_SIZE(self.workspacescroll, self.__OnGridSize)
+ wx.EVT_SIZE(self.workspacescroll, self.__OnGridSize)
object.__workspace = self.workspace
self.drawPage(object)
@@ -438,7 +438,7 @@
width = self.rootObject._layout.Char__width
height = self.rootObject._layout.Char__height
- self.panel.SetClientSize(wxSize(int(width)*self.widgetWidth,
+ self.panel.SetClientSize(wx.Size(int(width)*self.widgetWidth,
int(height)*self.widgetHeight))
self.panel.Refresh()
@@ -450,10 +450,10 @@
try:
self.panel = self.page.__panel
except AttributeError:
- self.panel = GridPane(self, self.workspace, wxPoint(10,12))
+ self.panel = GridPane(self, self.workspace, wx.Point(10,12))
# Automatically resize workspace
- EVT_SIZE(self.panel, self.__OnGridSize)
+ wx.EVT_SIZE(self.panel, self.__OnGridSize)
# We are a drop target for Drag-and-Drop
self.panel.SetDropTarget(DisplayDropTarget(self))
@@ -461,7 +461,7 @@
self.page.__panel = self.panel
self.panelColor = self.panel.GetBackgroundColour()
- self.panelGridColor = wxColour(order(255,self.panelColor.Red()+16)[0],
+ self.panelGridColor = wx.Colour(order(255,self.panelColor.Red()+16)[0],
order(255,self.panelColor.Green()+16)[0],
order(255,self.panelColor.Blue()+16)[0])
@@ -473,11 +473,11 @@
### coverPanel = TransparentPanel(self, self.panel)
- EVT_CHAR(self.panel, self.keyTrap)
- EVT_LEFT_DOWN(self.panel, self.OnLeftDown)
- EVT_MOTION(self.panel, self.OnMotion)
- EVT_LEFT_UP(self.panel, self.OnLeftUp)
- EVT_RIGHT_UP(self.panel, self.OnRightUp)
+ wx.EVT_CHAR(self.panel, self.keyTrap)
+ wx.EVT_LEFT_DOWN(self.panel, self.OnLeftDown)
+ wx.EVT_MOTION(self.panel, self.OnMotion)
+ wx.EVT_LEFT_UP(self.panel, self.OnLeftUp)
+ wx.EVT_RIGHT_UP(self.panel, self.OnRightUp)
def __drawItem(self, object):
@@ -518,7 +518,7 @@
object._widgetHandler.setSelected(1)
def OnSize(self, event):
- self.notebook.SetSize(wxSize(self.GetClientSize().x-8,
self.GetClientSize().y - 8))
+ self.notebook.SetSize(wx.Size(self.GetClientSize().x-8,
self.GetClientSize().y - 8))
def OnPageSelected(self, event):
p = self._notebookMap[event.GetSelection()]
@@ -542,7 +542,7 @@
self.setFeedback ('Col: %s Row: %s' % (cx, cy))
- self.__brush = wxBrush(wxWHITE, style=wxTRANSPARENT)
+ self.__brush = wx.Brush(wx.WHITE, style=wx.TRANSPARENT)
self.__x = x
self.__y = y
@@ -552,10 +552,10 @@
# Used by the dragging routines to draw a selection box
def xorBox(self, x1, y1, x2, y2, x3=None, y3=None):
- dc = wxClientDC(self.panel)
+ dc = wx.ClientDC(self.panel)
dc.SetBrush(self.__brush)
- dc.SetPen(wxGREY_PEN)
- dc.SetLogicalFunction(wxXOR)
+ dc.SetPen(wx.GREY_PEN)
+ dc.SetLogicalFunction(wx.XOR)
if x3 != None:
dc.DrawRectangle(x1,y1,x3-x1,y3-y1)
@@ -568,7 +568,7 @@
if self.__drawing and event.LeftIsDown():
if self.__drawing == 1:
- self.panel.SetCursor(wxCROSS_CURSOR)
+ self.panel.SetCursor(wx.CROSS_CURSOR)
self.__drawing = 2
x, y = event.GetPositionTuple()
@@ -614,8 +614,8 @@
y1, y2 = order(int(self.__y / self.gridHeight),int(y / self.gridHeight))
- self.panel.SetCursor(wxSTANDARD_CURSOR)
- wxSetCursor(wxSTANDARD_CURSOR)
+ self.panel.SetCursor(wx.STANDARD_CURSOR)
+ wx.SetCursor(wx.STANDARD_CURSOR)
areaSelected = (x1 <> x2 or y1 <> y2)
@@ -646,7 +646,7 @@
width = None
height = None
- wxFutureCall(100,self.endPrePositioningTemplate,x1,y1,width,height)
+ wx.FutureCall(100,self.endPrePositioningTemplate,x1,y1,width,height)
def selectWidgetInArea(self, object, x1, y1, x2, y2, selection):
try:
@@ -669,7 +669,7 @@
x = int(x / self.gridWidth)
y = int(y / self.gridHeight)
- menu = wxMenu('Layout Editor')
+ menu = wx.Menu('Layout Editor')
form = self._currentObject._type == 'GFForm' and self._currentObject or \
self._currentObject.findParentOfType('GFForm')
page = self._currentObject._type == 'GFPage' and self._currentObject or \
@@ -677,11 +677,11 @@
block = self._currentObject._type == 'GFBlock' and self._currentObject or \
self._currentObject.findParentOfType('GFBlock')
- menu.AppendMenu(wxNewId(), 'Form', PageMenu(self.instance, form, x, y))
+ menu.AppendMenu(wx.NewId(), 'Form', PageMenu(self.instance, form, x, y))
if page:
- menu.AppendMenu(wxNewId(), page.name, PageMenu(self.instance, page, x,
y))
+ menu.AppendMenu(wx.NewId(), page.name, PageMenu(self.instance, page, x,
y))
if block:
- menu.AppendMenu(wxNewId(), block.name, PageMenu(self.instance, block, x,
y))
+ menu.AppendMenu(wx.NewId(), block.name, PageMenu(self.instance, block,
x, y))
self.panel.PopupMenu(menu, event.GetPosition())
@@ -690,7 +690,7 @@
if event.KeyCode() in (WXK_LEFT, WXK_RIGHT, WXK_UP, WXK_DOWN) and \
len(self._currentSelection):
if event.AltDown() or event.ControlDown() or event.ShiftDown():
- # caution: event.MetaDown() is always true on some architectures
+ # caution: event.MetaDown() is always True on some architectures
resize = None
if event.KeyCode() == WXK_LEFT:
resize = (-1,0)
@@ -793,14 +793,14 @@
elif mode == 'refocus':
self.dispatchEvent('Cancel:LayoutEditor:FocusOrder')
- ##self.panel.SetCursor(wxCROSS_CURSOR)
- wxSetCursor(wxCROSS_CURSOR)
+ ##self.panel.SetCursor(wx.CROSS_CURSOR)
+ wx.SetCursor(wx.CROSS_CURSOR)
self.__wizardrunner = event.wizardrunner
def cancelPrePositioningTemplate(self, event=None):
if self.mode == 'prepositioning':
self.__wizardrunner.cancel()
- wxSetCursor(wxSTANDARD_CURSOR)
+ wx.SetCursor(wx.STANDARD_CURSOR)
def endPrePositioningTemplate(self, x, y, width=None, height=None):
self.mode = 'move'
@@ -861,7 +861,7 @@
Show "Add page" popup menu
"""
pt = event.GetPositionTuple()
- wxPyTypeCast(event.GetEventObject(),'wxWindow') \
+ wx.PyTypeCast(event.GetEventObject(),'wx.Window') \
.PopupMenu(self.page._popupMenu, pt)
event.Skip()
@@ -870,13 +870,13 @@
def __init__(self, layoutEditor, parent):
self.parent = parent
self.editor = layoutEditor
- self.bitmap = wxEmptyBitmap(*self.parent.GetClientSizeTuple())
+ self.bitmap = wx.EmptyBitmap(*self.parent.GetClientSizeTuple())
-class TransparentPanelXXXX(wxWindow):
+class TransparentPanelXXXX(wx.Window):
def __init__(self, layoutEditor, parent):
- wxWindow.__init__(self, parent, -1, pos=wxPoint(0,0),
size=parent.GetClientSize())
-# EVT_PAINT(self, self.OnPaint)
- EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
+ wx.Window.__init__(self, parent, -1, pos=wx.Point(0,0),
size=parent.GetClientSize())
+# wx.EVT_PAINT(self, self.OnPaint)
+ wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
# parent.Refresh()
def OnEraseBackground(self, event):
@@ -885,19 +885,19 @@
def OnPaint(self, event):
- object = wxPyTypeCast(event.GetEventObject(),'wxWindow')
- dc = wxPaintDC(object)
+ object = wx.PyTypeCast(event.GetEventObject(),'wx.Window')
+ dc = wx.PaintDC(object)
dc.BeginDrawing()
- dc.SetBackgroundMode(wxTRANSPARENT)
+ dc.SetBackgroundMode(wx.TRANSPARENT)
dc.SetClippingRegion(5,5,10,50)
-##
dc.SetBackground(wxBrush(self.parent.GetBackgroundColour(),wxTRANSPARENT))
-## dc.SetBackground(wxBrush(wxBLACK,wxTRANSPARENT))
+##
dc.SetBackground(wx.Brush(self.parent.GetBackgroundColour(),wx.TRANSPARENT))
+## dc.SetBackground(wx.Brush(wx.BLACK,wx.TRANSPARENT))
## dc.Clear()
## if self.focused:
-## dc.SetPen(wxPen(activeBorderColor))
+## dc.SetPen(wx.Pen(activeBorderColor))
## else:
-## dc.SetPen(wxPen(inactiveBorderColor))
+## dc.SetPen(wx.Pen(inactiveBorderColor))
## x1,y1 = object.GetSizeTuple()
## dc.DrawRectangle(0,0,x1,y1)
## if self.focused:
Modified: trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
from gnue.designer.base.ToolBar import BaseToolBar
@@ -61,8 +61,8 @@
self.AddSeparator()
self.addToolbarMapping(ToolbarMapping2)
self.AddSeparator()
- self.AddControl(wxStaticText(self,-1,_("Block: ")))
- self.blockCombo = wxComboBox(self, -1)
+ self.AddControl(wx.StaticText(self,-1,_("Block: ")))
+ self.blockCombo = wx.ComboBox(self, -1)
w, h = self.blockCombo.GetSizeTuple()
self.blockCombo.SetSize((int(w*1.4), h))
Modified: trunk/gnue-designer/src/forms/LayoutEditor/PopupEditor.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/PopupEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/PopupEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from Utils import *
from gnue.common.apps import GDebug
@@ -37,16 +37,16 @@
# (via complete) along with a success code and the final result
# (if success = 1)
#
-class PopupEditor(wxTextCtrl):
+class PopupEditor(wx.TextCtrl):
def __init__(self, panel, complete, x, y, width, height, value):
- wxTextCtrl.__init__(self, panel, -1, pos=wxPoint(x,y),
- size=wxSize(width,height),
- style=wxTE_PROCESS_TAB|wxTE_PROCESS_ENTER|wxSIMPLE_BORDER)
- self.SetBackgroundColour(wxColour(255,239,176))
+ wx.TextCtrl.__init__(self, panel, -1, pos=wx.Point(x,y),
+ size=wx.Size(width,height),
+ style=wx.TE_PROCESS_TAB|wx.TE_PROCESS_ENTER|wx.SIMPLE_BORDER)
+ self.SetBackgroundColour(wx.Colour(255,239,176))
self.__complete = complete
self.SetValue(value)
- EVT_CHAR(self, self.OnChar)
- EVT_KILL_FOCUS(self, self.OnFocusOut)
+ wx.EVT_CHAR(self, self.OnChar)
+ wx.EVT_KILL_FOCUS(self, self.OnFocusOut)
def done(self, success):
@@ -80,5 +80,5 @@
def Destroy(self, *args, **parms):
self.__complete = None
- wxTextCtrl.Destroy(self, *args, **parms)
+ wx.TextCtrl.Destroy(self, *args, **parms)
Modified: trunk/gnue-designer/src/forms/LayoutEditor/PropertyBar.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/PropertyBar.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/PropertyBar.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from Utils import *
from gnue.common.apps import GDebug
@@ -33,63 +33,63 @@
#
#
#
-class PropertyBar (wxPanel):
+class PropertyBar (wx.Panel):
def __init__(self, parent):
- wxPanel.__init__(self, parent, -1, style=wxCLIP_CHILDREN)
+ wx.Panel.__init__(self, parent, -1, style=wx.CLIP_CHILDREN)
self.parent = parent
self.object = None
-# self.nameLabel = wxStaticText(self, -1, "Current Object:",
pos=wxPoint(6,4))
-# self.nameEditor = wxTextCtrl(self, -1,
+# self.nameLabel = wx.StaticText(self, -1, "Current Object:",
pos=wx.Point(6,4))
+# self.nameEditor = wx.TextCtrl(self, -1,
# pos=calcRelPos(self.nameLabel, dx=6, absy=4))
# self.nameEditor.SetEditable(0)
- self.blockLabel = wxStaticText(self, -1, "Current Block:",
- pos=wxPoint(6,4))
+ self.blockLabel = wx.StaticText(self, -1, "Current Block:",
+ pos=wx.Point(6,4))
# pos=calcRelPos(self.nameEditor, dx=6, absy=4))
- self.blockEditor = wxComboBox(self, -1,
+ self.blockEditor = wx.ComboBox(self, -1,
pos=calcRelPos(self.blockLabel, dx=6, absy=4))
self.SetSize((100,8 + max(self.blockEditor.GetSizeTuple()[1],
# self.nameEditor.GetSizeTuple()[1],
self.blockLabel.GetSizeTuple()[1])))
-## self.typeLabel = wxStaticText(self, -1, "Class:",
+## self.typeLabel = wx.StaticText(self, -1, "Class:",
## pos=calcRelPos(self.nameEditor, absx=4, dy=8))
-## self.typeEditor = wxTextCtrl(self, -1,
+## self.typeEditor = wx.TextCtrl(self, -1,
## pos=calcRelPos(self.nameLabel, self.nameEditor, dx=6, dy=4))
## self.typeEditor.SetEditable(0)
-## self.xLabel = wxStaticText(self, -1, "x:",
+## self.xLabel = wx.StaticText(self, -1, "x:",
## pos=calcRelPos(self.nameEditor, dx=10, absy=8))
-## self.xEditor = wxSpinCtrl(self, -1,
+## self.xEditor = wx.SpinCtrl(self, -1,
## pos=calcRelPos(self.xLabel, dx=4, absy=6))
## self.xEditor.SetSize((50, self.xEditor.GetSize().height))
##
-## self.wLabel = wxStaticText(self, -1, "Width: ",
+## self.wLabel = wx.StaticText(self, -1, "Width: ",
## pos=calcRelPos(self.xEditor, dx=6, absy=8))
-## self.wEditor = wxSpinCtrl(self, -1,
+## self.wEditor = wx.SpinCtrl(self, -1,
## pos=calcRelPos(self.wLabel, dx=4, absy=6))
## self.wEditor.SetSize(self.xEditor.GetSize())
##
-## self.yLabel = wxStaticText(self, -1, "y:",
+## self.yLabel = wx.StaticText(self, -1, "y:",
## pos=calcRelPos(self.nameEditor, self.xEditor, dx=10, dy=8))
-## self.yEditor = wxSpinCtrl(self, -1,
+## self.yEditor = wx.SpinCtrl(self, -1,
## pos=calcRelPos(self.xLabel, self.xEditor, dx=4, dy=6))
## self.yEditor.SetSize(self.xEditor.GetSize())
##
-## self.hLabel = wxStaticText(self, -1, "Height:",
+## self.hLabel = wx.StaticText(self, -1, "Height:",
## pos=calcRelPos(self.xEditor, self.wEditor, dx=6, dy=8))
-## self.hEditor = wxSpinCtrl(self, -1,
+## self.hEditor = wx.SpinCtrl(self, -1,
## pos=calcRelPos(self.wLabel, self.wEditor, dx=4, dy=6))
## self.hEditor.SetSize(self.wEditor.GetSize())
## self.Fit()
-## EVT_SPINCTRL(self, self.xEditor.GetId(), self.OnXUpdated)
-## EVT_SPINCTRL(self, self.yEditor.GetId(), self.OnYUpdated)
-## EVT_SPINCTRL(self, self.wEditor.GetId(), self.OnWidthUpdated)
-## EVT_SPINCTRL(self, self.hEditor.GetId(), self.OnHeightUpdated)
+## wx.EVT_SPINCTRL(self, self.xEditor.GetId(), self.OnXUpdated)
+## wx.EVT_SPINCTRL(self, self.yEditor.GetId(), self.OnYUpdated)
+## wx.EVT_SPINCTRL(self, self.wEditor.GetId(), self.OnWidthUpdated)
+## wx.EVT_SPINCTRL(self, self.hEditor.GetId(), self.OnHeightUpdated)
def OnNameUpdated(self, event):
Modified: trunk/gnue-designer/src/forms/LayoutEditor/Utils.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/Utils.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/Utils.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from gnue.common.apps import GDebug
@@ -58,18 +58,18 @@
else:
y = y + h + dy
- return wxPoint (x,y)
+ return wx.Point (x,y)
#
#
#
-class MoveDropSource(wxDropSource):
+class MoveDropSource(wx.DropSource):
def __init__(self, handler, *args, **parms):
self.__handler = handler
- wxDropSource.__init__(self, *args, **parms)
+ wx.DropSource.__init__(self, *args, **parms)
def GiveFeedback(self, effect, scrolling=0):
return 0
Modified: trunk/gnue-designer/src/forms/LayoutEditor/WidgetFocusTab.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/WidgetFocusTab.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/WidgetFocusTab.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -26,13 +26,13 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
import sys, string
from gnue.common.apps import GDebug
-inactiveColor = wxBLUE
-activeColor = wxBLACK
-textColor = wxWHITE
+inactiveColor = wx.BLUE
+activeColor = wx.BLACK
+textColor = wx.WHITE
#
#
@@ -45,11 +45,11 @@
self.container = container
self.x, self.y = widget._widgetHandler.widget.GetPositionTuple()
-# self.label = wxStaticText(panel, -1, "0", pos=(self.x, self.y-10))
- self.label = wxButton(panel, -1, "00", pos=(self.x-5, self.y-8),
style=wxBU_EXACTFIT)
+# self.label = wx.StaticText(panel, -1, "0", pos=(self.x, self.y-10))
+ self.label = wx.Button(panel, -1, "00", pos=(self.x-5, self.y-8),
style=wx.BU_EXACTFIT)
self.label.SetBackgroundColour(inactiveColor)
self.label.SetForegroundColour(textColor)
- EVT_BUTTON(self.label, self.label.GetId(), self.buttonHandler)
+ wx.EVT_BUTTON(self.label, self.label.GetId(), self.buttonHandler)
def setOrder(self, position):
self.position = position
@@ -62,7 +62,7 @@
self.label.Destroy()
def buttonHandler(self, event):
- if event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED:
+ if event.GetEventType() == wx.EVT_COMMAND_BUTTON_CLICKED:
object = event.GetEventObject()
clicked = int(object.GetLabel())
Modified: trunk/gnue-designer/src/forms/LayoutEditor/WidgetHandler.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/WidgetHandler.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/WidgetHandler.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from Utils import *
from gnue.common.apps import GDebug
@@ -38,9 +38,9 @@
#
#
#
-class WidgetHandler(wxEvtHandler):
+class WidgetHandler(wx.EvtHandler):
def __init__(self, instance, object):
- wxEvtHandler.__init__(self)
+ wx.EvtHandler.__init__(self)
self.editor = instance
self.object = object
self.hasFocus = 0
@@ -57,7 +57,7 @@
self.recalcBoundaries()
for widget in self.mainWidget.widgets:
- widget.SetCursor (wxSTANDARD_CURSOR)
+ widget.SetCursor (wx.STANDARD_CURSOR)
# try:
# widget.Enable(0)
@@ -151,13 +151,13 @@
# "database": self.connectionName } }
#
#
- do = wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ do =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
do.SetData(cPickle.dumps(data,1))
## icon = FeedbackBitmap(10,10).icon()
dropSource = MoveDropSource(self, self.editor)
dropSource.SetData(do)
- result = dropSource.DoDragDrop(true)
+ result = dropSource.DoDragDrop(True)
event.Skip()
@@ -219,7 +219,7 @@
if self.editor.mode == 'move':
pt = event.GetPositionTuple()
self.editor.dispatchEvent('ObjectSelected',object=self.object,
originator=None)
- wxPyTypeCast(event.GetEventObject(),'wxWindow') \
+ wx.PyTypeCast(event.GetEventObject(),'wx.Window') \
.PopupMenu(self.object._popupMenu, pt)
event.Skip()
@@ -300,7 +300,7 @@
else:
for widget in self.mainWidget.widgets:
x,y = widget.GetSizeTuple()
- widget.SetSize(wxSize(x + nx,y + ny))
+ widget.SetSize(wx.Size(x + nx,y + ny))
oldVals = {}
newVals = {}
@@ -338,7 +338,7 @@
else:
for widget in self.mainWidget.widgets:
x,y = widget.GetPositionTuple()
- widget.SetPosition(wxPoint(x + nx,y + ny))
+ widget.SetPosition(wx.Point(x + nx,y + ny))
oldVals = {}
newVals = {}
if dx:
Modified: trunk/gnue-designer/src/forms/LayoutEditor/WidgetHighlighter.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/WidgetHighlighter.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/WidgetHighlighter.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -25,13 +25,13 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from Utils import *
from gnue.common.apps import GDebug
-inactiveBorderColor = wxBLACK
-activeBorderColor = wxBLUE
+inactiveBorderColor = wx.BLACK
+activeBorderColor = wx.BLUE
#
#
@@ -61,20 +61,20 @@
if self.north:
self.Destroy()
- self.northb = wxWindow(self.parent, -1)
- self.southb = wxWindow(self.parent, -1)
- self.eastb = wxWindow(self.parent, -1)
- self.westb = wxWindow(self.parent, -1)
+ self.northb = wx.Window(self.parent, -1)
+ self.southb = wx.Window(self.parent, -1)
+ self.eastb = wx.Window(self.parent, -1)
+ self.westb = wx.Window(self.parent, -1)
for object in (self.northb,self.southb,self.eastb,self.westb):
- EVT_PAINT(object, self.OnPaintBorder)
+ wx.EVT_PAINT(object, self.OnPaintBorder)
- self.north = wxWindow(self.parent, -1)
- self.south = wxWindow(self.parent, -1)
- self.east = wxWindow(self.parent, -1)
- self.west = wxWindow(self.parent, -1)
+ self.north = wx.Window(self.parent, -1)
+ self.south = wx.Window(self.parent, -1)
+ self.east = wx.Window(self.parent, -1)
+ self.west = wx.Window(self.parent, -1)
for object in (self.north,self.south,self.east,self.west):
- EVT_PAINT(object, self.OnPaint)
+ wx.EVT_PAINT(object, self.OnPaint)
@@ -117,17 +117,17 @@
self.y2 = y2
if self.west:
- self.west.SetPosition(wxPoint(x1,y1))
- self.west.SetSize(wxSize(2,y2-y1+2))
+ self.west.SetPosition(wx.Point(x1,y1))
+ self.west.SetSize(wx.Size(2,y2-y1+2))
if self.east:
- self.east.SetPosition(wxPoint(x2,y1))
- self.east.SetSize(wxSize(2,y2-y1+2))
+ self.east.SetPosition(wx.Point(x2,y1))
+ self.east.SetSize(wx.Size(2,y2-y1+2))
if self.south:
- self.south.SetPosition(wxPoint(x1,y2))
- self.south.SetSize(wxSize(x2-x1+2,2))
+ self.south.SetPosition(wx.Point(x1,y2))
+ self.south.SetSize(wx.Size(x2-x1+2,2))
if self.north:
- self.north.SetPosition(wxPoint(x1,y1))
- self.north.SetSize(wxSize(x2-x1+2,2))
+ self.north.SetPosition(wx.Point(x1,y1))
+ self.north.SetSize(wx.Size(x2-x1+2,2))
def setBoundary(self, x1, y1, x2, y2):
@@ -140,30 +140,30 @@
my = (y2 - y1)/2 + y1 - 1
if self.west:
- self.west.SetPosition(wxPoint(x1 - 3,my))
- self.west.SetSize(wxSize(4,4))
+ self.west.SetPosition(wx.Point(x1 - 3,my))
+ self.west.SetSize(wx.Size(4,4))
if self.east:
- self.east.SetPosition(wxPoint(x2,my))
- self.east.SetSize(wxSize(4,4))
+ self.east.SetPosition(wx.Point(x2,my))
+ self.east.SetSize(wx.Size(4,4))
if self.south:
- self.south.SetPosition(wxPoint(mx,y2))
- self.south.SetSize(wxSize(4,4))
+ self.south.SetPosition(wx.Point(mx,y2))
+ self.south.SetSize(wx.Size(4,4))
if self.north:
- self.north.SetPosition(wxPoint(mx,y1 - 3))
- self.north.SetSize(wxSize(4,4))
+ self.north.SetPosition(wx.Point(mx,y1 - 3))
+ self.north.SetSize(wx.Size(4,4))
if self.west:
- self.westb.SetPosition(wxPoint(x1,y1))
- self.westb.SetSize(wxSize(1,y2-y1+1))
+ self.westb.SetPosition(wx.Point(x1,y1))
+ self.westb.SetSize(wx.Size(1,y2-y1+1))
if self.east:
- self.eastb.SetPosition(wxPoint(x2,y1))
- self.eastb.SetSize(wxSize(1,y2-y1+1))
+ self.eastb.SetPosition(wx.Point(x2,y1))
+ self.eastb.SetSize(wx.Size(1,y2-y1+1))
if self.south:
- self.southb.SetPosition(wxPoint(x1,y2))
- self.southb.SetSize(wxSize(x2-x1+1,1))
+ self.southb.SetPosition(wx.Point(x1,y2))
+ self.southb.SetSize(wx.Size(x2-x1+1,1))
if self.north:
- self.northb.SetPosition(wxPoint(x1,y1))
- self.northb.SetSize(wxSize(x2-x1+1,1))
+ self.northb.SetPosition(wx.Point(x1,y1))
+ self.northb.SetSize(wx.Size(x2-x1+1,1))
def GetChildren(self):
@@ -192,15 +192,15 @@
self.Refresh()
def OnPaintXXXX(self, event):
- object = wxPyTypeCast(event.GetEventObject(),'wxWindow')
- dc = wxPaintDC(object)
+ object = wx.PyTypeCast(event.GetEventObject(),'wx.Window')
+ dc = wx.PaintDC(object)
dc.BeginDrawing()
- dc.SetBackground(wxBrush(self.parent.GetBackgroundColour(),wxTRANSPARENT))
+
dc.SetBackground(wx.Brush(self.parent.GetBackgroundColour(),wx.TRANSPARENT))
dc.Clear()
if self.focused:
- dc.SetPen(wxPen(activeBorderColor))
+ dc.SetPen(wx.Pen(activeBorderColor))
else:
- dc.SetPen(wxPen(inactiveBorderColor))
+ dc.SetPen(wx.Pen(inactiveBorderColor))
x1,y1 = object.GetSizeTuple()
## dc.DrawRectangle(0,0,x1,y1)
## if self.focused:
@@ -210,20 +210,20 @@
def OnPaint(self, event):
if not self.focused: return
- object = wxPyTypeCast(event.GetEventObject(),'wxWindow')
- dc = wxPaintDC(object)
+ object = wx.PyTypeCast(event.GetEventObject(),'wx.Window')
+ dc = wx.PaintDC(object)
dc.BeginDrawing()
-##
dc.SetBackground(wxBrush(self.parent.GetBackgroundColour(),wxTRANSPARENT))
+##
dc.SetBackground(wx.Brush(self.parent.GetBackgroundColour(),wx.TRANSPARENT))
if self.focused:
- dc.SetBackground(wxBrush(activeBorderColor,wxTRANSPARENT))
+ dc.SetBackground(wx.Brush(activeBorderColor,wx.TRANSPARENT))
else:
- dc.SetBackground(wxBrush(inactiveBorderColor,wxTRANSPARENT))
+ dc.SetBackground(wx.Brush(inactiveBorderColor,wx.TRANSPARENT))
dc.Clear()
## if self.focused:
-## dc.SetPen(wxPen(activeBorderColor))
+## dc.SetPen(wx.Pen(activeBorderColor))
## else:
-## dc.SetPen(wxPen(inactiveBorderColor))
+## dc.SetPen(wx.Pen(inactiveBorderColor))
## x1,y1 = object.GetSizeTuple()
## dc.DrawRectangle(0,0,x1,y1)
## if self.focused:
@@ -233,16 +233,16 @@
def OnPaintBorder(self, event):
- object = wxPyTypeCast(event.GetEventObject(),'wxWindow')
- dc = wxPaintDC(object)
+ object = wx.PyTypeCast(event.GetEventObject(),'wx.Window')
+ dc = wx.PaintDC(object)
dc.BeginDrawing()
-##
dc.SetBackground(wxBrush(self.parent.GetBackgroundColour(),wxTRANSPARENT))
- dc.SetBackground(wxBrush(wxBLACK,wxTRANSPARENT))
+##
dc.SetBackground(wx.Brush(self.parent.GetBackgroundColour(),wx.TRANSPARENT))
+ dc.SetBackground(wx.Brush(wx.BLACK,wx.TRANSPARENT))
dc.Clear()
## if self.focused:
-## dc.SetPen(wxPen(activeBorderColor))
+## dc.SetPen(wx.Pen(activeBorderColor))
## else:
-## dc.SetPen(wxPen(inactiveBorderColor))
+## dc.SetPen(wx.Pen(inactiveBorderColor))
## x1,y1 = object.GetSizeTuple()
## dc.DrawRectangle(0,0,x1,y1)
## if self.focused:
Modified: trunk/gnue-designer/src/forms/LayoutEditor/Workspace.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/Workspace.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/Workspace.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -29,7 +29,7 @@
__all__ = ['Workspace']
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.forms import GFObjects
from gnue.forms.uidrivers.wx import UIdriver as UIwxpython
@@ -48,19 +48,19 @@
from renderers.native.WidgetHandler import WidgetHandler
from renderers.Base.GridPane import GridPane
-panelColor = wxWHITE
+panelColor = wx.WHITE
-class Workspace(wxPanel):
+class Workspace(wx.Panel):
def __init__(self, parent, layouteditor, page):
- self.scroller = scroller = wxScrolledWindow(parent, -1,
- pos=wxPoint(0,0),
- style=wxCLIP_CHILDREN|wxHSCROLL|wxVSCROLL|wxSUNKEN_BORDER)
+ self.scroller = scroller = wx.ScrolledWindow(parent, -1,
+ pos=wx.Point(0,0),
+ style=wx.CLIP_CHILDREN|wx.HSCROLL|wx.VSCROLL|wx.SUNKEN_BORDER)
- wxPanel.__init__(self, scroller, -1)
+ wx.Panel.__init__(self, scroller, -1)
- EVT_SIZE(self.scroller, self.__OnGridSize)
+ wx.EVT_SIZE(self.scroller, self.__OnGridSize)
self.SetBackgroundColour(panelColor)
@@ -93,8 +93,8 @@
del self.widgets['GFPage']
- self.notebook = wxNotebook(self, -1, pos=wxPoint(4, 4), size=wxSize(32,32))
- self.backcolor = wxWHITE
+ self.notebook = wx.Notebook(self, -1, pos=wx.Point(4, 4),
size=wx.Size(32,32))
+ self.backcolor = wx.WHITE
self._currentObject = None
@@ -130,16 +130,16 @@
self._pageList = [] # Needed by UIwxpython
# Create our grid
- self.panel = GridPane(self.layouteditor, self, wxPoint(10,12))
+ self.panel = GridPane(self.layouteditor, self, wx.Point(10,12))
# Automatically resize workspace
- EVT_SIZE(self.panel, self.__OnGridSize)
+ wx.EVT_SIZE(self.panel, self.__OnGridSize)
- EVT_CHAR(self.panel, self.keyTrap)
- EVT_LEFT_DOWN(self.panel, self.OnLeftDown)
- EVT_MOTION(self.panel, self.OnMotion)
- EVT_LEFT_UP(self.panel, self.OnLeftUp)
- EVT_RIGHT_UP(self.panel, self.OnRightUp)
+ wx.EVT_CHAR(self.panel, self.keyTrap)
+ wx.EVT_LEFT_DOWN(self.panel, self.OnLeftDown)
+ wx.EVT_MOTION(self.panel, self.OnMotion)
+ wx.EVT_LEFT_UP(self.panel, self.OnLeftUp)
+ wx.EVT_RIGHT_UP(self.panel, self.OnRightUp)
# We are a drop target for Drag-and-Drop
@@ -148,7 +148,7 @@
self.panelColor = self.panel.GetBackgroundColour()
- self.panelGridColor = wxColour(min(255,self.panelColor.Red()+16),
+ self.panelGridColor = wx.Colour(min(255,self.panelColor.Red()+16),
min(255,self.panelColor.Green()+16),
min(255,self.panelColor.Blue()+16))
@@ -383,7 +383,7 @@
width = self.layouteditor.rootObject._layout.Char__width
height = self.layouteditor.rootObject._layout.Char__height
- self.panel.SetClientSize(wxSize(int(width)*self.widgetWidth,
+ self.panel.SetClientSize(wx.Size(int(width)*self.widgetWidth,
int(height)*self.widgetHeight))
self.panel.Refresh()
@@ -404,7 +404,7 @@
self.layouteditor.setFeedback ('Col: %s Row: %s' % (cx, cy))
- self.__brush = wxBrush(wxWHITE, style=wxTRANSPARENT)
+ self.__brush = wx.Brush(wx.WHITE, style=wx.TRANSPARENT)
self.__x = x
self.__y = y
@@ -414,10 +414,10 @@
# Used by the dragging routines to draw a selection box
def xorBox(self, x1, y1, x2, y2, x3=None, y3=None):
- dc = wxClientDC(self.panel)
+ dc = wx.ClientDC(self.panel)
dc.SetBrush(self.__brush)
- dc.SetPen(wxGREY_PEN)
- dc.SetLogicalFunction(wxXOR)
+ dc.SetPen(wx.GREY_PEN)
+ dc.SetLogicalFunction(wx.XOR)
if x3 != None:
dc.DrawRectangle(x1,y1,x3-x1,y3-y1)
@@ -430,7 +430,7 @@
if self.__drawing and event.LeftIsDown():
if self.__drawing == 1:
- self.panel.SetCursor(wxCROSS_CURSOR)
+ self.panel.SetCursor(wx.CROSS_CURSOR)
self.__drawing = 2
x, y = event.GetPositionTuple()
@@ -476,8 +476,8 @@
y1, y2 = order(int(self.__y / self.gridHeight),int(y / self.gridHeight))
- self.panel.SetCursor(wxSTANDARD_CURSOR)
- wxSetCursor(wxSTANDARD_CURSOR)
+ self.panel.SetCursor(wx.STANDARD_CURSOR)
+ wx.SetCursor(wx.STANDARD_CURSOR)
areaSelected = (x1 <> x2 or y1 <> y2)
@@ -533,7 +533,7 @@
x = int(x / self.gridWidth)
y = int(y / self.gridHeight)
- menu = wxMenu('Layout Editor')
+ menu = wx.Menu('Layout Editor')
form = self._currentObject._type == 'GFForm' and self._currentObject or \
self._currentObject.findParentOfType('GFForm')
page = self._currentObject._type == 'GFPage' and self._currentObject or \
@@ -541,11 +541,11 @@
block = self._currentObject._type == 'GFBlock' and self._currentObject or \
self._currentObject.findParentOfType('GFBlock')
- menu.AppendMenu(wxNewId(), 'Form', PageMenu(self.instance, form, x, y))
+ menu.AppendMenu(wx.NewId(), 'Form', PageMenu(self.instance, form, x, y))
if page:
- menu.AppendMenu(wxNewId(), page.name, PageMenu(self.instance, page, x,
y))
+ menu.AppendMenu(wx.NewId(), page.name, PageMenu(self.instance, page, x,
y))
if block:
- menu.AppendMenu(wxNewId(), block.name, PageMenu(self.instance, block, x,
y))
+ menu.AppendMenu(wx.NewId(), block.name, PageMenu(self.instance, block,
x, y))
self.panel.PopupMenu(menu, event.GetPosition())
@@ -554,7 +554,7 @@
if event.KeyCode() in (WXK_LEFT, WXK_RIGHT, WXK_UP, WXK_DOWN) and \
len(self._currentSelection):
if event.AltDown() or event.ControlDown() or event.ShiftDown():
- # caution: event.MetaDown() is always true on some architectures
+ # caution: event.MetaDown() is always True on some architectures
resize = None
if event.KeyCode() == WXK_LEFT:
resize = (-1,0)
@@ -657,14 +657,14 @@
elif mode == 'refocus':
self.layouteditor.dispatchEvent('Cancel:LayoutEditor:FocusOrder')
- ##self.panel.SetCursor(wxCROSS_CURSOR)
- wxSetCursor(wxCROSS_CURSOR)
+ ##self.panel.SetCursor(wx.CROSS_CURSOR)
+ wx.SetCursor(wx.CROSS_CURSOR)
self.__wizardrunner = event.wizardrunner
def cancelPrePositioningTemplate(self, event=None):
if self.layouteditor.mode == 'prepositioning':
self.__wizardrunner.cancel()
- wxSetCursor(wxSTANDARD_CURSOR)
+ wx.SetCursor(wx.STANDARD_CURSOR)
def endPrePositioningTemplate(self, x, y, width=None, height=None):
self.layouteditor.mode = 'move'
@@ -718,12 +718,12 @@
self.layouteditor.dispatchEvent('LayoutEditor:Select')
-class PrepositioningTimer(wxTimer):
+class PrepositioningTimer(wx.Timer):
def __init__(self, method, *args, **params):
self.__method = method
self.__args = args
self.__params = params
- wxTimer.__init__(self)
+ wx.Timer.__init__(self)
def Notify(self):
self.__method(*self.__args, **self.__params)
Modified: trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/Driver.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/Driver.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/Driver.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -26,7 +26,7 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
class BaseRenderer:
def __init__(self, instance, workspace):
Modified: trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/GridPane.py
===================================================================
--- trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/GridPane.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/forms/LayoutEditor/renderers/Base/GridPane.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from gnue.designer.forms.LayoutEditor.Utils import *
from gnue.common.apps import GDebug
@@ -34,25 +34,25 @@
#
#
#
-class GridPane(wxSashWindow):
+class GridPane(wx.SashWindow):
def __init__(self, instance, parent, pos):
- wxSashWindow.__init__(self, parent, -1, pos=pos,
style=wxWANTS_CHARS|wxSIMPLE_BORDER)
+ wx.SashWindow.__init__(self, parent, -1, pos=pos,
style=wx.WANTS_CHARS|wx.SIMPLE_BORDER)
self.__showGrids = 1
self.__instance = instance
- EVT_PAINT(self, self.OnPaint)
+ wx.EVT_PAINT(self, self.OnPaint)
# TODO: Have the sash events resize the form
- self.SetSashVisible(wxSASH_RIGHT,1)
- self.SetSashVisible(wxSASH_BOTTOM,1)
+ self.SetSashVisible(wx.SASH_RIGHT,1)
+ self.SetSashVisible(wx.SASH_BOTTOM,1)
- EVT_SASH_DRAGGED(self, self.GetId(), self.SashChanged)
+ wx.EVT_SASH_DRAGGED(self, self.GetId(), self.SashChanged)
def OnPaint(self, event):
if self.__showGrids:
- dc = wxPaintDC(self)
+ dc = wx.PaintDC(self)
dc.BeginDrawing()
w, h = self.GetSizeTuple()
- dc.SetPen(wxPen(self.__instance.panelGridColor))
+ dc.SetPen(wx.Pen(self.__instance.panelGridColor))
for x in range(self.__instance.widgetWidth,w-3,
self.__instance.widgetWidth):
dc.DrawLine(x,0,x,h-1)
Modified:
trunk/gnue-designer/src/forms/LayoutEditor/renderers/native/WidgetHandler.py
===================================================================
---
trunk/gnue-designer/src/forms/LayoutEditor/renderers/native/WidgetHandler.py
2006-03-03 17:45:45 UTC (rev 8200)
+++
trunk/gnue-designer/src/forms/LayoutEditor/renderers/native/WidgetHandler.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -25,7 +25,7 @@
#
# NOTES:
-from wxPython.wx import *
+import wx
import sys, string
from Utils import *
from gnue.common.apps import GDebug
@@ -38,9 +38,9 @@
#
#
#
-class WidgetHandler(wxEvtHandler):
+class WidgetHandler(wx.EvtHandler):
def __init__(self, instance, object):
- wxEvtHandler.__init__(self)
+ wx.EvtHandler.__init__(self)
self.editor = instance
self.object = object
self.hasFocus = 0
@@ -57,7 +57,7 @@
self.recalcBoundaries()
for widget in self.mainWidget.widgets:
- widget.SetCursor (wxSTANDARD_CURSOR)
+ widget.SetCursor (wx.STANDARD_CURSOR)
# try:
# widget.Enable(0)
@@ -151,13 +151,13 @@
# "database": self.connectionName } }
#
#
- do = wxCustomDataObject(wxCustomDataFormat("application/x-gnue-designer"))
+ do =
wx.CustomDataObject(wx.CustomDataFormat("application/x-gnue-designer"))
do.SetData(cPickle.dumps(data,1))
## icon = FeedbackBitmap(10,10).icon()
dropSource = MoveDropSource(self, self.editor)
dropSource.SetData(do)
- result = dropSource.DoDragDrop(true)
+ result = dropSource.DoDragDrop(True)
event.Skip()
@@ -219,7 +219,7 @@
if self.editor.mode == 'move':
pt = event.GetPositionTuple()
self.editor.dispatchEvent('ObjectSelected',object=self.object,
originator=None)
- wxPyTypeCast(event.GetEventObject(),'wxWindow') \
+ wx.PyTypeCast(event.GetEventObject(),'wx.Window') \
.PopupMenu(self.object._popupMenu, pt)
event.Skip()
@@ -300,7 +300,7 @@
else:
for widget in self.mainWidget.widgets:
x,y = widget.GetSizeTuple()
- widget.SetSize(wxSize(x + nx,y + ny))
+ widget.SetSize(wx.Size(x + nx,y + ny))
oldVals = {}
newVals = {}
@@ -338,7 +338,7 @@
else:
for widget in self.mainWidget.widgets:
x,y = widget.GetPositionTuple()
- widget.SetPosition(wxPoint(x + nx,y + ny))
+ widget.SetPosition(wx.Point(x + nx,y + ny))
oldVals = {}
newVals = {}
if dx:
Modified: trunk/gnue-designer/src/forms/PropertyEditor.py
===================================================================
--- trunk/gnue-designer/src/forms/PropertyEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/forms/PropertyEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -29,7 +29,7 @@
import sys, os, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
from gnue.designer.base.tools.PropertyEditor import PropertyEditor as
BasePropertyEditor
Modified: trunk/gnue-designer/src/forms/TreeView.py
===================================================================
--- trunk/gnue-designer/src/forms/TreeView.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/forms/TreeView.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -31,7 +31,7 @@
#
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.logic import GTrigger
from gnue.common.datasources import GDataSource
Modified: trunk/gnue-designer/src/navigator/LayoutEditor.py
===================================================================
--- trunk/gnue-designer/src/navigator/LayoutEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/navigator/LayoutEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -27,7 +27,7 @@
import sys, os, cPickle, string
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.common.apps import RuntimeSettings
from gnue.designer.base.ToolBase import ToolBase
@@ -38,7 +38,7 @@
def init(self):
- self.splitter = wxSplitterWindow(self, -1)
+ self.splitter = wx.SplitterWindow(self, -1)
self.tree = MasterTreeView(self, self.splitter)
self.list = ObjectEditor(self, self.splitter)
@@ -46,7 +46,7 @@
self.splitter.SplitHorizontally(self.tree, self.list,100)
self.finalize = 1
- EVT_SIZE(self, self.OnSize)
+ wx.EVT_SIZE(self, self.OnSize)
rootObject.walk(self.inventoryObject)
self.tree.postInit()
@@ -124,11 +124,11 @@
#
#
#
-class MasterTreeView(wxTreeCtrl):
+class MasterTreeView(wx.TreeCtrl):
def __init__(self, editor, parentWindow):
- wxTreeCtrl.__init__(self, parentWindow, -1,
- style=wxTR_HAS_BUTTONS|wxTR_EDIT_LABELS|wxTR_HAS_VARIABLE_ROW_HEIGHT)
+ wx.TreeCtrl.__init__(self, parentWindow, -1,
+ style=wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS|wx.TR_HAS_VARIABLE_ROW_HEIGHT)
self.editor = editor
@@ -138,8 +138,8 @@
self.SetPyData(self.editor.rootObject._treeItem, self.editor.rootObject)
- EVT_TREE_BEGIN_LABEL_EDIT(self, self.GetId(), self.OnBeginEdit)
- EVT_TREE_END_LABEL_EDIT(self, self.GetId(), self.OnEndEdit)
+ wx.EVT_TREE_BEGIN_LABEL_EDIT(self, self.GetId(), self.OnBeginEdit)
+ wx.EVT_TREE_END_LABEL_EDIT(self, self.GetId(), self.OnEndEdit)
def getName(self, object, includeDescr):
@@ -201,10 +201,10 @@
#
#
#
-class ObjectEditor(wxListCtrl):
+class ObjectEditor(wx.ListCtrl):
def __init__(self, editor, parentWindow):
- wxListCtrl.__init__(self, parentWindow, -1)
+ wx.ListCtrl.__init__(self, parentWindow, -1)
self.editor = editor
Modified: trunk/gnue-designer/src/reports/Char/LayoutEditor.py
===================================================================
--- trunk/gnue-designer/src/reports/Char/LayoutEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/reports/Char/LayoutEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -27,7 +27,7 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
from gnue.designer.base.ToolBase import ToolBase
from gnue.forms.uidrivers.wx import UIdriver as UIwxpython
@@ -40,8 +40,8 @@
uses_toolbar = 0 #1
def init(self):
- self.backcolor = wxWHITE
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
+ self.backcolor = wx.WHITE
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
self.panelColor = self.GetBackgroundColour()
self._instance = self.instance
self.rootObject = self.instance.rootObject
@@ -56,7 +56,7 @@
'ObjectDeleted' : self.onDeleteObject,
})
- EVT_SIZE(self, self.onSize)
+ wx.EVT_SIZE(self, self.onSize)
def inventoryObject(self, object):
Modified: trunk/gnue-designer/src/reports/Standard/GroupEditor.py
===================================================================
--- trunk/gnue-designer/src/reports/Standard/GroupEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/reports/Standard/GroupEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -28,8 +28,8 @@
import sys, os, string
-from wxPython.wx import *
-from wxPython.grid import *
+import wx
+from wx.grid import *
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
from gnue.common.logic.GTrigger import GTrigger
@@ -54,7 +54,7 @@
default_dock = 'right-0'
def init(self):
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
self.object = None
self.table = None
@@ -63,7 +63,7 @@
self.objectMap = {}
# Set up our grid
- self.grid = wxGrid(self.panel, -1, pos=wxPoint(0,0))
+ self.grid = Grid(self.panel, -1, pos=wx.Point(0,0))
self.grid.CreateGrid(1,numcols)
for i in range(numcols):
@@ -72,9 +72,9 @@
self.grid.SetRowLabelSize(0)
- EVT_GRID_CELL_CHANGE(self.grid, self.OnCellChange)
- EVT_GRID_CELL_LEFT_DCLICK(self.grid, self.OnLeftDClick)
- EVT_SIZE(self, self.onSize)
+ wx.EVT_GRID_CELL_CHANGE(self.grid, self.OnCellChange)
+ wx.EVT_GRID_CELL_LEFT_DCLICK(self.grid, self.OnLeftDClick)
+ wx.EVT_SIZE(self, self.onSize)
# EventAware provided by ToolBase
self.registerEventListeners({
Modified: trunk/gnue-designer/src/reports/Standard/LayoutEditor.py
===================================================================
--- trunk/gnue-designer/src/reports/Standard/LayoutEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/reports/Standard/LayoutEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -27,7 +27,7 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
from gnue.designer.base.ToolBase import ToolBase
from gnue.forms.uidrivers.wx import UIdriver as UIwxpython
@@ -40,8 +40,8 @@
uses_toolbar = 0 #1
def init(self):
- self.backcolor = wxWHITE
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
+ self.backcolor = wx.WHITE
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
self.panelColor = self.GetBackgroundColour()
self._instance = self.instance
self.rootObject = self.instance.rootObject
@@ -56,7 +56,7 @@
'ObjectDeleted' : self.onDeleteObject,
})
- EVT_SIZE(self, self.onSize)
+ wx.EVT_SIZE(self, self.onSize)
def inventoryObject(self, object):
Modified: trunk/gnue-designer/src/reports/TreeView.py
===================================================================
--- trunk/gnue-designer/src/reports/TreeView.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/reports/TreeView.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -28,7 +28,7 @@
# TODO: all the SetItemImage lines in this file have been commented out as on
win32 it was segfaulting
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.reports.base import GRReport, GRSources, GRParameters, GRSortOptions
from gnue.reports.base import layout as GRLayout
Modified: trunk/gnue-designer/src/schema/DiaEditor/VisualEditor.py
===================================================================
--- trunk/gnue-designer/src/schema/DiaEditor/VisualEditor.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/schema/DiaEditor/VisualEditor.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -27,7 +27,7 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
from VisualTable import *
from gnue.designer.base.ToolBase import *
@@ -40,26 +40,26 @@
self.object = None
self._app = self.instance._app
- self.dragmode = false
+ self.dragmode = False
self.tables=[]
- self.hasNewObj = false
+ self.hasNewObj = False
self.rootObject.walk(self.inventoryObject)
# Painting related stuff
- self.diagram=wxScrolledWindow(self, -1,
- style=wxSUNKEN_BORDER)
+ self.diagram=wx.ScrolledWindow(self, -1,
+ style=wx.SUNKEN_BORDER)
self.panelColor = self.GetBackgroundColour()
self.panelheight=100
self.panelwidth=200
- self.diagram.EnableScrolling(true, true)
+ self.diagram.EnableScrolling(True, True)
self.redrawBackground()
- #self.diagram.SetBackgroundColour(wxWHITE)
+ #self.diagram.SetBackgroundColour(wx.WHITE)
self.calculateTablePositions()
- Sizer = wxBoxSizer(wxHORIZONTAL)
+ Sizer = wx.BoxSizer(wx.HORIZONTAL)
#Sizer.Add(self.toolPalette, 0)
- Sizer.Add(self.diagram, 1, wxEXPAND)
+ Sizer.Add(self.diagram, 1, wx.EXPAND)
- self.SetAutoLayout(true)
+ self.SetAutoLayout(True)
self.SetSizer(Sizer)
@@ -74,17 +74,17 @@
# WX WINDOWS Events
- EVT_PAINT(self.diagram, self.onPaintEvent)
-# EVT_LEFT_DOWN(self.diagram, self.onLeftClickEvent)
- EVT_MOTION(self.diagram, self.onMouseEvent)
- EVT_LEFT_UP(self.diagram, self.onMouseEvent)
- EVT_LEFT_DOWN(self.diagram, self.onMouseEvent)
- EVT_LEFT_DCLICK(self.diagram, self.onDoubleClickEvent)
- EVT_RIGHT_DOWN(self.diagram, self.onRightClickEvent)
+ wx.EVT_PAINT(self.diagram, self.onPaintEvent)
+# wx.EVT_LEFT_DOWN(self.diagram, self.onLeftClickEvent)
+ wx.EVT_MOTION(self.diagram, self.onMouseEvent)
+ wx.EVT_LEFT_UP(self.diagram, self.onMouseEvent)
+ wx.EVT_LEFT_DOWN(self.diagram, self.onMouseEvent)
+ wx.EVT_LEFT_DCLICK(self.diagram, self.onDoubleClickEvent)
+ wx.EVT_RIGHT_DOWN(self.diagram, self.onRightClickEvent)
def calculateTablePositions(self):
- dc = wxMemoryDC()
+ dc = wx.MemoryDC()
self.diagram.PrepareDC(dc)
dc.BeginDrawing()
x=10
@@ -128,21 +128,21 @@
# mark actual object (in blue?)
if self.object!=object:
self.object=object
- dc = wxClientDC(self.diagram)
+ dc = wx.ClientDC(self.diagram)
self.diagram.PrepareDC(dc)
self.drawWholeScreen(dc)
def findFreePosition(self, x,y,w,h):
- conflict=true
+ conflict=True
while conflict:
- conflict=false
+ conflict=False
for i in self.tables:
if i.isInRectangle(x,y,x+w,y+h):
x=i.xpos+i.width+10
if x>500:
x=10
y=i.ypos+i.height+10
- conflict=true
+ conflict=True
self.resizeCanvas(x+w,y+h)
return (x,y)
@@ -170,11 +170,11 @@
except:
if object._type=="GSTable":
self.tables.append(VisualTable(object))
- self.hasNewObj=true
+ self.hasNewObj=True
self.refresh()
return
vTbl=VisualTable(object)
- dc = wxClientDC(self.diagram)
+ dc = wx.ClientDC(self.diagram)
self.diagram.PrepareDC(dc)
(w,h)=vTbl.calculateDimensions(dc)
@@ -185,7 +185,7 @@
self.tables.append(vTbl)
if object._type=="GSField":
- self.hasNewObj=true
+ self.hasNewObj=True
self.onModifyObject(event)
@@ -196,7 +196,7 @@
if tbl!=None:
for i in self.tables:
if i.instance==tbl:
- dc = wxClientDC(self.diagram)
+ dc = wx.ClientDC(self.diagram)
self.diagram.PrepareDC(dc)
(w,h)=i.calculateDimensions(dc)
# check if still freepos
@@ -206,7 +206,7 @@
return
def refresh(self):
- self.diagram.Refresh(true)
+ self.diagram.Refresh(True)
def onDeleteObject (self, event):
object = event.object
@@ -223,15 +223,15 @@
tbl=object.findParentOfType("GSTable")
for vTbl in self.tables:
if vTbl.instance==tbl:
- dc = wxMemoryDC()
+ dc = wx.MemoryDC()
vTbl.calculateDimensions(dc)
self.refresh()
- def onPaintEvent(self, event, clear=false):
+ def onPaintEvent(self, event, clear=False):
if self.hasNewObj:
self.calculateTablePositions()
- self.hasNewObj=false
- dc = wxPaintDC(self.diagram)
+ self.hasNewObj=False
+ dc = wx.PaintDC(self.diagram)
self.diagram.PrepareDC(dc)
if clear:
dc.SetBackground(self.panelColor)
@@ -249,8 +249,8 @@
dc.EndDrawing()
def redrawBackground(self):
- btm=wxEmptyBitmap(self.panelheight,self.panelwidth,-1)
- dc=wxMemoryDC()
+ btm=wx.EmptyBitmap(self.panelheight,self.panelwidth,-1)
+ dc=wx.MemoryDC()
dc.SelectObject(btm);
for vTbl in self.tables:
vTbl.drawMe(dc,self.object)
@@ -288,34 +288,34 @@
self.dragx=x-object.xpos
self.dragy=y-object.ypos
self.dragobj=object
- dc = wxClientDC(self.diagram)
+ dc = wx.ClientDC(self.diagram)
self.diagram.PrepareDC(dc)
- self.spriteOn=false
- self.dragmode=true
+ self.spriteOn=False
+ self.dragmode=True
elif event.LeftUp() and self.dragmode:
- self.dragmode=false
+ self.dragmode=False
self.refresh()
elif event.Dragging() and self.dragmode:
(x,y) = self.calculateMousePos(event)
- dc = wxClientDC(self.diagram)
+ dc = wx.ClientDC(self.diagram)
self.diagram.PrepareDC(dc)
dc.BeginDrawing()
- dc.SetLogicalFunction(wxXOR)
+ dc.SetLogicalFunction(wx.XOR)
if self.spriteOn:
- self.dragobj.drawMe(dc,self.object,true)
+ self.dragobj.drawMe(dc,self.object,True)
self.dragobj.moveTo(x-self.dragx,y-self.dragy)
- self.spriteOn=true
- self.dragobj.drawMe(dc,self.object,true)
+ self.spriteOn=True
+ self.dragobj.drawMe(dc,self.object,True)
# TODO: implement a way to move tables as a whole and not
# only showing the border of the window.
-# one way would be to use a wxMemoryDC to paint into, and
+# one way would be to use a wx.MemoryDC to paint into, and
# which is copied into the real window -> no flickering screen
# when a object should be moved, first delete it, and repaint the
-# wxMemoryDC, then you can move it on the real DC and you can
+# wx.MemoryDC, then you can move it on the real DC and you can
# restore the background by using Blit
dc.EndDrawing()
@@ -324,7 +324,7 @@
def onRightClickEvent(self,event):
(x,y) = self.calculateMousePos(event)
object=self.getObjectAt(x,y)
- menu = wxMenu()
+ menu = wx.Menu()
popup_NEWTABLE =1
popup_NEWSTRFIELD =2
@@ -347,46 +347,46 @@
if object._type=='VisualTable' or object._type=="GSTable":
menu.Append(popup_NEWSTRFIELD, "Add Field (String)")
- EVT_MENU(self,popup_NEWSTRFIELD,self.onAddStringField)
+ wx.EVT_MENU(self,popup_NEWSTRFIELD,self.onAddStringField)
menu.Append(popup_NEWNUMFIELD, "Add Field (Number)")
- EVT_MENU(self,popup_NEWNUMFIELD,self.onAddNumberField)
+ wx.EVT_MENU(self,popup_NEWNUMFIELD,self.onAddNumberField)
elif object._type=="GSField":
menu.Append(popup_NEWINDEX, "Add Index")
- EVT_MENU(self,popup_NEWINDEX,self.onAddIndex)
+ wx.EVT_MENU(self,popup_NEWINDEX,self.onAddIndex)
menu.Append(popup_NEWUINDEX, "Add Unique Index")
- EVT_MENU(self,popup_NEWUINDEX,self.onAddUniqueIndex)
+ wx.EVT_MENU(self,popup_NEWUINDEX,self.onAddUniqueIndex)
else:
menu.Append(popup_NEWTABLE, "New Table")
- EVT_MENU(self,popup_NEWTABLE,self.onNewTable)
+ wx.EVT_MENU(self,popup_NEWTABLE,self.onNewTable)
if object._type!='GSSchema':
menu.AppendSeparator()
menu.Append(popup_EDIT, "Edit")
- EVT_MENU(self,popup_EDIT,self.onEdit)
+ wx.EVT_MENU(self,popup_EDIT,self.onEdit)
menu.Append(popup_RENAME, "Rename")
- EVT_MENU(self,popup_RENAME,self.onRename)
+ wx.EVT_MENU(self,popup_RENAME,self.onRename)
menu.Append(popup_DUPPL, "Duplicate")
- EVT_MENU(self,popup_DUPPL,self.onDuplicate)
+ wx.EVT_MENU(self,popup_DUPPL,self.onDuplicate)
menu.Append(popup_DEL, "Delete")
- EVT_MENU(self,popup_DEL,self.onDelete)
+ wx.EVT_MENU(self,popup_DEL,self.onDelete)
- clickPt = wxPoint(x + self.diagram.GetPosition().x,
+ clickPt = wx.Point(x + self.diagram.GetPosition().x,
y + self.diagram.GetPosition().y)
self.diagram.PopupMenu(menu, clickPt)
menu.Destroy()
def onNewTable(self,event):
- dialog = wxTextEntryDialog(self.diagram,'Name of the new table:')
+ dialog = wx.TextEntryDialog(self.diagram,'Name of the new table:')
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
tables=self.rootObject.findChildOfType("GSTables")
if tables==None:
tables = self.instance.incubator.createObject(
@@ -403,9 +403,9 @@
self.onAddField(event,'string')
def onAddField(self,event,type='string'):
- dialog = wxTextEntryDialog(self.diagram,'Name of the new field:')
+ dialog = wx.TextEntryDialog(self.diagram,'Name of the new field:')
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
fields=self.object.findChildOfType("GSFields")
if fields==None:
tbl=self.object.findChildOfType("GSTable")
@@ -455,11 +455,11 @@
pass
def onRename(self,event):
- dialog = wxTextEntryDialog(self.diagram,'New Name')
+ dialog = wx.TextEntryDialog(self.diagram,'New Name')
if hasattr(self.object,'name'):
dialog.SetValue(self.object.name)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
self.object.name=dialog.GetValue()
self.instance.onModifyObject(self.object,"schema",
[('name',self.object.name)])
Modified: trunk/gnue-designer/src/schema/DiaEditor/VisualTable.py
===================================================================
--- trunk/gnue-designer/src/schema/DiaEditor/VisualTable.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/schema/DiaEditor/VisualTable.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -27,18 +27,18 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
class VisualTable:
def __init__(self, tableinstance):
self.instance=tableinstance
self._type='VisualTable'
- #self.font = wxFont(self.textSize, wxDEFAULT, wxNORMAL,wxNORMAL,0,fontname
)
- self.pen = wxBLACK_PEN # wxPen(...)
- self.pen_highlighted = wxPen(wxBLUE, 1, wxSOLID)
- self.brush = wxWHITE_BRUSH # wxTRANSPARENT_BRUSH # wxBLACK_BRUSH
- self.pen_inv = wxWHITE_PEN # wxPen(...)
- self.brush_inv = wxBLACK_BRUSH # wxTRANSPARENT_BRUSH # wxBLACK_BRUSH
+ #self.font = wx.Font(self.textSize, wx.DEFAULT,
wx.NORMAL,wx.NORMAL,0,fontname )
+ self.pen = wx.BLACK_PEN # wx.Pen(...)
+ self.pen_highlighted = wx.Pen(wx.BLUE, 1, wx.SOLID)
+ self.brush = wx.WHITE_BRUSH # wx.TRANSPARENT_BRUSH # wx.BLACK_BRUSH
+ self.pen_inv = wx.WHITE_PEN # wx.Pen(...)
+ self.brush_inv = wx.BLACK_BRUSH # wx.TRANSPARENT_BRUSH # wx.BLACK_BRUSH
self.xpos=-100
self.ypos=-100
self.width=10
@@ -88,7 +88,7 @@
self.xpos=x
self.ypos=y
- def drawMe(self,dc,current,inverse=false):
+ def drawMe(self,dc,current,inverse=False):
if inverse:
dc.SetPen(self.pen_inv)
dc.SetBrush(self.brush_inv)
@@ -112,7 +112,7 @@
# check if this field is the current selected object
if c==current:
dc.SetPen(self.pen_highlighted)
- dc.SetBrush(wxTRANSPARENT_BRUSH)
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.DrawRectangle(self.xpos+3,y+8,self.width-6,self.textheight+4)
dc.DrawText(c.name,self.xpos+10,y+10)
@@ -121,7 +121,7 @@
# check if the table is selected
if self.instance==current:
dc.SetPen(self.pen_highlighted)
- dc.SetBrush(wxTRANSPARENT_BRUSH)
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.DrawRectangle(self.xpos+3,self.ypos+8,
self.width-6,self.textheight+4)
@@ -155,7 +155,7 @@
def isInRectangle(self,x,y,x2,y2):
if (not (x>self.xpos+self.width or x2<self.xpos)) and \
(not (y>self.ypos+self.width and y2<self.ypos)):
- return true
+ return True
else:
- return false
+ return False
Modified: trunk/gnue-designer/src/schema/LayoutEditor.py
===================================================================
--- trunk/gnue-designer/src/schema/LayoutEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/schema/LayoutEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -27,7 +27,7 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
from gnue.designer.base.ToolBase import ToolBase
class LayoutEditor (ToolBase):
Modified: trunk/gnue-designer/src/schema/TableEditor.py
===================================================================
--- trunk/gnue-designer/src/schema/TableEditor.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/schema/TableEditor.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -28,8 +28,8 @@
import sys, os, string
-from wxPython.wx import *
-from wxPython.grid import *
+import wx
+from wx.grid import *
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
from gnue.common.logic.GTrigger import GTrigger
@@ -53,7 +53,7 @@
default_dock = 'right-0'
def init(self):
- self.panel = wxPanel(self,-1,style=wxSIMPLE_BORDER, pos=wxPoint(6,6))
+ self.panel = wx.Panel(self,-1,style=wx.SIMPLE_BORDER, pos=wx.Point(6,6))
self.object = None
self.table = None
@@ -62,7 +62,7 @@
self.objectMap = {}
# Set up our grid
- self.grid = wxGrid(self.panel, -1, pos=wxPoint(0,0))
+ self.grid = Grid(self.panel, -1, pos=wx.Point(0,0))
self.grid.CreateGrid(1,numcols)
for i in range(numcols):
@@ -70,9 +70,9 @@
self.grid.SetRowLabelSize(32)
- EVT_GRID_CELL_CHANGE(self.grid, self.OnCellChange)
- EVT_GRID_CELL_LEFT_DCLICK(self.grid, self.OnLeftDClick)
- EVT_SIZE(self, self.onSize)
+ wx.EVT_GRID_CELL_CHANGE(self.grid, self.OnCellChange)
+ wx.EVT_GRID_CELL_LEFT_DCLICK(self.grid, self.OnLeftDClick)
+ wx.EVT_SIZE(self, self.onSize)
# EventAware provided by ToolBase
self.registerEventListeners({
Modified: trunk/gnue-designer/src/schema/TreeView.py
===================================================================
--- trunk/gnue-designer/src/schema/TreeView.py 2006-03-03 17:45:45 UTC (rev
8200)
+++ trunk/gnue-designer/src/schema/TreeView.py 2006-03-04 01:22:59 UTC (rev
8201)
@@ -28,7 +28,7 @@
# TODO: all the SetItemImage lines in this file have been commented out as on
win32 it was segfaulting
import sys, os
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from gnue.designer.base.Icons import treeIconMap, treeIconList
from gnue.designer.base.tools.TreeView import TreeView as BaseTreeView
Modified: trunk/gnue-designer/src/templates/forms/FormBuilder.py
===================================================================
--- trunk/gnue-designer/src/templates/forms/FormBuilder.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/templates/forms/FormBuilder.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -401,7 +401,7 @@
multirecord = self.variables['tablearrangement%s' % count] == 'grid'
# Will labels appear above or to the left of the entries?
- # Note: this results in false for both "grid" and "above"
+ # Note: this results in False for both "grid" and "above"
leftlabels = self.variables['tablearrangement%s' % count] == 'left'
Modified: trunk/gnue-designer/src/templates/forms/Simple.py
===================================================================
--- trunk/gnue-designer/src/templates/forms/Simple.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/templates/forms/Simple.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -174,7 +174,7 @@
multirecord = self.variables['arrangement'] == 'grid'
# Will labels appear above or to the left of the entries?
- # Note: this results in false for both "grid" and "above"
+ # Note: this results in False for both "grid" and "above"
leftlabels = self.variables['arrangement'] == 'left'
# Set the basic attributes of the form
Modified: trunk/gnue-designer/src/uidrivers/wx/Base.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/Base.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/Base.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -23,20 +23,35 @@
#
# DESCRIPTION:
"""
-UI Driver for wxWidgets 2.4
+UI Driver for wxWidgets 2.6
"""
# NOTES:
#
+try:
+ import wxselect
+ wxselect.wx.VersionFinder.setpath(version="2.6")
+except ImportError:
+ pass
+
import sys, os, string
-from wxPython.wx import *
+
+
+try:
+ import wx
+ if wx.__version__ < '2.6.1':
+ raise ImportError
+
+except ImportError:
+ raise "GNUe Designer requires wxPython 2.6.1 or greater (2.6.2.1 on Mac)"
+
from gnue.forms.uidrivers.wx.GFwxApp import setWxApp
from startup.Startup import Startup
from Instance import Instance
from MenuBar import MenuBar
-class UIBase(wxApp):
+class UIBase(wx.App):
######################################################################
@@ -89,21 +104,21 @@
@returns: True
"""
if _cancel:
- buttonStyle = wxOK|wxCANCEL
+ buttonStyle = wx.OK|wx.CANCEL
else:
- buttonStyle = wxOK
+ buttonStyle = wx.OK
if icon == 'question':
- iconStyle = wxICON_QUESTION
+ iconStyle = wx.ICON_QUESTION
elif icon == "warn":
- iconStyle = wxICON_EXCLAMATION
+ iconStyle = wx.ICON_EXCLAMATION
elif icon == 'information':
- iconStyle = wxICON_INFORMATION
+ iconStyle = wx.ICON_INFORMATION
else:
# TODO: assert? error?
- iconStyle = wxICON_INFORMATION
- return wxMessageDialog(parentWindow or NULL, text, title,
- buttonStyle|iconStyle ).ShowModal() == wxID_OK
+ iconStyle = wx.ICON_INFORMATION
+ return wx.MessageDialog(parentWindow or None, text, title,
+ buttonStyle|iconStyle ).ShowModal() == wx.ID_OK
def dialogCancel(self, text, title, parentWindow=None, icon="warn"):
@@ -122,17 +137,17 @@
@returns: True if user selected Yes, False otherwise.
"""
if icon == 'question':
- iconStyle = wxICON_QUESTION
+ iconStyle = wx.ICON_QUESTION
elif icon == "warn":
- iconStyle = wxICON_EXCLAMATION
+ iconStyle = wx.ICON_EXCLAMATION
elif icon == 'information':
- iconStyle = wxICON_INFORMATION
+ iconStyle = wx.ICON_INFORMATION
else:
# TODO: assert? error?
- iconStyle = wxICON_INFORMATION
+ iconStyle = wx.ICON_INFORMATION
- return wxMessageDialog(parentWindow or NULL, text, title,
- wxYES_NO|iconStyle ).ShowModal() == wxID_YES
+ return wx.MessageDialog(parentWindow or None, text, title,
+ wx.YES_NO|iconStyle ).ShowModal() == wx.ID_YES
def dialogYesNoCancel(self, text, title, parentWindow=None, icon="question"):
"""
@@ -141,20 +156,20 @@
@returns: True (1) if user selected Yes, False (0) if No, -1 if canceled.
"""
if icon == 'question':
- iconStyle = wxICON_QUESTION
+ iconStyle = wx.ICON_QUESTION
elif icon == "warn":
- iconStyle = wxICON_EXCLAMATION
+ iconStyle = wx.ICON_EXCLAMATION
elif icon == 'information':
- iconStyle = wxICON_INFORMATION
+ iconStyle = wx.ICON_INFORMATION
else:
# TODO: assert? error?
- iconStyle = wxICON_INFORMATION
+ iconStyle = wx.ICON_INFORMATION
- rv = wxMessageDialog(parentWindow or NULL, text, title,
- wxYES_NO|wxCANCEL|iconStyle ).ShowModal()
- if rv == wxID_YES:
+ rv = wx.MessageDialog(parentWindow or None, text, title,
+ wx.YES_NO|wx.CANCEL|iconStyle ).ShowModal()
+ if rv == wx.ID_YES:
return True
- elif rv == wxID_NO:
+ elif rv == wx.ID_NO:
return False
else:
return -1
@@ -175,10 +190,10 @@
for extension, description in wildcards:
wcstring += "%s (*.%s)|*.%s|" % (description, extension, extension)
- dlg = wxFileDialog(parentWindow or NULL, title, defaultDir=os.getcwd(),
+ dlg = wx.FileDialog(parentWindow or None, title, defaultDir=os.getcwd(),
wildcard = wcstring,
- style=wxOPEN)
- if dlg.ShowModal() != wxID_OK:
+ style=wx.OPEN)
+ if dlg.ShowModal() != wx.ID_OK:
ret = None
else:
ret = dlg.GetPath()
@@ -199,11 +214,11 @@
wcstring += "%s (*.%s)|*.%s|" % (description, extension, extension)
wcstring = wcstring[:-1]
- dlg = wxFileDialog(parentWindow or NULL, title,
+ dlg = wx.FileDialog(parentWindow or None, title,
defaultDir=os.getcwd(),
wildcard = wcstring,
- style=wxSAVE)
- if dlg.ShowModal() != wxID_OK:
+ style=wx.SAVE)
+ if dlg.ShowModal() != wx.ID_OK:
return None
else:
return dlg.GetPath()
@@ -221,17 +236,17 @@
##########################################################
#
- # wxApp methods
+ # wx.App methods
#
##########################################################
def OnInit(self):
"""
- Standard wxApp OnInit function.
+ Standard wx.App OnInit function.
Designer uses it to display the startup screen and
load the initial editor instance
@rtype: boolean
- @return: Always true
+ @return: Always True
"""
return True
@@ -244,7 +259,7 @@
def __init__(self, app):
print "__init__"
self.app = app
- wxApp.__init__(self, False) # prevents IO redirect
- wxInitAllImageHandlers()
+ wx.App.__init__(self, False) # prevents IO redirect
+ wx.InitAllImageHandlers()
Modified: trunk/gnue-designer/src/uidrivers/wx/Instance.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/Instance.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/Instance.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -28,31 +28,57 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
from gnue.designer.base import Goat
from gnue.common.apps import RuntimeSettings
-from docks.Docker import Docker
+#from docks.Docker import Docker
from gnue.designer import PACKAGE as TITLE
from gnue.designer.base.PrimaryToolBar import PrimaryToolBar
+from uihelpers import PyAUI
from MenuBar import MenuBar
-class Instance(wxFrame):
+class Instance(wx.Frame):
def __init__(self, instance):
- wxFrame.__init__(self, NULL, -1, "")
+ wx.Frame.__init__(self, None, -1, "", style=wx.DEFAULT_FRAME_STYLE |
+ wx.SUNKEN_BORDER |
+ wx.CLIP_CHILDREN)
+
+ # Setup PyAUI
+ self._mgr = PyAUI.FrameManager(self)
+ self._mgr.SetFrame(self)
+
self.instance = instance
+
+ # Set our icon
icon = Goat.getGoatIcon()
self.SetIcon(icon)
+ # Just a sane default...
+ self.SetMinSize(wx.Size(400, 300))
+
self.toolbar = PrimaryToolBar(self, self.instance)
self.SetToolBar(self.toolbar)
self.statusbar = self.CreateStatusBar()
- self.SetStatusText(_('Welcome to GNUe Designer -- Do not expose to direct
sunlight, do not feed after midnight, and do not get wet.'))
+ self.SetStatusText(_('Welcome to GNUe Designer.'))
- EVT_CLOSE(self, self.instance.OnClose)
+
+ self._mgr.AddPane(self.toolbar, PyAUI.PaneInfo().
+ Name("PrimaryToolBar").Caption("GNUe Designer").
+ ToolbarPane().Top())
+
+ wx.EVT_CLOSE(self, self.instance.OnClose)
+
+ # I think PyAUI requires this...
+ self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
+
+
+ def OnEraseBackground(self, event):
+ event.Skip()
+
def createMenuBar(self):
menuBar = MenuBar(self.instance)
self.SetMenuBar(menuBar)
@@ -69,27 +95,109 @@
def finalize(self):
# Build accelerator list
- accel = wxAcceleratorTable(self.instance.globalAccelerators)
+ accel = wx.AcceleratorTable(self.instance.globalAccelerators)
for child in [self] + self.instance.globalAcceleratorListeners:
child.SetAcceleratorTable(accel)
- # Fit the widgets to the screen
- self.Fit()
+# # Fit the widgets to the screen
+# self.Fit()
- self.SetSize((
- RuntimeSettings.getint(self.instance.runtime_section, 'width', 550),
- RuntimeSettings.getint(self.instance.runtime_section, 'height', 400)))
+# self.SetSize((
+# RuntimeSettings.getint(self.instance.runtime_section, 'width', 550),
+# RuntimeSettings.getint(self.instance.runtime_section, 'height', 400)))
- self.SetPosition((
- RuntimeSettings.getint(self.instance.runtime_section, 'x', -1),
- RuntimeSettings.getint(self.instance.runtime_section, 'y', -1)))
+# self.SetPosition((
+# RuntimeSettings.getint(self.instance.runtime_section, 'x', -1),
+# RuntimeSettings.getint(self.instance.runtime_section, 'y', -1)))
- self.Show(true)
- self.Refresh()
+ perspective = RuntimeSettings.get(self.instance.runtime_section,
'aui-perspective','')
+ if perspective:
+ self._mgr.LoadPerspective(perspective)
+ self._mgr.Update()
+
+ self.Show(True)
+# self.Refresh()
+
def initTools(self):
- self.docker = Docker(self, self.instance, self.instance._toolCache)
+ self.tools = []
+ pan = wx.Panel(self, -1)
+ pan.SetMinSize((200,200))
+ pan.SetSize((200,200))
+ self._mgr.AddPane(pan,
PyAUI.PaneInfo().Name('Foo').Caption('Foo').CenterPane())
+
+
+
+ #
+ # Add each tool
+ #
+ leftrow = 0
+ rightrow = 0
+ for id, title, baseclass, hotkey, group in self.instance._toolCache:
+
+ assert gDebug(2,'Adding tool %s [%s]' % (title,id))
+
+ indx = 0
+ pos = baseclass.default_dock
+ if '-' in pos:
+ pos, indx = pos.split('-')
+ indx = int(indx)
+
+ tool = baseclass(id, title, self.instance, self.instance.rootObject,
self)
+
+ tool._docked = RuntimeSettings.getint(self.instance.runtime_section,
'%s-docked' % id, pos != 'frame')
+ tool._dock_location = RuntimeSettings.get(self.instance.runtime_section,
'%s-location' % id, (pos == 'frame' and 'left' or pos))
+ tool._dock_index = RuntimeSettings.getint(self.instance.runtime_section,
'%s-index' % id, indx)
+ tool._visible = RuntimeSettings.getint(self.instance.runtime_section,
'%s-visible' % id, tool.default_visible)
+ tool._frame_x = RuntimeSettings.getint(self.instance.runtime_section,
'%s-frame-x' % id, -1)
+ tool._frame_y = RuntimeSettings.getint(self.instance.runtime_section,
'%s-frame-y' % id, -1)
+ tool._frame_width =
RuntimeSettings.getint(self.instance.runtime_section, '%s-frame-width' % id,
200)
+ tool._frame_height =
RuntimeSettings.getint(self.instance.runtime_section, '%s-frame-height' % id,
150)
+
+ appd = (id, title, baseclass, hotkey, pos)
+
+ tool.SetMinSize((40,40))
+
+ toolinfo = PyAUI.PaneInfo().Name(title).Caption(title)
+ if tool._docked:
+ # Docked type
+ if tool._dock_location == 'right':
+ toolinfo.Right()
+# if rightrow:
+# toolinfo.Row(rightrow)
+# rightrow += 1
+ else:
+ toolinfo.Left()
+# if leftrow:
+# toolinfo.Row(leftrow)
+# leftrow += 1
+ else:
+ # Frame type
+ toolinfo.Float()
+
+ if not tool._visible:
+ toolinfo.Hide()
+
+ self._mgr.AddPane(tool, toolinfo)
+
+ # Keep track of the tools we created
+ self.tools.append(tool)
+
+ # Add ourselves to the Window menu
+ self.instance.menubar.addAction(location='View', text=title,
event='Tool:' + id,
+ grouping=group, canToggle=1, canDisable=0,
+ icon=None, hotkey=hotkey)
+
+
+ self.instance.__dict__[id] = tool
+
+# if tool._visible:
+# instance.dispatchEvent('Show:Tool:%s' % id)
+# else:
+# instance.dispatchEvent('Hide:Tool:%s' % id)
+
+
#
# Used by RuntimeSettings
#
Modified: trunk/gnue-designer/src/uidrivers/wx/MenuBar.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/MenuBar.py 2006-03-03 17:45:45 UTC
(rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/MenuBar.py 2006-03-04 01:22:59 UTC
(rev 8201)
@@ -28,17 +28,17 @@
# NOTES:
#
-from wxPython.wx import *
+import wx
-class MenuBar(wxMenuBar):
+class MenuBar(wx.MenuBar):
def __init__(self, instance):
- wxMenuBar.__init__(self)
+ wx.MenuBar.__init__(self)
self.instance = instance
self._locationToWx= {}
#
- # Return the wxMenu(Item) associated with a location
+ # Return the wx.Menu(Item) associated with a location
def getMenu(self, location):
return self._locationToWx[location]
@@ -47,9 +47,9 @@
return self.createSubMenu(title, location, self)
def createSubMenu(self, title, location, parent):
- menu = wxMenu()
+ menu = wx.Menu()
self._locationToWx[location] = menu
- parent.AppendMenu(wxNewId(), title, menu)
+ parent.AppendMenu(wx.NewId(), title, menu)
return menu
def createSeparator(self, menu):
@@ -58,20 +58,20 @@
def createMenuItem(self, menu, text, canToggle,
canDisable, icon, hotkey, eventdata, help, action):
- mid = wxNewId()
+ mid = wx.NewId()
if hotkey:
text += '\t' + hotkey
- item = wxMenuItem(menu, mid, text, help,
- (canToggle and [wxITEM_CHECK] or [wxITEM_NORMAL])[0])
+ item = wx.MenuItem(menu, mid, text, help,
+ (canToggle and [wx.ITEM_CHECK] or [wx.ITEM_NORMAL])[0])
if canToggle:
- EVT_MENU(self.instance.base.ui, mid,
+ wx.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.base.ui, mid,
+ wx.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/uidrivers/wx/docks/BasePane.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/docks/BasePane.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/docks/BasePane.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -28,7 +28,7 @@
__all__ = ['BasePane']
-from wxPython.wx import *
+import wx
class BasePane:
def __init__(self, parent, instance, tool):
Modified: trunk/gnue-designer/src/uidrivers/wx/docks/DockedPane.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/docks/DockedPane.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/docks/DockedPane.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -29,21 +29,21 @@
__all__ = ['DockedPane']
import sys
-from wxPython.wx import *
+import wx
from BasePane import BasePane
#
#
#
-class DockedPane(wxSashWindow, BasePane):
+class DockedPane(wx.Panel, BasePane):
def __init__(self, parent, instance, tool):
- TITLEBAR_ACTIVE = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_HIGHLIGHT)
- TITLETEXT_ACTIVE =
wxSystemSettings_GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT)
- #TITLEBAR_INACTIVE = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE)
- #TITLETEXT_INACTIVE =
wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE)
+ TITLEBAR_ACTIVE = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT)
+ TITLETEXT_ACTIVE = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)
+ #TITLEBAR_INACTIVE = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE)
+ #TITLETEXT_INACTIVE = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE)
- wxSashWindow.__init__(self, parent, -1, style=wxSW_3DSASH|wxCLIP_CHILDREN)
+ wx.Panel.__init__(self, parent.parent, -1)
BasePane.__init__(self, parent, instance, tool)
# These are used exclusively by ToolDock
@@ -52,41 +52,40 @@
self.lastSize = 0
self.statusbar = None
- EVT_SIZE(self, self.__OnSize)
- EVT_SASH_DRAGGED(self, self.GetId(), self.__OnDrag)
+ wx.EVT_SIZE(self, self.__OnSize)
- self.sizer = sizer = wxBoxSizer(wxVERTICAL)
+ self.sizer = sizer = wx.BoxSizer(wx.VERTICAL)
if sys.platform == "win32":
size = (1, 16)
else:
size = (-1,-1)
- tp = self.__titlePanel = wxPanel(self,-1, wxPoint(0,0), size)#,
style=wxSIMPLE_BORDER)
+ tp = self.__titlePanel = wx.Panel(self,-1, wx.Point(0,0), size)#,
style=wx.SIMPLE_BORDER)
tp.SetBackgroundColour(TITLEBAR_ACTIVE)
- sizer.Add(tp,0, wxALL|wxEXPAND, border=2)
+ sizer.Add(tp,0, wx.ALL|wx.EXPAND, border=2)
- tt = self.__titleText = wxStaticText(tp,-1,tool.title,wxPoint(4,1))
+ tt = self.__titleText = wx.StaticText(tp,-1,tool.title,wx.Point(4,1))
tt.SetForegroundColour(TITLETEXT_ACTIVE)
font = tt.GetFont()
- font.SetWeight(wxBOLD)
+ font.SetWeight(wx.BOLD)
tt.SetFont(font)
x, y = tt.GetSizeTuple()
tp.SetClientSize((tp.GetClientSizeTuple()[0], y+3))
self.minimumVerticalSize = y + 3
- EVT_LEFT_DCLICK(tp, self.__LeftDClick)
- EVT_LEFT_DCLICK(tt, self.__LeftDClick)
+# wx.EVT_LEFT_DCLICK(tp, self.__LeftDClick)
+# wx.EVT_LEFT_DCLICK(tt, self.__LeftDClick)
- EVT_RIGHT_UP(tp, self.__RightClick)
- EVT_RIGHT_UP(tt, self.__RightClick)
+# wx.EVT_RIGHT_UP(tp, self.__RightClick)
+# wx.EVT_RIGHT_UP(tt, self.__RightClick)
- if tool.uses_toolbar:
- sizer.Add(tool.createToolbar(self), 0, wxEXPAND)
+# if tool.uses_toolbar:
+# sizer.Add(tool.createToolbar(self), 0, wx.EXPAND)
- sizer.Add(tool, 1, wxEXPAND)
- self.SetAutoLayout(true)
+# sizer.Add(tool, 1, wx.EXPAND)
+ self.SetAutoLayout(True)
self.SetSizer(sizer)
self.Layout()
@@ -95,25 +94,25 @@
def __RightClick(self, event):
# Display a menu
- menu = wxMenu()
+ menu = wx.Menu()
- nid = wxNewId()
+ nid = wx.NewId()
menu.Append(nid, _("Hide Tool"))
- EVT_MENU(self, nid, self.__Hide)
+ wx.EVT_MENU(self, nid, self.__Hide)
if self.tool._visible:
menu.Enable(nid, 0)
- nid = wxNewId()
+ nid = wx.NewId()
menu.Append(nid, _("Show Tool"))
- EVT_MENU(self, nid, self.__Restore)
+ wx.EVT_MENU(self, nid, self.__Restore)
if not self.tool._visible:
menu.Enable(nid, 0)
menu.AppendSeparator()
- nid = wxNewId()
+ nid = wx.NewId()
menu.Append(nid, _("Release to Frame"))
- EVT_MENU(self, nid, self.__BreakAway)
+ wx.EVT_MENU(self, nid, self.__BreakAway)
## menu.Enable(nid, 0) # TODO
self.PopupMenu(menu, event.GetPosition())
Modified: trunk/gnue-designer/src/uidrivers/wx/docks/Docker.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/docks/Docker.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/docks/Docker.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -31,34 +31,19 @@
__all__ = ['Docker']
import sys
-from wxPython.wx import *
-from wxPython.wx import __version__ as wxversion
+import wx
+from wx import __version__ as wxversion
+from gnue.designer.uidrivers.wx.uihelpers import PyAUI
from gnue.common.apps import RuntimeSettings, GDebug
from FloatingPane import FloatingPane
from SplitDock import SplitDock
from DockedPane import DockedPane
-class Docker(wxPanel):
+class Docker:
def __init__(self, parent, instance, tools):
- # on win32 a toolbar doesn't reduce the client rectangle height
- # wx doesn't handle this when calculates default pos :(
- if sys.platform == "win32":
- if wxversion[:3] == '2.6':
- pos = (0, 0)
- else:
- pos = (0, 36)
- else:
- pos = (-1,-1)
-
- wxPanel.__init__(self, parent, -1, pos=pos)
self.parent = parent
self.instance = instance
- self.horizSplitter = horizSplitter = wxSplitterWindow(self, -1,
style=wxSP_3D)
- self.leftDock = leftWin = SplitDock(horizSplitter, self, 'left')
- self.rightDock = rightWin = SplitDock(horizSplitter, self,'right')
- EVT_SIZE(parent, self.__OnSize)
-
instance.registerEventListeners({
'Docker:Undock': self.undock,
'Docker:Dock': self.dock})
@@ -67,6 +52,10 @@
self.runtime_section = runtime_section = '%s-Docker' %
instance.properties.nickname
RuntimeSettings.registerRuntimeSettingHandler(self.instance, self)
+ # Setup PyAUI
+ self._mgr = PyAUI.FrameManager(parent)
+ self._mgr.SetFrame(parent)
+
self.tools = []
#
@@ -82,7 +71,7 @@
pos, indx = pos.split('-')
indx = int(indx)
- tool = baseclass(id, title, instance, instance.rootObject, self)
+ tool = baseclass(id, title, instance, instance.rootObject, parent)
tool._docked = RuntimeSettings.getint(self.runtime_section, '%s-docked'
% id, pos != 'frame')
tool._dock_location = RuntimeSettings.get(self.runtime_section,
'%s-location' % id, (pos == 'frame' and 'left' or pos))
@@ -95,17 +84,23 @@
appd = (id, title, baseclass, hotkey, pos)
+ toolinfo = PyAUI.PaneInfo().Name(title).Caption(title)
if tool._docked:
# Docked type
if tool._dock_location == 'right':
- dock = rightWin
+ dock = toolinfo.Left()
else:
- dock = leftWin
- dock.add(DockedPane(dock, instance, tool), tool._dock_index)
+ toolinfo.Right()
else:
# Frame type
- FloatingPane(instance.uiinstance, instance, tool)
+ toolinfo.Float()
+
+ if tool._visible:
+ toolinfo.Hide()
+
+ self._mgr.AddPane(tool, toolinfo.Left())
+
# Keep track of the tools we created
self.tools.append(tool)
@@ -117,40 +112,23 @@
instance.__dict__[id] = tool
- if tool._visible:
- instance.dispatchEvent('Show:Tool:%s' % id)
- else:
- instance.dispatchEvent('Hide:Tool:%s' % id)
+# if tool._visible:
+# instance.dispatchEvent('Show:Tool:%s' % id)
+# else:
+# instance.dispatchEvent('Hide:Tool:%s' % id)
- leftWin.refresh()
- rightWin.refresh()
- horizSplitter.SplitVertically(leftWin, rightWin,
- RuntimeSettings.getint(self.runtime_section,
'DockSplitter-TopBottom',500))
-
- def __OnSize(self, event):
- self.SetSize(self.parent.GetClientSize())
- self.horizSplitter.SetSize(self.GetClientSize())
-
+ perspective = RuntimeSettings.get(self.runtime_section,
'aui-perspective','')
+ if perspective:
+ self._mgr.LoadPerspective(perspective)
+
def saveRuntimeSettings(self):
- settings = {'docksplitter-topbottom': self.horizSplitter.GetSashPosition()}
- for tool in self.tools:
- tid = tool.id
- tool.dockpane.closing()
- settings['%s-docked' % tid] = tool._docked
- settings['%s-dock-location' % tid] = tool._dock_location
- settings['%s-dock-location' % tid] = tool._dock_location
- settings['%s-dock-index' % tid] = tool._dock_index
- settings['%s-frame-x' % tid] = tool._frame_x
- settings['%s-frame-y' % tid] = tool._frame_y
- settings['%s-frame-width' % tid] = tool._frame_width
- settings['%s-frame-height' % tid] = tool._frame_height
- settings['%s-visible' % tid] = tool._visible
-
- settings.update(self.leftDock.saveSettings())
- settings.update(self.rightDock.saveSettings())
-
+ settings = {'aui-perspective': self._mgr.SavePerspective()}
return (self.runtime_section, settings)
+
+ # ------------------------------
+ # This point on isn't needed ???
+ # ------------------------------
def undock(self, event):
tool = event.tool
instance = self.instance
Modified: trunk/gnue-designer/src/uidrivers/wx/docks/FloatingPane.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/docks/FloatingPane.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/docks/FloatingPane.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -30,7 +30,7 @@
import os, sys, string
from gnue.common.apps import RuntimeSettings
-from wxPython.wx import *
+import wx
from gnue.common.apps import GDebug
from BasePane import BasePane
from gnue.designer.base.ToolBar import BaseToolBar, getIcon
@@ -41,15 +41,15 @@
# It handles the Window menu and
# saving size/position/display settings
#
-class FloatingPane (wxFrame, BasePane):
+class FloatingPane (wx.Frame, BasePane):
default_width = 300
default_height = 200
def __init__(self, parent, instance, tool):
- style =
wxMINIMIZE_BOX|wxRESIZE_BORDER|wxCAPTION|wxFRAME_NO_TASKBAR|wxFRAME_FLOAT_ON_PARENT
+ style =
wx.MINIMIZE_BOX|wx.RESIZE_BORDER|wx.CAPTION|wx.FRAME_NO_TASKBAR|wx.FRAME_FLOAT_ON_PARENT
- wxFrame.__init__(self, parent, -1, tool.title, style=style)
+ wx.Frame.__init__(self, parent, -1, tool.title, style=style)
BasePane.__init__(self, parent, instance, tool)
icon = Goat.getGoatIcon()
@@ -63,16 +63,16 @@
self.SetToolBar(toolbar)
else:
toolbar = self.CreateToolBar()
- toolbar.SetToolBitmapSize(wxSize(24,24))
+ toolbar.SetToolBitmapSize(wx.Size(24,24))
toolbar.ICON_SIZE = (24,24)
toolbar.InsertSeparator(0)
- wid = wxNewId()
+ wid = wx.NewId()
toolbar.InsertTool(0, wid, getIcon("tb_dock", *toolbar.ICON_SIZE))
toolbar.Realize()
- EVT_MENU(self, wid, self.__redock)
- EVT_CLOSE(self, self.OnClose)
+ wx.EVT_MENU(self, wid, self.__redock)
+ wx.EVT_CLOSE(self, self.OnClose)
self.Refresh()
self.SetPosition((tool._frame_x, tool._frame_y))
Modified: trunk/gnue-designer/src/uidrivers/wx/docks/SplitDock.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/docks/SplitDock.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/docks/SplitDock.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -30,12 +30,12 @@
__all__ = ['SplitDock']
-from wxPython.wx import *
+import wx
from gnue.common.apps import RuntimeSettings
-class SplitDock(wxPanel):
+class SplitDock(wx.Panel):
def __init__(self, parent, docker, name):
- wxPanel.__init__(self, parent, -1)
+ wx.Panel.__init__(self, parent, -1)
self.parent = parent
self.name = name
self.docker = docker
@@ -70,9 +70,9 @@
# Make sashes visible
if index:
- panel.SetSashVisible(wxSASH_TOP,1)
+ panel.SetSashVisible(wx.SASH_TOP,1)
- self.sizer.Add(panel, 1, wxEXPAND)
+ self.sizer.Add(panel, 1, wx.EXPAND)
panel.tool._dock_index = index
self.panels.append((index, panel))
panel.tool._dock_location = self.name
@@ -245,11 +245,11 @@
######################################################################
#
-# Custom wxSizer class to handle our tool docks
+# Custom wx.Sizer class to handle our tool docks
#
-class MySizer(wxPySizer):
+class MySizer(wx.PySizer):
def __init__(self):
- wxPySizer.__init__(self)
+ wx.PySizer.__init__(self)
self.__objects = []
self.__childHideSize = 10
self.__oldw = 0
@@ -263,7 +263,7 @@
pass
def CalcMin(self):
- return wxSize(50, self.__childHideSize * len(self.__objects))
+ return wx.Size(50, self.__childHideSize * len(self.__objects))
def RecalcSizes(self, absolute=None, absheight=0, absrelative=None):
size = self.GetSize()
Modified: trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/startup/Startup.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -26,7 +26,7 @@
# NOTES:
-from wxPython.wx import *
+import wx
import sys, os
import __builtin__
from gnue.common.apps import GConfig
@@ -35,25 +35,25 @@
splashloc =
os.path.join(GConfig.getInstalledBase('designer_images','common_images')
,'designer', 'splash.png')
-class Startup(wxSplashScreen):
+class Startup(wx.SplashScreen):
def __init__(self):
- splashbitmap = wxImage(splashloc,
- wxBITMAP_TYPE_PNG).ConvertToBitmap()
+ splashbitmap = wx.Image(splashloc,
+ wx.BITMAP_TYPE_PNG).ConvertToBitmap()
__builtin__.__dict__['gStartupStatus'] = self.startupStatus
- wxSplashScreen.__init__(self, splashbitmap,
- wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,400, None, -1,
- style=wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP)
+ wx.SplashScreen.__init__(self, splashbitmap,
+ wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_NO_TIMEOUT,400, None, -1,
+ style=wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR|wx.STAY_ON_TOP)
self.text = 'Loading...'
- EVT_PAINT(self.GetSplashWindow(), self.OnPaint)
- EVT_CLOSE(self, self.destroy)
+ wx.EVT_PAINT(self.GetSplashWindow(), self.OnPaint)
+ wx.EVT_CLOSE(self, self.destroy)
self.timer = None
def pauseAndClose(self):
self.Raise()
gStartupStatus('Finalizing Settings')
- wxFutureCall(100,self.setSettingsText)
- wxFutureCall(1000,self.destroy)
+ wx.FutureCall(100,self.setSettingsText)
+ wx.FutureCall(1000,self.destroy)
def setSettingsText(self):
# Fscking, bastardized GTK piece of damn crap
@@ -68,7 +68,7 @@
self.Show(0)
def startupStatus(self, text):
- self.drawText(wxWHITE)
+ self.drawText(wx.WHITE)
self.text = "%s..." % text
self.OnPaint()
@@ -77,15 +77,15 @@
if sys.platform == "win32":
print self.text
return
- dc = wxPaintDC(self.GetSplashWindow())
+ dc = wx.PaintDC(self.GetSplashWindow())
dc.SetTextForeground(color)
dc.BeginDrawing()
-## font = wxFont(12, wxNORMAL, wxNORMAL, wxNORMAL)
+## font = wx.Font(12, wx.NORMAL, wx.NORMAL, wx.NORMAL)
## dc.SetFont(font)
dc.DrawText(self.text, 35, 225)
dc.EndDrawing()
def OnPaint(self, event=None):
- self.drawText(wxBLACK)
+ self.drawText(wx.BLACK)
if event:
event.Skip()
Added: trunk/gnue-designer/src/uidrivers/wx/uihelpers/AdvancedSplash.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/uihelpers/AdvancedSplash.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/uihelpers/AdvancedSplash.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -0,0 +1,397 @@
+# --------------------------------------------------------------------------- #
+# ADVANCEDSPLASH Control wxPython IMPLEMENTATION
+# Python Code By:
+#
+# Andrea Gavana, @ 10 Oct 2005
+# Latest Revision: 10 Oct 2005, 15.50 CET
+#
+#
+# TODO List/Caveats
+#
+# 1. Actually, Setting The Shape Of AdvancedSplash Is Done Using "SetShape"
+# Function On A Frame. This Works, AFAIK, On This Following Platforms:
+#
+# - MSW
+# - UNIX/Linux
+# - MacOS Carbon
+#
+# Obviously I May Be Wrong Here. Could Someone Verify That Lines 139-145
+# Work Correctly On Other Platforms Than Mine (MSW XP/2000)?
+# Moreover, Is There A Way To Avoid The Use Of The "SetShape" Method?
+# I Don't Know.
+#
+#
+# For All Kind Of Problems, Requests Of Enhancements And Bug Reports, Please
+# Write To Me At:
+#
+# address@hidden
+# address@hidden
+#
+# Or, Obviously, To The wxPython Mailing List!!!
+#
+#
+# End Of Comments
+# --------------------------------------------------------------------------- #
+
+
+"""Description:
+
+AdvancedSplash Tries To Reproduce The Behavior Of wx.SplashScreen, But With
+Some Enhancements (In My Opinion).
+
+AdvancedSplash Starts Its Construction From A Simple Frame. Then, Depending On
+The Options Passed To AdvancedSplash, It Sets The Frame Shape Accordingly To
+The Image Passed As Input. AdvancedSplash Behaves Somewhat Like
wx.SplashScreen,
+And Almost All The Methods Available In wx.SplashScreen Are Available Also In
+AdvancedSplash.
+
+Usage:
+
+SplashScreen = AS.AdvancedSplash(parent,
+ bitmap,
+ timeout,
+ extrastyle,
+ shadowcolour
+ )
+
+None Of The Options Are Strictly Required (A Part Of The "bitmap" Parameter.
+If You Use The Defaults You Get A Very Simple AdvancedSplash.
+For The Full Listing Of The Input Parameters, See The AdvancedSplash __init__()
+Method.
+
+Methods And Settings:
+
+AdvancedSplash Is Customizable, And In Particular You Can Set:
+
+- Wheter You Want To Mask A Colour Or Not In Your Input Bitmap;
+- Where To Center The Splash Screen (On Screen, On Parent Or Nowhere);
+- Wheter It Is A "Timeout" SplashScreen Or Not;
+- The Time After Which AdvancedSplash Is Destroyed (If It Is A Timeout
SplashScreen);
+- The (Optional) Text You Wish To Display;
+- The Font, Colour And Position Of The Displayed Text (Optional).
+
+For More Info On Methods And Initial Styles, Please Refer To The __init__()
+Method For AdvancedSplash Or To The Specific Functions.
+
+
+AdvancedSplash Control Is Freeware And Distributed Under The wxPython License.
+
+Latest Revision: Andrea Gavana @ 10 Oct 2005, 15.50 CET
+
+"""
+
+
+#----------------------------------------------------------------------
+# Beginning Of ADVANCEDSPLASH wxPython Code
+#----------------------------------------------------------------------
+
+import wx
+
+# These Are Used To Declare If The AdvancedSplash Should Be Destroyed After The
+# Timeout Or Not
+AS_TIMEOUT = 1
+AS_NOTIMEOUT = 2
+
+# These Flags Are Used To Position AdvancedSplash Correctly On Screen
+AS_CENTER_ON_SCREEN = 4
+AS_CENTER_ON_PARENT = 8
+AS_NO_CENTER = 16
+
+# This Option Allow To Mask A Colour In The Input Bitmap
+AS_SHADOW_BITMAP = 32
+
+
+#----------------------------------------------------------------------
+# ADVANCEDSPLASH Class
+# This Is The Main Class Implementation. See __init__() Method For
+# Details.
+#----------------------------------------------------------------------
+
+class AdvancedSplash(wx.Frame):
+
+ def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize,
+ style=wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.STAY_ON_TOP,
+ bitmap=None, timeout=5000,
+ extrastyle=AS_TIMEOUT | AS_CENTER_ON_SCREEN,
+ shadowcolour=None):
+
+ """ Default Class Constructor.
+
+ Non Standard wxPython Parameters Are:
+
+ a) bitmap: This Must Be A Valid wx.Bitmap, That You May Construct Using
+ Whatever Image File Format Supported By wxPython. If The File You
Load
+ Already Supports Mask/Transparency (Like PNG), The Transparent Areas
+ Will Not Be Drawn On Screen, And The AdvancedSplash Frame Will Have
+ The Shape Defined Only By *Non-Transparent* Pixels.
+ If You Use Other File Formats That Does Not Supports Transparency,
You
+ Can Obtain The Same Effect As Above By Masking A Specific Colour In
+ Your wx.Bitmap. See "shadowcolour" and "extrastyle" Parameters;
+
+ b) timeout: If You Construct AdvancedSplash Using The Style AS_TIMEOUT,
+ AdvancedSplash Will Be Destroyed After "timeout" Milliseconds;
+
+ c) extrastyle: This Value Specifies The AdvancedSplash Styles:
+ - AS_TIMEOUT: AdvancedSplash Will Be Destroyed After "timeout"
+ Milliseconds;
+ - AS_NOTIMEOUT: AdvancedSplash Can Be Destroyed By Clicking On It,
+ Pressing A Key Or By Explicitly Call The Close() Method;
+ - AS_CENTER_ON_SCREEN: AdvancedSplash Will Be Centered On Screen;
+ - AS_CENTER_ON_PARENT: AdvancedSplash Will Be Centered On Parent;
+ - AS_NO_CENTER: AdvancedSplash Will Not Be Centered;
+ - AS_SHADOW_BITMAP: If The Bitmap You Pass As Input Has No
Transparency,
+ You Can Choose One Colour That Will Be Masked In Your Bitmap. The
+ Final Shape Of AdvancedSplash Will Be Defined Only By
Non-Transparent
+ (Non-Masked) Pixels.
+
+ d) shadowcolour: If You Construct AdvancedSplash Using The Style
+ AS_SHADOW_BITMAP, Here You Can Specify The Colour That Will Be
Masked On
+ Your Input Bitmap. This Has To BeA Valid wxPython Colour.
+
+ """
+
+ wx.Frame.__init__(self, parent, id, "", pos, size, style)
+
+ # Some Error Checking
+ if extrastyle & AS_TIMEOUT and timeout <= 0:
+ raise '\nERROR: Style "AS_TIMEOUT" Used With Invalid "timeout"
Parameter Value (' \
+ + str(timeout) + ')'
+
+ if extrastyle & AS_SHADOW_BITMAP and not shadowcolour.Ok():
+ raise '\nERROR: Style "AS_SHADOW_BITMAP" Used With Invalid
"shadowcolour" Parameter'
+
+ if not bitmap.Ok():
+ raise "\nERROR: Bitmap Passed To AdvancedSplash Is Invalid."
+
+ if extrastyle & AS_SHADOW_BITMAP:
+ # Our Bitmap Is Masked Accordingly To User Input
+ self.bmp = self.ShadowBitmap(bitmap, shadowcolour)
+ else:
+ self.bmp = bitmap
+
+ self._extrastyle = extrastyle
+
+ # Setting Initial Properties
+ self.SetText()
+ self.SetTextFont()
+ self.SetTextPosition()
+ self.SetTextColour()
+
+ # Calculate The Shape Of AdvancedSplash Using The Input-Modified
Bitmap
+ self.reg = wx.RegionFromBitmap(self.bmp)
+
+ # Don't Know If It Works On Other Platforms!!
+ # Tested Only In Windows XP/2000
+
+ if wx.Platform == "__WXGTK__":
+ self.Bind(wx.EVT_WINDOW_CREATE, self.SetSplashShape)
+ else:
+ self.SetSplashShape()
+
+ w = self.bmp.GetWidth()
+ h = self.bmp.GetHeight()
+
+ # Set The AdvancedSplash Size To The Bitmap Size
+ self.SetSize((w, h))
+
+ if extrastyle & AS_CENTER_ON_SCREEN:
+ self.CenterOnScreen()
+ elif extrastyle & AS_CENTER_ON_PARENT:
+ self.CenterOnParent()
+
+ if extrastyle & AS_TIMEOUT:
+ # Starts The Timer. Once Expired, AdvancedSplash Is Destroyed
+ self._splashtimer = wx.PyTimer(self.OnNotify)
+ self._splashtimer.Start(timeout)
+
+ # Catch Some Mouse Events, To Behave Like wx.SplashScreen
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
+ self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvents)
+ self.Bind(wx.EVT_CHAR, self.OnCharEvents)
+
+ self.Show()
+
+
+ def SetSplashShape(self):
+ """ Sets AdvancedSplash Shape Using The Region Created From The
Bitmap."""
+
+ self.SetShape(self.reg)
+
+
+ def ShadowBitmap(self, bmp, shadowcolour):
+ """ Applies A Mask On The Bitmap Accordingly To User Input. """
+
+ mask = wx.Mask(bmp, shadowcolour)
+ bmp.SetMask(mask)
+
+ return bmp
+
+
+ def OnPaint(self, event):
+ """ Handles The wx.EVT_PAINT For AdvancedSplash. """
+
+ dc = wx.PaintDC(self)
+
+ # Here We Redraw The Bitmap Over The Frame
+ dc.DrawBitmap(self.bmp, 0, 0, True)
+
+ # We Draw The Text Anyway, Wheter It Is Empty ("") Or Not
+ textcolour = self.GetTextColour()
+ textfont = self.GetTextFont()
+ textpos = self.GetTextPosition()
+ text = self.GetText()
+
+ dc.SetFont(textfont[0])
+ dc.SetTextForeground(textcolour)
+ dc.DrawText(text, textpos[0], textpos[1])
+
+ wx.SafeYield()
+
+ event.Skip()
+
+
+ def OnNotify(self):
+ """ Handles The Timer Expiration, And Calls The Close() Method. """
+
+ self.Close()
+
+
+ def OnMouseEvents(self, event):
+ """ Handles The wx.EVT_MOUSE_EVENTS For AdvancedSplash.
+
+ This Reproduces The Behavior Of wx.SplashScreen."""
+
+ if event.LeftDown() or event.RightDown():
+ self.Close()
+
+ event.Skip()
+
+
+ def OnCharEvents(self, event):
+ """ Handles The wx.EVT_CHAR For AdvancedSplash.
+
+ This Reproduces The Behavior Of wx.SplashScreen."""
+
+ self.Close()
+
+
+ def OnCloseWindow(self, event):
+ """ Handles The wx.EVT_CLOSE For AdvancedSplash.
+
+ This Reproduces The Behavior Of wx.SplashScreen."""
+
+ if hasattr(self, "_splashtimer"):
+ self._splashtimer.Stop()
+ del self._splashtimer
+
+ self.Destroy()
+
+
+ def SetText(self, text=None):
+ """ Sets The Text To Be Displayed On AdvancedSplash."""
+
+ if text is None:
+ text = ""
+
+ self._text = text
+
+ self.Refresh()
+ self.Update()
+
+
+ def GetText(self):
+ """ Returns The Text Displayed On AdvancedSplash."""
+
+ return self._text
+
+
+ def SetTextFont(self, font=None):
+ """ Sets The Font For The Text In AdvancedSplash."""
+
+ if font is None:
+ self._textfont = wx.Font(1, wx.SWISS, wx.NORMAL, wx.BOLD, False)
+ self._textsize = 10.0
+ self._textfont.SetPointSize(self._textsize)
+ else:
+ self._textfont = font
+ self._textsize = font.GetPointSize()
+ self._textfont.SetPointSize(self._textsize)
+
+ self.Refresh()
+ self.Update()
+
+
+ def GetTextFont(self):
+ """ Gets The Font For The Text In AdvancedSplash."""
+
+ return self._textfont, self._textsize
+
+
+ def SetTextColour(self, colour=None):
+ """ Sets The Colour For The Text In AdvancedSplash."""
+
+ if colour is None:
+ colour = wx.BLACK
+
+ self._textcolour = colour
+ self.Refresh()
+ self.Update()
+
+
+ def GetTextColour(self):
+ """ Gets The Colour For The Text In AdvancedSplash."""
+
+ return self._textcolour
+
+
+ def SetTextPosition(self, position=None):
+ " Sets The Text Position Inside AdvancedSplash Frame."""
+
+ if position is None:
+ position = (0,0)
+
+ self._textpos = position
+ self.Refresh()
+ self.Update()
+
+
+ def GetTextPosition(self):
+ " Returns The Text Position Inside AdvancedSplash Frame."""
+
+ return self._textpos
+
+
+ def GetSplashStyle(self):
+ """ Returns A List Of Strings And A List Of Integers Containing The
Styles. """
+
+ stringstyle = []
+ integerstyle = []
+
+ if self._extrastyle & AS_TIMEOUT:
+ stringstyle.append("AS_TIMEOUT")
+ integerstyle.append(AS_TIMEOUT)
+
+ if self._extrastyle & AS_NOTIMEOUT:
+ stringstyle.append("AS_NOTIMEOUT")
+ integerstyle.append(AS_NOTIMEOUT)
+
+ if self._extrastyle & AS_CENTER_ON_SCREEN:
+ stringstyle.append("AS_CENTER_ON_SCREEN")
+ integerstyle.append(AS_CENTER_ON_SCREEN)
+
+ if self._extrastyle & AS_CENTER_ON_PARENT:
+ stringstyle.append("AS_CENTER_ON_PARENT")
+ integerstyle.append(AS_CENTER_ON_PARENT)
+
+ if self._extrastyle & AS_NO_CENTER:
+ stringstyle.append("AS_NO_CENTER")
+ integerstyle.append(AS_NO_CENTER)
+
+ if self._extrastyle & AS_SHADOW_BITMAP:
+ stringstyle.append("AS_SHADOW_BITMAP")
+ integerstyle.append(AS_SHADOW_BITMAP)
+
+ return stringstyle, integerstyle
+
+
\ No newline at end of file
Modified: trunk/gnue-designer/src/uidrivers/wx/uihelpers/GridCellEditors.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/uihelpers/GridCellEditors.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/uihelpers/GridCellEditors.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -22,7 +22,7 @@
# GridCellEditors.py
#
# DESCRIPTION:
-# Provides common wxGrid cell eitors
+# Provides common Grid cell eitors
#
# NOTES:
#
@@ -31,17 +31,17 @@
'BoolCellEditor', 'IntCellEditor']
import sys, os, string
-from wxPython.wx import *
-from wxPython.grid import *
+import wx
+from wx.grid import *
from gnue.common.apps import GDebug
from gnue.common.formatting import GTypecast
#
#
#
-class CharCellEditor (wxPyGridCellEditor):
+class CharCellEditor (PyGridCellEditor):
def __init__(self, grid, attributes):
- wxPyGridCellEditor.__init__(self)
+ PyGridCellEditor.__init__(self)
self.grid = grid
self.attributes = attributes
self.__created = 0
@@ -50,7 +50,7 @@
def Create(self, parent, id, evtHandler):
self.__created = 1
assert gDebug(10,'Creating CharCellEditor')
- self._tc = wxTextCtrl(parent, id, "")
+ self._tc = wx.TextCtrl(parent, id, "")
self._tc.SetInsertionPoint(0)
self.SetControl(self._tc)
if evtHandler:
@@ -76,11 +76,11 @@
def EndEdit(self, row, col, grid):
- changed = false
+ changed = False
val = self._tc.GetValue()
if val != self.startValue:
- changed = true
+ changed = True
grid.GetTable().SetValue(row, col, val) # update the table
self.startValue = ''
@@ -137,7 +137,7 @@
def Create(self, parent, id, evtHandler):
CharCellEditor.Create(self, parent, id, evtHandler)
- EVT_CHAR(self._tc, self.OnKeyPressed)
+ wx.EVT_CHAR(self._tc, self.OnKeyPressed)
def OnKeyPressed(self, evt):
if (ord('0') <= evt.KeyCode() <= ord('9') or \
@@ -191,7 +191,7 @@
def Create(self, parent, id, evtHandler):
assert gDebug(10,'Creating CharCellEditor')
- self._tc = wxComboBox(parent, id, "", style=wxCB_READONLY,
+ self._tc = wx.ComboBox(parent, id, "", style=wx.CB_READONLY,
choices=self.selectionList)
self.SetControl(self._tc)
if evtHandler:
@@ -203,11 +203,11 @@
self._tc.SetFocus()
def EndEdit(self, row, col, grid):
- changed = false
+ changed = False
val = self.valueList[self._tc.GetSelection()]
if val != self.startValue:
- changed = true
+ changed = True
grid.GetTable().SetValue(row, col, "%s" % val) # update the table
self.startValue = ''
@@ -249,7 +249,7 @@
self.selectionList = ['FALSE','TRUE']
def Create(self, parent, id, evtHandler):
- self._tc = wxComboBox(parent, id, "", style=wxCB_READONLY,
+ self._tc = wx.ComboBox(parent, id, "", style=wx.CB_READONLY,
choices=self.selectionList)
self.SetControl(self._tc)
if evtHandler:
@@ -262,14 +262,14 @@
self._tc.SetFocus()
def EndEdit(self, row, col, grid):
- changed = false
+ changed = False
if self._tc.GetSelection():
val = 'TRUE'
else:
val = 'FALSE'
if val != self.startValue:
- changed = true
+ changed = True
grid.GetTable().SetValue(row, col, "%s" % val) # update the table
self.startValue = ''
Added: trunk/gnue-designer/src/uidrivers/wx/uihelpers/PyAUI.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/uihelpers/PyAUI.py 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/uihelpers/PyAUI.py 2006-03-04
01:22:59 UTC (rev 8201)
@@ -0,0 +1,4866 @@
+# --------------------------------------------------------------------------- #
+# PYAUI Library wxPython IMPLEMENTATION
+#
+# Original C++ Code From Kirix (wx.AUI). You Can Find It At:
+#
+# License: wxWidgets license
+#
+# http://www.kirix.com/en/community/opensource/wxaui/about_wxaui.html
+#
+# Current wx.AUI Version Tracked: 0.9.1 + Patches
+#
+#
+# Python Code By:
+#
+# Andrea Gavana, @ 23 Dec 2005
+# Latest Revision: 23 Jan 2006, 00.00 CET
+#
+#
+# PyAUI version 0.9.1 Adds:
+#
+# * Support For MDI Frames;
+# * Gradient Captions Option;
+# * Active/Inactive Panes Option;
+# * Support For Vertical Toolbars;
+# * Fix For Screen Artifacts/Paint Problems;
+# * Fix For Hiding/Showing Floated Window Problem;
+# * Fix For Floating Pane Sizing Problem;
+# * Fix For Drop Position Problem When Dragging Around Center Pane Margins.
+#
+#
+# TODO List/Caveats
+#
+# 1. Using The New Versions Of wxPython (2.6.2.1pre.20060106 Or Higher) There
+# Is A New Method Called wx.GetMouseState() That Gets Rid Of The Import Of
+# win32all or ctypes. Moreover, It Should Make PyAUI Working On All
+# Platforms (I Hope).
+#
+#
+# For All Kind Of Problems, Requests Of Enhancements And Bug Reports, Please
+# Write To Me At:
+#
+# address@hidden
+# address@hidden
+#
+# Or, Obviously, To The wxPython Mailing List!!!
+#
+# with OS X support and refactoring implemented by Chris Mellon
(address@hidden) -
+# contact me directly or on wxPython ML for more info
+#
+#
+# End Of Comments
+# --------------------------------------------------------------------------- #
+
+"""
+PyAUI is an Advanced User Interface library that aims to implement
"cutting-edge"
+interface usability and design features so developers can quickly and easily
create
+beautiful and usable application interfaces.
+
+Vision and Design Principles
+
+PyAUI attempts to encapsulate the following aspects of the user interface:
+
+* Frame Management: Frame management provides the means to open, move and hide
common
+controls that are needed to interact with the document, and allow these
configurations
+to be saved into different perspectives and loaded at a later time.
+
+* Toolbars: Toolbars are a specialized subset of the frame management system
and should
+behave similarly to other docked components. However, they also require
additional
+functionality, such as "spring-loaded" rebar support, "chevron" buttons and
end-user
+customizability.
+
+* Modeless Controls: Modeless controls expose a tool palette or set of options
that
+float above the application content while allowing it to be accessed. Usually
accessed
+by the toolbar, these controls disappear when an option is selected, but may
also be
+"torn off" the toolbar into a floating frame of their own.
+
+* Look and Feel: Look and feel encompasses the way controls are drawn, both
when shown
+statically as well as when they are being moved. This aspect of user interface
design
+incorporates "special effects" such as transparent window dragging as well as
frame animation.
+
+PyAUI adheres to the following principles:
+
+- Use native floating frames to obtain a native look and feel for all
platforms;
+- Use existing wxPython code where possible, such as sizer implementation for
frame management;
+- Use standard wxPython coding conventions.
+
+
+Usage:
+
+The following example shows a simple implementation that utilizes FrameManager
to manage
+three text controls in a frame window:
+
+class MyFrame(wx.Frame):
+
+ def __init__(self, parent, id=-1, title="PyAUI Test",
pos=wx.DefaultPosition,
+ size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
+
+ wx.Frame.__init__(self, parent, id, title, pos, size, style)
+
+ self._mgr = PyAUI.FrameManager(self)
+
+ # notify PyAUI which frame to use
+ self._mgr.SetFrame(self)
+
+ # create several text controls
+ text1 = wx.TextCtrl(self, -1, "Pane 1 - sample text",
+ wx.DefaultPosition, wx.Size(200,150),
+ wx.NO_BORDER | wx.TE_MULTILINE)
+
+ text2 = wx.TextCtrl(self, -1, "Pane 2 - sample text",
+ wx.DefaultPosition, wx.Size(200,150),
+ wx.NO_BORDER | wx.TE_MULTILINE)
+
+ text3 = wx.TextCtrl(self, -1, "Main content window",
+ wx.DefaultPosition, wx.Size(200,150),
+ wx.NO_BORDER | wx.TE_MULTILINE)
+
+ # add the panes to the manager
+ self._mgr.AddPane(text1, wx.LEFT, "Pane Number One")
+ self._mgr.AddPane(text2, wx.BOTTOM, "Pane Number Two")
+ self._mgr.AddPane(text3, wx.CENTER)
+
+ # tell the manager to "commit" all the changes just made
+ self._mgr.Update()
+
+ self.Bind(wx.EVT_CLOSE, self.OnClose)
+
+
+ def OnClose(self, event):
+
+ # deinitialize the frame manager
+ self._mgr.UnInit()
+
+ self.Destroy()
+ event.Skip()
+
+
+# our normal wx.App-derived class, as usual
+
+app = wx.PySimpleApp()
+
+frame = MyFrame(None)
+app.SetTopWindow(frame)
+frame.Show()
+
+app.MainLoop()
+
+What's New:
+
+PyAUI version 0.9.1 Adds:
+
+* Support For MDI Frames;
+* Gradient Captions Option;
+* Active/Inactive Panes Option;
+* Support For Vertical Toolbars;
+* Fix For Screen Artifacts/Paint Problems;
+* Fix For Hiding/Showing Floated Window Problem;
+* Fix For Floating Pane Sizing Problem;
+* Fix For Drop Position Problem When Dragging Around Center Pane Margins.
+
+
+License And Version:
+
+PyAUI Library Is Freeware And Distributed Under The wxPython License.
+
+Latest Revision: Andrea Gavana @ 23 Jan 2006, 00.00 CET
+Version 0.9.1.
+
+"""
+
+import wx
+import cStringIO, zlib
+import time
+
+_libimported = None
+_newversion = False
+
+# Check For The New wx.Version: It Should Be > 2.6.2.1pre.20060102
+# In Order To Let PyAUI Working On All Platforms
+
+wxver = wx.VERSION_STRING
+
+if hasattr(wx, "GetMouseState"):
+ _newversion = True
+ if wx.Platform == "__WXMSW__":
+ try:
+ import win32api
+ import win32con
+ import winxpgui
+ _libimported = "MH"
+ except:
+ try:
+ import ctypes
+ _libimported = "ctypes"
+ except:
+ pass
+
+else:
+ if wx.Platform == "__WXMSW__":
+ try:
+ import win32api
+ import win32con
+ import winxpgui
+ _libimported = "MH"
+ except:
+ try:
+ import ctypes
+ _libimported = "ctypes"
+ except:
+ raise "\nERROR: At Present, On Windows Machines, You Need To
Install "\
+ "Mark Hammond's pywin32 Extensions Or The ctypes Module,
Or Download" \
+ "The Latest wxPython Version."
+
+ else:
+ raise "\nSorry: I Still Don't Know How To Work On GTK/MAC Platforms...
" \
+ "Please Download The Latest wxPython Version."
+
+
+if wx.Platform == "__WXMAC__":
+ try:
+ import ctypes
+ _carbon_dll =
ctypes.cdll.LoadLibrary(r'/System/Frameworks/Carbon.framework/Carbon')
+ except:
+ _carbon_dll = None
+
+# Docking Styles
+AUI_DOCK_NONE = 0
+AUI_DOCK_TOP = 1
+AUI_DOCK_RIGHT = 2
+AUI_DOCK_BOTTOM = 3
+AUI_DOCK_LEFT = 4
+AUI_DOCK_CENTER = 5
+AUI_DOCK_CENTRE = AUI_DOCK_CENTER
+
+# Floating/Dragging Styles
+AUI_MGR_ALLOW_FLOATING = 1
+AUI_MGR_ALLOW_ACTIVE_PANE = 2
+AUI_MGR_TRANSPARENT_DRAG = 4
+AUI_MGR_TRANSPARENT_HINT = 8
+AUI_MGR_TRANSPARENT_HINT_FADE = 16
+
+AUI_MGR_DEFAULT = AUI_MGR_ALLOW_FLOATING | \
+ AUI_MGR_TRANSPARENT_HINT | \
+ AUI_MGR_TRANSPARENT_HINT_FADE | \
+ AUI_MGR_TRANSPARENT_DRAG
+
+# Panes Customization
+AUI_ART_SASH_SIZE = 0
+AUI_ART_CAPTION_SIZE = 1
+AUI_ART_GRIPPER_SIZE = 2
+AUI_ART_PANE_BORDER_SIZE = 3
+AUI_ART_PANE_BUTTON_SIZE = 4
+AUI_ART_BACKGROUND_COLOUR = 5
+AUI_ART_SASH_COLOUR = 6
+AUI_ART_ACTIVE_CAPTION_COLOUR = 7
+AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8
+AUI_ART_INACTIVE_CAPTION_COLOUR = 9
+AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10
+AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR = 11
+AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR = 12
+AUI_ART_BORDER_COLOUR = 13
+AUI_ART_GRIPPER_COLOUR = 14
+AUI_ART_CAPTION_FONT = 15
+AUI_ART_GRADIENT_TYPE = 16
+
+# Caption Gradient Type
+AUI_GRADIENT_NONE = 0
+AUI_GRADIENT_VERTICAL = 1
+AUI_GRADIENT_HORIZONTAL = 2
+
+# Pane Button State
+AUI_BUTTON_STATE_NORMAL = 0
+AUI_BUTTON_STATE_HOVER = 1
+AUI_BUTTON_STATE_PRESSED = 2
+
+# Pane Insert Level
+AUI_INSERT_PANE = 0
+AUI_INSERT_ROW = 1
+AUI_INSERT_DOCK = 2
+
+# some built in bitmaps
+close_bits =
'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00' \
+
'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00' \
+
'\xef\x00\x00\x00\xfb\x00\x00\x00\xcf\x00\x00\x00\xf9\x00\x00\x00' \
+
'\x9f\x00\x00\x00\xfc\x00\x00\x00?\x00\x00\x00\xfe\x00\x00\x00?\x00' \
+
'\x00\x00\xfe\x00\x00\x00\x9f\x00\x00\x00\xfc\x00\x00\x00\xcf\x00' \
+
'\x00\x00\xf9\x00\x00\x00\xef\x00\x00\x00\xfb\x00\x00\x00\xff\x00' \
+
'\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00' \
+ '\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00'
+
+pin_bits =
'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff' \
+
'\x00\x00\x00\xff\x00\x00\x00\x1f\x00\x00\x00\xfc\x00\x00\x00\xdf\x00' \
+
'\x00\x00\xfc\x00\x00\x00\xdf\x00\x00\x00\xfc\x00\x00\x00\xdf\x00\x00' \
+
'\x00\xfc\x00\x00\x00\xdf\x00\x00\x00\xfc\x00\x00\x00\xdf\x00\x00\x00' \
+
'\xfc\x00\x00\x00\x0f\x00\x00\x00\xf8\x00\x00\x00\x7f\x00\x00\x00\xff' \
+
'\x00\x00\x00\x7f\x00\x00\x00\xff\x00\x00\x00\x7f\x00\x00\x00\xff\x00' \
+
'\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00' \
+ '\x00\xff\x00\x00\x00\xff\x00\x00\x00'
+
+# PyAUI Event
+wx.EVT_AUI_PANEBUTTON = wx.NewEventType()
+EVT_AUI_PANEBUTTON = wx.PyEventBinder(wx.EVT_AUI_PANEBUTTON, 0)
+
+
+def GetCloseData():
+ return zlib.decompress(
+'x\xda\xeb\x0c\xf0s\xe7\xe5\x92\xe2b``\xe0\xf5\xf4p\t\x02\xd2\x02 \xcc\xc1\
+\x06$\xe5?\xffO\x04R,address@hidden
+\x9e\r:\xcd\xc7\xa0\xc0\xe1\xf5\xfb\xbf\xff\xbb\xc2\xacb6\xdbg\xaez\xb9|\x1c\
+\x9a\x82kU\x99xW\x16K\xf5\xdccS\xdad\xe9\xf3\xe0\xa4\x0f\x0f\xaf\xcb\xea\x88\
+\x8bV\xd7k\x1eoN\xdf\xb2\xdd\xc8\xd0\xe7Cw2{\xdd\\uf\xfd}3\x0f\xb0\xd4=\x0ff\
+\xdfr$\\\xe5\xcf\xa9\xfd3\xfa\xcdu\xa4\x7fk\xa6\x89\x03ma\xf0t\xf5sY\xe7\x94\
+\xd0\x04\x00\x1714z')
+
+
+def GetCloseBitmap():
+ return wx.BitmapFromImage(GetCloseImage())
+
+
+def GetCloseImage():
+ stream = cStringIO.StringIO(GetCloseData())
+ return wx.ImageFromStream(stream)
+
+
+def StepColour(c, percent):
+ """
+ StepColour() it a utility function that simply darkens
+ a color by the specified percentage.
+ """
+
+ r = c.Red()
+ g = c.Green()
+ b = c.Blue()
+
+ return wx.Colour(min((r*percent)/100, 255),
+ min((g*percent)/100, 255),
+ min((b*percent)/100, 255))
+
+
+def LightContrastColour(c):
+
+ amount = 120
+
+ # if the color is especially dark, then
+ # make the contrast even lighter
+ if c.Red() < 128 and c.Green() < 128 and c.Blue() < 128:
+ amount = 160
+
+ return StepColour(c, amount)
+
+
+def BitmapFromBits(color, type=0):
+ """
+ BitmapFromBits() is a utility function that creates a
+ masked bitmap from raw bits (XBM format).
+ """
+
+ if type == 0: # Close Bitmap
+ img = GetCloseImage()
+ else:
+ # this should be GetClosePin()... but what the hell is a "pin"?
+ img = GetCloseImage()
+
+ img.Replace(255, 255, 255, 123, 123, 123)
+ img.Replace(0, 0, 0, color.Red(), color.Green(), color.Blue())
+
+ return img.ConvertToBitmap()
+
+
+def DrawGradientRectangle(dc, rect, start_color, end_color, direction):
+
+ rd = end_color.Red() - start_color.Red()
+ gd = end_color.Green() - start_color.Green()
+ bd = end_color.Blue() - start_color.Blue()
+
+ if direction == AUI_GRADIENT_VERTICAL:
+ high = rect.GetHeight() - 1
+ else:
+ high = rect.GetWidth() - 1
+
+ for ii in xrange(high+1):
+ r = start_color.Red() + ((ii*rd*100)/high)/100
+ g = start_color.Green() + ((ii*gd*100)/high)/100
+ b = start_color.Blue() + ((ii*bd*100)/high)/100
+
+ p = wx.Pen(wx.Colour(r, g, b))
+ dc.SetPen(p)
+
+ if direction == AUI_GRADIENT_VERTICAL:
+ dc.DrawLine(rect.x, rect.y+ii, rect.x+rect.width, rect.y+ii)
+ else:
+ dc.DrawLine(rect.x+ii, rect.y, rect.x+ii, rect.y+rect.height)
+
+
+class DockInfo:
+
+ def __init__(self):
+
+ self.dock_direction = 0
+ self.dock_layer = 0
+ self.dock_row = 0
+ self.size = 0
+ self.min_size = 0
+ self.resizable = True
+ self.fixed = False
+ self.toolbar = False
+ self.rect = wx.Rect()
+ self.panes = []
+
+
+ def IsOk(self):
+
+ return (self.dock_direction != 0 and [True] or [False])[0]
+
+
+ def IsHorizontal(self):
+
+ return ((self.dock_direction == AUI_DOCK_TOP or \
+ self.dock_direction == AUI_DOCK_BOTTOM) and \
+ [True] or [False])[0]
+
+
+ def IsVertical(self):
+
+ return ((self.dock_direction == AUI_DOCK_LEFT or \
+ self.dock_direction == AUI_DOCK_RIGHT or \
+ self.dock_direction == AUI_DOCK_CENTER) and [True] or
[False])[0]
+
+
+class DockUIPart:
+
+ typeCaption = 0
+ typeGripper = 1
+ typeDock = 2
+ typeDockSizer = 3
+ typePane = 4
+ typePaneSizer = 5
+ typeBackground = 6
+ typePaneBorder = 7
+ typePaneButton = 8
+
+ def __init__(self):
+
+ self.orientation = wx.VERTICAL
+ self.type = 0
+ self.rect = wx.Rect()
+
+
+class PaneButton:
+
+ def __init__(self, button_id):
+
+ self.button_id = button_id
+
+
+# event declarations/classes
+
+class FrameManagerEvent(wx.PyCommandEvent):
+
+ def __init__(self, eventType, id=1):
+
+ wx.PyCommandEvent.__init__(self, eventType, id)
+
+ self.pane = None
+ self.button = 0
+
+
+ def SetPane(self, p):
+
+ self.pane = p
+
+
+ def SetButton(self, b):
+
+ self.button = b
+
+
+ def GetPane(self):
+
+ return self.pane
+
+
+ def GetButton(self):
+
+ return self.button
+
+
+# -- DefaultDockArt class implementation --
+#
+# DefaultDockArt is an art provider class which does all of the drawing for
+# FrameManager. This allows the library caller to customize the dock art
+# (probably by deriving from this class), or to completely replace all drawing
+# with custom dock art. The active dock art class can be set via
+# FrameManager.SetDockArt()
+
+class DefaultDockArt:
+
+ def __init__(self):
+
+ base_color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE)
+ darker1_color = StepColour(base_color, 85)
+ darker2_color = StepColour(base_color, 70)
+ darker3_color = StepColour(base_color, 60)
+ darker4_color = StepColour(base_color, 50)
+ darker5_color = StepColour(base_color, 40)
+
+ self._active_caption_colour =
LightContrastColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))
+ self._active_caption_gradient_colour =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT)
+ self._active_caption_text_colour =
wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)
+ self._inactive_caption_colour = StepColour(darker1_color, 80)
+ self._inactive_caption_gradient_colour = darker1_color
+ self._inactive_caption_text_colour = wx.BLACK
+
+ sash_color = base_color
+ caption_color = darker1_color
+ paneborder_color = darker2_color
+ selectbutton_color = base_color
+ selectbuttonpen_color = darker3_color
+
+ self._sash_brush = wx.Brush(base_color)
+ self._background_brush = wx.Brush(base_color)
+ self._border_pen = wx.Pen(darker2_color)
+ self._gripper_brush = wx.Brush(base_color)
+ self._gripper_pen1 = wx.Pen(darker5_color)
+ self._gripper_pen2 = wx.Pen(darker3_color)
+ self._gripper_pen3 = wx.WHITE_PEN
+
+ self._caption_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL,
False)
+
+ self._inactive_close_bitmap =
BitmapFromBits(self._inactive_caption_text_colour, 0)
+ self._inactive_pin_bitmap =
BitmapFromBits(self._inactive_caption_text_colour, 1)
+ self._active_close_bitmap =
BitmapFromBits(self._active_caption_text_colour, 0)
+ self._active_pin_bitmap =
BitmapFromBits(self._active_caption_text_colour, 1)
+
+ # default metric values
+ self._sash_size = 4
+ self._caption_size = 17
+ self._border_size = 1
+ self._button_size = 14
+ self._gripper_size = 9
+ self._gradient_type = AUI_GRADIENT_VERTICAL
+
+
+ def GetMetric(self, id):
+
+ if id == AUI_ART_SASH_SIZE:
+ return self._sash_size
+ elif id == AUI_ART_CAPTION_SIZE:
+ return self._caption_size
+ elif id == AUI_ART_GRIPPER_SIZE:
+ return self._gripper_size
+ elif id == AUI_ART_PANE_BORDER_SIZE:
+ return self._border_size
+ elif id == AUI_ART_PANE_BUTTON_SIZE:
+ return self._button_size
+ elif id == AUI_ART_GRADIENT_TYPE:
+ return self._gradient_type
+ else:
+ raise "\nERROR: Invalid Metric Ordinal. "
+
+
+ def SetMetric(self, id, new_val):
+
+ if id == AUI_ART_SASH_SIZE:
+ self._sash_size = new_val
+ elif id == AUI_ART_CAPTION_SIZE:
+ self._caption_size = new_val
+ elif id == AUI_ART_GRIPPER_SIZE:
+ self._gripper_size = new_val
+ elif id == AUI_ART_PANE_BORDER_SIZE:
+ self._border_size = new_val
+ elif id == AUI_ART_PANE_BUTTON_SIZE:
+ self._button_size = new_val
+ elif id == AUI_ART_GRADIENT_TYPE:
+ self._gradient_type = new_val
+ else:
+ raise "\nERROR: Invalid Metric Ordinal. "
+
+
+ def GetColor(self, id):
+
+ if id == AUI_ART_BACKGROUND_COLOUR:
+ return self._background_brush.GetColour()
+ elif id == AUI_ART_SASH_COLOUR:
+ return self._sash_brush.GetColour()
+ elif id == AUI_ART_INACTIVE_CAPTION_COLOUR:
+ return self._inactive_caption_colour
+ elif id == AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR:
+ return self._inactive_caption_gradient_colour
+ elif id == AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR:
+ return self._inactive_caption_text_colour
+ elif id == AUI_ART_ACTIVE_CAPTION_COLOUR:
+ return self._active_caption_colour
+ elif id == AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR:
+ return self._active_caption_gradient_colour
+ elif id == AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR:
+ return self._active_caption_text_colour
+ elif id == AUI_ART_BORDER_COLOUR:
+ return self._border_pen.GetColour()
+ elif id == AUI_ART_GRIPPER_COLOUR:
+ return self._gripper_brush.GetColour()
+ else:
+ raise "\nERROR: Invalid Metric Ordinal. "
+
+
+ def SetColor(self, id, colour):
+
+ if id == AUI_ART_BACKGROUND_COLOUR:
+ self._background_brush.SetColour(colour)
+ elif id == AUI_ART_SASH_COLOUR:
+ self._sash_brush.SetColour(colour)
+ elif id == AUI_ART_INACTIVE_CAPTION_COLOUR:
+ self._inactive_caption_colour = colour
+ elif id == AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR:
+ self._inactive_caption_gradient_colour = colour
+ elif id == AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR:
+ self._inactive_caption_text_colour = colour
+ elif id == AUI_ART_ACTIVE_CAPTION_COLOUR:
+ self._active_caption_colour = colour
+ elif id == AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR:
+ self._active_caption_gradient_colour = colour
+ elif id == AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR:
+ self._active_caption_text_colour = colour
+ elif id == AUI_ART_BORDER_COLOUR:
+ self._border_pen.SetColour(colour)
+ elif id == AUI_ART_GRIPPER_COLOUR:
+ self._gripper_brush.SetColour(colour)
+ self._gripper_pen1.SetColour(DarkenColor(colour, 40))
+ self._gripper_pen2.SetColour(DarkenColor(colour, 60))
+ else:
+ raise "\nERROR: Invalid Metric Ordinal. "
+
+
+ def SetFont(self, id, font):
+
+ if id == AUI_ART_CAPTION_FONT:
+ self._caption_font = font
+
+
+ def GetFont(self, id):
+
+ if id == AUI_ART_CAPTION_FONT:
+ return self._caption_font
+
+ return wx.NoneFont
+
+
+ def DrawSash(self, dc, orient, rect):
+
+ dc.SetPen(wx.TRANSPARENT_PEN)
+ dc.SetBrush(self._sash_brush)
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+
+
+ def DrawBackground(self, dc, orient, rect):
+
+ dc.SetPen(wx.TRANSPARENT_PEN)
+ dc.SetBrush(self._background_brush)
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+
+
+ def DrawBorder(self, dc, rect, pane):
+
+ drect = wx.Rect()
+ drect.x = rect.x
+ drect.y = rect.y
+ drect.width = rect.width
+ drect.height = rect.height
+
+ dc.SetPen(self._border_pen)
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
+
+ border_width = self.GetMetric(AUI_ART_PANE_BORDER_SIZE)
+
+ if pane.IsToolbar():
+
+ for ii in xrange(0, border_width):
+
+ dc.SetPen(wx.WHITE_PEN)
+ dc.DrawLine(drect.x, drect.y, drect.x+drect.width, drect.y)
+ dc.DrawLine(drect.x, drect.y, drect.x, drect.y+drect.height)
+ dc.SetPen(self._border_pen)
+ dc.DrawLine(drect.x, drect.y+drect.height-1,
+ drect.x+drect.width, drect.y+drect.height-1)
+ dc.DrawLine(drect.x+drect.width-1, drect.y,
+ drect.x+drect.width-1, drect.y+drect.height)
+ drect.Deflate(1, 1)
+
+ else:
+
+ for ii in xrange(0, border_width):
+
+ dc.DrawRectangle(drect.x, drect.y, drect.width, drect.height)
+ drect.Deflate(1, 1)
+
+
+ def DrawCaptionBackground(self, dc, rect, active):
+
+ if self._gradient_type == AUI_GRADIENT_NONE:
+ if active:
+ dc.SetBrush(wx.Brush(self._active_caption_colour))
+ else:
+ dc.SetBrush(wx.Brush(self._inactive_caption_colour))
+
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+ else:
+ if active:
+ DrawGradientRectangle(dc, rect, self._active_caption_colour,
+ self._active_caption_gradient_colour,
+ self._gradient_type)
+ else:
+ DrawGradientRectangle(dc, rect, self._inactive_caption_colour,
+ self._inactive_caption_gradient_colour,
+ self._gradient_type)
+
+
+ def DrawCaption(self, dc, text, rect, pane):
+
+ dc.SetPen(wx.TRANSPARENT_PEN)
+ dc.SetFont(self._caption_font)
+
+ self.DrawCaptionBackground(dc, rect, ((pane.state &
PaneInfo.optionActive) and \
+ [True] or [False])[0])
+
+ if pane.state & PaneInfo.optionActive:
+ dc.SetTextForeground(self._active_caption_text_colour)
+ else:
+ dc.SetTextForeground(self._inactive_caption_text_colour)
+
+ w, h = dc.GetTextExtent("ABCDEFHXfgkj")
+
+ dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height)
+ dc.DrawText(text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1)
+ dc.DestroyClippingRegion()
+
+
+ def DrawGripper(self, dc, rect, pane):
+
+ dc.SetPen(wx.TRANSPARENT_PEN)
+ dc.SetBrush(self._gripper_brush)
+
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+
+ if not pane.HasGripperTop():
+ y = 5
+ while 1:
+ dc.SetPen(self._gripper_pen1)
+ dc.DrawPoint(rect.x+3, rect.y+y)
+ dc.SetPen(self._gripper_pen2)
+ dc.DrawPoint(rect.x+3, rect.y+y+1)
+ dc.DrawPoint(rect.x+4, rect.y+y)
+ dc.SetPen(self._gripper_pen3)
+ dc.DrawPoint(rect.x+5, rect.y+y+1)
+ dc.DrawPoint(rect.x+5, rect.y+y+2)
+ dc.DrawPoint(rect.x+4, rect.y+y+2)
+ y = y + 4
+ if y > rect.GetHeight() - 5:
+ break
+ else:
+ x = 5
+ while 1:
+ dc.SetPen(self._gripper_pen1)
+ dc.DrawPoint(rect.x+x, rect.y+3)
+ dc.SetPen(self._gripper_pen2)
+ dc.DrawPoint(rect.x+x+1, rect.y+3)
+ dc.DrawPoint(rect.x+x, rect.y+4)
+ dc.SetPen(self._gripper_pen3)
+ dc.DrawPoint(rect.x+x+1, rect.y+5)
+ dc.DrawPoint(rect.x+x+2, rect.y+5)
+ dc.DrawPoint(rect.x+x+2, rect.y+4)
+ x = x + 4
+ if x > rect.GetWidth() - 5:
+ break
+
+
+ def DrawPaneButton(self, dc, button, button_state, rect, pane):
+
+ drect = wx.Rect()
+ drect.x = rect.x
+ drect.y = rect.y
+ drect.width = rect.width
+ drect.height = rect.height
+
+ if button_state == AUI_BUTTON_STATE_PRESSED:
+
+ drect.x = drect.x + 1
+ drect.y = drect.y + 1
+
+ if button_state in [AUI_BUTTON_STATE_HOVER, AUI_BUTTON_STATE_PRESSED]:
+
+ if pane.state & PaneInfo.optionActive:
+ dc.SetBrush(wx.Brush(StepColour(self._active_caption_colour,
120)))
+ dc.SetPen(wx.Pen(StepColour(self._active_caption_colour, 70)))
+ else:
+ dc.SetBrush(wx.Brush(StepColour(self._inactive_caption_colour,
120)))
+ dc.SetPen(wx.Pen(StepColour(self._inactive_caption_colour,
70)))
+
+ # draw the background behind the button
+ dc.DrawRectangle(drect.x, drect.y, 15, 15)
+
+ if button == PaneInfo.buttonClose:
+ if pane.state & PaneInfo.optionActive:
+
+ bmp = self._active_close_bitmap
+
+ else:
+ bmp = self._inactive_close_bitmap
+ elif button == PaneInfo.buttonPin:
+ if pane.state & PaneInfo.optionActive:
+
+ bmp = self._active_pin_bitmap
+
+ else:
+ bmp = self._inactive_pin_bitmap
+
+ # draw the button itself
+ dc.DrawBitmap(bmp, drect.x, drect.y, True)
+
+
+# -- PaneInfo class implementation --
+#
+# PaneInfo specifies all the parameters for a pane. These parameters specify
where
+# the pane is on the screen, whether it is docked or floating, or hidden. In
addition,
+# these parameters specify the pane's docked position, floating position,
preferred
+# size, minimum size, caption text among many other parameters.
+
+class PaneInfo:
+
+ optionFloating = 2**0
+ optionHidden = 2**1
+ optionLeftDockable = 2**2
+ optionRightDockable = 2**3
+ optionTopDockable = 2**4
+ optionBottomDockable = 2**5
+ optionFloatable = 2**6
+ optionMovable = 2**7
+ optionResizable = 2**8
+ optionPaneBorder = 2**9
+ optionCaption = 2**10
+ optionGripper = 2**11
+ optionDestroyOnClose = 2**12
+ optionToolbar = 2**13
+ optionActive = 2**14
+ optionGripperTop = 2**15
+
+ buttonClose = 2**24
+ buttonMaximize = 2**25
+ buttonMinimize = 2**26
+ buttonPin = 2**27
+ buttonCustom1 = 2**28
+ buttonCustom2 = 2**29
+ buttonCustom3 = 2**30
+ actionPane = 2**31 # used internally
+
+ def __init__(self):
+
+ self.window = None
+ self.frame = None
+ self.state = 0
+ self.dock_direction = AUI_DOCK_LEFT
+ self.dock_layer = 0
+ self.dock_row = 0
+ self.dock_pos = 0
+ self.floating_pos = wx.DefaultPosition
+ self.floating_size = wx.DefaultSize
+ self.best_size = wx.DefaultSize
+ self.min_size = wx.DefaultSize
+ self.max_size = wx.DefaultSize
+ self.dock_proportion = 0
+ self.caption = ""
+ self.buttons = []
+ self.name = ""
+ self.rect = wx.Rect()
+
+ self.DefaultPane()
+
+
+ def IsOk(self):
+ """ IsOk() returns True if the PaneInfo structure is valid. """
+
+ return (self.window != None and [True] or [False])[0]
+
+
+ def IsFixed(self):
+ """ IsFixed() returns True if the pane cannot be resized. """
+
+ return not self.HasFlag(self.optionResizable)
+
+
+ def IsResizable(self):
+ """ IsResizeable() returns True if the pane can be resized. """
+
+ return self.HasFlag(self.optionResizable)
+
+
+ def IsShown(self):
+ """ IsShown() returns True if the pane should be drawn on the screen.
"""
+
+ return not self.HasFlag(self.optionHidden)
+
+
+ def IsFloating(self):
+ """ IsFloating() returns True if the pane is floating. """
+
+ return self.HasFlag(self.optionFloating)
+
+
+ def IsDocked(self):
+ """ IsDocked() returns True if the pane is docked. """
+
+ return not self.HasFlag(self.optionFloating)
+
+
+ def IsToolbar(self):
+ """ IsToolbar() returns True if the pane contains a toolbar. """
+
+ return self.HasFlag(self.optionToolbar)
+
+
+ def IsTopDockable(self):
+ """
+ IsTopDockable() returns True if the pane can be docked at the top
+ of the managed frame.
+ """
+
+ return self.HasFlag(self.optionTopDockable)
+
+
+ def IsBottomDockable(self):
+ """
+ IsBottomDockable() returns True if the pane can be docked at the bottom
+ of the managed frame.
+ """
+
+ return self.HasFlag(self.optionBottomDockable)
+
+
+ def IsLeftDockable(self):
+ """
+ IsLeftDockable() returns True if the pane can be docked at the left
+ of the managed frame.
+ """
+
+ return self.HasFlag(self.optionLeftDockable)
+
+
+ def IsRightDockable(self):
+ """
+ IsRightDockable() returns True if the pane can be docked at the right
+ of the managed frame.
+ """
+
+ return self.HasFlag(self.optionRightDockable)
+
+
+ def IsDockable(self):
+ """ IsDockable() returns True if the pane can be docked. """
+
+ return self.IsTopDockable() or self.IsBottomDockable() or
self.IsLeftDockable() or \
+ self.IsRightDockable()
+
+
+ def IsFloatable(self):
+ """
+ IsFloatable() returns True if the pane can be undocked and displayed
as a
+ floating window.
+ """
+
+ return self.HasFlag(self.optionFloatable)
+
+
+ def IsMovable(self):
+ """
+ IsMoveable() returns True if the docked frame can be undocked or moved
to
+ another dock position.
+ """
+
+ return self.HasFlag(self.optionMovable)
+
+
+ def HasCaption(self):
+ """ HasCaption() returns True if the pane displays a caption. """
+
+ return self.HasFlag(self.optionCaption)
+
+
+ def HasGripper(self):
+ """ HasGripper() returns True if the pane displays a gripper. """
+
+ return self.HasFlag(self.optionGripper)
+
+
+ def HasBorder(self):
+ """ HasBorder() returns True if the pane displays a border. """
+
+ return self.HasFlag(self.optionPaneBorder)
+
+
+ def HasCloseButton(self):
+ """
+ HasCloseButton() returns True if the pane displays a button to close
+ the pane.
+ """
+
+ return self.HasFlag(self.buttonClose)
+
+
+ def HasMaximizeButton(self):
+ """
+ HasMaximizeButton() returns True if the pane displays a button to
+ maximize the pane.
+ """
+
+ return self.HasFlag(self.buttonMaximize)
+
+
+ def HasMinimizeButton(self):
+ """
+ HasMinimizeButton() returns True if the pane displays a button to
+ minimize the pane.
+ """
+
+ return self.HasFlag(self.buttonMinimize)
+
+
+ def HasPinButton(self):
+ """ HasPinButton() returns True if the pane displays a button to float
the pane. """
+
+ return self.HasFlag(self.buttonPin)
+
+
+ def HasGripperTop(self):
+
+ return self.HasFlag(self.optionGripperTop)
+
+
+ def Window(self, w):
+
+ self.window = w
+ return self
+
+
+ def Name(self, n):
+ """ Name() sets the name of the pane so it can be referenced in lookup
functions. """
+
+ self.name = n
+ return self
+
+
+ def Caption(self, c):
+ """ Caption() sets the caption of the pane. """
+
+ self.caption = c
+ return self
+
+
+ def Left(self):
+ """ Left() sets the pane dock position to the left side of the frame.
"""
+
+ self.dock_direction = AUI_DOCK_LEFT
+ return self
+
+
+ def Right(self):
+ """ Right() sets the pane dock position to the right side of the
frame. """
+
+ self.dock_direction = AUI_DOCK_RIGHT
+ return self
+
+
+ def Top(self):
+ """ Top() sets the pane dock position to the top of the frame. """
+
+ self.dock_direction = AUI_DOCK_TOP
+ return self
+
+
+ def Bottom(self):
+ """ Bottom() sets the pane dock position to the bottom of the frame.
"""
+
+ self.dock_direction = AUI_DOCK_BOTTOM
+ return self
+
+
+ def Center(self):
+ """ Center() sets the pane to the center position of the frame. """
+
+ self.dock_direction = AUI_DOCK_CENTER
+ return self
+
+
+ def Centre(self):
+ """ Centre() sets the pane to the center position of the frame. """
+
+ self.dock_direction = AUI_DOCK_CENTRE
+ return self
+
+
+ def Direction(self, direction):
+ """ Direction() determines the direction of the docked pane. """
+
+ self.dock_direction = direction
+ return self
+
+
+ def Layer(self, layer):
+ """ Layer() determines the layer of the docked pane. """
+
+ self.dock_layer = layer
+ return self
+
+
+ def Row(self, row):
+ """ Row() determines the row of the docked pane. """
+
+ self.dock_row = row
+ return self
+
+
+ def Position(self, pos):
+ """ Position() determines the position of the docked pane. """
+
+ self.dock_pos = pos
+ return self
+
+
+ def MinSize(self, arg1=None, arg2=None):
+ """ MinSize() sets the minimum size of the pane. """
+
+ if isinstance(arg1, wx.Size):
+ ret = self.MinSize1(arg1)
+ else:
+ ret = self.MinSize2(arg1, arg2)
+
+ return ret
+
+
+ def MinSize1(self, size):
+
+ self.min_size = size
+ return self
+
+
+ def MinSize2(self, x, y):
+
+ self.min_size.Set(x,y)
+ return self
+
+
+ def MaxSize(self, arg1=None, arg2=None):
+ """ MaxSize() sets the maximum size of the pane. """
+
+ if isinstance(arg1, wx.Size):
+ ret = self.MaxSize1(arg1)
+ else:
+ ret = self.MaxSize2(arg1, arg2)
+
+ return ret
+
+
+ def MaxSize1(self, size):
+
+ self.max_size = size
+ return self
+
+
+ def MaxSize2(self, x, y):
+
+ self.max_size.Set(x,y)
+ return self
+
+
+ def BestSize(self, arg1=None, arg2=None):
+ """ BestSize() sets the ideal size for the pane. """
+
+ if isinstance(arg1, wx.Size):
+ ret = self.BestSize1(arg1)
+ else:
+ ret = self.BestSize2(arg1, arg2)
+
+ return ret
+
+
+ def BestSize1(self, size):
+
+ self.best_size = size
+ return self
+
+
+ def BestSize2(self, x, y):
+
+ self.best_size.Set(x,y)
+ return self
+
+
+ def FloatingPosition(self, pos):
+ """ FloatingPosition() sets the position of the floating pane. """
+
+ self.floating_pos = pos
+ return self
+
+
+ def FloatingSize(self, size):
+ """ FloatingSize() sets the size of the floating pane. """
+
+ self.floating_size = size
+ return self
+
+
+ def Fixed(self):
+ """ Fixed() forces a pane to be fixed size so that it cannot be
resized. """
+
+ return self.SetFlag(self.optionResizable, False)
+
+
+ def Resizable(self, resizable=True):
+ """
+ Resizable() allows a pane to be resizable if resizable is True, and
forces
+ it to be a fixed size if resizeable is False.
+ """
+
+ return self.SetFlag(self.optionResizable, resizable)
+
+
+ def Dock(self):
+ """ Dock() indicates that a pane should be docked. """
+
+ return self.SetFlag(self.optionFloating, False)
+
+
+ def Float(self):
+ """ Float() indicates that a pane should be floated. """
+
+ return self.SetFlag(self.optionFloating, True)
+
+
+ def Hide(self):
+ """ Hide() indicates that a pane should be hidden. """
+
+ return self.SetFlag(self.optionHidden, True)
+
+
+ def Show(self, show=True):
+ """ Show() indicates that a pane should be shown. """
+
+ return self.SetFlag(self.optionHidden, not show)
+
+
+ def CaptionVisible(self, visible=True):
+ """ CaptionVisible() indicates that a pane caption should be visible.
"""
+
+ return self.SetFlag(self.optionCaption, visible)
+
+
+ def PaneBorder(self, visible=True):
+ """ PaneBorder() indicates that a border should be drawn for the pane.
"""
+
+ return self.SetFlag(self.optionPaneBorder, visible)
+
+
+ def Gripper(self, visible=True):
+ """ Gripper() indicates that a gripper should be drawn for the pane.
"""
+
+ return self.SetFlag(self.optionGripper, visible)
+
+
+ def GripperTop(self, attop=True):
+ """ GripperTop() indicates that a gripper should be drawn for the
pane. """
+
+ return self.SetFlag(self.optionGripperTop, attop)
+
+
+ def CloseButton(self, visible=True):
+ """ CloseButton() indicates that a close button should be drawn for
the pane. """
+
+ return self.SetFlag(self.buttonClose, visible)
+
+
+ def MaximizeButton(self, visible=True):
+ """ MaximizeButton() indicates that a maximize button should be drawn
for the pane. """
+
+ return self.SetFlag(self.buttonMaximize, visible)
+
+
+ def MinimizeButton(self, visible=True):
+ """ MinimizeButton() indicates that a minimize button should be drawn
for the pane. """
+
+ return self.SetFlag(self.buttonMinimize, visible)
+
+
+ def PinButton(self, visible=True):
+ """ PinButton() indicates that a pin button should be drawn for the
pane. """
+
+ return self.SetFlag(self.buttonPin, visible)
+
+
+ def DestroyOnClose(self, b=True):
+ """ DestroyOnClose() indicates whether a pane should be destroyed when
it is closed. """
+
+ return self.SetFlag(self.optionDestroyOnClose, b)
+
+
+ def TopDockable(self, b=True):
+ """ TopDockable() indicates whether a pane can be docked at the top of
the frame. """
+
+ return self.SetFlag(self.optionTopDockable, b)
+
+
+ def BottomDockable(self, b=True):
+ """ BottomDockable() indicates whether a pane can be docked at the
bottom of the frame. """
+
+ return self.SetFlag(self.optionBottomDockable, b)
+
+
+ def LeftDockable(self, b=True):
+ """ LeftDockable() indicates whether a pane can be docked on the left
of the frame. """
+
+ return self.SetFlag(self.optionLeftDockable, b)
+
+
+ def RightDockable(self, b=True):
+ """ RightDockable() indicates whether a pane can be docked on the
right of the frame. """
+
+ return self.SetFlag(self.optionRightDockable, b)
+
+
+ def Floatable(self, b=True):
+ """ Floatable() indicates whether a frame can be floated. """
+
+ return self.SetFlag(self.optionFloatable, b)
+
+
+ def Movable(self, b=True):
+ """ Movable() indicates whether a frame can be moved. """
+
+ return self.SetFlag(self.optionMovable, b)
+
+
+ def Dockable(self, b=True):
+
+ return
self.TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b)
+
+
+ def DefaultPane(self):
+ """ DefaultPane() specifies that the pane should adopt the default
pane settings. """
+
+ state = self.state
+ state |= self.optionTopDockable | self.optionBottomDockable | \
+ self.optionLeftDockable | self.optionRightDockable | \
+ self.optionFloatable | self.optionMovable |
self.optionResizable | \
+ self.optionCaption | self.optionPaneBorder | self.buttonClose
+
+ self.state = state
+
+ return self
+
+
+ def CentrePane(self):
+ """ CentrePane() specifies that the pane should adopt the default
center pane settings. """
+
+ return self.CenterPane()
+
+
+ def CenterPane(self):
+ """ CenterPane() specifies that the pane should adopt the default
center pane settings. """
+
+ self.state = 0
+ return self.Center().PaneBorder().Resizable()
+
+
+ def ToolbarPane(self):
+ """ ToolbarPane() specifies that the pane should adopt the default
toolbar pane settings. """
+
+ self.DefaultPane()
+ state = self.state
+
+ state |= (self.optionToolbar | self.optionGripper)
+ state &= ~(self.optionResizable | self.optionCaption)
+
+ if self.dock_layer == 0:
+ self.dock_layer = 10
+
+ self.state = state
+
+ return self
+
+
+ def SetFlag(self, flag, option_state):
+ """ SetFlag() turns the property given by flag on or off with the
option_state parameter. """
+
+ state = self.state
+
+ if option_state:
+ state |= flag
+ else:
+ state &= ~flag
+
+ self.state = state
+
+ return self
+
+
+ def HasFlag(self, flag):
+ """ HasFlag() returns True if the the property specified by flag is
active for the pane. """
+
+ return (self.state & flag and [True] or [False])[0]
+
+
+NonePaneInfo = PaneInfo()
+
+# -- FloatingPane class implementation --
+#
+# FloatingPane implements a frame class with some special functionality
+# which allows the library to sense when the frame move starts, is active,
+# and completes. Note that it contains it's own FrameManager instance,
+# which, in the future, would allow for nested managed frames.
+# For now, with wx.MSW, the wx.MiniFrame window is used, but on wx.GTK,
wx.Frame
+
+if wx.Platform == "__WXGTK__":
+
+ class FloatingPaneBaseClass(wx.Frame):
+ def __init__(self, parent, id=wx.ID_ANY, title="",
pos=wx.DefaultPosition,
+ size=wx.DefaultSize, style=0):
+ wx.Frame.__init__(self, parent, id, title, pos, size, style)
+
+else:
+
+ class FloatingPaneBaseClass(wx.MiniFrame):
+ def __init__(self, parent, id=wx.ID_ANY, title="",
pos=wx.DefaultPosition,
+ size=wx.DefaultSize, style=0):
+ wx.MiniFrame.__init__(self, parent, id, title, pos, size, style)
+ if wx.Platform == "__WXMAC__":
+ self.MacSetMetalAppearance(True)
+
+
+class FloatingPane(FloatingPaneBaseClass):
+
+ def __init__(self, parent, owner_mgr, id=wx.ID_ANY, title="",
pos=wx.DefaultPosition,
+ size=wx.DefaultSize, style=wx.RESIZE_BORDER | wx.SYSTEM_MENU
| wx.CAPTION |
+ wx.CLOSE_BOX | wx.FRAME_NO_TASKBAR
|
+ wx.FRAME_FLOAT_ON_PARENT |
wx.CLIP_CHILDREN,
+ resizeborder=0):
+
+ if not resizeborder:
+ style = style & ~wx.RESIZE_BORDER
+
+ FloatingPaneBaseClass.__init__(self, parent, id, title, pos, size,
style)
+ self._owner_mgr = owner_mgr
+ self._moving = False
+ self._last_rect = wx.Rect()
+ self._mgr = FrameManager(None)
+ self._mgr.SetFrame(self)
+ self._mousedown = False
+
+ self.Bind(wx.EVT_CLOSE, self.OnClose)
+ self.Bind(wx.EVT_SIZE, self.OnSize)
+ self.Bind(wx.EVT_MOVE, self.OnMoveEvent)
+ self.Bind(wx.EVT_MOVING, self.OnMoveEvent)
+ self.Bind(wx.EVT_IDLE, self.OnIdle)
+ self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
+
+
+ def CopyAttributes(self, pane, contained_pane):
+
+ contained_pane.name = pane.name
+ contained_pane.caption = pane.caption
+ contained_pane.window = pane.window
+ contained_pane.frame = pane.frame
+ contained_pane.state = pane.state
+ contained_pane.dock_direction = pane.dock_direction
+ contained_pane.dock_layer = pane.dock_layer
+ contained_pane.dock_row = pane.dock_row
+ contained_pane.dock_pos = pane.dock_pos
+ contained_pane.best_size = pane.best_size
+ contained_pane.min_size = pane.min_size
+ contained_pane.max_size = pane.max_size
+ contained_pane.floating_pos = pane.floating_pos
+ contained_pane.floating_size = pane.floating_size
+ contained_pane.dock_proportion = pane.dock_proportion
+ contained_pane.buttons = pane.buttons
+ contained_pane.rect = pane.rect
+
+ return contained_pane
+
+
+ def SetPaneWindow(self, pane):
+
+ self._pane_window = pane.window
+ self._pane_window.Reparent(self)
+
+ contained_pane = PaneInfo()
+
+ contained_pane = self.CopyAttributes(pane, contained_pane)
+
+ contained_pane.Dock().Center().Show(). \
+ CaptionVisible(False). \
+ PaneBorder(False). \
+ Layer(0).Row(0).Position(0)
+
+ indx = self._owner_mgr._panes.index(pane)
+ self._owner_mgr._panes[indx] = pane
+
+ self._mgr.AddPane(self._pane_window, contained_pane)
+ self._mgr.Update()
+
+ if pane.min_size.IsFullySpecified():
+ tmp = self.GetSize()
+ self.GetSizer().SetSizeHints(self)
+ self.SetSize(tmp)
+
+ self.SetTitle(pane.caption)
+
+ if pane.floating_size != wx.DefaultSize:
+ self.SetSize(pane.floating_size)
+ self._owner_mgr._panes[indx] = pane
+ else:
+ size = pane.best_size
+ if size == wx.DefaultSize:
+ size = pane.min_size
+ if size == wx.DefaultSize:
+ size = self._pane_window.GetSize()
+ if pane.HasGripper():
+ if pane.HasGripperTop():
+ size.y +=
self._owner_mgr._art.GetMetric(AUI_ART_GRIPPER_SIZE)
+ else:
+ size.x +=
self._owner_mgr._art.GetMetric(AUI_ART_GRIPPER_SIZE)
+
+ pane.floating_size = size
+ self._owner_mgr._panes[indx] = pane
+ self.SetClientSize(size)
+
+
+ def OnSize(self, event):
+
+ self._owner_mgr.OnFloatingPaneResized(self._pane_window,
event.GetSize())
+
+
+ def OnClose(self, event):
+
+ self._owner_mgr.OnFloatingPaneClosed(self._pane_window)
+ self.Destroy()
+
+ self._mgr.UnInit()
+
+
+ def OnMoveEvent(self, event):
+
+ win_rect = self.GetRect()
+
+ # skip the first move event
+ if self._last_rect.IsEmpty():
+ self._last_rect = win_rect
+ return
+
+ # prevent frame redocking during resize
+ if self._last_rect.GetSize() != win_rect.GetSize():
+ self._last_rect = win_rect
+ return
+
+ self._last_rect = win_rect
+
+ if not self.IsMouseDown():
+ return
+
+ if not self._moving:
+ self.OnMoveStart()
+ self._moving = True
+
+ self.OnMoving(event.GetRect())
+
+
+ def IsMouseDown(self):
+
+ if _newversion:
+ ms = wx.GetMouseState()
+ return ms.leftDown
+ else:
+ if wx.Platform == "__WXMSW__":
+ if _libimported == "MH":
+ return ((win32api.GetKeyState(win32con.VK_LBUTTON) &
(1<<15))\
+ and [True] or [False])[0]
+ elif _libimported == "ctypes":
+ return ((ctypes.windll.user32.GetKeyState(1) & (1<<15))
and \
+ [True] or [False])[0]
+
+
+ def OnIdle(self, event):
+
+ if self._moving:
+ if not self.IsMouseDown():
+ self._moving = False
+ self.OnMoveFinished()
+ else:
+ event.RequestMore()
+
+ event.Skip()
+
+
+ def OnMoveStart(self):
+
+ # notify the owner manager that the pane has started to move
+ self._owner_mgr.OnFloatingPaneMoveStart(self._pane_window)
+
+
+ def OnMoving(self, window_rect):
+
+ # notify the owner manager that the pane is moving
+ self._owner_mgr.OnFloatingPaneMoving(self._pane_window)
+
+
+ def OnMoveFinished(self):
+
+ # notify the owner manager that the pane has finished moving
+ self._owner_mgr.OnFloatingPaneMoved(self._pane_window)
+
+
+ def OnActivate(self, event):
+
+ if event.GetActive():
+ self._owner_mgr.OnFloatingPaneActivated(self._pane_window)
+
+
+# -- static utility functions --
+
+def PaneCreateStippleBitmap():
+
+ data = [0, 0, 0, 192, 192, 192, 192, 192, 192, 0, 0, 0]
+ img = wx.EmptyImage(2, 2)
+ counter = 0
+
+ for ii in xrange(2):
+ for jj in xrange(2):
+ img.SetRGB(ii, jj, data[counter], data[counter+1], data[counter+2])
+ counter = counter + 3
+
+ return img.ConvertToBitmap()
+
+
+def DrawResizeHint(dc, rect):
+ print "drawing resize hint in rect:", rect
+ stipple = PaneCreateStippleBitmap()
+ brush = wx.BrushFromBitmap(stipple)
+ #brush.SetStipple(stipple)
+ dc.SetBrush(brush)
+ dc.SetPen(wx.TRANSPARENT_PEN)
+
+ dc.SetLogicalFunction(wx.XOR)
+ dc.DrawRectangleRect(rect)
+
+
+def CopyDocksAndPanes(src_docks, src_panes):
+ """
+ CopyDocksAndPanes() - this utility function creates shallow copies of
+ the dock and pane info. DockInfo's usually contain pointers
+ to PaneInfo classes, thus this function is necessary to reliably
+ reconstruct that relationship in the new dock info and pane info arrays.
+ """
+
+ dest_docks = src_docks
+ dest_panes = src_panes
+
+ for ii in xrange(len(dest_docks)):
+ dock = dest_docks[ii]
+ for jj in xrange(len(dock.panes)):
+ for kk in xrange(len(src_panes)):
+ if dock.panes[jj] == src_panes[kk]:
+ dock.panes[jj] = dest_panes[kk]
+
+ return dest_docks, dest_panes
+
+
+def CopyDocksAndPanes2(src_docks, src_panes):
+ """
+ CopyDocksAndPanes2() - this utility function creates full copies of
+ the dock and pane info. DockInfo's usually contain pointers
+ to PaneInfo classes, thus this function is necessary to reliably
+ reconstruct that relationship in the new dock info and pane info arrays.
+ """
+
+ dest_docks = []
+
+ for ii in xrange(len(src_docks)):
+ dest_docks.append(DockInfo())
+ dest_docks[ii].dock_direction = src_docks[ii].dock_direction
+ dest_docks[ii].dock_layer = src_docks[ii].dock_layer
+ dest_docks[ii].dock_row = src_docks[ii].dock_row
+ dest_docks[ii].size = src_docks[ii].size
+ dest_docks[ii].min_size = src_docks[ii].min_size
+ dest_docks[ii].resizable = src_docks[ii].resizable
+ dest_docks[ii].fixed = src_docks[ii].fixed
+ dest_docks[ii].toolbar = src_docks[ii].toolbar
+ dest_docks[ii].panes = src_docks[ii].panes
+ dest_docks[ii].rect = src_docks[ii].rect
+
+ dest_panes = []
+
+ for ii in xrange(len(src_panes)):
+ dest_panes.append(PaneInfo())
+ dest_panes[ii].name = src_panes[ii].name
+ dest_panes[ii].caption = src_panes[ii].caption
+ dest_panes[ii].window = src_panes[ii].window
+ dest_panes[ii].frame = src_panes[ii].frame
+ dest_panes[ii].state = src_panes[ii].state
+ dest_panes[ii].dock_direction = src_panes[ii].dock_direction
+ dest_panes[ii].dock_layer = src_panes[ii].dock_layer
+ dest_panes[ii].dock_row = src_panes[ii].dock_row
+ dest_panes[ii].dock_pos = src_panes[ii].dock_pos
+ dest_panes[ii].best_size = src_panes[ii].best_size
+ dest_panes[ii].min_size = src_panes[ii].min_size
+ dest_panes[ii].max_size = src_panes[ii].max_size
+ dest_panes[ii].floating_pos = src_panes[ii].floating_pos
+ dest_panes[ii].floating_size = src_panes[ii].floating_size
+ dest_panes[ii].dock_proportion = src_panes[ii].dock_proportion
+ dest_panes[ii].buttons = src_panes[ii].buttons
+ dest_panes[ii].rect = src_panes[ii].rect
+
+ for ii in xrange(len(dest_docks)):
+ dock = dest_docks[ii]
+ for jj in xrange(len(dock.panes)):
+ for kk in xrange(len(src_panes)):
+ if dock.panes[jj] == src_panes[kk]:
+ dock.panes[jj] = dest_panes[kk]
+
+ dest_docks[ii] = dock
+
+ return dest_docks, dest_panes
+
+
+def GetMaxLayer(docks, dock_direction):
+ """
+ GetMaxLayer() is an internal function which returns
+ the highest layer inside the specified dock.
+ """
+
+ max_layer = 0
+
+ for ii in xrange(len(docks)):
+ dock = docks[ii]
+ if dock.dock_direction == dock_direction and dock.dock_layer >
max_layer and not dock.fixed:
+ max_layer = dock.dock_layer
+
+ return max_layer
+
+
+def GetMaxRow(panes, direction, layer):
+ """
+ GetMaxRow() is an internal function which returns
+ the highest layer inside the specified dock.
+ """
+
+ max_row = 0
+
+ for ii in xrange(len(panes)):
+ pane = panes[ii]
+ if pane.dock_direction == direction and pane.dock_layer == layer and \
+ pane.dock_row > max_row:
+ max_row = pane.dock_row
+
+ return max_row
+
+
+def DoInsertDockLayer(panes, dock_direction, dock_layer):
+ """
+ DoInsertDockLayer() is an internal function that inserts a new dock
+ layer by incrementing all existing dock layer values by one.
+ """
+
+ for ii in xrange(len(panes)):
+ pane = panes[ii]
+ if not pane.IsFloating() and pane.dock_direction == dock_direction and
pane.dock_layer >= dock_layer:
+ pane.dock_layer = pane.dock_layer + 1
+
+ panes[ii] = pane
+
+ return panes
+
+
+def DoInsertDockRow(panes, dock_direction, dock_layer, dock_row):
+ """
+ DoInsertDockRow() is an internal function that inserts a new dock
+ row by incrementing all existing dock row values by one.
+ """
+
+ for ii in xrange(len(panes)):
+ pane = panes[ii]
+ if not pane.IsFloating() and pane.dock_direction == dock_direction and
\
+ pane.dock_layer == dock_layer and pane.dock_row >= dock_row:
+ pane.dock_row = pane.dock_row + 1
+
+ panes[ii] = pane
+
+ return panes
+
+
+def DoInsertPane(panes, dock_direction, dock_layer, dock_row, dock_pos):
+
+ for ii in xrange(len(panes)):
+ pane = panes[ii]
+ if not pane.IsFloating() and pane.dock_direction == dock_direction and
\
+ pane.dock_layer == dock_layer and pane.dock_row == dock_row and \
+ pane.dock_pos >= dock_pos:
+ pane.dock_pos = pane.dock_pos + 1
+
+ panes[ii] = pane
+
+ return panes
+
+
+def FindDocks(docks, dock_direction, dock_layer=-1, dock_row=-1, arr=[]):
+ """
+ FindDocks() is an internal function that returns a list of docks which meet
+ the specified conditions in the parameters and returns a sorted array
+ (sorted by layer and then row).
+ """
+
+ begin_layer = dock_layer
+ end_layer = dock_layer
+ begin_row = dock_row
+ end_row = dock_row
+ dock_count = len(docks)
+ max_row = 0
+ max_layer = 0
+
+ # discover the maximum dock layer and the max row
+ for ii in xrange(dock_count):
+ max_row = max(max_row, docks[ii].dock_row)
+ max_layer = max(max_layer, docks[ii].dock_layer)
+
+ # if no dock layer was specified, search all dock layers
+ if dock_layer == -1:
+ begin_layer = 0
+ end_layer = max_layer
+
+ # if no dock row was specified, search all dock row
+ if dock_row == -1:
+ begin_row = 0
+ end_row = max_row
+
+ arr = []
+
+ for layer in xrange(begin_layer, end_layer+1):
+ for row in xrange(begin_row, end_row+1):
+ for ii in xrange(dock_count):
+ d = docks[ii]
+ if dock_direction == -1 or dock_direction == d.dock_direction:
+ if d.dock_layer == layer and d.dock_row == row:
+ arr.append(d)
+
+ return arr
+
+
+def FindPaneInDock(dock, window):
+ """
+ FindPaneInDock() looks up a specified window pointer inside a dock.
+ If found, the corresponding PaneInfo pointer is returned, otherwise None.
+ """
+
+ count = len(dock.panes)
+ for ii in xrange(count):
+ p = dock.panes[ii]
+ if p.window == window:
+ return p
+
+ return None
+
+
+def RemovePaneFromDocks(docks, pane, exc=None):
+ """
+ RemovePaneFromDocks() removes a pane window from all docks
+ with a possible exception specified by parameter "except".
+ """
+
+ for ii in xrange(len(docks)):
+ d = docks[ii]
+ if d == exc:
+ continue
+ pi = FindPaneInDock(d, pane.window)
+ if pi:
+ d.panes.remove(pi)
+
+ docks[ii] = d
+
+ return docks
+
+
+def RenumberDockRows(docks):
+ """
+ RenumberDockRows() takes a dock and assigns sequential numbers
+ to existing rows. Basically it takes out the gaps so if a
+ dock has rows with numbers 0, 2, 5, they will become 0, 1, 2.
+ """
+
+ for ii in xrange(len(docks)):
+ dock = docks[ii]
+ dock.dock_row = ii
+ for jj in xrange(len(dock.panes)):
+ dock.panes[jj].dock_row = ii
+
+ docks[ii] = dock
+
+ return docks
+
+
+def SetActivePane(panes, active_pane):
+
+ for ii in xrange(len(panes)):
+ pane = panes[ii]
+ pane.state &= ~PaneInfo.optionActive
+
+ if pane.window == active_pane:
+ pane.state |= PaneInfo.optionActive
+
+ panes[ii]= pane
+
+ return panes
+
+
+def PaneSortFunc(p1, p2):
+ """ This function is used to sort panes by dock position. """
+
+ return (p1.dock_pos < p2.dock_pos and [-1] or [1])[0]
+
+
+def EscapeDelimiters(s):
+ """
+ EscapeDelimiters() changes "" into "\" and "|" into "\|"
+ in the input string. This is an internal functions which is
+ used for saving perspectives.
+ """
+
+ result = s.replace(";", "\\")
+ result = result.replace("|", "|\\")
+
+ return result
+
+
+actionNone = 0
+actionResize = 1
+actionClickButton = 2
+actionClickCaption = 3
+actionDragToolbarPane = 4
+actionDragFloatingPane = 5
+
+auiInsertRowPixels = 10
+auiNewRowPixels = 40
+auiLayerInsertPixels = 40
+auiLayerInsertOffset = 5
+
+# -- FrameManager class implementation --
+#
+# FrameManager manages the panes associated with it for a particular wx.Frame,
+# using a pane's PaneInfo information to determine each pane's docking and
+# floating behavior. FrameManager uses wxPython's sizer mechanism to plan the
+# layout of each frame. It uses a replaceable dock art class to do all drawing,
+# so all drawing is localized in one area, and may be customized depending on
an
+# applications' specific needs.
+#
+# FrameManager works as follows: The programmer adds panes to the class, or
makes
+# changes to existing pane properties (dock position, floating state, show
state, etc.).
+# To apply these changes, FrameManager's Update() function is called. This
batch
+# processing can be used to avoid flicker, by modifying more than one pane at
a time,
+# and then "committing" all of the changes at once by calling Update().
+#
+# Panes can be added quite easily:
+#
+# text1 = wx.TextCtrl(self, -1)
+# text2 = wx.TextCtrl(self, -1)
+# self._mgr.AddPane(text1, wx.LEFT, "Pane Caption")
+# self._mgr.AddPane(text2, wx.BOTTOM, "Pane Caption")
+# self._mgr.Update()
+#
+# Later on, the positions can be modified easily. The following will float an
+# existing pane in a tool window:
+
+# self._mgr.GetPane(text1).Float()
+
+# Layers, Rows and Directions, Positions
+# Inside PyAUI, the docking layout is figured out by checking several pane
parameters.
+# Four of these are important for determining where a pane will end up.
+#
+# Direction - Each docked pane has a direction, Top, Bottom, Left, Right, or
Center.
+# This is fairly self-explanatory. The pane will be placed in the location
specified
+# by this variable.
+#
+# Position - More than one pane can be placed inside of a "dock." Imagine to
panes
+# being docked on the left side of a window. One pane can be placed over
another.
+# In proportionally managed docks, the pane position indicates it's sequential
position,
+# starting with zero. So, in our scenario with two panes docked on the left
side, the
+# top pane in the dock would have position 0, and the second one would occupy
position 1.
+#
+# Row - A row can allow for two docks to be placed next to each other. One of
the most
+# common places for this to happen is in the toolbar. Multiple toolbar rows
are allowed,
+# the first row being in row 0, and the second in row 1. Rows can also be used
on
+# vertically docked panes.
+#
+# Layer - A layer is akin to an onion. Layer 0 is the very center of the
managed pane.
+# Thus, if a pane is in layer 0, it will be closest to the center window (also
sometimes
+# known as the "content window"). Increasing layers "swallow up" all layers of
a lower
+# value. This can look very similar to multiple rows, but is different because
all panes
+# in a lower level yield to panes in higher levels. The best way to understand
layers
+# is by running the PyAUI sample (PyAUIDemo.py).
+
+class FrameManager(wx.EvtHandler):
+
+ def __init__(self, frame=None, flags=None):
+ """
+ Default Class Constructor. frame specifies the wx.Frame which should
be managed.
+ flags specifies options which allow the frame management behavior to
be modified.
+ """
+
+ wx.EvtHandler.__init__(self)
+ self._action = actionNone
+ self._last_mouse_move = wx.Point()
+ self._hover_button = None
+ self._art = DefaultDockArt()
+ self._frame = frame
+ self._hint_wnd = None
+ self._action_window = None
+ self._last_hint = wx.Rect()
+ self._hint_fadetimer = wx.Timer()
+ self._hintshown = False
+
+ if flags is None:
+ flags = AUI_MGR_DEFAULT
+
+ self._flags = flags
+ self._active_pane = None
+
+ self._panes = []
+ self._docks = []
+ self._uiparts = []
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+ self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
+ self.Bind(wx.EVT_SIZE, self.OnSize)
+ self.Bind(wx.EVT_SET_CURSOR, self.OnSetCursor)
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
+ self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
+ self.Bind(wx.EVT_MOTION, self.OnMotion)
+ self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
+ self.Bind(wx.EVT_TIMER, self.OnHintFadeTimer)
+ self.Bind(wx.EVT_CHILD_FOCUS, self.OnChildFocus)
+ self.Bind(EVT_AUI_PANEBUTTON, self.OnPaneButton)
+
+
+ def GetPaneByWidget(self, window):
+ """
+ This version of GetPane() looks up a pane based on a
+ 'pane window', see below comment for more info.
+ """
+
+ for ii in xrange(len(self._panes)):
+ p = self._panes[ii]
+ if p.window == window:
+ return p
+
+ return NonePaneInfo
+
+
+ def GetPaneByName(self, name):
+ """
+ This version of GetPane() looks up a pane based on a
+ 'pane name', see below comment for more info.
+ """
+
+ for ii in xrange(len(self._panes)):
+ p = self._panes[ii]
+ if p.name == name:
+ return p
+
+ return NonePaneInfo
+
+
+ def GetPane(self, item):
+ """
+ GetPane() looks up a PaneInfo structure based
+ on the supplied window pointer. Upon failure, GetPane()
+ returns an empty PaneInfo, a condition which can be checked
+ by calling PaneInfo.IsOk().
+
+ The pane info's structure may then be modified. Once a pane's
+ info is modified, FrameManager.Update() must be called to
+ realize the changes in the UI.
+
+ AG: Added To Handle 2 Different Versions Of GetPane() For
+ wxPython/Python.
+ """
+
+ if isinstance(item, type("")):
+ return self.GetPaneByName(item)
+ else:
+ return self.GetPaneByWidget(item)
+
+
+ def GetAllPanes(self):
+ """ GetAllPanes() returns a reference to all the pane info structures.
"""
+
+ return self._panes
+
+
+ def HitTest(self, x, y):
+ """
+ HitTest() is an internal function which determines
+ which UI item the specified coordinates are over
+ (x,y) specify a position in client coordinates.
+ """
+
+ result = None
+
+ for ii in xrange(len(self._uiparts)):
+
+ item = self._uiparts[ii]
+
+ # we are not interested in typeDock, because this space
+ # isn't used to draw anything, just for measurements
+ # besides, the entire dock area is covered with other
+ # rectangles, which we are interested in.
+ if item.type == DockUIPart.typeDock:
+ continue
+
+ # if we already have a hit on a more specific item, we are not
+ # interested in a pane hit. If, however, we don't already have
+ # a hit, returning a pane hit is necessary for some operations
+ if (item.type == DockUIPart.typePane or \
+ item.type == DockUIPart.typePaneBorder) and result:
+ continue
+
+ # if the point is inside the rectangle, we have a hit
+ if item.rect.Inside((x, y)):
+ result = item
+
+ return result
+
+
+ # SetFlags() and GetFlags() allow the owner to set various
+ # options which are global to FrameManager
+
+ def SetFlags(self, flags):
+ """
+ SetFlags() is used to specify FrameManager's settings flags. flags
specifies
+ options which allow the frame management behavior to be modified.
+ """
+
+ self._flags = flags
+
+
+ def GetFlags(self):
+ """ GetFlags() returns the current manager's flags. """
+
+ return self._flags
+
+
+ def SetFrame(self, frame):
+ """
+ SetFrame() is usually called once when the frame
+ manager class is being initialized. "frame" specifies
+ the frame which should be managed by the frame manager.
+ """
+
+ if not frame:
+ raise "\nERROR: Specified Frame Must Be Non-Null. "
+
+ self._frame = frame
+ self._frame.PushEventHandler(self)
+
+ # if the owner is going to manage an MDI parent frame,
+ # we need to add the MDI client window as the default
+ # center pane
+ if isinstance(frame, wx.MDIParentFrame):
+ mdi_frame = frame
+ client_window = mdi_frame.GetClientWindow()
+
+ if not client_window:
+ raise "\nERROR: MDI Client Window Is Null. "
+
+ self.AddPane(client_window, PaneInfo().Name("mdiclient").
+ CenterPane().PaneBorder(False))
+
+
+ def GetFrame(self):
+ """ GetFrame() returns the frame pointer being managed by
FrameManager. """
+
+ return self._frame
+
+
+ def UnInit(self):
+ """
+ UnInit() must be called, usually in the destructor
+ of the frame class. If it is not called, usually this
+ will result in a crash upon program exit.
+ """
+
+ if self._frame.GetEventHandler() == self:
+ self._frame.PopEventHandler()
+
+
+ def GetArtProvider(self):
+ """ GetArtProvider() returns the current art provider being used. """
+
+ return self._art
+
+
+ def ProcessMgrEvent(self, event):
+
+ # first, give the owner frame a chance to override
+ if self._frame:
+ if self._frame.ProcessEvent(event):
+ return
+
+ self.ProcessEvent(event)
+
+
+ def CanMakeWindowsTransparent(self):
+ if wx.Platform == "__WXMSW__":
+ version = wx.GetOsDescription()
+ found = version.find("XP") >= 0 or version.find("2000") >= 0 or
version.find("NT") >= 0
+ return found and _libimported
+ elif wx.Platform == "__WXMAC__" and _carbon_dll:
+ return True
+ else:
+ return False
+
+# on supported windows systems (Win2000 and greater), this function
+# will make a frame window transparent by a certain amount
+ def MakeWindowTransparent(self, wnd, amount):
+
+ if wnd.GetSize() == (0, 0):
+ return
+
+ # this API call is not in all SDKs, only the newer ones, so
+ # we will runtime bind this
+ if wx.Platform == "__WXMSW__":
+ hwnd = wnd.GetHandle()
+
+ if not hasattr(self, "_winlib"):
+ if _libimported == "MH":
+ self._winlib = win32api.LoadLibrary("user32")
+ elif _libimported == "ctypes":
+ self._winlib = ctypes.windll.user32
+
+ if _libimported == "MH":
+ pSetLayeredWindowAttributes =
win32api.GetProcAddress(self._winlib,
+
"SetLayeredWindowAttributes")
+
+ if pSetLayeredWindowAttributes == None:
+ return
+
+ exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
+ if 0 == (exstyle & 0x80000):
+ win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, exstyle
| 0x80000)
+
+ winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
+
+ elif _libimported == "ctypes":
+ style = self._winlib.GetWindowLongA(hwnd, 0xffffffecL)
+ style |= 0x00080000
+ self._winlib.SetWindowLongA(hwnd, 0xffffffecL, style)
+ self._winlib.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
+ elif wx.Platform == "__WXMAC__" and _carbon_dll:
+ handle = _carbon_dll.GetControlOwner(wnd.GetHandle())
+ if amount == 0:
+ amnt = float(0)
+ else:
+ amnt = float(amount)/255.0 #convert from the 0-255 amount to
the float that Carbon wants
+ _carbon_dll.SetWindowAlpha(handle, ctypes.c_float(amnt))
+ else:
+ #shouldn't be called, but just in case...
+ return
+
+
+ def SetArtProvider(self, art_provider):
+ """
+ SetArtProvider() instructs FrameManager to use the
+ specified art provider for all drawing calls. This allows
+ plugable look-and-feel features.
+ """
+
+ # delete the last art provider, if any
+ del self._art
+
+ # assign the new art provider
+ self._art = art_provider
+
+
+ def AddPane(self, window, arg1=None, arg2=None):
+ """
+ AddPane() tells the frame manager to start managing a child window.
There
+ are two versions of this function. The first verison allows the full
spectrum
+ of pane parameter possibilities (AddPane1). The second version is used
for
+ simpler user interfaces which do not require as much configuration
(AddPane2).
+ In wxPython, simply call AddPane.
+ """
+
+ if type(arg1) == type(1):
+ # This Is Addpane2
+ if arg1 is None:
+ arg1 = wx.LEFT
+ if arg2 is None:
+ arg2 = ""
+ return self.AddPane2(window, arg1, arg2)
+ else:
+ return self.AddPane1(window, arg1)
+
+
+ def AddPane1(self, window, pane_info):
+
+ # check if the pane has a valid window
+ if not window:
+ return False
+
+ # check if the pane already exists
+ if self.GetPane(pane_info.window).IsOk():
+ return False
+
+ if isinstance(window, wx.ToolBar):
+ window.SetBestFittingSize()
+
+ self._panes.append(pane_info)
+
+ pinfo = self._panes[-1]
+
+ # set the pane window
+ pinfo.window = window
+
+ # if the pane's name identifier is blank, create a random string
+ if len(pinfo.name) == 0 or pinfo.name == "":
+ pinfo.name = ("%s%08x%08x%08x")%(pinfo.window.GetName(),
time.time(),
+ time.clock(), len(self._panes))
+
+ # set initial proportion (if not already set)
+ if pinfo.dock_proportion == 0:
+ pinfo.dock_proportion = 100000
+
+ if pinfo.HasCloseButton() and len(pinfo.buttons) == 0:
+ button = PaneButton(None)
+ button.button_id = PaneInfo.buttonClose
+ pinfo.buttons.append(button)
+
+ if pinfo.best_size == wx.DefaultSize and pinfo.window:
+ pinfo.best_size = pinfo.window.GetClientSize()
+ if pinfo.min_size != wx.DefaultSize:
+ if pinfo.best_size.x < pinfo.min_size.x:
+ pinfo.best_size.x = pinfo.min_size.x
+ if pinfo.best_size.y < pinfo.min_size.y:
+ pinfo.best_size.y = pinfo.min_size.y
+
+ self._panes[-1] = pinfo
+
+ return True
+
+
+ def AddPane2(self, window, direction, caption):
+
+ pinfo = PaneInfo()
+ pinfo.Caption(caption)
+
+ if direction == wx.TOP:
+ pinfo.Top()
+ elif direction == wx.BOTTOM:
+ pinfo.Bottom()
+ elif direction == wx.LEFT:
+ pinfo.Left()
+ elif direction == wx.RIGHT:
+ pinfo.Right()
+ elif direction == wx.CENTER:
+ pinfo.CenterPane()
+
+ return self.AddPane(window, pinfo)
+
+
+ def InsertPane(self, window, pane_info, insert_level=AUI_INSERT_PANE):
+ """
+ InsertPane() is used to insert either a previously unmanaged pane
window
+ into the frame manager, or to insert a currently managed pane
somewhere else.
+ InsertPane() will push all panes, rows, or docks aside and insert the
window
+ into the position specified by insert_location. Because
insert_location can
+ specify either a pane, dock row, or dock layer, the insert_level
parameter is
+ used to disambiguate this. The parameter insert_level can take a value
of
+ AUI_INSERT_PANE, AUI_INSERT_ROW or AUI_INSERT_DOCK.
+ """
+
+ # shift the panes around, depending on the insert level
+ if insert_level == AUI_INSERT_PANE:
+ self._panes = DoInsertPane(self._panes, pane_info.dock_direction,
+ pane_info.dock_layer,
pane_info.dock_row,
+ pane_info.dock_pos)
+
+ elif insert_level == AUI_INSERT_ROW:
+ self._panes = DoInsertDockRow(self._panes,
pane_info.dock_direction,
+ pane_info.dock_layer,
pane_info.dock_row)
+
+ elif insert_level == AUI_INSERT_DOCK:
+ self._panes = DoInsertDockLayer(self._panes,
pane_info.dock_direction,
+ pane_info.dock_layer)
+
+ # if the window already exists, we are basically just moving/inserting
the
+ # existing window. If it doesn't exist, we need to add it and insert
it
+ existing_pane = self.GetPane(window)
+ indx = self._panes.index(existing_pane)
+
+ if not existing_pane.IsOk():
+
+ return self.AddPane(window, pane_info)
+
+ else:
+
+ if pane_info.IsFloating():
+ existing_pane.Float()
+ if pane_info.floating_pos != wx.DefaultPosition:
+ existing_pane.FloatingPosition(pane_info.floating_pos)
+ if pane_info.floating_size != wx.DefaultSize:
+ existing_pane.FloatingSize(pane_info.floating_size)
+ else:
+ existing_pane.Direction(pane_info.dock_direction)
+ existing_pane.Layer(pane_info.dock_layer)
+ existing_pane.Row(pane_info.dock_row)
+ existing_pane.Position(pane_info.dock_pos)
+
+ self._panes[indx] = existing_pane
+
+ return True
+
+
+ def DetachPane(self, window):
+ """
+ DetachPane() tells the FrameManager to stop managing the pane specified
+ by window. The window, if in a floated frame, is reparented to the
frame
+ managed by FrameManager.
+ """
+
+ for ii in xrange(len(self._panes)):
+ if self._panes[ii].window == window:
+ self._panes.pop(ii)
+ return True
+
+ return False
+
+
+ def SavePerspective(self):
+ """
+ SavePerspective() saves all pane information as a single string.
+ This string may later be fed into LoadPerspective() to restore
+ all pane settings. This save and load mechanism allows an
+ exact pane configuration to be saved and restored at a later time.
+ """
+
+ result = "layout1|"
+ pane_count = len(self._panes)
+
+ for pane_i in xrange(pane_count):
+ pane = self._panes[pane_i]
+ result = result + "name=" + EscapeDelimiters(pane.name) + ";"
+ result = result + "caption=" + EscapeDelimiters(pane.caption) + ";"
+ result = result + "state=%u;"%pane.state
+ result = result + "dir=%d;"%pane.dock_direction
+ result = result + "layer=%d;"%pane.dock_layer
+ result = result + "row=%d;"%pane.dock_row
+ result = result + "pos=%d;"%pane.dock_pos
+ result = result + "prop=%d;"%pane.dock_proportion
+ result = result + "bestw=%d;"%pane.best_size.x
+ result = result + "besth=%d;"%pane.best_size.y
+ result = result + "minw=%d;"%pane.min_size.x
+ result = result + "minh=%d;"%pane.min_size.y
+ result = result + "maxw=%d;"%pane.max_size.x
+ result = result + "maxh=%d;"%pane.max_size.y
+ result = result + "floatx=%d;"%pane.floating_pos.x
+ result = result + "floaty=%d;"%pane.floating_pos.y
+ result = result + "floatw=%d;"%pane.floating_size.x
+ result = result + "floath=%d"%pane.floating_size.y
+ result = result + "|"
+
+ dock_count = len(self._docks)
+
+ for dock_i in xrange(dock_count):
+ dock = self._docks[dock_i]
+ result = result + ("dock_size(%d,%d,%d)=%d|")%(dock.dock_direction,
+ dock.dock_layer,
+ dock.dock_row,
+ dock.size)
+
+ return result
+
+
+ def LoadPerspective(self, layout, update=True):
+ """
+ LoadPerspective() loads a layout which was saved with SavePerspective()
+ If the "update" flag parameter is True, the GUI will immediately be
updated.
+ """
+
+ input = layout
+ # check layout string version
+ indx = input.index("|")
+ part = input[0:indx]
+ input = input[indx+1:]
+ part = part.strip()
+
+ if part != "layout1":
+ return False
+
+ olddocks = self._docks[:]
+ oldpanes = self._panes[:]
+
+ # mark all panes currently managed as docked and hidden
+ pane_count = len(self._panes)
+ for pane_i in xrange(pane_count):
+ pane = self._panes[pane_i]
+ pane.Dock().Hide()
+ self._panes[pane_i] = pane
+
+ # clear out the dock array this will be reconstructed
+ self._docks = []
+
+ # replace escaped characters so we can
+ # split up the string easily
+ input = input.replace("\\|", "\a")
+ input = input.replace("\\", "\b")
+
+ input = input.split("|")
+
+ for line in input:
+
+ if line.startswith("dock_size"):
+
+ indx = line.index("=")
+ size = int(line[indx+1:])
+ indx1 = line.index("(")
+ indx2 = line.index(")")
+ line2 = line[indx1+1:indx2]
+ vals = line2.split(",")
+ dir = int(vals[0])
+ layer = int(vals[1])
+ row = int(vals[2])
+ dock = DockInfo()
+ dock.dock_direction = dir
+ dock.dock_layer = layer
+ dock.dock_row = row
+ dock.size = size
+
+ self._docks.append(dock)
+
+ elif line.startswith("name"):
+
+ newline = line.split(";")
+ pane = PaneInfo()
+
+ for newl in newline:
+ myline = newl.strip()
+ vals = myline.split("=")
+ val_name = vals[0]
+ value = vals[1]
+ if val_name == "name":
+ pane.name = value
+ elif val_name == "caption":
+ pane.caption = value
+ elif val_name == "state":
+ pane.state = int(value)
+ elif val_name == "dir":
+ pane.dock_direction = int(value)
+ elif val_name == "layer":
+ pane.dock_layer = int(value)
+ elif val_name == "row":
+ pane.dock_row = int(value)
+ elif val_name == "pos":
+ pane.dock_pos = int(value)
+ elif val_name == "prop":
+ pane.dock_proportion = int(value)
+ elif val_name == "bestw":
+ pane.best_size.x = int(value)
+ elif val_name == "besth":
+ pane.best_size.y = int(value)
+ pane.best_size = wx.Size(pane.best_size.x,
pane.best_size.y)
+ elif val_name == "minw":
+ pane.min_size.x = int(value)
+ elif val_name == "minh":
+ pane.min_size.y = int(value)
+ pane.min_size = wx.Size(pane.min_size.x,
pane.min_size.y)
+ elif val_name == "maxw":
+ pane.max_size.x = int(value)
+ elif val_name == "maxh":
+ pane.max_size.y = int(value)
+ pane.max_size = wx.Size(pane.max_size.x,
pane.max_size.y)
+ elif val_name == "floatx":
+ pane.floating_pos.x = int(value)
+ elif val_name == "floaty":
+ pane.floating_pos.y = int(value)
+ pane.floating_pos = wx.Point(pane.floating_pos.x,
pane.floating_pos.y)
+ elif val_name == "floatw":
+ pane.floating_size.x = int(value)
+ elif val_name == "floath":
+ pane.floating_size.y = int(value)
+ pane.floating_size = wx.Size(pane.floating_size.x,
pane.floating_size.y)
+ else:
+ raise "\nERROR: Bad Perspective String."
+
+ # replace escaped characters so we can
+ # split up the string easily
+ pane.name = pane.name.replace("\a", "|")
+ pane.name = pane.name.replace("\b", ";")
+ pane.caption = pane.caption.replace("\a", "|")
+ pane.caption = pane.caption.replace("\b", ";")
+
+ p = self.GetPane(pane.name)
+ if not p.IsOk():
+ # the pane window couldn't be found
+ # in the existing layout
+ return False
+
+ indx = self._panes.index(p)
+ pane.window = p.window
+ pane.frame = p.frame
+ pane.buttons = p.buttons
+ self._panes[indx] = pane
+
+ if update:
+ self.Update()
+
+ return True
+
+
+ def GetPanePositionsAndSizes(self, dock):
+ """ Returns all the panes positions and sizes. """
+
+ caption_size = self._art.GetMetric(AUI_ART_CAPTION_SIZE)
+ pane_border_size = self._art.GetMetric(AUI_ART_PANE_BORDER_SIZE)
+ gripper_size = self._art.GetMetric(AUI_ART_GRIPPER_SIZE)
+
+ positions = []
+ sizes = []
+
+ action_pane = -1
+ pane_count = len(dock.panes)
+
+ # find the pane marked as our action pane
+ for pane_i in xrange(pane_count):
+ pane = dock.panes[pane_i]
+ if pane.state & PaneInfo.actionPane:
+ action_pane = pane_i
+
+ # set up each panes default position, and
+ # determine the size (width or height, depending
+ # on the dock's orientation) of each pane
+ for pane_i in xrange(pane_count):
+ pane = dock.panes[pane_i]
+ positions.append(pane.dock_pos)
+ size = 0
+
+ if pane.HasBorder():
+ size = size + pane_border_size*2
+
+ if dock.IsHorizontal():
+ if pane.HasGripper() and not pane.HasGripperTop():
+ size = size + gripper_size
+
+ size = size + pane.best_size.x
+
+ else:
+ if pane.HasGripper() and pane.HasGripperTop():
+ size = size + gripper_size
+
+ if pane.HasCaption():
+ size = size + caption_size
+
+ size = size + pane.best_size.y
+
+ sizes.append(size)
+
+ # if there is no action pane, just return the default
+ # positions (as specified in pane.pane_pos)
+ if action_pane == -1:
+ return positions, sizes
+
+ offset = 0
+ for pane_i in xrange(action_pane-1, -1, -1):
+ amount = positions[pane_i+1] - (positions[pane_i] + sizes[pane_i])
+ if amount >= 0:
+ offset = offset + amount
+ else:
+ positions[pane_i] -= -amount
+
+ offset = offset + sizes[pane_i]
+
+ # if the dock mode is fixed, make sure none of the panes
+ # overlap we will bump panes that overlap
+ offset = 0
+ for pane_i in xrange(action_pane, pane_count):
+ amount = positions[pane_i] - offset
+ if amount >= 0:
+ offset = offset + amount
+ else:
+ positions[pane_i] += -amount
+
+ offset = offset + sizes[pane_i]
+
+ return positions, sizes
+
+
+ def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only):
+
+ sizer_item = wx.SizerItem()
+ caption_size = self._art.GetMetric(AUI_ART_CAPTION_SIZE)
+ gripper_size = self._art.GetMetric(AUI_ART_GRIPPER_SIZE)
+ pane_border_size = self._art.GetMetric(AUI_ART_PANE_BORDER_SIZE)
+ pane_button_size = self._art.GetMetric(AUI_ART_PANE_BUTTON_SIZE)
+
+ # find out the orientation of the item (orientation for panes
+ # is the same as the dock's orientation)
+
+ if dock.IsHorizontal():
+ orientation = wx.HORIZONTAL
+ else:
+ orientation = wx.VERTICAL
+
+ # this variable will store the proportion
+ # value that the pane will receive
+ pane_proportion = pane.dock_proportion
+
+ horz_pane_sizer = wx.BoxSizer(wx.HORIZONTAL)
+ vert_pane_sizer = wx.BoxSizer(wx.VERTICAL)
+
+ if pane.HasGripper():
+
+ part = DockUIPart()
+ if pane.HasGripperTop():
+ sizer_item = vert_pane_sizer.Add((1, gripper_size), 0,
wx.EXPAND)
+ else:
+ sizer_item = horz_pane_sizer.Add((gripper_size, 1), 0,
wx.EXPAND)
+
+ part.type = DockUIPart.typeGripper
+ part.dock = dock
+ part.pane = pane
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = horz_pane_sizer
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ if pane.HasCaption():
+
+ # create the caption sizer
+ part = DockUIPart()
+ caption_sizer = wx.BoxSizer(wx.HORIZONTAL)
+ sizer_item = caption_sizer.Add((1, caption_size), 1, wx.EXPAND)
+ part.type = DockUIPart.typeCaption
+ part.dock = dock
+ part.pane = pane
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = vert_pane_sizer
+ part.sizer_item = sizer_item
+ caption_part_idx = len(uiparts)
+ uiparts.append(part)
+
+ # add pane buttons to the caption
+ for ii in xrange(len(pane.buttons)):
+ button = pane.buttons[ii]
+ sizer_item = caption_sizer.Add((pane_button_size,
+ caption_size),
+ 0, wx.EXPAND)
+ part = DockUIPart()
+ part.type = DockUIPart.typePaneButton
+ part.dock = dock
+ part.pane = pane
+ part.button = button
+ part.orientation = orientation
+ part.cont_sizer = caption_sizer
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ # add the caption sizer
+ sizer_item = vert_pane_sizer.Add(caption_sizer, 0, wx.EXPAND)
+ uiparts[caption_part_idx].sizer_item = sizer_item
+
+ # add the pane window itself
+ if spacer_only:
+ sizer_item = vert_pane_sizer.Add((1, 1), 1, wx.EXPAND)
+ else:
+ sizer_item = vert_pane_sizer.Add(pane.window, 1, wx.EXPAND)
+ vert_pane_sizer.SetItemMinSize(pane.window, (1, 1))
+
+ part = DockUIPart()
+ part.type = DockUIPart.typePane
+ part.dock = dock
+ part.pane = pane
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = vert_pane_sizer
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ # determine if the pane should have a minimum size if the pane is
+ # non-resizable (fixed) then we must set a minimum size. Alternitavely,
+ # if the pane.min_size is set, we must use that value as well
+
+ min_size = pane.min_size
+ if pane.IsFixed():
+ if min_size == wx.DefaultSize:
+ min_size = pane.best_size
+ pane_proportion = 0
+
+ if min_size != wx.DefaultSize:
+ vert_pane_sizer.SetItemMinSize(
+ len(vert_pane_sizer.GetChildren())-1, (min_size.x, min_size.y))
+
+ # add the verticle sizer (caption, pane window) to the
+ # horizontal sizer (gripper, verticle sizer)
+ horz_pane_sizer.Add(vert_pane_sizer, 1, wx.EXPAND)
+
+ # finally, add the pane sizer to the dock sizer
+ if pane.HasBorder():
+ # allowing space for the pane's border
+ sizer_item = cont.Add(horz_pane_sizer, pane_proportion,
+ wx.EXPAND | wx.ALL, pane_border_size)
+ part = DockUIPart()
+ part.type = DockUIPart.typePaneBorder
+ part.dock = dock
+ part.pane = pane
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = cont
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+ else:
+ sizer_item = cont.Add(horz_pane_sizer, pane_proportion, wx.EXPAND)
+
+ return uiparts
+
+
+ def LayoutAddDock(self, cont, dock, uiparts, spacer_only):
+
+ sizer_item = wx.SizerItem()
+ part = DockUIPart()
+
+ sash_size = self._art.GetMetric(AUI_ART_SASH_SIZE)
+ orientation = (dock.IsHorizontal() and [wx.HORIZONTAL] or
[wx.VERTICAL])[0]
+
+ # resizable bottom and right docks have a sash before them
+ if not dock.fixed and (dock.dock_direction == AUI_DOCK_BOTTOM or \
+ dock.dock_direction == AUI_DOCK_RIGHT):
+
+ sizer_item = cont.Add((sash_size, sash_size), 0, wx.EXPAND)
+
+ part.type = DockUIPart.typeDockSizer
+ part.orientation = orientation
+ part.dock = dock
+ part.pane = None
+ part.button = None
+ part.cont_sizer = cont
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ # create the sizer for the dock
+ dock_sizer = wx.BoxSizer(orientation)
+
+ # add each pane to the dock
+ pane_count = len(dock.panes)
+
+ if dock.fixed:
+
+ # figure out the real pane positions we will
+ # use, without modifying the each pane's pane_pos member
+ pane_positions, pane_sizes = self.GetPanePositionsAndSizes(dock)
+
+ offset = 0
+ for pane_i in xrange(pane_count):
+
+ pane = dock.panes[pane_i]
+ pane_pos = pane_positions[pane_i]
+
+ amount = pane_pos - offset
+ if amount > 0:
+
+ if dock.IsVertical():
+ sizer_item = dock_sizer.Add((1, amount), 0, wx.EXPAND)
+ else:
+ sizer_item = dock_sizer.Add((amount, 1), 0, wx.EXPAND)
+
+ part = DockUIPart()
+ part.type = DockUIPart.typeBackground
+ part.dock = dock
+ part.pane = None
+ part.button = None
+ part.orientation = (orientation==wx.HORIZONTAL and \
+ [wx.VERTICAL] or [wx.HORIZONTAL])[0]
+ part.cont_sizer = dock_sizer
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ offset = offset + amount
+
+ uiparts = self.LayoutAddPane(dock_sizer, dock, pane, uiparts,
spacer_only)
+
+ offset = offset + pane_sizes[pane_i]
+
+ # at the end add a very small stretchable background area
+ sizer_item = dock_sizer.Add((1, 1), 1, wx.EXPAND)
+ part = DockUIPart()
+ part.type = DockUIPart.typeBackground
+ part.dock = dock
+ part.pane = None
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = dock_sizer
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ else:
+
+ for pane_i in xrange(pane_count):
+
+ pane = dock.panes[pane_i]
+
+ # if this is not the first pane being added,
+ # we need to add a pane sizer
+ if pane_i > 0:
+ sizer_item = dock_sizer.Add((sash_size, sash_size), 0,
wx.EXPAND)
+ part = DockUIPart()
+ part.type = DockUIPart.typePaneSizer
+ part.dock = dock
+ part.pane = dock.panes[pane_i-1]
+ part.button = None
+ part.orientation = (orientation==wx.HORIZONTAL and \
+ [wx.VERTICAL] or [wx.HORIZONTAL])[0]
+ part.cont_sizer = dock_sizer
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ uiparts = self.LayoutAddPane(dock_sizer, dock, pane, uiparts,
spacer_only)
+
+ if dock.dock_direction == AUI_DOCK_CENTER:
+ sizer_item = cont.Add(dock_sizer, 1, wx.EXPAND)
+ else:
+ sizer_item = cont.Add(dock_sizer, 0, wx.EXPAND)
+
+ part = DockUIPart()
+ part.type = DockUIPart.typeDock
+ part.dock = dock
+ part.pane = None
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = cont
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ if dock.IsHorizontal():
+ cont.SetItemMinSize(dock_sizer, (0, dock.size))
+ else:
+ cont.SetItemMinSize(dock_sizer, (dock.size, 0))
+
+ # top and left docks have a sash after them
+ if not dock.fixed and (dock.dock_direction == AUI_DOCK_TOP or \
+ dock.dock_direction == AUI_DOCK_LEFT):
+
+ sizer_item = cont.Add((sash_size, sash_size), 0, wx.EXPAND)
+
+ part = DockUIPart()
+ part.type = DockUIPart.typeDockSizer
+ part.dock = dock
+ part.pane = None
+ part.button = None
+ part.orientation = orientation
+ part.cont_sizer = cont
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ return uiparts
+
+
+ def LayoutAll(self, panes, docks, uiparts, spacer_only=False,
oncheck=True):
+
+ container = wx.BoxSizer(wx.VERTICAL)
+
+ pane_border_size = self._art.GetMetric(AUI_ART_PANE_BORDER_SIZE)
+ caption_size = self._art.GetMetric(AUI_ART_CAPTION_SIZE)
+ cli_size = self._frame.GetClientSize()
+
+ # empty all docks out
+ for ii in xrange(len(docks)):
+ docks[ii].panes = []
+
+ dock_count = len(docks)
+
+ # iterate through all known panes, filing each
+ # of them into the appropriate dock. If the
+ # pane does not exist in the dock, add it
+ for ii in xrange(len(panes)):
+ p = panes[ii]
+
+ # find any docks in this layer
+ arr = FindDocks(docks, p.dock_direction, p.dock_layer, p.dock_row)
+
+ if len(arr) > 0:
+ dock = arr[0]
+ else:
+ # dock was not found, so we need to create a new one
+ d = DockInfo()
+ d.dock_direction = p.dock_direction
+ d.dock_layer = p.dock_layer
+ d.dock_row = p.dock_row
+ docks.append(d)
+ dock = docks[-1]
+
+ if p.IsDocked() and p.IsShown():
+ # remove the pane from any existing docks except this one
+ docks = RemovePaneFromDocks(docks, p, dock)
+
+ # pane needs to be added to the dock,
+ # if it doesn't already exist
+ if not FindPaneInDock(dock, p.window):
+ dock.panes.append(p)
+ else:
+ # remove the pane from any existing docks
+ docks = RemovePaneFromDocks(docks, p)
+
+ # remove any empty docks
+ for ii in xrange(len(docks)-1, -1, -1):
+ if len(docks[ii].panes) == 0:
+ docks.pop(ii)
+
+ dock_count = len(docks)
+ # configure the docks further
+ for ii in xrange(len(docks)):
+ dock = docks[ii]
+ dock_pane_count = len(dock.panes)
+
+ # sort the dock pane array by the pane's
+ # dock position (dock_pos), in ascending order
+ dock.panes.sort(PaneSortFunc)
+
+ # for newly created docks, set up their initial size
+ if dock.size == 0:
+ size = 0
+ for jj in xrange(dock_pane_count):
+ pane = dock.panes[jj]
+ pane_size = pane.best_size
+ if pane_size == wx.DefaultSize:
+ pane_size = pane.min_size
+ if pane_size == wx.DefaultSize:
+ pane_size = pane.window.GetSize()
+
+ if dock.IsHorizontal():
+ size = max(pane_size.y, size)
+ else:
+ size = max(pane_size.x, size)
+
+ # add space for the border (two times), but only
+ # if at least one pane inside the dock has a pane border
+ for jj in xrange(dock_pane_count):
+ if dock.panes[jj].HasBorder():
+ size = size + pane_border_size*2
+ break
+
+ # if pane is on the top or bottom, add the caption height,
+ # but only if at least one pane inside the dock has a caption
+ if dock.IsHorizontal():
+ for jj in xrange(dock_pane_count):
+ if dock.panes[jj].HasCaption():
+ size = size + caption_size
+ break
+
+ # new dock's size may not be more than 1/3 of the frame size
+ if dock.IsHorizontal():
+ size = min(size, cli_size.y/3)
+ else:
+ size = min(size, cli_size.x/3)
+
+ if size < 10:
+ size = 10
+
+ dock.size = size
+
+ # determine the dock's minimum size
+ plus_border = False
+ plus_caption = False
+ dock_min_size = 0
+ for jj in xrange(dock_pane_count):
+ pane = dock.panes[jj]
+ if pane.min_size != wx.DefaultSize:
+ if pane.HasBorder():
+ plus_border = True
+ if pane.HasCaption():
+ plus_caption = True
+ if dock.IsHorizontal():
+ if pane.min_size.y > dock_min_size:
+ dock_min_size = pane.min_size.y
+ else:
+ if pane.min_size.x > dock_min_size:
+ dock_min_size = pane.min_size.x
+
+ if plus_border:
+ dock_min_size = dock_min_size + pane_border_size*2
+ if plus_caption and dock.IsHorizontal():
+ dock_min_size = dock_min_size + caption_size
+
+ dock.min_size = dock_min_size
+
+ # if the pane's current size is less than it's
+ # minimum, increase the dock's size to it's minimum
+ if dock.size < dock.min_size:
+ dock.size = dock.min_size
+
+ # determine the dock's mode (fixed or proportional)
+ # determine whether the dock has only toolbars
+ action_pane_marked = False
+ dock.fixed = True
+ dock.toolbar = True
+ for jj in xrange(dock_pane_count):
+ pane = dock.panes[jj]
+ if not pane.IsFixed():
+ dock.fixed = False
+ if not pane.IsToolbar():
+ dock.toolbar = False
+ if pane.state & PaneInfo.actionPane:
+ action_pane_marked = True
+
+ # if the dock mode is proportional and not fixed-pixel,
+ # reassign the dock_pos to the sequential 0, 1, 2, 3
+ # e.g. remove gaps like 1, 2, 30, 500
+ if not dock.fixed:
+ for jj in xrange(dock_pane_count):
+ pane = dock.panes[jj]
+ pane.dock_pos = jj
+ dock.panes[jj] = pane
+
+ # if the dock mode is fixed, and none of the panes
+ # are being moved right now, make sure the panes
+ # do not overlap each other. If they do, we will
+ # adjust the panes' positions
+ if dock.fixed and not action_pane_marked:
+ pane_positions, pane_sizes =
self.GetPanePositionsAndSizes(dock)
+ offset = 0
+ for jj in xrange(dock_pane_count):
+ pane = dock.panes[jj]
+ pane.dock_pos = pane_positions[jj]
+ amount = pane.dock_pos - offset
+ if amount >= 0:
+ offset = offset + amount
+ else:
+ pane.dock_pos += -amount
+
+ offset = offset + pane_sizes[jj]
+ dock.panes[jj] = pane
+
+ if oncheck:
+ self._docks[ii] = dock
+
+ # discover the maximum dock layer
+ max_layer = 0
+
+ for ii in xrange(dock_count):
+ max_layer = max(max_layer, docks[ii].dock_layer)
+
+ # clear out uiparts
+ uiparts = []
+
+ # create a bunch of box sizers,
+ # from the innermost level outwards.
+ cont = None
+ middle = None
+
+ if oncheck:
+ docks = self._docks
+
+ for layer in xrange(max_layer+1):
+ # find any docks in this layer
+ arr = FindDocks(docks, -1, layer, -1)
+ # if there aren't any, skip to the next layer
+ if len(arr) == 0:
+ continue
+
+ old_cont = cont
+
+ # create a container which will hold this layer's
+ # docks (top, bottom, left, right)
+ cont = wx.BoxSizer(wx.VERTICAL)
+
+ # find any top docks in this layer
+ arr = FindDocks(docks, AUI_DOCK_TOP, layer, -1, arr)
+ arr = RenumberDockRows(arr)
+ if len(arr) > 0:
+ for row in xrange(len(arr)):
+ uiparts = self.LayoutAddDock(cont, arr[row], uiparts,
spacer_only)
+
+ # fill out the middle layer (which consists
+ # of left docks, content area and right docks)
+
+ middle = wx.BoxSizer(wx.HORIZONTAL)
+
+ # find any left docks in this layer
+ arr = FindDocks(docks, AUI_DOCK_LEFT, layer, -1, arr)
+ arr = RenumberDockRows(arr)
+ if len(arr) > 0:
+ for row in xrange(len(arr)):
+ uiparts = self.LayoutAddDock(middle, arr[row], uiparts,
spacer_only)
+
+ # add content dock (or previous layer's sizer
+ # to the middle
+ if not old_cont:
+ # find any center docks
+ arr = FindDocks(docks, AUI_DOCK_CENTER, -1, -1, arr)
+ if len(arr) > 0:
+ for row in xrange(len(arr)):
+ uiparts = self.LayoutAddDock(middle, arr[row], uiparts,
spacer_only)
+ else:
+ # there are no center docks, add a background area
+ sizer_item = middle.Add((1, 1), 1, wx.EXPAND)
+ part = DockUIPart()
+ part.type = DockUIPart.typeBackground
+ part.pane = None
+ part.dock = None
+ part.button = None
+ part.cont_sizer = middle
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+ else:
+ middle.Add(old_cont, 1, wx.EXPAND)
+
+ # find any right docks in this layer
+ arr = FindDocks(docks, AUI_DOCK_RIGHT, layer, -1, arr)
+ arr = RenumberDockRows(arr)
+ if len(arr) > 0:
+ for row in xrange(len(arr)-1, -1, -1):
+ uiparts = self.LayoutAddDock(middle, arr[row], uiparts,
spacer_only)
+
+ cont.Add(middle, 1, wx.EXPAND)
+
+ # find any bottom docks in this layer
+ arr = FindDocks(docks, AUI_DOCK_BOTTOM, layer, -1, arr)
+ arr = RenumberDockRows(arr)
+ if len(arr) > 0:
+ for row in xrange(len(arr)-1, -1, -1):
+ uiparts = self.LayoutAddDock(cont, arr[row], uiparts,
spacer_only)
+
+ if not cont:
+ # no sizer available, because there are no docks,
+ # therefore we will create a simple background area
+ cont = wx.BoxSizer(wx.VERTICAL)
+ sizer_item = cont.Add((1, 1), 1, wx.EXPAND)
+ part = DockUIPart()
+ part.type = DockUIPart.typeBackground
+ part.pane = None
+ part.dock = None
+ part.button = None
+ part.cont_sizer = middle
+ part.sizer_item = sizer_item
+ uiparts.append(part)
+
+ if oncheck:
+ self._uiparts = uiparts
+ self._docks = docks
+
+ container.Add(cont, 1, wx.EXPAND)
+
+ if oncheck:
+ return container
+ else:
+ return container, panes, docks, uiparts
+
+
+ def Update(self):
+ """
+ Update() updates the layout. Whenever changes are made to
+ one or more panes, this function should be called. It is the
+ external entry point for running the layout engine.
+ """
+
+ pane_count = len(self._panes)
+ # delete old sizer first
+ self._frame.SetSizer(None)
+
+ # destroy floating panes which have been
+ # redocked or are becoming non-floating
+ for ii in xrange(pane_count):
+ p = self._panes[ii]
+ if not p.IsFloating() and p.frame:
+ # because the pane is no longer in a floating, we need to
+ # reparent it to self._frame and destroy the floating frame
+ # reduce flicker
+ p.window.SetSize((1, 1))
+ p.frame.Show(False)
+
+ # reparent to self._frame and destroy the pane
+ p.window.Reparent(self._frame)
+ p.frame.SetSizer(None)
+ p.frame.Destroy()
+ p.frame = None
+
+ self._panes[ii] = p
+
+ # create a layout for all of the panes
+ sizer = self.LayoutAll(self._panes, self._docks, self._uiparts, False)
+
+ # hide or show panes as necessary,
+ # and float panes as necessary
+
+ pane_count = len(self._panes)
+
+ for ii in xrange(pane_count):
+ p = self._panes[ii]
+ if p.IsFloating():
+ if p.frame == None:
+ # we need to create a frame for this
+ # pane, which has recently been floated
+ resizeborder = 1
+ if p.IsFixed():
+ resizeborder = 0
+
+ frame = FloatingPane(self._frame, self, -1, "",
p.floating_pos,
+ p.floating_size,
resizeborder=resizeborder)
+
+ # on MSW, if the owner desires transparent dragging, and
+ # the dragging is happening right now, then the floating
+ # window should have this style by default
+
+ if self.UseTransparentDrag():
+ self.MakeWindowTransparent(frame, 150)
+
+ frame.SetPaneWindow(p)
+ p.frame = frame
+ if p.IsShown():
+ frame.Show()
+ else:
+
+ # frame already exists, make sure it's position
+ # and size reflect the information in PaneInfo
+ if p.frame.GetPosition() != p.floating_pos:
+ p.frame.SetDimensions(p.floating_pos.x,
p.floating_pos.y,
+ -1, -1, wx.SIZE_USE_EXISTING)
+ p.frame.Show(p.IsShown())
+ else:
+
+ p.window.Show(p.IsShown())
+
+ # if "active panes" are no longer allowed, clear
+ # any optionActive values from the pane states
+ if self._flags & AUI_MGR_ALLOW_ACTIVE_PANE == 0:
+ p.state &= ~PaneInfo.optionActive
+
+ self._panes[ii] = p
+
+
+ old_pane_rects = []
+
+ for ii in xrange(pane_count):
+ r = wx.Rect()
+ p = self._panes[ii]
+
+ if p.window and p.IsShown() and p.IsDocked():
+ r = p.rect
+
+ old_pane_rects.append(r)
+
+ # apply the new sizer
+ self._frame.SetSizer(sizer)
+ self._frame.SetAutoLayout(False)
+ self.DoFrameLayout()
+
+ # now that the frame layout is done, we need to check
+ # the new pane rectangles against the old rectangles that
+ # we saved a few lines above here. If the rectangles have
+ # changed, the corresponding panes must also be updated
+ for ii in xrange(pane_count):
+ p = self._panes[ii]
+ if p.window and p.IsShown() and p.IsDocked():
+ if p.rect != old_pane_rects[ii]:
+ p.window.Refresh()
+ p.window.Update()
+
+ self.Repaint()
+
+
+ def DoFrameLayout(self):
+ """
+ DoFrameLayout() is an internal function which invokes wx.Sizer.Layout
+ on the frame's main sizer, then measures all the various UI items
+ and updates their internal rectangles. This should always be called
+ instead of calling self._frame.Layout() directly
+ """
+
+ self._frame.Layout()
+
+ for ii in xrange(len(self._uiparts)):
+ part = self._uiparts[ii]
+
+ # get the rectangle of the UI part
+ # originally, this code looked like this:
+ # part.rect = wx.Rect(part.sizer_item.GetPosition(),
+ # part.sizer_item.GetSize())
+ # this worked quite well, with one exception: the mdi
+ # client window had a "deferred" size variable
+ # that returned the wrong size. It looks like
+ # a bug in wx, because the former size of the window
+ # was being returned. So, we will retrieve the part's
+ # rectangle via other means
+
+ part.rect = part.sizer_item.GetRect()
+ flag = part.sizer_item.GetFlag()
+ border = part.sizer_item.GetBorder()
+
+ if flag & wx.TOP:
+ part.rect.y -= border
+ part.rect.height += border
+ if flag & wx.LEFT:
+ part.rect.x -= border
+ part.rect.width += border
+ if flag & wx.BOTTOM:
+ part.rect.height += border
+ if flag & wx.RIGHT:
+ part.rect.width += border
+
+ if part.type == DockUIPart.typeDock:
+ part.dock.rect = part.rect
+ if part.type == DockUIPart.typePane:
+ part.pane.rect = part.rect
+
+ self._uiparts[ii] = part
+
+
+ def GetPanePart(self, wnd):
+ """
+ GetPanePart() looks up the pane border UI part of the
+ pane specified. This allows the caller to get the exact rectangle
+ of the pane in question, including decorations like caption and border.
+ """
+
+ for ii in xrange(len(self._uiparts)):
+ part = self._uiparts[ii]
+ if part.type == DockUIPart.typePaneBorder and \
+ part.pane and part.pane.window == wnd:
+ return part
+
+ for ii in xrange(len(self._uiparts)):
+ part = self._uiparts[ii]
+ if part.type == DockUIPart.typePane and \
+ part.pane and part.pane.window == wnd:
+ return part
+
+ return None
+
+
+ def GetDockPixelOffset(self, test):
+ """
+ GetDockPixelOffset() is an internal function which returns
+ a dock's offset in pixels from the left side of the window
+ (for horizontal docks) or from the top of the window (for
+ vertical docks). This value is necessary for calculating
+ fixel-pane/toolbar offsets when they are dragged.
+ """
+
+ # the only way to accurately calculate the dock's
+ # offset is to actually run a theoretical layout
+
+ docks, panes = CopyDocksAndPanes2(self._docks, self._panes)
+ panes.append(test)
+
+ sizer, panes, docks, uiparts = self.LayoutAll(panes, docks, [], True,
False)
+ client_size = self._frame.GetClientSize()
+ sizer.SetDimension(0, 0, client_size.x, client_size.y)
+ sizer.Layout()
+
+ for ii in xrange(len(uiparts)):
+ part = uiparts[ii]
+ pos = part.sizer_item.GetPosition()
+ size = part.sizer_item.GetSize()
+ part.rect = wx.Rect(pos[0], pos[1], size[0], size[1])
+ if part.type == DockUIPart.typeDock:
+ part.dock.rect = part.rect
+
+ sizer.Destroy()
+
+ for ii in xrange(len(docks)):
+ dock = docks[ii]
+ if test.dock_direction == dock.dock_direction and \
+ test.dock_layer == dock.dock_layer and \
+ test.dock_row == dock.dock_row:
+
+ if dock.IsVertical():
+ return dock.rect.y
+ else:
+ return dock.rect.x
+
+ return 0
+
+
+ def ProcessDockResult(self, target, new_pos):
+ """
+ ProcessDockResult() is a utility function used by DoDrop() - it checks
+ if a dock operation is allowed, the new dock position is copied into
+ the target info. If the operation was allowed, the function returns
True.
+ """
+
+ allowed = False
+ if new_pos.dock_direction == AUI_DOCK_TOP:
+ allowed = target.IsTopDockable()
+ elif new_pos.dock_direction == AUI_DOCK_BOTTOM:
+ allowed = target.IsBottomDockable()
+ elif new_pos.dock_direction == AUI_DOCK_LEFT:
+ allowed = target.IsLeftDockable()
+ elif new_pos.dock_direction == AUI_DOCK_RIGHT:
+ allowed = target.IsRightDockable()
+
+ if allowed:
+ target = new_pos
+
+ return allowed, target
+
+
+ def DoDrop(self, docks, panes, target, pt, offset=wx.Point(0,0)):
+ """
+ DoDrop() is an important function. It basically takes a mouse
position,
+ and determines where the panes new position would be. If the pane is
to be
+ dropped, it performs the drop operation using the specified dock and
pane
+ arrays. By specifying copy dock and pane arrays when calling, a
"what-if"
+ scenario can be performed, giving precise coordinates for drop hints.
+ """
+
+ cli_size = self._frame.GetClientSize()
+
+ drop = PaneInfo()
+ drop.name = target.name
+ drop.caption = target.caption
+ drop.window = target.window
+ drop.frame = target.frame
+ drop.state = target.state
+ drop.dock_direction = target.dock_direction
+ drop.dock_layer = target.dock_layer
+ drop.dock_row = target.dock_row
+ drop.dock_pos = target.dock_pos
+ drop.best_size = target.best_size
+ drop.min_size = target.min_size
+ drop.max_size = target.max_size
+ drop.floating_pos = target.floating_pos
+ drop.floating_size = target.floating_size
+ drop.dock_proportion = target.dock_proportion
+ drop.buttons = target.buttons
+ drop.rect = target.rect
+
+ # The result should always be shown
+ drop.Show()
+
+ # Check to see if the pane has been dragged outside of the window
+ # (or near to the outside of the window), if so, dock it along the edge
+
+ layer_insert_offset = auiLayerInsertOffset
+
+ if target.IsToolbar():
+ layer_insert_offset = 0
+
+ if pt.x < layer_insert_offset and \
+ pt.x > layer_insert_offset-auiLayerInsertPixels:
+ new_layer = max(max(GetMaxLayer(docks, AUI_DOCK_LEFT),
+ GetMaxLayer(docks, AUI_DOCK_BOTTOM)),
+ GetMaxLayer(docks, AUI_DOCK_TOP)) + 1
+
+ drop.Dock().Left().Layer(new_layer).Row(0). \
+ Position(pt.y - self.GetDockPixelOffset(drop) - offset.y)
+
+ return self.ProcessDockResult(target, drop)
+
+ elif pt.y < layer_insert_offset and \
+ pt.y > layer_insert_offset-auiLayerInsertPixels:
+ new_layer = max(max(GetMaxLayer(docks, AUI_DOCK_TOP),
+ GetMaxLayer(docks, AUI_DOCK_LEFT)),
+ GetMaxLayer(docks, AUI_DOCK_RIGHT)) + 1
+
+ drop.Dock().Top().Layer(new_layer).Row(0). \
+ Position(pt.x - self.GetDockPixelOffset(drop) - offset.x)
+
+ return self.ProcessDockResult(target, drop)
+
+ elif pt.x >= cli_size.x - layer_insert_offset and \
+ pt.x < cli_size.x - layer_insert_offset + auiLayerInsertPixels:
+
+ new_layer = max(max(GetMaxLayer(docks, AUI_DOCK_RIGHT),
+ GetMaxLayer(docks, AUI_DOCK_TOP)),
+ GetMaxLayer(docks, AUI_DOCK_BOTTOM)) + 1
+
+ drop.Dock().Right().Layer(new_layer).Row(0). \
+ Position(pt.y - self.GetDockPixelOffset(drop) - offset.y)
+
+ return self.ProcessDockResult(target, drop)
+
+ elif pt.y >= cli_size.y - layer_insert_offset and \
+ pt.y < cli_size.y - layer_insert_offset + auiLayerInsertPixels:
+
+ new_layer = max(max(GetMaxLayer(docks, AUI_DOCK_BOTTOM),
+ GetMaxLayer(docks, AUI_DOCK_LEFT)),
+ GetMaxLayer(docks, AUI_DOCK_RIGHT)) + 1
+
+ drop.Dock().Bottom().Layer(new_layer).Row(0). \
+ Position(pt.x - self.GetDockPixelOffset(drop) - offset.x)
+
+ return self.ProcessDockResult(target, drop)
+
+ part = self.HitTest(pt.x, pt.y)
+
+ if drop.IsToolbar():
+ if not part or not part.dock:
+ return False, target
+
+ # calculate the offset from where the dock begins
+ # to the point where the user dropped the pane
+ dock_drop_offset = 0
+ if part.dock.IsHorizontal():
+ dock_drop_offset = pt.x - part.dock.rect.x - offset.x
+ else:
+ dock_drop_offset = pt.y - part.dock.rect.y - offset.y
+
+ # toolbars may only be moved in and to fixed-pane docks,
+ # otherwise we will try to float the pane. Also, the pane
+ # should float if being dragged over center pane windows
+ if not part.dock.fixed or part.dock.dock_direction ==
AUI_DOCK_CENTER:
+ if self._flags & AUI_MGR_ALLOW_FLOATING:
+ drop.Float()
+
+ return self.ProcessDockResult(target, drop)
+
+ drop.Dock(). \
+ Direction(part.dock.dock_direction). \
+ Layer(part.dock.dock_layer). \
+ Row(part.dock.dock_row). \
+ Position(dock_drop_offset)
+
+ if pt.y < part.dock.rect.y + 2 and len(part.dock.panes) > 1:
+ row = drop.dock_row
+ panes = DoInsertDockRow(panes, part.dock.dock_direction,
+ part.dock.dock_layer,
+ part.dock.dock_row)
+ drop.dock_row = row
+
+ if pt.y > part.dock.rect.y + part.dock.rect.height - 2 and \
+ len(part.dock.panes) > 1:
+ panes = DoInsertDockRow(panes, part.dock.dock_direction,
+ part.dock.dock_layer,
+ part.dock.dock_row+1)
+ drop.dock_row = part.dock.dock_row + 1
+
+ return self.ProcessDockResult(target, drop)
+
+ if not part:
+ return False, target
+
+ if part.type == DockUIPart.typePaneBorder or \
+ part.type == DockUIPart.typeCaption or \
+ part.type == DockUIPart.typeGripper or \
+ part.type == DockUIPart.typePaneButton or \
+ part.type == DockUIPart.typePane or \
+ part.type == DockUIPart.typePaneSizer or \
+ part.type == DockUIPart.typeDockSizer or \
+ part.type == DockUIPart.typeBackground:
+
+ if part.type == DockUIPart.typeDockSizer:
+ if len(part.dock.panes) != 1:
+ return False, target
+
+ part = self.GetPanePart(part.dock.panes[0].window)
+
+ # If a normal frame is being dragged over a toolbar, insert it
+ # along the edge under the toolbar, but over all other panes.
+ # (this could be done much better, but somehow factoring this
+ # calculation with the one at the beginning of this function)
+ if hasattr(part.dock, "toolbar") and part.dock.toolbar:
+ layer = 0
+
+ if part.dock.dock_direction == AUI_DOCK_LEFT:
+ layer = max(max(GetMaxLayer(docks, AUI_DOCK_LEFT),
+ GetMaxLayer(docks, AUI_DOCK_BOTTOM)),
+ GetMaxLayer(docks, AUI_DOCK_TOP))
+ elif part.dock.dock_direction == AUI_DOCK_TOP:
+ layer = max(max(GetMaxLayer(docks, AUI_DOCK_TOP),
+ GetMaxLayer(docks, AUI_DOCK_LEFT)),
+ GetMaxLayer(docks, AUI_DOCK_RIGHT))
+ elif part.dock.dock_direction == AUI_DOCK_RIGHT:
+ layer = max(max(GetMaxLayer(docks, AUI_DOCK_RIGHT),
+ GetMaxLayer(docks, AUI_DOCK_TOP)),
+ GetMaxLayer(docks, AUI_DOCK_BOTTOM))
+ elif part.dock.dock_direction == AUI_DOCK_BOTTOM:
+ layer = max(max(GetMaxLayer(docks, AUI_DOCK_BOTTOM),
+ GetMaxLayer(docks, AUI_DOCK_LEFT)),
+ GetMaxLayer(docks, AUI_DOCK_RIGHT))
+
+ panes = DoInsertDockRow(panes, part.dock.dock_direction,
+ layer, 0)
+ drop.Dock(). \
+ Direction(part.dock.dock_direction). \
+ Layer(layer).Row(0).Position(0)
+
+ return self.ProcessDockResult(target, drop)
+
+ if not part.pane:
+ return False, target
+
+ part = self.GetPanePart(part.pane.window)
+ if not part:
+ return False, target
+
+ insert_dock_row = False
+ insert_row = part.pane.dock_row
+ insert_dir = part.pane.dock_direction
+ insert_layer = part.pane.dock_layer
+
+ if part.pane.dock_direction == AUI_DOCK_TOP:
+ if pt.y >= part.rect.y and \
+ pt.y < part.rect.y+auiInsertRowPixels:
+ insert_dock_row = True
+
+ elif part.pane.dock_direction == AUI_DOCK_BOTTOM:
+ if pt.y > part.rect.y+part.rect.height-auiInsertRowPixels and \
+ pt.y <= part.rect.y + part.rect.height:
+ insert_dock_row = True
+
+ elif part.pane.dock_direction == AUI_DOCK_LEFT:
+ if pt.x >= part.rect.x and \
+ pt.x < part.rect.x+auiInsertRowPixels:
+ insert_dock_row = True
+
+ elif part.pane.dock_direction == AUI_DOCK_RIGHT:
+ if pt.x > part.rect.x+part.rect.width-auiInsertRowPixels and \
+ pt.x <= part.rect.x+part.rect.width:
+ insert_dock_row = True
+
+ elif part.pane.dock_direction == AUI_DOCK_CENTER:
+ # "new row pixels" will be set to the default, but
+ # must never exceed 20% of the window size
+ new_row_pixels_x = auiNewRowPixels
+ new_row_pixels_y = auiNewRowPixels
+
+ if new_row_pixels_x > part.rect.width*20/100:
+ new_row_pixels_x = part.rect.width*20/100
+
+ if new_row_pixels_y > part.rect.height*20/100:
+ new_row_pixels_y = part.rect.height*20/100
+
+ # determine if the mouse pointer is in a location that
+ # will cause a new row to be inserted. The hot spot
positions
+ # are along the borders of the center pane
+
+ insert_layer = 0
+ insert_dock_row = True
+
+ if pt.x >= part.rect.x and \
+ pt.x < part.rect.x+new_row_pixels_x:
+ insert_dir = AUI_DOCK_LEFT
+ elif pt.y >= part.rect.y and \
+ pt.y < part.rect.y+new_row_pixels_y:
+ insert_dir = AUI_DOCK_TOP
+ elif pt.x >= part.rect.x +
part.rect.width-new_row_pixels_x and \
+ pt.x < part.rect.x + part.rect.width:
+ insert_dir = AUI_DOCK_RIGHT
+ elif pt.y >= part.rect.y+
part.rect.height-new_row_pixels_y and \
+ pt.y < part.rect.y + part.rect.height:
+ insert_dir = AUI_DOCK_BOTTOM
+ else:
+ return False, target
+
+ insert_row = GetMaxRow(panes, insert_dir, insert_layer) + 1
+
+ if insert_dock_row:
+
+ panes = DoInsertDockRow(panes, insert_dir, insert_layer,
+ insert_row)
+ drop.Dock().Direction(insert_dir). \
+ Layer(insert_layer). \
+ Row(insert_row). \
+ Position(0)
+
+ return self.ProcessDockResult(target, drop)
+
+ # determine the mouse offset and the pane size, both in the
+ # direction of the dock itself, and perpendicular to the dock
+
+ if part.orientation == wx.VERTICAL:
+
+ offset = pt.y - part.rect.y
+ size = part.rect.GetHeight()
+
+ else:
+
+ offset = pt.x - part.rect.x
+ size = part.rect.GetWidth()
+
+ drop_position = part.pane.dock_pos
+
+ # if we are in the top/left part of the pane,
+ # insert the pane before the pane being hovered over
+ if offset <= size/2:
+
+ drop_position = part.pane.dock_pos
+ panes = DoInsertPane(panes,
+ part.pane.dock_direction,
+ part.pane.dock_layer,
+ part.pane.dock_row,
+ part.pane.dock_pos)
+
+ # if we are in the bottom/right part of the pane,
+ # insert the pane before the pane being hovered over
+ if offset > size/2:
+
+ drop_position = part.pane.dock_pos+1
+ panes = DoInsertPane(panes,
+ part.pane.dock_direction,
+ part.pane.dock_layer,
+ part.pane.dock_row,
+ part.pane.dock_pos+1)
+
+ drop.Dock(). \
+ Direction(part.dock.dock_direction). \
+ Layer(part.dock.dock_layer). \
+ Row(part.dock.dock_row). \
+ Position(drop_position)
+
+ return self.ProcessDockResult(target, drop)
+
+ return False, target
+
+
+ def UseTransparentHint(self):
+ return (self._flags & AUI_MGR_TRANSPARENT_HINT) and
self.CanMakeWindowsTransparent()
+
+ def OnHintFadeTimer(self, event):
+ #sanity check
+ if not self.UseTransparentHint():
+ return
+
+ if not self._hint_wnd or self._hint_fadeamt >= 50:
+ self._hint_fadetimer.Stop()
+ return
+
+ self._hint_fadeamt = self._hint_fadeamt + 5
+ self.MakeWindowTransparent(self._hint_wnd, self._hint_fadeamt)
+
+
+ def ShowHint(self, rect):
+ self._hintshown = True
+ if self.UseTransparentHint():
+ if wx.Platform == "__WXMSW__":
+ if self._last_hint == rect:
+ return
+ self._last_hint = rect
+
+ initial_fade = 50
+
+ if self._flags & AUI_MGR_TRANSPARENT_HINT_FADE:
+ initial_fade = 0
+
+ if self._hint_wnd == None:
+
+ pt = rect.GetPosition()
+ size = rect.GetSize()
+ self._hint_wnd = wx.Frame(self._frame, -1, "", pt, size,
+ wx.FRAME_FLOAT_ON_PARENT |
+ wx.FRAME_NO_TASKBAR |
+ wx.NO_BORDER)
+
+ self.MakeWindowTransparent(self._hint_wnd, initial_fade)
+
self._hint_wnd.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
+ self._hint_wnd.Show()
+
+ # if we are dragging a floating pane, set the focus
+
+ # back to that floating pane (otherwise it becomes
unfocused)
+
+ if self._action == actionDragFloatingPane and
self._action_window:
+ self._action_window.SetFocus()
+
+ else:
+
+ pt = rect.GetPosition()
+ size = rect.GetSize()
+ self.MakeWindowTransparent(self._hint_wnd, initial_fade)
+ self._hint_wnd.SetDimensions(pt.x, pt.y, rect.width,
rect.height)
+
+ if self._flags & AUI_MGR_TRANSPARENT_HINT_FADE:
+ # start fade in timer
+ self._hint_fadeamt = 0
+ self._hint_fadetimer.SetOwner(self, 101)
+ self._hint_fadetimer.Start(5)
+ return
+ elif wx.Platform == "__WXMAC__":
+ if self._last_hint == rect:
+ return #same rect, already shown, no-op
+ if self._flags & AUI_MGR_TRANSPARENT_HINT_FADE:
+ initial_fade = 0
+ else:
+ initial_fade = 80
+
+ if not self._hint_wnd:
+ self._hint_wnd = wx.MiniFrame(self._frame,
+ style=wx.FRAME_FLOAT_ON_PARENT|wx.FRAME_TOOL_WINDOW
+ |wx.CAPTION#|wx.FRAME_SHAPED
+ #without wx.CAPTION + wx.FRAME_TOOL_WINDOW, the hint
window
+ #gets focus & dims the main frames toolbar, which is
both wrong
+ #and distracting.
+ #wx.CAPTION + wx.FRAME_TOOL_WINDOW cures the focus
problem,
+ #but then it draws the caption. Adding wx.FRAME_SHAPED
takes
+ #care of that, but then SetRect doesn't work to size -
need to
+ #create a bitmap or mask or something.
+ )
+ #can't set the background of a wx.Frame in OSX
+ p = wx.Panel(self._hint_wnd)
+
+ #the caption color is a light silver thats really hard to
see
+ #especially transparent. See if theres some other system
+ #setting that is more appropriate, or just extend the art
provider
+ #to cover this
+
#p.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
+ p.SetBackgroundColour(wx.BLUE)
+
+ self.MakeWindowTransparent(self._hint_wnd, initial_fade)
+ self._hint_wnd.SetRect(rect)
+ self._hint_wnd.Show()
+
+ if self._action == actionDragFloatingPane and
self._action_window:
+ self._action_window.SetFocus()
+
+ if self._flags & AUI_MGR_TRANSPARENT_HINT_FADE:
+ # start fade in timer
+ self._hint_fadeamt = 0
+ self._hint_fadetimer.SetOwner(self, 101)
+ self._hint_fadetimer.Start(5)
+ return
+
+
+ if self._last_hint != rect:
+ # remove the last hint rectangle
+ self._last_hint = rect
+ self._frame.Refresh()
+ self._frame.Update()
+
+
+
+ screendc = wx.ScreenDC()
+ clip = wx.Region(1, 1, 10000, 10000)
+
+ # clip all floating windows, so we don't draw over them
+ for ii in xrange(len(self._panes)):
+ pane = self._panes[ii]
+ if pane.IsFloating() and pane.frame.IsShown():
+ recta = pane.frame.GetRect()
+ if wx.Platform == "__WXGTK__":
+ # wx.GTK returns the client size, not the whole frame size
+ recta.width = rect.width + 15
+ recta.height = rect.height + 35
+ recta.Inflate(5, 5)
+ #endif
+
+ clip.Subtract(recta.x, recta.y, recta.width, recta.height)
+
+ box = clip.GetBox()
+ screendc.SetClippingRegion(box.x, box.y, box.width, box.height)
+
+
screendc.SetBrush(wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION)))
+ screendc.SetPen(wx.TRANSPARENT_PEN)
+
+ screendc.DrawRectangle(rect.x, rect.y, 5, rect.height)
+ screendc.DrawRectangle(rect.x+5, rect.y, rect.width-10, 5)
+ screendc.DrawRectangle(rect.x+rect.width-5, rect.y, 5, rect.height)
+ screendc.DrawRectangle(rect.x+5, rect.y+rect.height-5, rect.width-10,
5)
+
+
+ def HideHint(self):
+
+ self._hintshown = False
+
+ # hides a transparent window hint (currently wx.MSW only)
+ if self.UseTransparentHint():
+ if self._hint_wnd:
+ self._hint_fadetimer.Stop()
+ #self._hint_wnd.Destroy()
+ self.MakeWindowTransparent(self._hint_wnd, 0)
+ self._last_hint = wx.Rect()
+
+ return
+
+ # hides a painted hint by redrawing the frame window
+ if not self._last_hint.IsEmpty():
+ self._frame.Refresh()
+ self._frame.Update()
+ self._last_hint = wx.Rect()
+
+
+ def DrawHintRect(self, pane_window, pt, offset):
+ """
+ DrawHintRect() draws a drop hint rectangle. First calls DoDrop() to
+ determine the exact position the pane would be at were if dropped. If
+ the pame would indeed become docked at the specified drop point,
+ DrawHintRect() then calls ShowHint() to indicate this drop rectangle.
+ "pane_window" is the window pointer of the pane being dragged, pt is
+ the mouse position, in client coordinates.
+ """
+
+ # we need to paint a hint rectangle to find out the exact hint
rectangle,
+ # we will create a new temporary layout and then measure the resulting
+ # rectangle we will create a copy of the docking structures
(self._docks)
+ # so that we don't modify the real thing on screen
+
+ rect = wx.Rect()
+ pane = self.GetPane(pane_window)
+
+ attrs = self.GetAttributes(pane)
+ hint = PaneInfo()
+ hint = self.SetAttributes(hint, attrs)
+
+ if hint.name != "__HINT__":
+ self._oldname = hint.name
+
+ hint.name = "__HINT__"
+
+ if not hint.IsOk():
+ hint.name = self._oldname
+ return
+
+ docks, panes = CopyDocksAndPanes2(self._docks, self._panes)
+
+ # remove any pane already there which bears the same window
+ # this happens when you are moving a pane around in a dock
+ for ii in xrange(len(panes)):
+ if panes[ii].window == pane_window:
+ docks = RemovePaneFromDocks(docks, panes[ii])
+ panes.pop(ii)
+ break
+
+ # find out where the new pane would be
+ allow, hint = self.DoDrop(docks, panes, hint, pt, offset)
+
+ if not allow:
+ self.HideHint()
+ return
+
+ panes.append(hint)
+
+ sizer, panes, docks, uiparts = self.LayoutAll(panes, docks, [], True,
False)
+ client_size = self._frame.GetClientSize()
+ sizer.SetDimension(0, 0, client_size.x, client_size.y)
+ sizer.Layout()
+
+ for ii in xrange(len(uiparts)):
+ part = uiparts[ii]
+ if part.type == DockUIPart.typePaneBorder and \
+ part.pane and part.pane.name == "__HINT__":
+ pos = part.sizer_item.GetPosition()
+ size = part.sizer_item.GetSize()
+ rect = wx.Rect(pos[0], pos[1], size[0], size[1])
+ break
+
+ sizer.Destroy()
+
+ # actually show the hint rectangle on the screen
+ rect.x, rect.y = self._frame.ClientToScreen((rect.x, rect.y))
+ self.ShowHint(rect)
+
+
+ def GetAttributes(self, pane):
+
+ attrs = []
+ attrs.extend([pane.window, pane.frame, pane.state, pane.dock_direction,
+ pane.dock_layer, pane.dock_pos, pane.dock_row,
pane.dock_proportion,
+ pane.floating_pos, pane.floating_size, pane.best_size,
+ pane.min_size, pane.max_size, pane.caption, pane.name,
+ pane.buttons, pane.rect])
+
+ return attrs
+
+
+ def SetAttributes(self, pane, attrs):
+
+ pane.window = attrs[0]
+ pane.frame = attrs[1]
+ pane.state = attrs[2]
+ pane.dock_direction = attrs[3]
+ pane.dock_layer = attrs[4]
+ pane.dock_pos = attrs[5]
+ pane.dock_row = attrs[6]
+ pane.dock_proportion = attrs[7]
+ pane.floating_pos = attrs[8]
+ pane.floating_size = attrs[9]
+ pane.best_size = attrs[10]
+ pane.min_size = attrs[11]
+ pane.max_size = attrs[12]
+ pane.caption = attrs[13]
+ pane.name = attrs[14]
+ pane.buttons = attrs[15]
+ pane.rect = attrs[16]
+
+ return pane
+
+ def UseTransparentDrag(self):
+ if self._flags & AUI_MGR_TRANSPARENT_DRAG:
+ return self.CanMakeWindowsTransparent()
+ else:
+ return False
+
+
+ def OnFloatingPaneMoveStart(self, wnd):
+
+ # try to find the pane
+ pane = self.GetPane(wnd)
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+ if self.UseTransparentDrag() and pane.IsDockable():
+ self.MakeWindowTransparent(pane.frame, 150)
+
+
+ def OnFloatingPaneMoving(self, wnd):
+
+ # try to find the pane
+ pane = self.GetPane(wnd)
+
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ pt = wx.GetMousePosition()
+ client_pt = self._frame.ScreenToClient(pt)
+
+ # calculate the offset from the upper left-hand corner
+ # of the frame to the mouse pointer
+ frame_pos = pane.frame.GetPosition()
+ action_offset = wx.Point(pt[0]-frame_pos.x, pt[1]-frame_pos.y)
+
+ # no hint for toolbar floating windows
+ if pane.IsToolbar() and self._action == actionDragFloatingPane:
+ if self._action == actionDragFloatingPane:
+
+ oldname = pane.name
+ indx = self._panes.index(pane)
+ hint = pane
+ docks, panes = CopyDocksAndPanes2(self._docks, self._panes)
+
+ # find out where the new pane would be
+ ret, hint = self.DoDrop(docks, panes, hint, client_pt)
+
+ if not ret:
+ return
+
+ if hint.IsFloating():
+ return
+
+ pane = hint
+ pane.name = oldname
+
+ self._panes[indx] = pane
+ self._action = actionDragToolbarPane
+ self._action_window = pane.window
+
+ self.Update()
+
+ return
+
+ # if a key modifier is pressed while dragging the frame,
+ # don't dock the window
+ if wx.GetKeyState(wx.WXK_CONTROL):
+ self.HideHint()
+ return
+
+ if pane.IsDockable():
+ self.DrawHintRect(wnd, client_pt, action_offset)
+
+ # reduces flicker
+ self._frame.Update()
+ wx.CallAfter(pane.frame.Refresh)
+
+
+ def OnFloatingPaneMoved(self, wnd):
+
+ # try to find the pane
+ pane = self.GetPane(wnd)
+
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ pt = wx.GetMousePosition()
+ client_pt = self._frame.ScreenToClient(pt)
+
+ indx = self._panes.index(pane)
+
+ # calculate the offset from the upper left-hand corner
+ # of the frame to the mouse pointer
+ frame_pos = pane.frame.GetPosition()
+ action_offset = wx.Point(pt[0]-frame_pos.x, pt[1]-frame_pos.y)
+
+ # if a key modifier is pressed while dragging the frame,
+ # don't dock the window
+ if wx.GetKeyState(wx.WXK_CONTROL):
+ self.HideHint()
+ return
+
+ if not pane.IsToolbar() and pane.IsDockable() and not self._hintshown:
+ if not pane.IsFloating():
+ pane.Float()
+ pane.floating_pos = pane.frame.GetPosition()
+ self._panes[indx] = pane
+ if self.UseTransparentDrag():
+ self.MakeWindowTransparent(pane.frame, 255)
+
+ # do the drop calculation
+ allow, pane = self.DoDrop(self._docks, self._panes, pane, client_pt,
action_offset)
+
+ # if the pane is still floating, update it's floating
+ # position (that we store)
+ if pane.IsFloating():
+ pane.floating_pos = pane.frame.GetPosition()
+ if self.UseTransparentDrag():
+ self.MakeWindowTransparent(pane.frame, 255)
+
+ if not pane.IsToolbar() and pane.IsDockable():
+ pane.name = self._oldname
+
+ self._panes[indx] = pane
+
+ self.Update()
+ self.HideHint()
+
+
+ def OnFloatingPaneResized(self, wnd, size):
+
+ # try to find the pane
+ pane = self.GetPane(wnd)
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ indx = self._panes.index(pane)
+ pane.floating_size = size
+ self._panes[indx] = pane
+
+
+ def OnFloatingPaneClosed(self, wnd):
+
+ # try to find the pane
+ pane = self.GetPane(wnd)
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ indx = self._panes.index(pane)
+ # reparent the pane window back to us and
+ # prepare the frame window for destruction
+ pane.window.Show(False)
+ pane.window.Reparent(self._frame)
+ pane.frame = None
+ pane.Hide()
+
+ self._panes[indx] = pane
+
+
+ def OnFloatingPaneActivated(self, wnd):
+
+ if self.GetFlags() & AUI_MGR_ALLOW_ACTIVE_PANE:
+ # try to find the pane
+ pane = self.GetPane(wnd)
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ self._panes = SetActivePane(self._panes, wnd)
+ self.Repaint()
+
+
+ def Render(self, dc):
+ """
+ Render() draws all of the pane captions, sashes,
+ backgrounds, captions, grippers, pane borders and buttons.
+ It renders the entire user interface.
+ """
+
+ for ii in xrange(len(self._uiparts)):
+ part = self._uiparts[ii]
+
+ # don't draw hidden pane items
+ if part.sizer_item and not part.sizer_item.IsShown():
+ continue
+
+ if part.type == DockUIPart.typeDockSizer or \
+ part.type == DockUIPart.typePaneSizer:
+ self._art.DrawSash(dc, part.orientation, part.rect)
+ elif part.type == DockUIPart.typeBackground:
+ self._art.DrawBackground(dc, part.orientation, part.rect)
+ elif part.type == DockUIPart.typeCaption:
+ self._art.DrawCaption(dc, part.pane.caption, part.rect,
part.pane)
+ elif part.type == DockUIPart.typeGripper:
+ self._art.DrawGripper(dc, part.rect, part.pane)
+ elif part.type == DockUIPart.typePaneBorder:
+ self._art.DrawBorder(dc, part.rect, part.pane)
+ elif part.type == DockUIPart.typePaneButton:
+ self._art.DrawPaneButton(dc, part.button.button_id,
+ AUI_BUTTON_STATE_NORMAL, part.rect,
part.pane)
+
+
+ def Repaint(self, dc=None):
+
+ w, h = self._frame.GetClientSize()
+ # figure out which dc to use if one
+ # has been specified, use it, otherwise
+ # make a client dc
+ client_dc = None
+
+ if not dc:
+ client_dc = wx.ClientDC(self._frame)
+ dc = client_dc
+
+ # if the frame has a toolbar, the client area
+ # origin will not be (0,0).
+ pt = self._frame.GetClientAreaOrigin()
+ if pt.x != 0 or pt.y != 0:
+ dc.SetDeviceOrigin(pt.x, pt.y)
+
+ # render all the items
+ self.Render(dc)
+
+ # if we created a client_dc, delete it
+ if client_dc:
+ del client_dc
+
+
+ def OnPaint(self, event):
+ dc = wx.PaintDC(self._frame)
+ if wx.Platform == "__WXMAC__":
+ #Macs paint optimizations clip the area we need to paint a log
+ #of the time, this is a dirty hack to always paint everything
+ self.Repaint(None)
+ else:
+ self.Repaint(dc)
+
+ event.Skip()
+
+
+ def OnEraseBackground(self, event):
+
+ event.Skip()
+
+
+ def OnSize(self, event):
+
+ if self._frame:
+ self.DoFrameLayout()
+ wx.CallAfter(self.Repaint)
+ event.Skip()
+
+
+ def OnSetCursor(self, event):
+
+ # determine cursor
+ part = self.HitTest(event.GetX(), event.GetY())
+ cursor = None
+
+ if part:
+ if part.type == DockUIPart.typeDockSizer or \
+ part.type == DockUIPart.typePaneSizer:
+
+ # a dock may not be resized if it has a single
+ # pane which is not resizable
+ if part.type == DockUIPart.typeDockSizer and part.dock and \
+ len(part.dock.panes) == 1 and part.dock.panes[0].IsFixed():
+ return
+
+ # panes that may not be resized do not get a sizing cursor
+ if part.pane and part.pane.IsFixed():
+ return
+
+ if part.orientation == wx.VERTICAL:
+ cursor = wx.StockCursor(wx.CURSOR_SIZEWE)
+ else:
+ cursor = wx.StockCursor(wx.CURSOR_SIZENS)
+
+ elif part.type == DockUIPart.typeGripper:
+ cursor = wx.StockCursor(wx.CURSOR_SIZING)
+
+ if cursor is not None:
+ event.SetCursor(cursor)
+
+
+ def UpdateButtonOnScreen(self, button_ui_part, event):
+
+ hit_test = self.HitTest(event.GetX(), event.GetY())
+ state = AUI_BUTTON_STATE_NORMAL
+
+ if hit_test == button_ui_part:
+ if event.LeftDown():
+ state = AUI_BUTTON_STATE_PRESSED
+ else:
+ state = AUI_BUTTON_STATE_HOVER
+ else:
+ if event.LeftDown():
+ state = AUI_BUTTON_STATE_HOVER
+
+ # now repaint the button with hover state
+ cdc = wx.ClientDC(self._frame)
+
+ # if the frame has a toolbar, the client area
+ # origin will not be (0,0).
+ pt = self._frame.GetClientAreaOrigin()
+ if pt.x != 0 or pt.y != 0:
+ cdc.SetDeviceOrigin(pt.x, pt.y)
+
+ self._art.DrawPaneButton(cdc,
+ button_ui_part.button.button_id,
+ state,
+ button_ui_part.rect, hit_test.pane)
+
+
+ def OnLeftDown(self, event):
+
+ part = self.HitTest(event.GetX(), event.GetY())
+
+ if part:
+ if part.dock and part.dock.dock_direction == AUI_DOCK_CENTER:
+ return
+
+ if part.type == DockUIPart.typeDockSizer or \
+ part.type == DockUIPart.typePaneSizer:
+
+ # a dock may not be resized if it has a single
+ # pane which is not resizable
+ if part.type == DockUIPart.typeDockSizer and part.dock and \
+ len(part.dock.panes) == 1 and part.dock.panes[0].IsFixed():
+ return
+
+ # panes that may not be resized should be ignored here
+ if part.pane and part.pane.IsFixed():
+ return
+
+ self._action = actionResize
+ self._action_part = part
+ self._action_hintrect = wx.Rect()
+ self._action_start = wx.Point(event.GetX(), event.GetY())
+ self._action_offset = wx.Point(event.GetX() - part.rect.x,
+ event.GetY() - part.rect.y)
+ self._frame.CaptureMouse()
+ print "resize down:"
+ print "\tRect: ", self._action_hintrect
+ print "\tStart:", self._action_start
+ print "\tOffset:", self._action_offset
+
+ elif part.type == DockUIPart.typePaneButton:
+
+ self._action = actionClickButton
+ self._action_part = part
+ self._action_start = wx.Point(event.GetX(), event.GetY())
+ self._frame.CaptureMouse()
+
+ self.UpdateButtonOnScreen(part, event)
+
+ elif part.type == DockUIPart.typeCaption or \
+ part.type == DockUIPart.typeGripper:
+
+ if self.GetFlags() & AUI_MGR_ALLOW_ACTIVE_PANE:
+ # set the caption as active
+ self._panes = SetActivePane(self._panes, part.pane.window)
+ self.Repaint()
+
+ self._action = actionClickCaption
+ self._action_part = part
+ self._action_start = wx.Point(event.GetX(), event.GetY())
+ self._action_offset = wx.Point(event.GetX() - part.rect.x,
+ event.GetY() - part.rect.y)
+ self._frame.CaptureMouse()
+
+ #event.Skip()
+
+
+ def OnLeftUp(self, event):
+
+ if self._action == actionResize:
+
+ self._frame.ReleaseMouse()
+
+ # get rid of the hint rectangle
+ dc = wx.ScreenDC()
+ DrawResizeHint(dc, self._action_hintrect)
+
+ # resize the dock or the pane
+ if self._action_part and self._action_part.type ==
DockUIPart.typeDockSizer:
+ rect = self._action_part.dock.rect
+ new_pos = wx.Point(event.GetX() - self._action_offset.x,
+ event.GetY() - self._action_offset.y)
+
+ if self._action_part.dock.dock_direction == AUI_DOCK_LEFT:
+ self._action_part.dock.size = new_pos.x - rect.x
+ elif self._action_part.dock.dock_direction == AUI_DOCK_TOP:
+ self._action_part.dock.size = new_pos.y - rect.y
+ elif self._action_part.dock.dock_direction == AUI_DOCK_RIGHT:
+ self._action_part.dock.size = rect.x + rect.width - \
+ new_pos.x - \
+
self._action_part.rect.GetWidth()
+ elif self._action_part.dock.dock_direction == AUI_DOCK_BOTTOM:
+ self._action_part.dock.size = rect.y + rect.height - \
+ new_pos.y - \
+
self._action_part.rect.GetHeight()
+
+ self.Update()
+ self.Repaint(None)
+
+ elif self._action_part and \
+ self._action_part.type == DockUIPart.typePaneSizer:
+
+ dock = self._action_part.dock
+ pane = self._action_part.pane
+
+ total_proportion = 0
+ dock_pixels = 0
+ new_pixsize = 0
+
+ caption_size = self._art.GetMetric(AUI_ART_CAPTION_SIZE)
+ pane_border_size =
self._art.GetMetric(AUI_ART_PANE_BORDER_SIZE)
+ sash_size = self._art.GetMetric(AUI_ART_SASH_SIZE)
+
+ new_pos = wx.Point(event.GetX() - self._action_offset.x,
+ event.GetY() - self._action_offset.y)
+
+ # determine the pane rectangle by getting the pane part
+ pane_part = self.GetPanePart(pane.window)
+ if not pane_part:
+ raise "\nERROR: Pane border part not found -- shouldn't
happen"
+
+ # determine the new pixel size that the user wants
+ # this will help us recalculate the pane's proportion
+ if dock.IsHorizontal():
+ new_pixsize = new_pos.x - pane_part.rect.x
+ else:
+ new_pixsize = new_pos.y - pane_part.rect.y
+
+ # determine the size of the dock, based on orientation
+ if dock.IsHorizontal():
+ dock_pixels = dock.rect.GetWidth()
+ else:
+ dock_pixels = dock.rect.GetHeight()
+
+ # determine the total proportion of all resizable panes,
+ # and the total size of the dock minus the size of all
+ # the fixed panes
+ dock_pane_count = len(dock.panes)
+ pane_position = -1
+
+ for ii in xrange(dock_pane_count):
+ p = dock.panes[ii]
+ if p.window == pane.window:
+ pane_position = ii
+
+ # while we're at it, subtract the pane sash
+ # width from the dock width, because this would
+ # skew our proportion calculations
+ if ii > 0:
+ dock_pixels = dock_pixels - sash_size
+
+ # also, the whole size (including decorations) of
+ # all fixed panes must also be subtracted, because they
+ # are not part of the proportion calculation
+ if p.IsFixed():
+ if dock.IsHorizontal():
+ dock_pixels = dock_pixels - p.best_size.x
+ else:
+ dock_pixels = dock_pixels - p.best_size.y
+ else:
+ total_proportion = total_proportion + p.dock_proportion
+
+ # find a pane in our dock to 'steal' space from or to 'give'
+ # space to -- this is essentially what is done when a pane is
+ # resized the pane should usually be the first non-fixed pane
+ # to the right of the action pane
+ borrow_pane = -1
+
+ for ii in xrange(pane_position+1, dock_pane_count):
+ p = dock.panes[ii]
+ if not p.IsFixed():
+ borrow_pane = ii
+ break
+
+ # demand that the pane being resized is found in this dock
+ # (this assert really never should be raised)
+ if pane_position == -1:
+ raise "\nERROR: Pane not found in dock"
+
+ # prevent division by zero
+ if dock_pixels == 0 or total_proportion == 0 or borrow_pane ==
-1:
+ self._action = actionNone
+ return
+
+ # calculate the new proportion of the pane
+ new_proportion = new_pixsize*total_proportion/dock_pixels
+
+ # default minimum size
+ min_size = 0
+
+ # check against the pane's minimum size, if specified. please
note
+ # that this is not enough to ensure that the minimum size will
+ # not be violated, because the whole frame might later be
shrunk,
+ # causing the size of the pane to violate it's minimum size
+ if pane.min_size.IsFullySpecified():
+ min_size = 0
+ if pane.HasBorder():
+ min_size = min_size + pane_border_size*2
+
+ # calculate minimum size with decorations (border,caption)
+ if pane_part.orientation == wx.VERTICAL:
+ min_size = min_size + pane.min_size.y
+ if pane.HasCaption():
+ min_size = min_size + caption_size
+ else:
+ min_size = min_size + pane.min_size.x
+
+ # for some reason, an arithmatic error somewhere is causing
+ # the proportion calculations to always be off by 1 pixel
+ # for now we will add the 1 pixel on, but we really should
+ # determine what's causing this.
+ min_size = min_size + 1
+
+ min_proportion = min_size*total_proportion/dock_pixels
+
+ if new_proportion < min_proportion:
+ new_proportion = min_proportion
+
+ prop_diff = new_proportion - pane.dock_proportion
+
+ # borrow the space from our neighbor pane to the
+ # right or bottom (depending on orientation)
+ dock.panes[borrow_pane].dock_proportion -= prop_diff
+ pane.dock_proportion = new_proportion
+
+ indxd = self._docks.index(dock)
+ indxp = self._panes.index(pane)
+
+ self._docks[indxd] = dock
+ self._panes[indxp] = pane
+
+ # repaint
+ self.Update()
+ self.Repaint(None)
+
+ elif self._action == actionClickButton:
+
+ self._hover_button = None
+ self._frame.ReleaseMouse()
+ self.UpdateButtonOnScreen(self._action_part, event)
+
+ # make sure we're still over the item that was originally clicked
+ if self._action_part == self.HitTest(event.GetX(), event.GetY()):
+ # fire button-click event
+ e = FrameManagerEvent(wx.EVT_AUI_PANEBUTTON)
+ e.SetPane(self._action_part.pane)
+ e.SetButton(self._action_part.button.button_id)
+ self.ProcessMgrEvent(e)
+
+ elif self._action == actionClickCaption:
+
+ self._frame.ReleaseMouse()
+
+ elif self._action == actionDragFloatingPane:
+
+ self._frame.ReleaseMouse()
+
+ elif self._action == actionDragToolbarPane:
+
+ self._frame.ReleaseMouse()
+
+ pane = self.GetPane(self._action_window)
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ # save the new positions
+ docks = FindDocks(self._docks, pane.dock_direction,
+ pane.dock_layer, pane.dock_row)
+
+ if len(docks) == 1:
+ dock = docks[0]
+ pane_positions, pane_sizes =
self.GetPanePositionsAndSizes(dock)
+
+ dock_pane_count = len(dock.panes)
+ for ii in xrange(dock_pane_count):
+ dock.panes[ii].dock_pos = pane_positions[ii]
+
+ pane.state &= ~PaneInfo.actionPane
+ indx = self._panes.index(pane)
+ self._panes[indx] = pane
+
+ self.Update()
+
+ self._action = actionNone
+ self._last_mouse_move = wx.Point() # see comment in OnMotion()
+
+
+ def OnMotion(self, event):
+
+ # sometimes when Update() is called from inside this method,
+ # a spurious mouse move event is generated this check will make
+ # sure that only real mouse moves will get anywhere in this method
+ # this appears to be a bug somewhere, and I don't know where the
+ # mouse move event is being generated. only verified on MSW
+
+ mouse_pos = event.GetPosition()
+ if self._last_mouse_move == mouse_pos:
+ return
+
+ self._last_mouse_move = mouse_pos
+
+ if self._action == actionResize:
+ pos = self._action_part.rect.GetPosition()
+ if self._action_part.orientation == wx.HORIZONTAL:
+ pos.y = max(0, mouse_pos.y - self._action_offset.y)
+ else:
+ pos.x = max(0, mouse_pos.x - self._action_offset.x)
+
+ mypos = self._frame.ClientToScreen(pos)
+ mysize = self._action_part.rect.GetSize()
+ rect = wx.Rect(mypos[0], mypos[1], mysize[0], mysize[1])
+
+ dc = wx.ScreenDC()
+
+ if not self._action_hintrect.IsEmpty() and self._action_hintrect
!= rect:
+ DrawResizeHint(dc, self._action_hintrect)
+
+ DrawResizeHint(dc, rect)
+ self._action_hintrect = rect
+
+ elif self._action == actionClickCaption:
+
+ drag_x_threshold = wx.SystemSettings_GetMetric(wx.SYS_DRAG_X)
+ drag_y_threshold = wx.SystemSettings_GetMetric(wx.SYS_DRAG_Y)
+
+ # caption has been clicked. we need to check if the mouse
+ # is now being dragged. if it is, we need to change the
+ # mouse action to 'drag'
+ if abs(mouse_pos.x - self._action_start.x) > drag_x_threshold or \
+ abs(mouse_pos.y - self._action_start.y) > drag_y_threshold:
+
+ pane_info = self._action_part.pane
+ indx = self._panes.index(pane_info)
+
+ if not pane_info.IsToolbar():
+
+ if self._flags & AUI_MGR_ALLOW_FLOATING and \
+ pane_info.IsFloatable():
+
+ self._action = actionDragFloatingPane
+
+ # set initial float position
+ pt = self._frame.ClientToScreen(event.GetPosition())
+ pane_info.floating_pos = wx.Point(pt.x -
self._action_offset.x,
+ pt.y -
self._action_offset.y)
+ # float the window
+ pane_info.Float()
+ self._panes[indx] = pane_info
+
+ self.Update()
+
+ self._action_window = pane_info.frame
+
+ # action offset is used here to make it feel "natural"
to the user
+ # to drag a docked pane and suddenly have it become a
floating frame.
+ # Sometimes, however, the offset where the user
clicked on the docked
+ # caption is bigger than the width of the floating
frame itself, so
+ # in that case we need to set the action offset to a
sensible value
+ frame_size = self._action_window.GetSize()
+ if frame_size.x <= self._action_offset.x:
+ self._action_offset.x = 30
+
+ else:
+
+ self._action = actionDragToolbarPane
+ self._action_window = pane_info.window
+
+ elif self._action == actionDragFloatingPane:
+
+ pt = self._frame.ClientToScreen(event.GetPosition())
+ if self._action_window:
+ self._action_window.Move((pt.x - self._action_offset.x,
+ pt.y - self._action_offset.y))
+
+ elif self._action == actionDragToolbarPane:
+
+ pane = self.GetPane(self._action_window)
+ if not pane.IsOk():
+ raise "\nERROR: Pane Window Not Found"
+
+ indx = self._panes.index(pane)
+ pane.state |= PaneInfo.actionPane
+
+ pt = event.GetPosition()
+ ret, pane = self.DoDrop(self._docks, self._panes, pane, pt,
self._action_offset)
+
+ if not ret:
+ return
+
+ # if DoDrop() decided to float the pane, set up
+ # the floating pane's initial position
+ if pane.IsFloating():
+
+ pt = self._frame.ClientToScreen(event.GetPosition())
+ pane.floating_pos = wx.Point(pt.x - self._action_offset.x,
+ pt.y - self._action_offset.y)
+
+ self._panes[indx] = pane
+
+ # this will do the actiual move operation
+ # in the case that the pane has been floated,
+ # this call will create the floating pane
+ # and do the reparenting
+ self.Update()
+
+ # if the pane has been floated, change the mouse
+ # action actionDragFloatingPane so that subsequent
+ # wx.EVT_MOTION() events will move the floating pane
+ if pane.IsFloating():
+
+ pane.state &= ~PaneInfo.actionPane
+ self._action = actionDragFloatingPane
+ self._action_window = pane.frame
+
+ self._panes[indx] = pane
+
+ else:
+
+ part = self.HitTest(event.GetX(), event.GetY())
+ if part and part.type == DockUIPart.typePaneButton:
+ if part != self._hover_button:
+ # make the old button normal
+ if self._hover_button:
+ self.UpdateButtonOnScreen(self._hover_button, event)
+
+ # mouse is over a button, so repaint the
+ # button in hover mode
+ self.UpdateButtonOnScreen(part, event)
+ self._hover_button = part
+ else:
+ if self._hover_button:
+
+ self._hover_button = None
+ self.Repaint()
+
+
+ def OnLeaveWindow(self, event):
+
+ if self._hover_button:
+ self._hover_button = None
+ self.Repaint()
+
+
+ def OnChildFocus(self, event):
+
+ # when a child pane has it's focus set, we should change the
+ # pane's active state to reflect this. (this is only True if
+ # active panes are allowed by the owner)
+ if self.GetFlags() & AUI_MGR_ALLOW_ACTIVE_PANE:
+ if self.GetPane(event.GetWindow()).IsOk():
+ self._panes = SetActivePane(self._panes, event.GetWindow())
+ self._frame.Refresh()
+
+ event.Skip()
+
+
+ def OnPaneButton(self, event):
+ """
+ OnPaneButton() is an event handler that is called
+ when a pane button has been pressed.
+ """
+
+ pane = event.pane
+ indx = self._panes.index(pane)
+
+ if event.button == PaneInfo.buttonClose:
+ pane.Hide()
+ self._panes[indx] = pane
+ self.Update()
+
+ elif event.button == PaneInfo.buttonPin:
+
+ if self._flags & AUI_MGR_ALLOW_FLOATING and pane.IsFloatable():
+ pane.Float()
+
+ self._panes[indx] = pane
+ self.Update()
Added: trunk/gnue-designer/src/uidrivers/wx/uihelpers/PythonEditor.py
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/uihelpers/PythonEditor.py
2006-03-03 17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/uihelpers/PythonEditor.py
2006-03-04 01:22:59 UTC (rev 8201)
@@ -0,0 +1,754 @@
+#
+# 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-2006 Free Software Foundation
+#
+# FILE:
+# SplitDock.py
+#
+# DESCRIPTION:
+"""
+Provides a python editing widget based on scintilla.
+"""
+# NOTES:
+# This is largely based on the scintilla control
+# used in Stani's Python Editor, which was in turn
+# largely based on the wxPython example code.
+
+import re
+import wx
+import wx.stc as wx_stc
+import wx.gizmos as wx_gizmos
+
+import inspect,keyword,os,sys,types
+
+#-------------------------------------------------------------------------------
+
+WORDCHARS = "_.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+
+#-------------------------------------------------------------------------------
+try:
+ True
+except NameError:
+ True = 1==1
+ False = 1==0
+
+
+
+#----------------------------------------------------------------------
+
+class PythonBaseSTC(wx_stc.StyledTextCtrl):
+ def __init__(self, parent, id=-1,namespace={},path=None,config=None,
+ ignore=None,menu=None, pos=(0,0)):
+ wx_stc.StyledTextCtrl.__init__(self, parent, id,
+ style =
wx.FULL_REPAINT_ON_RESIZE|wx.NO_BORDER, pos=pos)
+ #PASSING VALUES
+ self.namespace=namespace
+ self.config=config
+ self.ignore=ignore
+ if path and path not in sys.path: sys.path.append(path)
+
+ #INITIALIZE
+ self.calltip = 0 #calltip counter
+ self.menu = menu
+ self.SetLexer(wx_stc.STC_LEX_PYTHON)
+
+ #KEYBOARD SHORTCUTS (what are they doing here?)
+ self.CmdKeyAssign(ord('B'), wx_stc.STC_SCMOD_CTRL,
wx_stc.STC_CMD_ZOOMIN)
+ self.CmdKeyAssign(ord('N'), wx_stc.STC_SCMOD_CTRL,
wx_stc.STC_CMD_ZOOMOUT)
+
+ #PYTHON
+ self.SetLexer(wx_stc.STC_LEX_PYTHON)
+ keywords=keyword.kwlist
+ keywords.extend(['None','as','True','False'])
+ self.SetKeyWords(0, " ".join(keywords))
+
+ #GENERAL
+ self.AutoCompSetIgnoreCase(False)
+
+ #FOLDING
+ self.SetProperty("fold", "1")
+ self.SetProperty("tab.timmy.whinge.level", "1")
+ self.SetProperty("fold.comment.python", "0")
+ self.SetProperty("fold.quotes.python", "0")
+
+ #USER SETTINGS
+ if self.config:
+ self.update()
+ else:
+ self.SetViewWhiteSpace(0)
+ self.SetTabWidth(4)
+ self.SetIndentationGuides(1)
+ self.SetUseTabs(0)
+ self.SetEdgeMode(wx_stc.STC_EDGE_LINE)
+ self.SetEdgeColumn(79)
+ #self.faces
+ if wx.Platform == '__WXMSW__':
+ self.faces = { 'times': 'Courier New',
+ 'mono' : 'Courier',
+ 'helv' : 'Courier',
+ 'other': 'Courier',
+ 'size' : 10,
+ 'size2': 10,
+ }
+ ## self.faces = { 'times': 'Times New Roman',
+ ## 'mono' : 'Courier New',
+ ## 'helv' : 'Arial',
+ ## 'other': 'Comic Sans MS',
+ ## 'size' : 10,
+ ## 'size2': 8,
+ ## }
+ else:
+ self.faces = { 'times': 'Times',
+ 'mono' : 'Courier',
+ 'helv' : 'Helvetica',
+ 'other': 'new century schoolbook',
+ 'size' : 12,
+ 'size2': 10,
+ }
+ self.SetWordChars(WORDCHARS)
+ self.SetStyles()
+
+ self.SetBackSpaceUnIndents(1)
+## self.SetTabIndents(0)
+## self.SetIndent(1)
+ self.SetEdgeColumn(79)
+ self.SetEdgeColour(wx.Colour(200,200,200))
+
+ #MARGINS
+ self.SetMargins(0,0)
+ #margin 1 for line numbers
+ self.SetMarginType(1, wx_stc.STC_MARGIN_NUMBER)
+ self.SetMarginWidth(1, 50)
+ #margin 2 for markers
+ self.SetMarginType(2, wx_stc.STC_MARGIN_SYMBOL)
+ self.SetMarginMask(2, wx_stc.STC_MASK_FOLDERS)
+ self.SetMarginSensitive(2, True)
+ self.SetMarginWidth(2, 12)
+ if 0: # simple folder marks, like the old version
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDER,
wx_stc.STC_MARK_ARROW, "navy", "navy")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDEROPEN,
wx_stc.STC_MARK_ARROWDOWN, "navy", "navy")
+ # Set these to an invisible mark
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDEROPENMID,
wx_stc.STC_MARK_BACKGROUND, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDERMIDTAIL,
wx_stc.STC_MARK_BACKGROUND, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDERSUB,
wx_stc.STC_MARK_BACKGROUND, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDERTAIL,
wx_stc.STC_MARK_BACKGROUND, "white", "black")
+
+ else: # more involved "outlining" folder marks
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDEREND,
wx_stc.STC_MARK_BOXPLUSCONNECTED, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDEROPENMID,
wx_stc.STC_MARK_BOXMINUSCONNECTED, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDERMIDTAIL,
wx_stc.STC_MARK_TCORNER, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDERTAIL,
wx_stc.STC_MARK_LCORNER, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDERSUB,
wx_stc.STC_MARK_VLINE, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDER,
wx_stc.STC_MARK_BOXPLUS, "white", "black")
+ self.MarkerDefine(wx_stc.STC_MARKNUM_FOLDEROPEN,
wx_stc.STC_MARK_BOXMINUS, "white", "black")
+ wx_stc.EVT_STC_UPDATEUI(self, id, self.OnUpdateUI)
+ wx_stc.EVT_STC_MARGINCLICK(self, id, self.OnMarginClick)
+
+ # STYLES
+ # Make some styles, The lexer defines what each style is used for, we
+ # just have to define what each style looks like. This set is adapted
from
+ # Scintilla sample property files.
+ # Default style
+ self.StyleSetSpec(wx_stc.STC_STYLE_DEFAULT,
+ "face:%(mono)s,size:%(size)d" % \
+ self.faces)
+ self.StyleSetBackground(wx_stc.STC_STYLE_BRACELIGHT,"#AAAAFF")
+
+ self.SetCaretForeground("BLACK")
+ self.SetSelBackground(1,'DARK TURQUOISE')
+
+ #EVENTS
+ self.Bind(wx_stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
+ self.Bind(wx_stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
+ self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
+ self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMiddleDown)
+ self.Bind(wx.EVT_CHAR, self.OnChar)
+ if self.menu:
+ self.UsePopUp(False)
+ if wx.Platform=='__WXMAC__':
+ self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightClick)
+ else:
+ self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
+
+ #---events
+ def OnLeftDown(self,event):
+ if not event.ShiftDown():
+ self.SetSelectionEnd(0)
+ event.Skip()
+
+ def OnMiddleDown(self,event):
+ code = self.GetSelectedText()
+ pos = self.PositionFromPointClose(event.GetX(),event.GetY())
+ event.Skip()
+ self.SetSelection(pos,pos)
+ self.ReplaceSelection(code)
+
+ def OnKeyDown(self, event):
+ """"""
+ key = event.KeyCode()
+ control = event.ControlDown()
+ #shift=event.ShiftDown()
+ alt = event.AltDown()
+ if key == wx.WXK_RETURN and not control and not alt and not
self.AutoCompActive():
+ #auto-indentation
+ if self.CallTipActive():
+ self.CallTipCancel()
+ self.calltip=0
+ line = self.GetCurrentLine()
+ txt = self.GetLine(line)
+ pos = self.GetCurrentPos()
+ linePos = self.PositionFromLine(line)
+ self.CmdKeyExecute(wx_stc.STC_CMD_NEWLINE)
+ indent = self.GetLineIndentation(line)
+ padding = self.indentation * (indent/max(1,self.tabWidth))
+ newpos = self.GetCurrentPos()
+ # smart indentation
+ stripped = txt[:pos-linePos].split('#')[0].strip()
+ firstWord = stripped.split(" ")[0]
+ if stripped and self.needsIndent(firstWord,lastChar=stripped[-1]):
+ padding += self.indentation
+ elif self.needsDedent(firstWord):
+ padding = padding[:-self.tabWidth]
+ self.InsertText(newpos, padding)
+ newpos += len(padding)
+ self.SetCurrentPos(newpos)
+ self.SetSelection(newpos, newpos)
+ else:
+ event.Skip()
+
+ def OnChar(self,event):
+ key = event.KeyCode()
+ control = event.ControlDown()
+ alt = event.AltDown()
+ # GF We avoid an error while evaluating chr(key), next line.
+ if key > 255 or key < 0:
+ event.Skip()
+ # GF No keyboard needs control or alt to make '(', ')' or '.'
+ # GF Shift is not included as it is needed in some keyboards.
+ elif chr(key) in ['(',')','.'] and not control and not alt:
+ CallTips = self.get('CallTips').lower()
+ if key == ord('(') and CallTips!='disable':
+ # ( start tips
+ if self.CallTipActive():
+ self.calltip += 1
+ self.AddText('(')
+ else:
+ self.showCallTip('(')
+ elif key == ord(')'):
+ # ) end tips
+ self.AddText(')')
+ if self.calltip:
+ self.calltip -=1
+ if not self.calltip:
+ self.CallTipCancel()
+ elif key == ord('.') and self.getint('AutoComplete'):
+ # . Code completion
+ self.autoComplete(object=1)
+ else:
+ event.Skip()
+ else:
+ event.Skip()
+
+ def OnUpdateUI(self, evt):
+ # check for matching braces
+ braceAtCaret = -1
+ braceOpposite = -1
+ charBefore = None
+ caretPos = self.GetCurrentPos()
+ if caretPos > 0:
+ charBefore = self.GetCharAt(caretPos - 1)
+ styleBefore = self.GetStyleAt(caretPos - 1)
+
+ # check before
+ if charBefore and chr(charBefore) in "[]{}()" and styleBefore ==
wx_stc.STC_P_OPERATOR:
+ braceAtCaret = caretPos - 1
+
+ # check after
+ if braceAtCaret < 0:
+ charAfter = self.GetCharAt(caretPos)
+ styleAfter = self.GetStyleAt(caretPos)
+ if charAfter and chr(charAfter) in "[]{}()" and styleAfter ==
wx_stc.STC_P_OPERATOR:
+ braceAtCaret = caretPos
+
+ if braceAtCaret >= 0:
+ braceOpposite = self.BraceMatch(braceAtCaret)
+
+ if braceAtCaret != -1 and braceOpposite == -1:
+ self.BraceBadLight(braceAtCaret)
+ else:
+ self.BraceHighlight(braceAtCaret, braceOpposite)
+ #pt = self.PointFromPosition(braceOpposite)
+ #self.Refresh(True, wx.Rect(pt.x, pt.y, 5,5))
+ #print pt
+ #self.Refresh(False)
+
+
+ def OnMarginClick(self, evt):
+ # fold and unfold as needed
+ if evt.GetMargin() == 2:
+ if evt.GetShift() and evt.GetControl():
+ self.FoldAll()
+ else:
+ lineClicked = self.LineFromPosition(evt.GetPosition())
+ if self.GetFoldLevel(lineClicked) &
wx_stc.STC_FOLDLEVELHEADERFLAG:
+ if evt.GetShift():
+ self.SetFoldExpanded(lineClicked, True)
+ self.Expand(lineClicked, True, True, 1)
+ elif evt.GetControl():
+ if self.GetFoldExpanded(lineClicked):
+ self.SetFoldExpanded(lineClicked, False)
+ self.Expand(lineClicked, False, True, 0)
+ else:
+ self.SetFoldExpanded(lineClicked, True)
+ self.Expand(lineClicked, True, True, 100)
+ else:
+ self.ToggleFold(lineClicked)
+
+
+ def OnRightClick(self, event):
+ self.PopupMenu(self.menu)
+
+ def SetViewEdge(self,check):
+ if check:
+ self.SetEdgeMode(wx_stc.STC_EDGE_LINE)
+ else:
+ self.SetEdgeMode(wx_stc.STC_EDGE_NONE)
+
+ def FoldAll(self):
+ lineCount = self.GetLineCount()
+ expanding = True
+
+ # find out if we are folding or unfolding
+ for lineNum in range(lineCount):
+ if self.GetFoldLevel(lineNum) & wx_stc.STC_FOLDLEVELHEADERFLAG:
+ expanding = not self.GetFoldExpanded(lineNum)
+ break;
+
+ lineNum = 0
+ while lineNum < lineCount:
+ level = self.GetFoldLevel(lineNum)
+ if level & wx_stc.STC_FOLDLEVELHEADERFLAG and \
+ (level & wx_stc.STC_FOLDLEVELNUMBERMASK) ==
wx_stc.STC_FOLDLEVELBASE:
+
+ if expanding:
+ self.SetFoldExpanded(lineNum, True)
+ lineNum = self.Expand(lineNum, True)
+ lineNum = lineNum - 1
+ else:
+ lastChild = self.GetLastChild(lineNum, -1)
+ self.SetFoldExpanded(lineNum, False)
+ if lastChild > lineNum:
+ self.HideLines(lineNum+1, lastChild)
+
+ lineNum = lineNum + 1
+
+ def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
+ lastChild = self.GetLastChild(line, level)
+ line = line + 1
+ while line <= lastChild:
+ if force:
+ if visLevels > 0:
+ self.ShowLines(line, line)
+ else:
+ self.HideLines(line, line)
+ else:
+ if doExpand:
+ self.ShowLines(line, line)
+
+ if level == -1:
+ level = self.GetFoldLevel(line)
+
+ if level & wx_stc.STC_FOLDLEVELHEADERFLAG:
+ if force:
+ if visLevels > 1:
+ self.SetFoldExpanded(line, True)
+ else:
+ self.SetFoldExpanded(line, False)
+ line = self.Expand(line, doExpand, force, visLevels-1)
+
+ else:
+ if doExpand and self.GetFoldExpanded(line):
+ line = self.Expand(line, True, force, visLevels-1)
+ else:
+ line = self.Expand(line, False, force, visLevels-1)
+ else:
+ line = line + 1;
+
+ return line
+
+#---preferences-----------------------------------------------------------------
+ def get(self,name):
+ return self.config.get('Default',name)
+
+ def getint(self,name):
+ try:
+ return self.config.getint('Default',name)
+ except:#True,False
+ if eval(self.config.get('Default',name)):
+ return 1
+ else:
+ return 0
+
+ def update(self):
+ #general
+ font,size=self.get('Font').split(',')
+ size=eval(size)
+ self.faces={'times': font, 'mono' : font, 'helv' : font, 'other': font,
+ 'size' : size, 'size2': size}
+ self.SetStyles()
+ #guides
+ self.SetEdgeColumn(self.getint('EdgeColumn'))
+ self.SetViewEdge(self.getint('ViewEdge'))
+ self.SetIndentationGuides(self.getint('IndentationGuides'))
+ #tabs & whitespaces
+ self.tabWidth = self.getint('TabWidth')
+ self.SetTabWidth(self.getint('TabWidth'))
+ self.SetUseTabs(self.getint('UseTabs'))
+ self.SetViewWhiteSpace(self.getint('ViewWhiteSpace'))
+ if self.getint('UseTabs'):
+ self.indentation = '\t'
+ else:
+ self.indentation = " " * self.tabWidth
+ self.SetWordChars(self.get('WordChars'))
+
+ def SetStyles(self):
+ # anti-aliasing
+ if hasattr(self,'SetUseAntiAliasing'):
+ self.SetUseAntiAliasing(True)
+
+ #INDICATOR STYLES FOR ERRORS (self.errorMark)
+ self.IndicatorSetStyle(2, wx_stc.STC_INDIC_SQUIGGLE)
+ self.IndicatorSetForeground(2, wx.RED)
+
+ if 1:
+ self.StyleClearAll()
+
+ # Global default styles for all languages
+ self.StyleSetSpec(wx_stc.STC_STYLE_DEFAULT,
"face:%(helv)s,size:%(size)d" % self.faces)
+ self.StyleSetSpec(wx_stc.STC_STYLE_LINENUMBER,
"back:#C0C0C0,face:%(helv)s,size:%(size2)d" % self.faces)
+ self.StyleSetSpec(wx_stc.STC_STYLE_CONTROLCHAR, "face:%(other)s" %
self.faces)
+ self.StyleSetSpec(wx_stc.STC_STYLE_BRACELIGHT,
"fore:#FFFFFF,back:#0000FF,bold")
+ self.StyleSetSpec(wx_stc.STC_STYLE_BRACEBAD,
"fore:#000000,back:#FF0000,bold")
+
+ # Python styles
+ # White space
+ self.StyleSetSpec(wx_stc.STC_P_DEFAULT,
"face:%(mono)s,size:%(size)d" % self.faces)
+ # Comment
+ self.StyleSetSpec(wx_stc.STC_P_COMMENTLINE,
"fore:#007F00,back:#E8FFE8,italic,face:%(other)s,size:%(size)d" % self.faces)
+ # Number
+ self.StyleSetSpec(wx_stc.STC_P_NUMBER,
"fore:#007F7F,size:%(size)d" % self.faces)
+ # String
+ self.StyleSetSpec(wx_stc.STC_P_STRING,
"fore:#7F007F,face:%(times)s,size:%(size)d" % self.faces)
+ # Single quoted string
+ self.StyleSetSpec(wx_stc.STC_P_CHARACTER,
"fore:#7F007F,face:%(times)s,size:%(size)d" % self.faces)
+ # Keyword
+ self.StyleSetSpec(wx_stc.STC_P_WORD,
"fore:#00007F,bold,size:%(size)d" % self.faces)
+ # Triple quotes
+ self.StyleSetSpec(wx_stc.STC_P_TRIPLE,
"fore:#7F0000,size:%(size)d" % self.faces)
+ # Triple double quotes
+ self.StyleSetSpec(wx_stc.STC_P_TRIPLEDOUBLE,
"fore:#7F0000,size:%(size)d" % self.faces)
+ # Class name definition
+ self.StyleSetSpec(wx_stc.STC_P_CLASSNAME,
"fore:#0000FF,bold,underline,size:%(size)d" % self.faces)
+ # Function or method name definition
+ self.StyleSetSpec(wx_stc.STC_P_DEFNAME,
"fore:#007F7F,bold,size:%(size)d" % self.faces)
+ # Operators
+ self.StyleSetSpec(wx_stc.STC_P_OPERATOR, "bold,size:%(size)d" %
self.faces)
+ # Identifiers
+ self.StyleSetSpec(wx_stc.STC_P_IDENTIFIER, "")
+ # Comment-blocks
+ self.StyleSetSpec(wx_stc.STC_P_COMMENTBLOCK,
"fore:#990000,back:#C0C0C0,italic,size:%(size)d" % self.faces)
+ # End of line where string is not closed
+ self.StyleSetSpec(wx_stc.STC_P_STRINGEOL,
"fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % self.faces)
+
+ #---get
+ def getWord(self,whole=None):
+ for delta in (0,-1,1):
+ word = self._getWord(whole=whole,delta=delta)
+ if word: return word
+ return ''
+
+ def _getWord(self,whole=None,delta=0):
+ pos = self.GetCurrentPos()+delta
+ line = self.GetCurrentLine()
+ linePos = self.PositionFromLine(line)
+ txt = self.GetLine(line)
+ start = self.WordStartPosition(pos,1)
+ if whole:
+ end = self.WordEndPosition(pos,1)
+ else:
+ end = pos
+ return txt[start-linePos:end-linePos]
+
+ def getWords(self,word=None,whole=None):
+ if not word: word = self.getWord(whole=whole)
+ if not word:
+ return []
+ else:
+ return sm.unique([x for x in re.findall(r"\b" + word + r"\w+\b",
self.GetText())
+ if x.find(',')==-1 and x[0]!= ' '])
+
+ def getWordObject(self,word=None,whole=None):
+ if not word: word=self.getWord(whole=whole)
+ try:
+ obj = self.evaluate(word)
+ return obj
+ except:
+ return None
+
+ def getWordFileName(self,whole=None):
+ wordList=self.getWord(whole=whole).split('.')
+ wordList.append('')
+ index=1
+ n=len(wordList)
+ while index<n:
+ word='.'.join(wordList[:-index])
+ try:
+ fileName =
self.getWordObject(word=word).__file__.replace('.pyc','.py').replace('.pyo','.py')
+ if os.path.exists(fileName):
+ return fileName
+ except:
+ pass
+ index+=1
+ return '"%s.py"'%'.'.join(wordList[:-1])
+
+ #---methods
+ def assertEOL(self):
+ self.ConvertEOLs(self.GetEOLMode())
+
+ def autoComplete(self,object=0):
+ word = self.getWord()
+ if not word:
+ if object:
+ self.AddText('.')
+ return
+ if object:
+ self.AddText('.')
+ word+='.'
+ words = self.getWords(word=word)
+ if word[-1] == '.':
+ try:
+ obj = self.getWordObject(word[:-1])
+ if obj:
+ for attr in dir(obj):
+ attr = '%s%s'%(word,attr)
+ if attr not in words: words.append(attr)
+ except:
+ pass
+ if words:
+ words.sort()
+ try:
+ self.AutoCompShow(len(word), " ".join(words))
+ except:
+ pass
+
+ def evaluate(self,word):
+ if word in self.namespace.keys():return self.namespace[word]
+ try:
+ self.namespace[word]=eval(word,self.namespace)
+ return self.namespace[word]
+ except:
+ try:
+ self.get('AutoCompleteIgnore').index(word)
+ return None
+ except:
+ try:
+ components = word.split('.')
+ try:
+ mod= __import__(word)
+ except:
+ if len(components) < 2:
+ return None
+ mod = '.'.join(components[:-1])
+ try:
+ mod= __import__(mod)
+ except:
+ return None
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ self.namespace[word]=mod
+ return mod
+ except:
+ return None
+
+ def markError(self,lineno,offset):
+ self.StartStyling(self.PositionFromLine(lineno-1),
wx_stc.STC_INDICS_MASK)
+ self.SetStyling(offset, wx_stc.STC_INDIC2_MASK)
+ self.Colourise(0, -1)
+
+ def clearError(self,length):
+ self.StartStyling(0, wx_stc.STC_INDICS_MASK)
+ self.SetStyling(length, 0)
+ self.Colourise(0, -1)
+
+ def needsIndent(self,firstWord,lastChar):
+ "Tests if a line needs extra indenting, ie if, while, def, etc "
+ # remove trailing : on token
+ if len(firstWord) > 0:
+ if firstWord[-1] == ":":
+ firstWord = firstWord[:-1]
+ # control flow keywords
+ if firstWord in ["for","if", "else", "def","class","elif",
"try","except","finally","while"] and lastChar == ':':
+ return True
+ else:
+ return False
+
+ def needsDedent(self,firstWord):
+ "Tests if a line needs extra dedenting, ie break, return, etc "
+ # control flow keywords
+ if firstWord in ["break","return","continue","yield","raise"]:
+ return True
+ else:
+ return False
+
+ def showCallTip(self,text=''):
+ #prepare
+ obj = self.getWordObject()
+ self.AddText(text)
+ if not obj: return
+ #classes, methods & functions
+ if type(obj) in [types.ClassType,types.TypeType] and
hasattr(obj,'__init__'):
+ init = obj.__init__
+ tip = getargspec(init).strip()
+ if tip == '(self, *args, **kwargs)':
+ tip = ""
+ else:
+ tip = "%s\n"%tip
+ doci = init.__doc__
+ if doci:
+ doc = '%s\n'%(doci.strip())
+ else:
+ doc = ""
+ tip = getargspec(init)
+ else:
+ doc = ""
+ tip = getargspec(obj)
+ #normal docstring
+ _doc = obj.__doc__
+ #compose
+ if _doc: doc += _doc
+ if doc:
+ if self.get('CallTips').lower() == 'first paragraph only':
+ tip += doc.split('\n')[0]
+ else:
+ tip += doc
+ if tip:
+ pos = self.GetCurrentPos()
+ self.calltip = 1
+ tip+='\n(Press ESC to close)'
+ self.CallTipSetBackground('#FFFFE1')
+ self.CallTipShow(pos, tip.replace('\r\n','\n'))
+
+
+
+
+
+class PythonViewSTC(PythonBaseSTC):
+ """Mutation for dynamic class"""
+ def __init__(self,parent, child = None, *args,**kwds):
+ PythonBaseSTC.__init__(self,parent,*args,**kwds)
+ self.dyn_sash = parent
+ self.child = child
+ self._args = args
+ self._kwds = kwds
+ self.SetupScrollBars()
+ wx_gizmos.EVT_DYNAMIC_SASH_SPLIT(self,-1,self.OnSplit)
+ wx_gizmos.EVT_DYNAMIC_SASH_UNIFY(self,-1,self.OnUnify)
+ wx.EVT_SET_FOCUS(self,self.OnSetFocus)
+ self.SetScrollbar(wx.HORIZONTAL, 0, 0, 0)
+ self.SetScrollbar(wx.VERTICAL, 0, 0, 0)
+##
eventManager.Register(self.OnSplit,wx_gizmos.EVT_DYNAMIC_SASH_SPLIT,self)
+##
eventManager.Register(self.OnUnify,wx_gizmos.EVT_DYNAMIC_SASH_UNIFY,self)
+
+ def SetupScrollBars(self):
+ # hook the scrollbars provided by the wxDynamicSashWindow
+ # to this view
+ v_bar = self.dyn_sash.GetVScrollBar(self)
+ h_bar = self.dyn_sash.GetHScrollBar(self)
+ wx.EVT_SCROLL(v_bar,self.OnSBScroll)
+ wx.EVT_SCROLL(h_bar,self.OnSBScroll)
+ wx.EVT_SET_FOCUS(v_bar, self.OnSBFocus)
+ wx.EVT_SET_FOCUS(h_bar, self.OnSBFocus)
+## eventManager.Register(self.OnSBScroll, wx.EVT_SCROLL, v_bar)
+## eventManager.Register(self.OnSBScroll, wx.EVT_SCROLL, h_bar)
+## eventManager.Register(self.OnSBFocus, wx.EVT_SET_FOCUS, v_bar)
+## eventManager.Register(self.OnSBFocus, wx.EVT_SET_FOCUS, h_bar)
+
+ # And set the wxStyledText to use these scrollbars instead
+ # of its built-in ones.
+ self.SetVScrollBar(v_bar)
+ self.SetHScrollBar(h_bar)
+
+ def OnSetFocus(self,event):
+ self.child.source = self
+ event.Skip()
+
+ def OnSplit(self, evt):
+ newview = PythonViewSTC(self.dyn_sash, child = self.child,
*self._args, **self._kwds)
+ newview.SetDocPointer(self.GetDocPointer()) # use the same document
+ self.SetupScrollBars()
+
+ def OnUnify(self, evt):
+ self.SetupScrollBars()
+ children = self.dyn_sash.GetChildren()[-1].GetChildren()
+ while children[-1].__class__!=PythonViewSTC:
+ children = children[-1].GetChildren()
+ source = self.child.source = self.dyn_sash.view = children[-1]
+
+ def OnSBScroll(self, evt):
+ # redirect the scroll events from the dyn_sash's scrollbars to the STC
+ self.GetEventHandler().ProcessEvent(evt)
+
+ def OnSBFocus(self, evt):
+ # when the scrollbar gets the focus move it back to the STC
+ self.SetFocus()
+
+class PythonSashSTC(wx_gizmos.DynamicSashWindow):
+ def __init__(self,parent,*args,**kwds):
+ wx_gizmos.DynamicSashWindow.__init__(self, parent,-1, style =
wx.CLIP_CHILDREN | wx.FULL_REPAINT_ON_RESIZE
+ #| wxDS_MANAGE_SCROLLBARS
+ #| wxDS_DRAG_CORNER
+ )
+ self.parent = parent
+ self.view = PythonViewSTC(parent=self, id=-1, child = parent, *args,
**kwds)
+ #print dir(self)
+
+if wx.Platform == "__WXMAC__":
+ #The dynamic sash currently fails on the Mac. The problem is being looked
into...
+ PythonSTC = PythonBaseSTC
+else:
+ PythonSTC = PythonBaseSTC#PythonSashSTC
+
+#-------------------------------------------------------------------------------
+
+def getargspec(func):
+ """Get argument specifications"""
+ try:
+ func=func.im_func
+ except:
+ pass
+ try:
+ return inspect.formatargspec(*inspect.getargspec(func)).replace('self,
','')+'\n\n'
+ except:
+ pass
+ try:
+ return
inspect.formatargvalues(*inspect.getargvalues(func)).replace('self, ','')+'\n\n'
+ except:
+ return ''
+
Property changes on:
trunk/gnue-designer/src/uidrivers/wx/uihelpers/PythonEditor.py
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/gnue-designer/src/uidrivers/wx/uihelpers/README.txt
===================================================================
--- trunk/gnue-designer/src/uidrivers/wx/uihelpers/README.txt 2006-03-03
17:45:45 UTC (rev 8200)
+++ trunk/gnue-designer/src/uidrivers/wx/uihelpers/README.txt 2006-03-04
01:22:59 UTC (rev 8201)
@@ -0,0 +1,7 @@
+The following two files are externally maintained, from sigmacore.net/andrea/.
+
+* PyAUI.py -- a docking library for wx2.6.
+
+* AdvancedSplash.py -- a splashscreen interface that handles
+ drawing text over the splash.
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8201 - in trunk/gnue-designer/src: . base base/tools forms forms/LayoutEditor forms/LayoutEditor/renderers/Base forms/LayoutEditor/renderers/native navigator reports reports/Char reports/Standard schema schema/DiaEditor templates/forms uidrivers/wx uidrivers/wx/docks uidrivers/wx/startup uidrivers/wx/uihelpers,
jcater <=