sunuml-svn-commit Mailing List for SunUML
Status: Planning
Brought to you by:
lazaruslong
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <nee...@us...> - 2009-03-23 18:41:03
|
Revision: 15 http://sunuml.svn.sourceforge.net/sunuml/?rev=15&view=rev Author: neerod_s Date: 2009-03-23 18:40:57 +0000 (Mon, 23 Mar 2009) Log Message: ----------- add some Eclipse setting files to svn-ignore Property Changed: ---------------- sunuml/trunk/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-31 10:39:09
|
Revision: 14 http://sunuml.svn.sourceforge.net/sunuml/?rev=14&view=rev Author: aids Date: 2008-12-31 10:39:05 +0000 (Wed, 31 Dec 2008) Log Message: ----------- UI work: Model Explorer/Properties explorer. Core UML classes - skeletons. Modified Paths: -------------- sunuml/trunk/.pydevproject sunuml/trunk/doc/sunuml.uml sunuml/trunk/ui/__init__.py sunuml/trunk/ui/mainframe.py sunuml/trunk/ui/sunumlapp.py Added Paths: ----------- sunuml/trunk/core/__init__.py sunuml/trunk/core/project.py sunuml/trunk/core/projectstorage.py sunuml/trunk/core/uml/ sunuml/trunk/core/uml/__init__.py sunuml/trunk/core/uml/annotationelements.py sunuml/trunk/core/uml/classelements.py sunuml/trunk/core/uml/containerelements.py sunuml/trunk/core/uml/links.py sunuml/trunk/core/uml/modelelement.py sunuml/trunk/core/uml/sequenceelements.py sunuml/trunk/core/uml/usecaseelements.py sunuml/trunk/ui/modelexplorer.py sunuml/trunk/ui/newproject.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:13:59
|
Revision: 13 http://sunuml.svn.sourceforge.net/sunuml/?rev=13&view=rev Author: aids Date: 2008-12-23 23:13:48 +0000 (Tue, 23 Dec 2008) Log Message: ----------- SunUML UI skeleton Modified Paths: -------------- sunuml/trunk/doc/sunuml.uml Added Paths: ----------- sunuml/trunk/.project sunuml/trunk/.pydevproject sunuml/trunk/main.py sunuml/trunk/ui/ sunuml/trunk/ui/__init__.py sunuml/trunk/ui/mainframe.py sunuml/trunk/ui/sunumlapp.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:08:28
|
Revision: 9 http://sunuml.svn.sourceforge.net/sunuml/?rev=9&view=rev Author: aids Date: 2008-12-23 23:05:42 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/SunUMLMainFrame.py Removed Paths: ------------- sunuml/trunk/core/SunUMLMainFrame.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:07:18
|
Revision: 12 http://sunuml.svn.sourceforge.net/sunuml/?rev=12&view=rev Author: aids Date: 2008-12-23 23:06:57 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/SunUMLWorkspaceTreeUITool.py Removed Paths: ------------- sunuml/trunk/core/SunUMLWorkspaceTreeUITool.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:06:37
|
Revision: 11 http://sunuml.svn.sourceforge.net/sunuml/?rev=11&view=rev Author: aids Date: 2008-12-23 23:06:35 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/SunUMLUITool.py Removed Paths: ------------- sunuml/trunk/core/SunUMLUITool.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:06:35
|
Revision: 10 http://sunuml.svn.sourceforge.net/sunuml/?rev=10&view=rev Author: aids Date: 2008-12-23 23:06:09 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/SunUMLMainFrameBase.py Removed Paths: ------------- sunuml/trunk/core/SunUMLMainFrameBase.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:06:31
|
Revision: 7 http://sunuml.svn.sourceforge.net/sunuml/?rev=7&view=rev Author: aids Date: 2008-12-23 23:04:37 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/main.py Removed Paths: ------------- sunuml/trunk/core/main.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:05:13
|
Revision: 8 http://sunuml.svn.sourceforge.net/sunuml/?rev=8&view=rev Author: aids Date: 2008-12-23 23:05:06 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/SunUMLDrawingUITool.py Removed Paths: ------------- sunuml/trunk/core/SunUMLDrawingUITool.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:04:16
|
Revision: 6 http://sunuml.svn.sourceforge.net/sunuml/?rev=6&view=rev Author: aids Date: 2008-12-23 23:04:05 +0000 (Tue, 23 Dec 2008) Log Message: ----------- move experimental code to another folder Added Paths: ----------- sunuml/trunk/experiments/images.py Removed Paths: ------------- sunuml/trunk/core/images.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-23 23:00:29
|
Revision: 5 http://sunuml.svn.sourceforge.net/sunuml/?rev=5&view=rev Author: aids Date: 2008-12-23 22:34:29 +0000 (Tue, 23 Dec 2008) Log Message: ----------- placeholder for experiments Added Paths: ----------- sunuml/trunk/experiments/ sunuml/trunk/experiments/placeholder.txt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2008-12-12 09:26:23
|
Revision: 4 http://sunuml.svn.sourceforge.net/sunuml/?rev=4&view=rev Author: aids Date: 2008-12-12 09:26:19 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Domain model + first use cases. Added Paths: ----------- sunuml/trunk/doc/sunuml.uml This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pc...@us...> - 2008-11-10 22:22:19
|
Revision: 3 http://sunuml.svn.sourceforge.net/sunuml/?rev=3&view=rev Author: pcastor Date: 2008-11-10 21:33:43 +0000 (Mon, 10 Nov 2008) Log Message: ----------- .doc documentation of the GUI-Plugin Framework UML diagram Added Paths: ----------- sunuml/trunk/doc/GUI-Plugin Framework.doc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pc...@us...> - 2008-11-05 01:57:01
|
Revision: 2 http://sunuml.svn.sourceforge.net/sunuml/?rev=2&view=rev Author: pcastor Date: 2008-11-05 01:56:33 +0000 (Wed, 05 Nov 2008) Log Message: ----------- GUI-Plugin Framework UML diagram Added Paths: ----------- sunuml/trunk/doc/GUI-Plugin Framework.uml Property Changed: ---------------- sunuml/trunk/doc/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pc...@us...> - 2008-11-03 02:43:16
|
Revision: 1 http://sunuml.svn.sourceforge.net/sunuml/?rev=1&view=rev Author: pcastor Date: 2008-11-03 02:43:12 +0000 (Mon, 03 Nov 2008) Log Message: ----------- wxPython test and experimentation Added Paths: ----------- sunuml/ sunuml/branches/ sunuml/tags/ sunuml/trunk/ sunuml/trunk/AUTHORS.txt sunuml/trunk/COPYING.txt sunuml/trunk/ChangeLog sunuml/trunk/INSTALL.txt sunuml/trunk/LICENSE.txt sunuml/trunk/NEWS sunuml/trunk/README.txt sunuml/trunk/bin/ sunuml/trunk/build/ sunuml/trunk/build/komodo/ sunuml/trunk/build/komodo/SunUML.kpf sunuml/trunk/core/ sunuml/trunk/core/SunUMLDrawingUITool.py sunuml/trunk/core/SunUMLMainFrame.py sunuml/trunk/core/SunUMLMainFrameBase.py sunuml/trunk/core/SunUMLUITool.py sunuml/trunk/core/SunUMLWorkspaceTreeUITool.py sunuml/trunk/core/images.py sunuml/trunk/core/main.py sunuml/trunk/dependencies/ sunuml/trunk/dependencies/include/ sunuml/trunk/dependencies/lib/ sunuml/trunk/doc/ sunuml/trunk/help/ sunuml/trunk/installer/ sunuml/trunk/plugins/ Property Changed: ---------------- / Property changes on: ___________________________________________________________________ Added: svn:ignore + OGEd_plugin_0_0 doc Added: sunuml/trunk/build/komodo/SunUML.kpf =================================================================== --- sunuml/trunk/build/komodo/SunUML.kpf (rev 0) +++ sunuml/trunk/build/komodo/SunUML.kpf 2008-11-03 02:43:12 UTC (rev 1) @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Komodo Project File - DO NOT EDIT --> +<project id="949307d2-7aa4-4ac5-8549-3a0cb763cef6" kpf_version="4" name="SunUML.kpf"> +<file id="1b0679f8-7400-41ea-b742-34b901a4cf79" idref="11d5c731-cfea-474a-9be2-93ead213f2e3" name="images.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/images.py"> +</file> +<file id="2ea36b48-3bdf-4a01-98c0-7712f8f969c8" idref="11d5c731-cfea-474a-9be2-93ead213f2e3" name="SunUMLDrawingUITool.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/SunUMLDrawingUITool.py"> +</file> +<file id="5b2ca8ff-4615-4d97-86bf-55049eab39af" idref="11d5c731-cfea-474a-9be2-93ead213f2e3" name="SunUMLMainFrame.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/SunUMLMainFrame.py"> +</file> +<file id="5cc489e2-ba85-41fb-8358-e7db92d34745" idref="11d5c731-cfea-474a-9be2-93ead213f2e3" name="SunUMLMainFrameBase.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/SunUMLMainFrameBase.py"> +</file> +<file id="9ae29082-8ac3-42ac-8a2f-1feb2f7f14f1" idref="11d5c731-cfea-474a-9be2-93ead213f2e3" name="SunUMLUITool.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/SunUMLUITool.py"> +</file> +<file id="9d191292-dce4-44eb-ae54-335c1929545b" idref="11d5c731-cfea-474a-9be2-93ead213f2e3" name="SunUMLWorkspaceTreeUITool.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/SunUMLWorkspaceTreeUITool.py"> +</file> +<folder id="11d5c731-cfea-474a-9be2-93ead213f2e3" idref="949307d2-7aa4-4ac5-8549-3a0cb763cef6" name="ui"> +</folder> +<file id="510e4c96-e117-40ad-994c-57ad972b4ccd" idref="949307d2-7aa4-4ac5-8549-3a0cb763cef6" name="main.py" url="file:///G:/!Desarrollos/SunUML/sunuml/trunk/core/main.py"> +</file> +<preference-set idref="2ea36b48-3bdf-4a01-98c0-7712f8f969c8"> +<preference-set id="Invocations"> +<preference-set id="default"> + <string id="cookieparams"></string> + <string id="cwd"></string> + <string id="documentRoot"></string> + <string id="executable-params"></string> + <string id="filename">G:\!Desarrollos\SunUML\sunuml\trunk\core\SunUMLDrawingUITool.py</string> + <string id="getparams"></string> + <string id="language">Python</string> + <string id="mpostparams"></string> + <string id="params"></string> + <string id="postparams"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="request-method">GET</string> + <boolean id="show-dialog">1</boolean> + <boolean id="sim-cgi">0</boolean> + <boolean id="use-console">0</boolean> + <string id="userCGIEnvironment"></string> + <string id="userEnvironment"></string> +</preference-set> +</preference-set> + <string id="lastInvocation">Project</string> +</preference-set> +<preference-set idref="510e4c96-e117-40ad-994c-57ad972b4ccd"> +<preference-set id="Invocations"> +<preference-set id="default"> + <string id="cookieparams"></string> + <string id="cwd"></string> + <string id="documentRoot"></string> + <string id="executable-params"></string> + <string id="filename">G:\!Desarrollos\SunUML\sunuml\trunk\core\main.py</string> + <string id="getparams"></string> + <string id="language">Python</string> + <string id="mpostparams"></string> + <string id="params"></string> + <string id="postparams"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="request-method">GET</string> + <boolean id="show-dialog">1</boolean> + <boolean id="sim-cgi">0</boolean> + <boolean id="use-console">0</boolean> + <string id="userCGIEnvironment"></string> + <string id="userEnvironment"></string> +</preference-set> +</preference-set> + <string id="lastInvocation">default</string> +</preference-set> +<preference-set idref="5b2ca8ff-4615-4d97-86bf-55049eab39af"> +<preference-set id="Invocations"> +<preference-set id="default"> + <string id="cookieparams"></string> + <string id="cwd"></string> + <string id="documentRoot"></string> + <string id="executable-params"></string> + <string id="filename">G:\!Desarrollos\SunUML\sunuml\trunk\core\main.py</string> + <string id="getparams"></string> + <string id="language">Python</string> + <string id="mpostparams"></string> + <string id="params"></string> + <string id="postparams"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="request-method">GET</string> + <boolean id="show-dialog">1</boolean> + <boolean id="sim-cgi">0</boolean> + <boolean id="use-console">0</boolean> + <string id="userCGIEnvironment"></string> + <string id="userEnvironment"></string> +</preference-set> +</preference-set> + <string id="lastInvocation">default</string> +</preference-set> +<preference-set idref="949307d2-7aa4-4ac5-8549-3a0cb763cef6"> +<preference-set id="Invocations"> +<preference-set id="Project"> + <string id="cookieparams"></string> + <string id="cwd">G:\!Desarrollos\SunUML\sunuml\trunk\</string> + <string id="documentRoot"></string> + <string id="executable-params"></string> + <string id="filename">G:\!Desarrollos\SunUML\sunuml\trunk\core\main.py</string> + <string id="getparams"></string> + <string id="langauge"></string> + <string id="language">Python</string> + <string id="mpostparams"></string> + <string id="params"></string> + <string id="postparams"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="request-method">GET</string> + <boolean id="show-dialog">1</boolean> + <boolean id="sim-cgi">0</boolean> + <boolean id="use-console">0</boolean> + <string id="userCGIEnvironment"></string> + <string id="userEnvironment"></string> +</preference-set> +</preference-set> + <string id="donotask_action_remotedebug_mapped_uri"></string> + <boolean id="donotask_remotedebug_mapped_uri">0</boolean> + <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;_svn;*%*;tmp*.html;.DS_Store</string> + <string id="import_include_matches"></string> + <boolean id="import_live">1</boolean> + <boolean id="import_recursive">1</boolean> + <string id="import_type">useFolders</string> + <string id="lastTestPlanName_pref">New test plan #1</string> + <string id="mappedPaths"></string> + <string id="pythonExtraPaths"></string> +<preference-set id="testPlans"> +<preference-set id="New test plan #1"> + <string id="command_line"></string> + <string id="directory">file:///G:/!Desarrollos/SunUML/sunuml/trunk/</string> + <string id="language">Python - unittest</string> +</preference-set> +</preference-set> +</preference-set> +</project> Property changes on: sunuml/trunk/core ___________________________________________________________________ Added: svn:ignore + *.pyc Added: sunuml/trunk/core/SunUMLDrawingUITool.py =================================================================== --- sunuml/trunk/core/SunUMLDrawingUITool.py (rev 0) +++ sunuml/trunk/core/SunUMLDrawingUITool.py 2008-11-03 02:43:12 UTC (rev 1) @@ -0,0 +1,433 @@ +import wx +import wx.lib.ogl as ogl +import images +import wx.lib.flatnotebook as fnb +from SunUMLUITool import UITool + +#---------------------------------------------------------------------- + +class DrawnShape(ogl.DrawnShape): + def __init__(self): + ogl.DrawnShape.__init__(self) + + self.SetDrawnBrush(wx.WHITE_BRUSH) + self.SetDrawnPen(wx.BLACK_PEN) + self.DrawArc((0, -10), (30, 0), (-30, 0)) + + self.SetDrawnPen(wx.Pen("#ff8030")) + self.DrawLine((-30, 5), (30, 5)) + + self.SetDrawnPen(wx.Pen("#00ee10")) + self.DrawRoundedRectangle((-20, 10, 40, 10), 5) + + self.SetDrawnPen(wx.Pen("#9090f0")) + self.DrawEllipse((-30, 25, 60, 20)) + + self.SetDrawnTextColour(wx.BLACK) + self.SetDrawnFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL)) + self.DrawText("DrawText", (-26, 28)) + + self.SetDrawnBrush(wx.GREEN_BRUSH) + self.DrawPolygon([(-100, 5), (-45, 30), (-35, 20), (-30, 5)]) + + self.SetDrawnPen(wx.BLACK_PEN) + self.DrawLines([(30, -45), (40, -45), (40 ,45), (30, 45)]) + + # Make sure to call CalculateSize when all drawing is done + self.CalculateSize() + +#---------------------------------------------------------------------- + +class DiamondShape(ogl.PolygonShape): + def __init__(self, w=0.0, h=0.0): + ogl.PolygonShape.__init__(self) + if w == 0.0: + w = 60.0 + if h == 0.0: + h = 60.0 + + points = [ (0.0, -h/2.0), + (w/2.0, 0.0), + (0.0, h/2.0), + (-w/2.0, 0.0), + ] + + self.Create(points) + + +#---------------------------------------------------------------------- + +class RoundedRectangleShape(ogl.RectangleShape): + def __init__(self, w=0.0, h=0.0): + ogl.RectangleShape.__init__(self, w, h) + self.SetCornerRadius(-0.3) + + +#---------------------------------------------------------------------- + +class CompositeDivisionShape(ogl.CompositeShape): + def __init__(self, canvas): + ogl.CompositeShape.__init__(self) + + self.SetCanvas(canvas) + + # create a division in the composite + self.MakeContainer() + + # add a shape to the original division + shape2 = ogl.RectangleShape(40, 60) + self.GetDivisions()[0].AddChild(shape2) + + # now divide the division so we get 2 + self.GetDivisions()[0].Divide(wx.HORIZONTAL) + + # and add a shape to the second division (and move it to the + # centre of the division) + shape3 = ogl.CircleShape(40) + shape3.SetBrush(wx.CYAN_BRUSH) + self.GetDivisions()[1].AddChild(shape3) + shape3.SetX(self.GetDivisions()[1].GetX()) + + for division in self.GetDivisions(): + division.SetSensitivityFilter(0) + +#---------------------------------------------------------------------- + +class CompositeShape(ogl.CompositeShape): + def __init__(self, canvas): + ogl.CompositeShape.__init__(self) + + self.SetCanvas(canvas) + + constraining_shape = ogl.RectangleShape(120, 100) + constrained_shape1 = ogl.CircleShape(50) + constrained_shape2 = ogl.RectangleShape(80, 20) + + constraining_shape.SetBrush(wx.BLUE_BRUSH) + constrained_shape2.SetBrush(wx.RED_BRUSH) + + self.AddChild(constraining_shape) + self.AddChild(constrained_shape1) + self.AddChild(constrained_shape2) + + constraint = ogl.Constraint(ogl.CONSTRAINT_MIDALIGNED_BOTTOM, constraining_shape, [constrained_shape1, constrained_shape2]) + self.AddConstraint(constraint) + self.Recompute() + + # If we don't do this, the shapes will be able to move on their + # own, instead of moving the composite + constraining_shape.SetDraggable(False) + constrained_shape1.SetDraggable(False) + constrained_shape2.SetDraggable(False) + + # If we don't do this the shape will take all left-clicks for itself + constraining_shape.SetSensitivityFilter(0) + + +#---------------------------------------------------------------------- + +class DividedShape(ogl.DividedShape): + def __init__(self, width, height, canvas): + ogl.DividedShape.__init__(self, width, height) + + region1 = ogl.ShapeRegion() + region1.SetText('DividedShape') + region1.SetProportions(0.0, 0.2) + region1.SetFormatMode(ogl.FORMAT_CENTRE_HORIZ) + self.AddRegion(region1) + + region2 = ogl.ShapeRegion() + region2.SetText('This is Region number two.') + region2.SetProportions(0.0, 0.3) + region2.SetFormatMode(ogl.FORMAT_CENTRE_HORIZ|ogl.FORMAT_CENTRE_VERT) + self.AddRegion(region2) + + region3 = ogl.ShapeRegion() + region3.SetText('Region 3\nwith embedded\nline breaks') + region3.SetProportions(0.0, 0.5) + region3.SetFormatMode(ogl.FORMAT_NONE) + self.AddRegion(region3) + + self.SetRegionSizes() + self.ReformatRegions(canvas) + + + def ReformatRegions(self, canvas=None): + rnum = 0 + + if canvas is None: + canvas = self.GetCanvas() + + dc = wx.ClientDC(canvas) # used for measuring + + for region in self.GetRegions(): + text = region.GetText() + self.FormatText(dc, text, rnum) + rnum += 1 + + + def OnSizingEndDragLeft(self, pt, x, y, keys, attch): + print "***", self + ogl.DividedShape.OnSizingEndDragLeft(self, pt, x, y, keys, attch) + self.SetRegionSizes() + self.ReformatRegions() + self.GetCanvas().Refresh() + + +#---------------------------------------------------------------------- + +class MyEvtHandler(ogl.ShapeEvtHandler): + def __init__(self): + ogl.ShapeEvtHandler.__init__(self) + #self.log = log + #self.statbarFrame = frame + + def UpdateStatusBar(self, shape): + x, y = shape.GetX(), shape.GetY() + width, height = shape.GetBoundingBoxMax() + #self.statbarFrame.SetStatusText("Pos: (%d, %d) Size: (%d, %d)" % + # (x, y, width, height)) + + + def OnLeftClick(self, x, y, keys=0, attachment=0): + shape = self.GetShape() + canvas = shape.GetCanvas() + dc = wx.ClientDC(canvas) + canvas.PrepareDC(dc) + + if shape.Selected(): + shape.Select(False, dc) + #canvas.Redraw(dc) + canvas.Refresh(False) + else: + redraw = False + shapeList = canvas.GetDiagram().GetShapeList() + toUnselect = [] + + for s in shapeList: + if s.Selected(): + # If we unselect it now then some of the objects in + # shapeList will become invalid (the control points are + # shapes too!) and bad things will happen... + toUnselect.append(s) + + shape.Select(True, dc) + + if toUnselect: + for s in toUnselect: + s.Select(False, dc) + + ##canvas.Redraw(dc) + canvas.Refresh(False) + + self.UpdateStatusBar(shape) + + + def OnEndDragLeft(self, x, y, keys=0, attachment=0): + shape = self.GetShape() + ogl.ShapeEvtHandler.OnEndDragLeft(self, x, y, keys, attachment) + + if not shape.Selected(): + self.OnLeftClick(x, y, keys, attachment) + + self.UpdateStatusBar(shape) + + + def OnSizingEndDragLeft(self, pt, x, y, keys, attch): + ogl.ShapeEvtHandler.OnSizingEndDragLeft(self, pt, x, y, keys, attch) + self.UpdateStatusBar(self.GetShape()) + + + def OnMovePost(self, dc, x, y, oldX, oldY, display): + shape = self.GetShape() + ogl.ShapeEvtHandler.OnMovePost(self, dc, x, y, oldX, oldY, display) + self.UpdateStatusBar(shape) + if "wxMac" in wx.PlatformInfo: + shape.GetCanvas().Refresh(False) + + def OnRightClick(self, *dontcare): + pass + #self.log.WriteText("%s\n" % self.GetShape()) + + +#---------------------------------------------------------------------- + +class DrawingFrame(ogl.ShapeCanvas): + def __init__(self, parent): + ogl.ShapeCanvas.__init__(self, parent) + + maxWidth = 1000 + maxHeight = 1000 + self.SetScrollbars(20, 20, maxWidth/20, maxHeight/20) + + self.SetBackgroundColour("LIGHT BLUE") #wx.WHITE) + self.diagram = ogl.Diagram() + self.SetDiagram(self.diagram) + self.diagram.SetCanvas(self) + self.shapes = [] + self.save_gdi = [] + + rRectBrush = wx.Brush("MEDIUM TURQUOISE", wx.SOLID) + dsBrush = wx.Brush("WHEAT", wx.SOLID) + + self.MyAddShape( + CompositeDivisionShape(self), + 270, 310, wx.BLACK_PEN, wx.BLUE_BRUSH, "Division" + ) + + self.MyAddShape( + CompositeShape(self), + 100, 260, wx.BLACK_PEN, wx.RED_BRUSH, "Composite" + ) + + self.MyAddShape( + ogl.CircleShape(80), + 75, 110, wx.Pen(wx.BLUE, 3), wx.GREEN_BRUSH, "Circle" + ) + + self.MyAddShape( + ogl.TextShape(120, 45), + 160, 35, wx.GREEN_PEN, wx.LIGHT_GREY_BRUSH, "OGL is now a\npure Python lib!" + ) + + self.MyAddShape( + ogl.RectangleShape(85, 50), + 305, 60, wx.BLACK_PEN, wx.LIGHT_GREY_BRUSH, "Rectangle" + ) + + self.MyAddShape( + DrawnShape(), + 500, 80, wx.BLACK_PEN, wx.BLACK_BRUSH, "DrawnShape" + ) + + ds = self.MyAddShape( + DividedShape(140, 150, self), + 520, 265, wx.BLACK_PEN, dsBrush, '' + ) + + self.MyAddShape( + DiamondShape(90, 90), + 355, 260, wx.Pen(wx.BLUE, 3, wx.DOT), wx.RED_BRUSH, "Polygon" + ) + + self.MyAddShape( + RoundedRectangleShape(95, 70), + 345, 145, wx.Pen(wx.RED, 2), rRectBrush, "Rounded Rect" + ) + + bmp = images.Test2.GetBitmap() + mask = wx.Mask(bmp, wx.BLUE) + bmp.SetMask(mask) + + s = ogl.BitmapShape() + s.SetBitmap(bmp) + self.MyAddShape(s, 225, 130, None, None, "Bitmap") + + #dc = wx.ClientDC(self) + #self.PrepareDC(dc) + + for x in range(len(self.shapes)): + fromShape = self.shapes[x] + if x+1 == len(self.shapes): + toShape = self.shapes[0] + else: + toShape = self.shapes[x+1] + + line = ogl.LineShape() + line.SetCanvas(self) + line.SetPen(wx.BLACK_PEN) + line.SetBrush(wx.BLACK_BRUSH) + line.AddArrow(ogl.ARROW_ARROW) + line.MakeLineControlPoints(2) + fromShape.AddLine(line, toShape) + self.diagram.AddShape(line) + line.Show(True) + + + def MyAddShape(self, shape, x, y, pen, brush, text): + # Composites have to be moved for all children to get in place + if isinstance(shape, ogl.CompositeShape): + dc = wx.ClientDC(self) + self.PrepareDC(dc) + shape.Move(dc, x, y) + else: + shape.SetDraggable(True, True) + shape.SetCanvas(self) + shape.SetX(x) + shape.SetY(y) + if pen: shape.SetPen(pen) + if brush: shape.SetBrush(brush) + if text: + for line in text.split('\n'): + shape.AddText(line) + #shape.SetShadowMode(ogl.SHADOW_RIGHT) + self.diagram.AddShape(shape) + shape.Show(True) + + evthandler = MyEvtHandler() + evthandler.SetShape(shape) + evthandler.SetPreviousHandler(shape.GetEventHandler()) + shape.SetEventHandler(evthandler) + + self.shapes.append(shape) + return shape + + + def OnBeginDragLeft(self, x, y, keys): + #self.log.write("OnBeginDragLeft: %s, %s, %s\n" % (x, y, keys)) + pass + + def OnEndDragLeft(self, x, y, keys): + #self.log.write("OnEndDragLeft: %s, %s, %s\n" % (x, y, keys)) + pass + + +#---------------------------------------------------------------------- + +class ParentFrame(wx.Panel): + def __init__(self, parent): + wx.Panel.__init__(self, parent) + self.count = 0 + mainSizer = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(mainSizer) + bookStyle = fnb.FNB_NODRAG + self.book = fnb.FlatNotebook(self, wx.ID_ANY, style=bookStyle) + mainSizer.Add(self.book, 6, wx.EXPAND) + mainSizer.Layout() + self.SendSizeEvent() + + def newChild(self): + self.Freeze() + caption = "Tab #" + str(self.count) + self.book.AddPage(self.createPage(caption), caption, True, -1) + self.Thaw() + self.count += 1 + + def createPage(self, caption): + p = DrawingFrame(self.book) + return p + + def OnDoClose(self, evt): + self.Close() + + +#---------------------------------------------------------------------- + +class DrawingUITool(UITool): + def onWorkspaceChanged(self): + pass + + def createPane(self): + # This creates some pens and brushes that the OGL library uses. + # It should be called after the app object has been created, but + # before OGL is used. + ogl.OGLInitialize() + pane = ParentFrame(self._parent) + pane.newChild() + pane.newChild() + return pane + + def addPaneToParent(self): + pane = self._parent.addCenterPane(self._name, self._pane) + #pane.Left().Layer(1).Position(1) + Added: sunuml/trunk/core/SunUMLMainFrame.py =================================================================== --- sunuml/trunk/core/SunUMLMainFrame.py (rev 0) +++ sunuml/trunk/core/SunUMLMainFrame.py 2008-11-03 02:43:12 UTC (rev 1) @@ -0,0 +1,978 @@ +import wx +import wx.grid +import wx.html +import wx.aui +from SunUMLMainFrameBase import MainFrameBase +from SunUMLWorkspaceTreeUITool import WorkspaceTreeUITool +from SunUMLDrawingUITool import DrawingUITool + +ID_CreateTree = wx.NewId() +ID_CreateGrid = wx.NewId() +ID_CreateText = wx.NewId() +ID_CreateHTML = wx.NewId() +ID_CreateSizeReport = wx.NewId() +ID_GridContent = wx.NewId() +ID_TextContent = wx.NewId() +ID_TreeContent = wx.NewId() +ID_HTMLContent = wx.NewId() +ID_SizeReportContent = wx.NewId() +ID_CreatePerspective = wx.NewId() +ID_CopyPerspective = wx.NewId() + +ID_TransparentHint = wx.NewId() +ID_VenetianBlindsHint = wx.NewId() +ID_RectangleHint = wx.NewId() +ID_NoHint = wx.NewId() +ID_HintFade = wx.NewId() +ID_AllowFloating = wx.NewId() +ID_NoVenetianFade = wx.NewId() +ID_TransparentDrag = wx.NewId() +ID_AllowActivePane = wx.NewId() +ID_NoGradient = wx.NewId() +ID_VerticalGradient = wx.NewId() +ID_HorizontalGradient = wx.NewId() + +ID_Settings = wx.NewId() +ID_About = wx.NewId() +ID_FirstPerspective = ID_CreatePerspective+1000 + +#---------------------------------------------------------------------- +class MainFrame(MainFrameBase): + + def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | + wx.SUNKEN_BORDER | + wx.CLIP_CHILDREN): + MainFrameBase.__init__(self, parent, id, title, pos, size, style) + + all_panes = self._mgr.GetAllPanes() + + for ii in xrange(len(all_panes)): + if not all_panes[ii].IsToolbar(): + all_panes[ii].Hide() + + self.getPane("tb1").Hide() + self.getPane("tb5").Hide() + self.getPane("test8").Show().Right().Layer(0).Row(0).Position(0) + self.getPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) + self.getPane("html_content").Show() + + self.savePerspective() + + for ii in xrange(len(all_panes)): + if not all_panes[ii].IsToolbar(): + all_panes[ii].Hide() + + self.getPane("tb1").Hide() + self.getPane("tb5").Hide() + self.getPane("tbvert").Show() + self.getPane("grid_content").Show() + self.getPane("test8").Show().Right().Layer(0).Row(0).Position(0) + self.getPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) + self.getPane("html_content").Show() + + self.savePerspective() + + self.getPane("tbvert").Show() + self.getPane("grid_content").Hide() + + # "commit" all changes made to FrameManager + self.updateAll() + + self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) + self.Bind(wx.EVT_SIZE, self.OnSize) + self.Bind(wx.EVT_CLOSE, self.OnClose) + + # Show How To Use The Closing Panes Event + self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.OnPaneClose) + + self.Bind(wx.EVT_MENU, self.OnCreateTree, id=ID_CreateTree) + self.Bind(wx.EVT_MENU, self.OnCreateGrid, id=ID_CreateGrid) + self.Bind(wx.EVT_MENU, self.OnCreateText, id=ID_CreateText) + self.Bind(wx.EVT_MENU, self.OnCreateHTML, id=ID_CreateHTML) + self.Bind(wx.EVT_MENU, self.OnCreateSizeReport, id=ID_CreateSizeReport) + self.Bind(wx.EVT_MENU, self.OnCreatePerspective, id=ID_CreatePerspective) + self.Bind(wx.EVT_MENU, self.OnCopyPerspective, id=ID_CopyPerspective) + + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_AllowFloating) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_TransparentHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_VenetianBlindsHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_RectangleHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_NoHint) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_HintFade) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_NoVenetianFade) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_TransparentDrag) + self.Bind(wx.EVT_MENU, self.OnManagerFlag, id=ID_AllowActivePane) + + self.Bind(wx.EVT_MENU, self.OnGradient, id=ID_NoGradient) + self.Bind(wx.EVT_MENU, self.OnGradient, id=ID_VerticalGradient) + self.Bind(wx.EVT_MENU, self.OnGradient, id=ID_HorizontalGradient) + self.Bind(wx.EVT_MENU, self.OnSettings, id=ID_Settings) + self.Bind(wx.EVT_MENU, self.OnChangeContentPane, id=ID_GridContent) + self.Bind(wx.EVT_MENU, self.OnChangeContentPane, id=ID_TreeContent) + self.Bind(wx.EVT_MENU, self.OnChangeContentPane, id=ID_TextContent) + self.Bind(wx.EVT_MENU, self.OnChangeContentPane, id=ID_SizeReportContent) + self.Bind(wx.EVT_MENU, self.OnChangeContentPane, id=ID_HTMLContent) + self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT) + self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_About) + + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_TransparentHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_VenetianBlindsHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_RectangleHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_NoHint) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_HintFade) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_AllowFloating) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_NoVenetianFade) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_TransparentDrag) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_AllowActivePane) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_NoGradient) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_VerticalGradient) + self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=ID_HorizontalGradient) + + + self.Bind(wx.EVT_MENU_RANGE, self.OnRestorePerspective, id=ID_FirstPerspective, + id2=ID_FirstPerspective+1000) + + def createMenuBar(self, mb): # create menu + file_menu = wx.Menu() + file_menu.Append(wx.ID_EXIT, "Exit") + + view_menu = wx.Menu() + view_menu.Append(ID_CreateText, "Create Text Control") + view_menu.Append(ID_CreateHTML, "Create HTML Control") + view_menu.Append(ID_CreateTree, "Create Tree") + view_menu.Append(ID_CreateGrid, "Create Grid") + view_menu.Append(ID_CreateSizeReport, "Create Size Reporter") + view_menu.AppendSeparator() + view_menu.Append(ID_GridContent, "Use a Grid for the Content Pane") + view_menu.Append(ID_TextContent, "Use a Text Control for the Content Pane") + view_menu.Append(ID_HTMLContent, "Use an HTML Control for the Content Pane") + view_menu.Append(ID_TreeContent, "Use a Tree Control for the Content Pane") + view_menu.Append(ID_SizeReportContent, "Use a Size Reporter for the Content Pane") + + options_menu = wx.Menu() + options_menu.AppendRadioItem(ID_TransparentHint, "Transparent Hint") + options_menu.AppendRadioItem(ID_VenetianBlindsHint, "Venetian Blinds Hint") + options_menu.AppendRadioItem(ID_RectangleHint, "Rectangle Hint") + options_menu.AppendRadioItem(ID_NoHint, "No Hint") + options_menu.AppendSeparator(); + options_menu.AppendCheckItem(ID_HintFade, "Hint Fade-in") + options_menu.AppendCheckItem(ID_AllowFloating, "Allow Floating") + options_menu.AppendCheckItem(ID_NoVenetianFade, "Disable Venetian Blinds Hint Fade-in") + options_menu.AppendCheckItem(ID_TransparentDrag, "Transparent Drag") + options_menu.AppendCheckItem(ID_AllowActivePane, "Allow Active Pane") + options_menu.AppendSeparator(); + options_menu.AppendRadioItem(ID_NoGradient, "No Caption Gradient") + options_menu.AppendRadioItem(ID_VerticalGradient, "Vertical Caption Gradient") + options_menu.AppendRadioItem(ID_HorizontalGradient, "Horizontal Caption Gradient") + options_menu.AppendSeparator(); + options_menu.Append(ID_Settings, "Settings Pane") + + self._perspectives_menu = wx.Menu() + self._perspectives_menu.Append(ID_CreatePerspective, "Create Perspective") + self._perspectives_menu.Append(ID_CopyPerspective, "Copy Perspective Data To Clipboard") + self._perspectives_menu.AppendSeparator() + self._perspectives_menu.Append(ID_FirstPerspective+0, "Default Startup") + self._perspectives_menu.Append(ID_FirstPerspective+1, "All Panes") + self._perspectives_menu.Append(ID_FirstPerspective+2, "Vertical Toolbar") + + help_menu = wx.Menu() + help_menu.Append(ID_About, "About...") + + mb.Append(file_menu, "File") + mb.Append(view_menu, "View") + mb.Append(self._perspectives_menu, "Perspectives") + mb.Append(options_menu, "Options") + mb.Append(help_menu, "Help") + + def createToolbars(self): + # create some toolbars + tb1 = self.newEmptyToolbar() + tb1.SetToolBitmapSize(wx.Size(48,48)) + tb1.AddLabelTool(101, "Test", wx.ArtProvider_GetBitmap(wx.ART_ERROR)) + tb1.AddSeparator() + tb1.AddLabelTool(102, "Test", wx.ArtProvider_GetBitmap(wx.ART_QUESTION)) + tb1.AddLabelTool(103, "Test", wx.ArtProvider_GetBitmap(wx.ART_INFORMATION)) + tb1.AddLabelTool(103, "Test", wx.ArtProvider_GetBitmap(wx.ART_WARNING)) + tb1.AddLabelTool(103, "Test", wx.ArtProvider_GetBitmap(wx.ART_MISSING_IMAGE)) + tb1.Realize() + + tb2 = self.newEmptyToolbar() + tb2.SetToolBitmapSize(wx.Size(16,16)) + tb2_bmp1 = wx.ArtProvider_GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(16, 16)) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddSeparator() + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddSeparator() + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.AddLabelTool(101, "Test", tb2_bmp1) + tb2.Realize() + + tb3 = self.newEmptyToolbar() + tb3.SetToolBitmapSize(wx.Size(16,16)) + tb3_bmp1 = wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, wx.Size(16, 16)) + tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddSeparator() + tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.AddLabelTool(101, "Test", tb3_bmp1) + tb3.Realize() + + tb4 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, + wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_HORZ_TEXT) + tb4.SetToolBitmapSize(wx.Size(16,16)) + tb4_bmp1 = wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16)) + tb4.AddLabelTool(101, "Item 1", tb4_bmp1) + tb4.AddLabelTool(101, "Item 2", tb4_bmp1) + tb4.AddLabelTool(101, "Item 3", tb4_bmp1) + tb4.AddLabelTool(101, "Item 4", tb4_bmp1) + tb4.AddSeparator() + tb4.AddLabelTool(101, "Item 5", tb4_bmp1) + tb4.AddLabelTool(101, "Item 6", tb4_bmp1) + tb4.AddLabelTool(101, "Item 7", tb4_bmp1) + tb4.AddLabelTool(101, "Item 8", tb4_bmp1) + tb4.Realize() + + tb5 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, + wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_VERTICAL) + tb5.SetToolBitmapSize(wx.Size(48, 48)) + tb5.AddLabelTool(101, "Test", wx.ArtProvider_GetBitmap(wx.ART_ERROR)) + tb5.AddSeparator() + tb5.AddLabelTool(102, "Test", wx.ArtProvider_GetBitmap(wx.ART_QUESTION)) + tb5.AddLabelTool(103, "Test", wx.ArtProvider_GetBitmap(wx.ART_INFORMATION)) + tb5.AddLabelTool(103, "Test", wx.ArtProvider_GetBitmap(wx.ART_WARNING)) + tb5.AddLabelTool(103, "Test", wx.ArtProvider_GetBitmap(wx.ART_MISSING_IMAGE)) + tb5.Realize() + + # add the toolbars to the manager + self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo(). + Name("tb1").Caption("Big Toolbar"). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False)) + + self._mgr.AddPane(tb2, wx.aui.AuiPaneInfo(). + Name("tb2").Caption("Toolbar 2"). + ToolbarPane().Top().Row(1). + LeftDockable(True).RightDockable(False)) + + self._mgr.AddPane(tb3, wx.aui.AuiPaneInfo(). + Name("tb3").Caption("Toolbar 3"). + ToolbarPane().Top().Row(1).Position(1). + LeftDockable(False).RightDockable(False)) + + self._mgr.AddPane(tb4, wx.aui.AuiPaneInfo(). + Name("tb4").Caption("Sample Bookmark Toolbar"). + ToolbarPane().Top().Row(2). + LeftDockable(False).RightDockable(False)) + + self._mgr.AddPane(tb5, wx.aui.AuiPaneInfo(). + Name("tbvert").Caption("Sample Vertical Toolbar"). + ToolbarPane().Left().GripperTop(). + TopDockable(False).BottomDockable(False)) + + self._mgr.AddPane(wx.Button(self, -1, "Test Button"), + wx.aui.AuiPaneInfo().Name("tb5"). + ToolbarPane().Top().Row(2).Position(1). + LeftDockable(False).RightDockable(False)) + + def createPanes(self): + # add a bunch of panes + pane = self.addToolPane("test1", self.CreateSizeReportCtrl(), "Pane Caption") + pane.Top() + pane = self.addToolPane("test2", self.CreateSizeReportCtrl(), "Client Size Reporter") + pane.Bottom().Position(1) + pane = self.addToolPane("test3", self.CreateSizeReportCtrl(), "Client Size Reporter") + pane.Bottom() + pane = self.addToolPane("test4", self.CreateSizeReportCtrl(), "Pane Caption") + pane.Left() + pane = self.addToolPane("test5", self.CreateSizeReportCtrl(), "Pane Caption") + pane.Right() + pane = self.addToolPane("test6", self.CreateSizeReportCtrl(), "Client Size Reporter") + pane.Right().Row(1) + pane = self.addToolPane("test7", self.CreateSizeReportCtrl(), "Client Size Reporter") + pane.Left().Layer(1) + #pane = self.addToolPane("test8", self.CreateTreeCtrl(), "Tree Pane") + #pane.Left().Layer(1).Position(1) + self.addUITool(WorkspaceTreeUITool("test8")) + pane = self.addToolPane("test9", self.CreateSizeReportCtrl(), "Min Size 200x100") + pane.BestSize(wx.Size(200,100)).MinSize(wx.Size(200,100)).Bottom().Layer(1) + pane = self.addToolPane("test10", self.CreateTextCtrl(), "Text Pane") + pane.Bottom().Layer(1).Position(1) + pane = self.addToolPane("test11", self.CreateSizeReportCtrl(), "Fixed Pane") + pane.Bottom().Layer(1).Position(2).Fixed() + pane = self.addFloatingPane("settings", SettingsPanel(self, self), "Dock Manager Settings") + pane.Hide() + + # create some center panes + self.addCenterPane("grid_content", self.CreateGrid()).Hide() + self.addCenterPane("tree_content", self.CreateTreeCtrl()).Hide() + self.addCenterPane("sizereport_content", self.CreateSizeReportCtrl()).Hide() + self.addCenterPane("text_content", self.CreateTextCtrl()).Hide() + #self.addCenterPane("html_content", self.CreateHTMLCtrl()) + self.addUITool(DrawingUITool("html_content")) + + # make some default perspectives + self.getPane("tbvert").Show() + + def OnPaneClose(self, event): + caption = event.GetPane().caption + + if caption in ["Tree Pane", "Dock Manager Settings", "Fixed Pane"]: + msg = "Are You Sure You Want To Close This Pane?" + dlg = wx.MessageDialog(self, msg, "AUI Question", + wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) + + if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]: + event.Veto() + dlg.Destroy() + + + def OnClose(self, event): + self._mgr.UnInit() + del self._mgr + self.Destroy() + + + def OnExit(self, event): + self.Close() + + def OnAbout(self, event): + + msg = "wx.aui Demo\n" + \ + "An advanced window management library for wxWidgets\n" + \ + "(c) Copyright 2005-2006, Kirix Corporation" + dlg = wx.MessageDialog(self, msg, "About wx.aui Demo", + wx.OK | wx.ICON_INFORMATION) + dlg.ShowModal() + dlg.Destroy() + + def OnEraseBackground(self, event): + event.Skip() + + + def OnSize(self, event): + event.Skip() + + + def OnSettings(self, event): + # show the settings pane, and float it + floating_pane = self._mgr.GetPane("settings").Float().Show() + if floating_pane.floating_pos == wx.DefaultPosition: + floating_pane.FloatingPosition(self.GetStartPosition()) + + self.updateAll() + + + def OnGradient(self, event): + + gradient = 0 + + if event.GetId() == ID_NoGradient: + gradient = wx.aui.AUI_GRADIENT_NONE + elif event.GetId() == ID_VerticalGradient: + gradient = wx.aui.AUI_GRADIENT_VERTICAL + elif event.GetId() == ID_HorizontalGradient: + gradient = wx.aui.AUI_GRADIENT_HORIZONTAL + + self.getDockArt().SetMetric(wx.aui.AUI_DOCKART_GRADIENT_TYPE, gradient) + self.updateAll() + + + def OnManagerFlag(self, event): + + flag = 0 + eid = event.GetId() + + if eid in [ ID_TransparentHint, ID_VenetianBlindsHint, ID_RectangleHint, ID_NoHint ]: + flags = self._mgr.GetFlags() + flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT + flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT + flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT + self._mgr.SetFlags(flags) + + if eid == ID_AllowFloating: + flag = wx.aui.AUI_MGR_ALLOW_FLOATING + elif eid == ID_TransparentDrag: + flag = wx.aui.AUI_MGR_TRANSPARENT_DRAG + elif eid == ID_HintFade: + flag = wx.aui.AUI_MGR_HINT_FADE + elif eid == ID_NoVenetianFade: + flag = wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE + elif eid == ID_AllowActivePane: + flag = wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE + elif eid == ID_TransparentHint: + flag = wx.aui.AUI_MGR_TRANSPARENT_HINT + elif eid == ID_VenetianBlindsHint: + flag = wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT + elif eid == ID_RectangleHint: + flag = wx.aui.AUI_MGR_RECTANGLE_HINT + + self._mgr.SetFlags(self._mgr.GetFlags() ^ flag) + + + def OnUpdateUI(self, event): + + flags = self._mgr.GetFlags() + eid = event.GetId() + + if eid == ID_NoGradient: + event.Check(self._mgr.GetArtProvider().GetMetric(wx.aui.AUI_DOCKART_GRADIENT_TYPE) == wx.aui.AUI_GRADIENT_NONE) + + elif eid == ID_VerticalGradient: + event.Check(self._mgr.GetArtProvider().GetMetric(wx.aui.AUI_DOCKART_GRADIENT_TYPE) == wx.aui.AUI_GRADIENT_VERTICAL) + + elif eid == ID_HorizontalGradient: + event.Check(self._mgr.GetArtProvider().GetMetric(wx.aui.AUI_DOCKART_GRADIENT_TYPE) == wx.aui.AUI_GRADIENT_HORIZONTAL) + + elif eid == ID_AllowFloating: + event.Check((flags & wx.aui.AUI_MGR_ALLOW_FLOATING) != 0) + + elif eid == ID_TransparentDrag: + event.Check((flags & wx.aui.AUI_MGR_TRANSPARENT_DRAG) != 0) + + elif eid == ID_TransparentHint: + event.Check((flags & wx.aui.AUI_MGR_TRANSPARENT_HINT) != 0) + + elif eid == ID_VenetianBlindsHint: + event.Check((flags & wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT) != 0) + + elif eid == ID_RectangleHint: + event.Check((flags & wx.aui.AUI_MGR_RECTANGLE_HINT) != 0) + + elif eid == ID_NoHint: + event.Check(((wx.aui.AUI_MGR_TRANSPARENT_HINT | + wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT | + wx.aui.AUI_MGR_RECTANGLE_HINT) & flags) == 0) + + elif eid == ID_HintFade: + event.Check((flags & wx.aui.AUI_MGR_HINT_FADE) != 0); + + elif eid == ID_NoVenetianFade: + event.Check((flags & wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE) != 0); + + + + + def OnCreatePerspective(self, event): + + dlg = wx.TextEntryDialog(self, "Enter a name for the new perspective:", "AUI Test") + + dlg.SetValue(("Perspective %d")%(len(self._perspectives)+1)) + if dlg.ShowModal() != wx.ID_OK: + return + + if len(self._perspectives) == 0: + self._perspectives_menu.AppendSeparator() + + self._perspectives_menu.Append(ID_FirstPerspective + len(self._perspectives), dlg.GetValue()) + self.savePerspective() + + + def OnCopyPerspective(self, event): + + s = self._mgr.SavePerspective() + + if wx.TheClipboard.Open(): + + wx.TheClipboard.SetData(wx.TextDataObject(s)) + wx.TheClipboard.Close() + + def OnRestorePerspective(self, event): + self.restorePerspective(event.GetId() - ID_FirstPerspective) + + def OnCreateTree(self, event): + self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.AuiPaneInfo(). + Caption("Tree Control"). + Float().FloatingPosition(self.GetStartPosition()). + FloatingSize(wx.Size(150, 300)).CloseButton(True).MaximizeButton(True)) + self.updateAll() + + def OnCreateGrid(self, event): + self._mgr.AddPane(self.CreateGrid(), wx.aui.AuiPaneInfo(). + Caption("Grid"). + Float().FloatingPosition(self.GetStartPosition()). + FloatingSize(wx.Size(300, 200)).CloseButton(True).MaximizeButton(True)) + self.updateAll() + + def OnCreateHTML(self, event): + self._mgr.AddPane(self.CreateHTMLCtrl(), wx.aui.AuiPaneInfo(). + Caption("HTML Content"). + Float().FloatingPosition(self.GetStartPosition()). + FloatingSize(wx.Size(300, 200)).CloseButton(True).MaximizeButton(True)) + self.updateAll() + + + def OnCreateText(self, event): + self._mgr.AddPane(self.CreateTextCtrl(), wx.aui.AuiPaneInfo(). + Caption("Text Control"). + Float().FloatingPosition(self.GetStartPosition()). + CloseButton(True).MaximizeButton(True)) + self.updateAll() + + + def OnCreateSizeReport(self, event): + self._mgr.AddPane(self.CreateSizeReportCtrl(), wx.aui.AuiPaneInfo(). + Caption("Client Size Reporter"). + Float().FloatingPosition(self.GetStartPosition()). + CloseButton(True).MaximizeButton(True)) + self.updateAll() + + + def OnChangeContentPane(self, event): + self.getPane("grid_content").Show(event.GetId() == ID_GridContent) + self.getPane("text_content").Show(event.GetId() == ID_TextContent) + self.getPane("tree_content").Show(event.GetId() == ID_TreeContent) + self.getPane("sizereport_content").Show(event.GetId() == ID_SizeReportContent) + self.getPane("html_content").Show(event.GetId() == ID_HTMLContent) + self.updateAll() + + + def CreateTextCtrl(self): + text = ("This is text box %d")%(self.n + 1) + return wx.TextCtrl(self,-1, text, wx.Point(0, 0), wx.Size(150, 90), + wx.NO_BORDER | wx.TE_MULTILINE) + + def CreateGrid(self): + grid = wx.grid.Grid(self, -1, wx.Point(0, 0), wx.Size(150, 250), + wx.NO_BORDER | wx.WANTS_CHARS) + grid.CreateGrid(50, 20) + return grid + + def CreateTreeCtrl(self): + tree = wx.TreeCtrl(self, -1, wx.Point(0, 0), wx.Size(160, 250), + wx.TR_DEFAULT_STYLE | wx.NO_BORDER) + root = tree.AddRoot("AUI Project") + items = [] + imglist = wx.ImageList(16, 16, True, 2) + imglist.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, wx.Size(16,16))) + imglist.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16,16))) + tree.AssignImageList(imglist) + items.append(tree.AppendItem(root, "Item 1", 0)) + items.append(tree.AppendItem(root, "Item 2", 0)) + items.append(tree.AppendItem(root, "Item 3", 0)) + items.append(tree.AppendItem(root, "Item 4", 0)) + items.append(tree.AppendItem(root, "Item 5", 0)) + for ii in xrange(len(items)): + id = items[ii] + tree.AppendItem(id, "Subitem 1", 1) + tree.AppendItem(id, "Subitem 2", 1) + tree.AppendItem(id, "Subitem 3", 1) + tree.AppendItem(id, "Subitem 4", 1) + tree.AppendItem(id, "Subitem 5", 1) + tree.Expand(root) + return tree + + def CreateSizeReportCtrl(self, width=80, height=80): + ctrl = SizeReportCtrl(self, -1, wx.DefaultPosition, + wx.Size(width, height), self._mgr) + return ctrl + + def CreateHTMLCtrl(self): + ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300)) + if "gtk2" in wx.PlatformInfo: + ctrl.SetStandardFonts() + ctrl.SetPage(self.GetIntroText()) + return ctrl + + + def GetIntroText(self): + return overview + +# -- wx.SizeReportCtrl -- +# (a utility control that always reports it's client size) + +class SizeReportCtrl(wx.PyControl): + + def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, + size=wx.DefaultSize, mgr=None): + + wx.PyControl.__init__(self, parent, id, pos, size, wx.NO_BORDER) + + self._mgr = mgr + + self.Bind(wx.EVT_PAINT, self.OnPaint) + self.Bind(wx.EVT_SIZE, self.OnSize) + self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) + + + def OnPaint(self, event): + + dc = wx.PaintDC(self) + + size = self.GetClientSize() + s = ("Size: %d x %d")%(size.x, size.y) + + dc.SetFont(wx.NORMAL_FONT) + w, height = dc.GetTextExtent(s) + height = height + 3 + dc.SetBrush(wx.WHITE_BRUSH) + dc.SetPen(wx.WHITE_PEN) + dc.DrawRectangle(0, 0, size.x, size.y) + dc.SetPen(wx.LIGHT_GREY_PEN) + dc.DrawLine(0, 0, size.x, size.y) + dc.DrawLine(0, size.y, size.x, 0) + dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)) + + if self._mgr: + + pi = self._mgr.GetPane(self) + + s = ("Layer: %d")%pi.dock_layer + w, h = dc.GetTextExtent(s) + dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1)) + + s = ("Dock: %d Row: %d")%(pi.dock_direction, pi.dock_row) + w, h = dc.GetTextExtent(s) + dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2)) + + s = ("Position: %d")%pi.dock_pos + w, h = dc.GetTextExtent(s) + dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3)) + + s = ("Proportion: %d")%pi.dock_proportion + w, h = dc.GetTextExtent(s) + dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4)) + + + def OnEraseBackground(self, event): + # intentionally empty + pass + + + def OnSize(self, event): + + self.Refresh() + event.Skip() + + +ID_PaneBorderSize = wx.ID_HIGHEST + 1 +ID_SashSize = ID_PaneBorderSize + 1 +ID_CaptionSize = ID_PaneBorderSize + 2 +ID_BackgroundColor = ID_PaneBorderSize + 3 +ID_SashColor = ID_PaneBorderSize + 4 +ID_InactiveCaptionColor = ID_PaneBorderSize + 5 +ID_InactiveCaptionGradientColor = ID_PaneBorderSize + 6 +ID_InactiveCaptionTextColor = ID_PaneBorderSize + 7 +ID_ActiveCaptionColor = ID_PaneBorderSize + 8 +ID_ActiveCaptionGradientColor = ID_PaneBorderSize + 9 +ID_ActiveCaptionTextColor = ID_PaneBorderSize + 10 +ID_BorderColor = ID_PaneBorderSize + 11 +ID_GripperColor = ID_PaneBorderSize + 12 + +class SettingsPanel(wx.Panel): + + def __init__(self, parent, frame): + + wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, + wx.DefaultSize) + + self._frame = frame + + vert = wx.BoxSizer(wx.VERTICAL) + + s1 = wx.BoxSizer(wx.HORIZONTAL) + self._border_size = wx.SpinCtrl(self, ID_PaneBorderSize, "", wx.DefaultPosition, wx.Size(50,20)) + s1.Add((1, 1), 1, wx.EXPAND) + s1.Add(wx.StaticText(self, -1, "Pane Border Size:")) + s1.Add(self._border_size) + s1.Add((1, 1), 1, wx.EXPAND) + s1.SetItemMinSize(1, (180, 20)) + #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) + + s2 = wx.BoxSizer(wx.HORIZONTAL) + self._sash_size = wx.SpinCtrl(self, ID_SashSize, "", wx.DefaultPosition, wx.Size(50,20)) + s2.Add((1, 1), 1, wx.EXPAND) + s2.Add(wx.StaticText(self, -1, "Sash Size:")) + s2.Add(self._sash_size) + s2.Add((1, 1), 1, wx.EXPAND) + s2.SetItemMinSize(1, (180, 20)) + #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) + + s3 = wx.BoxSizer(wx.HORIZONTAL) + self._caption_size = wx.SpinCtrl(self, ID_CaptionSize, "", wx.DefaultPosition, wx.Size(50,20)) + s3.Add((1, 1), 1, wx.EXPAND) + s3.Add(wx.StaticText(self, -1, "Caption Size:")) + s3.Add(self._caption_size) + s3.Add((1, 1), 1, wx.EXPAND) + s3.SetItemMinSize(1, (180, 20)) + #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) + + #vert.Add(1, 1, 1, wx.EXPAND) + + b = self.CreateColorBitmap(wx.BLACK) + + s4 = wx.BoxSizer(wx.HORIZONTAL) + self._background_color = wx.BitmapButton(self, ID_BackgroundColor, b, wx.DefaultPosition, wx.Size(50,25)) + s4.Add((1, 1), 1, wx.EXPAND) + s4.Add(wx.StaticText(self, -1, "Background Color:")) + s4.Add(self._background_color) + s4.Add((1, 1), 1, wx.EXPAND) + s4.SetItemMinSize(1, (180, 20)) + + s5 = wx.BoxSizer(wx.HORIZONTAL) + self._sash_color = wx.BitmapButton(self, ID_SashColor, b, wx.DefaultPosition, wx.Size(50,25)) + s5.Add((1, 1), 1, wx.EXPAND) + s5.Add(wx.StaticText(self, -1, "Sash Color:")) + s5.Add(self._sash_color) + s5.Add((1, 1), 1, wx.EXPAND) + s5.SetItemMinSize(1, (180, 20)) + + s6 = wx.BoxSizer(wx.HORIZONTAL) + self._inactive_caption_color = wx.BitmapButton(self, ID_InactiveCaptionColor, b, + wx.DefaultPosition, wx.Size(50,25)) + s6.Add((1, 1), 1, wx.EXPAND) + s6.Add(wx.StaticText(self, -1, "Normal Caption:")) + s6.Add(self._inactive_caption_color) + s6.Add((1, 1), 1, wx.EXPAND) + s6.SetItemMinSize(1, (180, 20)) + + s7 = wx.BoxSizer(wx.HORIZONTAL) + self._inactive_caption_gradient_color = wx.BitmapButton(self, ID_InactiveCaptionGradientColor, + b, wx.DefaultPosition, wx.Size(50,25)) + s7.Add((1, 1), 1, wx.EXPAND) + s7.Add(wx.StaticText(self, -1, "Normal Caption Gradient:")) + s7.Add(self._inactive_caption_gradient_color) + s7.Add((1, 1), 1, wx.EXPAND) + s7.SetItemMinSize(1, (180, 20)) + + s8 = wx.BoxSizer(wx.HORIZONTAL) + self._inactive_caption_text_color = wx.BitmapButton(self, ID_InactiveCaptionTextColor, b, + wx.DefaultPosition, wx.Size(50,25)) + s8.Add((1, 1), 1, wx.EXPAND) + s8.Add(wx.StaticText(self, -1, "Normal Caption Text:")) + s8.Add(self._inactive_caption_text_color) + s8.Add((1, 1), 1, wx.EXPAND) + s8.SetItemMinSize(1, (180, 20)) + + s9 = wx.BoxSizer(wx.HORIZONTAL) + self._active_caption_color = wx.BitmapButton(self, ID_ActiveCaptionColor, b, + wx.DefaultPosition, wx.Size(50,25)) + s9.Add((1, 1), 1, wx.EXPAND) + s9.Add(wx.StaticText(self, -1, "Active Caption:")) + s9.Add(self._active_caption_color) + s9.Add((1, 1), 1, wx.EXPAND) + s9.SetItemMinSize(1, (180, 20)) + + s10 = wx.BoxSizer(wx.HORIZONTAL) + self._active_caption_gradient_color = wx.BitmapButton(self, ID_ActiveCaptionGradientColor, + b, wx.DefaultPosition, wx.Size(50,25)) + s10.Add((1, 1), 1, wx.EXPAND) + s10.Add(wx.StaticText(self, -1, "Active Caption Gradient:")) + s10.Add(self._active_caption_gradient_color) + s10.Add((1, 1), 1, wx.EXPAND) + s10.SetItemMinSize(1, (180, 20)) + + s11 = wx.BoxSizer(wx.HORIZONTAL) + self._active_caption_text_color = wx.BitmapButton(self, ID_ActiveCaptionTextColor, + b, wx.DefaultPosition, wx.Size(50,25)) + s11.Add((1, 1), 1, wx.EXPAND) + s11.Add(wx.StaticText(self, -1, "Active Caption Text:")) + s11.Add(self._active_caption_text_color) + s11.Add((1, 1), 1, wx.EXPAND) + s11.SetItemMinSize(1, (180, 20)) + + s12 = wx.BoxSizer(wx.HORIZONTAL) + self._border_color = wx.BitmapButton(self, ID_BorderColor, b, wx.DefaultPosition, + wx.Size(50,25)) + s12.Add((1, 1), 1, wx.EXPAND) + s12.Add(wx.StaticText(self, -1, "Border Color:")) + s12.Add(self._border_color) + s12.Add((1, 1), 1, wx.EXPAND) + s12.SetItemMinSize(1, (180, 20)) + + s13 = wx.BoxSizer(wx.HORIZONTAL) + self._gripper_color = wx.BitmapButton(self, ID_GripperColor, b, wx.DefaultPosition, + wx.Size(50,25)) + s13.Add((1, 1), 1, wx.EXPAND) + s13.Add(wx.StaticText(self, -1, "Gripper Color:")) + s13.Add(self._gripper_color) + s13.Add((1, 1), 1, wx.EXPAND) + s13.SetItemMinSize(1, (180, 20)) + + grid_sizer = wx.GridSizer(0, 2) + grid_sizer.SetHGap(5) + grid_sizer.Add(s1) + grid_sizer.Add(s4) + grid_sizer.Add(s2) + grid_sizer.Add(s5) + grid_sizer.Add(s3) + grid_sizer.Add(s13) + grid_sizer.Add((1, 1)) + grid_sizer.Add(s12) + grid_sizer.Add(s6) + grid_sizer.Add(s9) + grid_sizer.Add(s7) + grid_sizer.Add(s10) + grid_sizer.Add(s8) + grid_sizer.Add(s11) + + cont_sizer = wx.BoxSizer(wx.VERTICAL) + cont_sizer.Add(grid_sizer, 1, wx.EXPAND | wx.ALL, 5) + self.SetSizer(cont_sizer) + self.GetSizer().SetSizeHints(self) + + self._border_size.SetValue(frame.getDockArt().GetMetric(wx.aui.AUI_DOCKART_PANE_BORDER_SIZE)) + self._sash_size.SetValue(frame.getDockArt().GetMetric(wx.aui.AUI_DOCKART_SASH_SIZE)) + self._caption_size.SetValue(frame.getDockArt().GetMetric(wx.aui.AUI_DOCKART_CAPTION_SIZE)) + + self.UpdateColors() + + self.Bind(wx.EVT_SPINCTRL, self.OnPaneBorderSize, id=ID_PaneBorderSize) + self.Bind(wx.EVT_SPINCTRL, self.OnSashSize, id=ID_SashSize) + self.Bind(wx.EVT_SPINCTRL, self.OnCaptionSize, id=ID_CaptionSize) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BackgroundColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_SashColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionGradientColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionTextColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionGradientColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionTextColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BorderColor) + self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_GripperColor) + + + def CreateColorBitmap(self, c): + image = wx.EmptyImage(25, 14) + + for x in xrange(25): + for y in xrange(14): + pixcol = c + if x == 0 or x == 24 or y == 0 or y == 13: + pixcol = wx.BLACK + + image.SetRGB(x, y, pixcol.Red(), pixcol.Green(), pixcol.Blue()) + + return image.ConvertToBitmap() + + + def UpdateColors(self): + + bk = self._frame.getDockArt().GetColour(wx.aui.AUI_DOCKART_BACKGROUND_COLOUR) + self._background_color.SetBitmapLabel(self.CreateColorBitmap(bk)) + + cap = self._frame.getDockArt().GetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR) + self._inactive_caption_color.SetBitmapLabel(self.CreateColorBitmap(cap)) + + capgrad = self._frame.getDockArt().GetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR) + self._inactive_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmap(capgrad)) + ... [truncated message content] |