[Commits] (jed) Fixed menu bug as John suggested.
commits at osafoundation.org
commits at osafoundation.org
Wed Jan 21 03:04:24 PST 2004
Commit by: jed
Modified files:
osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml 1.1 1.2
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py 1.38 1.39
Log message:
Fixed menu bug as John suggested.
Changed EmbeddedContainers to have a wxSizer behind them.
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml.diff?r1=text&tr1=1.1&r2=text&tr2=1.2
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.38&r2=text&tr2=1.39
Index: osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml:1.1 osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml:1.2
--- osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml:1.1 Tue Jan 20 12:36:07 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/demo/parcel.xml Wed Jan 21 03:03:52 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
-<!-- $Date: 2004/01/20 20:36:07 $ -->
+<!-- $Revision: 1.2 $ -->
+<!-- $Date: 2004/01/21 11:03:52 $ -->
<!-- Copyright (c) 2003 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -10,7 +10,8 @@
xmlns:core="//Schema/Core"
xmlns="//parcels/OSAF/framework/blocks"
xmlns:doc="//parcels/OSAF/views/demo"
- xmlns:events="//parcels/OSAF/framework/blocks/Events">
+ xmlns:events="//parcels/OSAF/framework/blocks/Events"
+ xmlns:main="//parcels/OSAF/views/main">
<core:version>0.3</core:version>
@@ -72,7 +73,7 @@
<ChoiceEvent itemName="SwitchEmbeddedChild">
<dispatchEnum>SendToBlock</dispatchEnum>
- <dispatchToBlock itemref="doc:EmbeddedTitle"/>
+ <dispatchToBlock itemref="main:ParcelViewer"/>
<methodName>OnChooseTabEvent</methodName>
<choice>parcels/OSAF/templates/top/LeftText</choice>
</ChoiceEvent>
@@ -420,9 +421,11 @@
</BoxContainer>
<TreeList itemName="TreeExample">
- <columnHeadings>Heading</columnHeadings>
-
+ <columnHeadings>Heading</columnHeadings>
<columnWidths>200</columnWidths>
+ <noLines>False</noLines>
+ <useButtons>True</useButtons>
+ <hideRoot>False</hideRoot>
<contentSpec itemref="doc:myQuery"/>
<open>True</open>
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.38 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.39
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.38 Tue Jan 20 17:38:59 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py Wed Jan 21 03:03:53 2004
@@ -69,7 +69,7 @@
def addToContainer(self, parent, child, id, flag, border):
pass
- def removeFromContainer(self, childToRemove):
+ def removeFromContainer(self, parent, child):
pass
def handleChildren(self, window):
@@ -155,24 +155,51 @@
class EmbeddedContainer(RectangularChild):
def renderOneBlock (self, parent, parentWindow):
- self.wxParent = parent
- self.wxParentWindow = parentWindow
+ sizer = wxBoxSizer(wxHORIZONTAL)
+ panel = wxPanel(parentWindow, -1)
+ panel.SetSizer(sizer)
+ self.getParentBlock(parentWindow).addToContainer(parent, panel, 1,
+ self.Calculate_wxFlag(),
+ self.Calculate_wxBorder())
newChild = Globals.repository.find (self.contentSpec.data)
if newChild:
- return newChild.render (parent, parentWindow)
+ newChild.parentBlock = self
+ return panel, sizer, panel
return None, None, None
+
+ def addToContainer (self, parent, child, weight, flag, border):
+ parent.Add(child, int(weight), flag, border)
+
+ def removeFromContainer(self, parent, child):
+ parent.Remove (child)
+ child.Destroy ()
+ parent.Layout ()
- def OnSwitchEmbeddedChildEvent (self, notification):
+ def OnSelectionChangedEvent (self, notification):
+ # @@@ This isn't working yet. For some reason, switching parcels
+ # causes an infinite number of UpdateUI notifications to be posted.
+ return
+ node = notification.data['node']
+ name = node.treeList.GetItemText(node.nodeId)
oldChild = Globals.repository.find (self.contentSpec.data)
- wxOldChild = Globals.association[oldChild.getUUID()]
- self.getParentBlock(self.wxParentWindow).removeFromContainer(self.wxParent, wxOldChild)
-
- self.contentSpec.data = notification.event.choice
+ wxOldChild = Globals.association [oldChild.getUUID()]
+ parent = wxOldChild.GetContainingSizer ()
+ parentWindow = wxOldChild.GetParent()
+
+ self.removeFromContainer(parent, wxOldChild)
+ oldChild.parentBlock = None
+
+ if name == "Demo":
+ self.contentSpec.data = 'parcels/OSAF/views/demo/TabBox'
+ else:
+ self.contentSpec.data = 'parcels/OSAF/views/repositoryviewer/RepositoryBox'
+
newChild = Globals.repository.find (self.contentSpec.data)
if newChild:
- newChild.render (self.wxParent, self.wxParentWindow)
-
-
+ newChild.parentBlock = self
+ newChild.render (parent, parentWindow)
+
+
class Button(RectangularChild):
def renderOneBlock(self, parent, parentWindow):
id = 0
@@ -364,30 +391,24 @@
self.childrenToAdd = []
self.childrenToAdd.append(child)
- def removeFromContainer(self, childToRemove):
+ def removeFromContainer(self, parent, child):
# @@@ Must be implemented
pass
-
+
def handleChildren(self, window):
- children = window.GetChildren()
+ assert (len (self.childrenToAdd) == 2)
width, height = window.GetSizeTuple()
assert self.splitPercentage >= 0.0 and self.splitPercentage < 1.0
if self.orientationEnum == "Horizontal":
- window.SplitHorizontally(children[0],
- children[1],
+ window.SplitHorizontally(self.childrenToAdd[0],
+ self.childrenToAdd[1],
int (round (height * self.splitPercentage)))
else:
- window.SplitVertically(children[0],
- children[1],
+ window.SplitVertically(self.childrenToAdd[0],
+ self.childrenToAdd[1],
int (round (width * self.splitPercentage)))
return window
-
- assert (len (self.childrenToAdd) == 2)
- if self.orientationEnum == "Horizontal":
- window.SplitVertically(self.childrenToAdd[0], self.childrenToAdd[1])
- else:
- window.SplitHorizontally(self.childrenToAdd[0], self.childrenToAdd[1])
-
+
class StaticText(RectangularChild):
def renderOneBlock (self, parent, parentWindow):
@@ -443,7 +464,7 @@
self.childrenToAdd = []
self.childrenToAdd.append(child)
- def removeFromContainer(self, childToRemove):
+ def removeFromContainer(self, parent, child):
# @@@ Must be implemented
pass
@@ -623,4 +644,12 @@
node.AddRootNode (['Repository Viewer', 'Demo'], ['Views'], true)
def OnSelectionChangedEvent (self, notification):
- pass
\ No newline at end of file
+ node = notification.data['node']
+ name = node.treeList.GetItemText(node.nodeId)
+ arguments = {'parcelName':name, 'type':'Normal'}
+ event = Globals.repository.find('//parcels/OSAF/views/demo/SwitchEmbeddedChild')
+ notification = Notification(event, None, None)
+ notification.SetData(arguments)
+ Globals.notificationManager.PostNotification (notification)
+
+
\ No newline at end of file
More information about the Commits
mailing list