[Commits] (jed) Hooked up the hide/show menus for the navigation elements (Bug#1180).

commits at osafoundation.org commits at osafoundation.org
Wed Mar 10 01:18:32 PST 2004


Commit by: jed
Modified files:
osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py 1.3 1.4
osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml 1.23 1.24
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml 1.18 1.19
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py 1.16 1.17
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml 1.53 1.54
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py 1.5 1.6
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py 1.67 1.68

Log message:
Hooked up the hide/show menus for the navigation elements (Bug#1180).


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml.diff?r1=text&tr1=1.23&r2=text&tr2=1.24
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml.diff?r1=text&tr1=1.18&r2=text&tr2=1.19
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py.diff?r1=text&tr1=1.16&r2=text&tr2=1.17
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml.diff?r1=text&tr1=1.53&r2=text&tr2=1.54
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.67&r2=text&tr2=1.68

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.16 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.17
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.16	Mon Mar  8 09:02:11 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py	Wed Mar 10 01:18:30 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.16 $"
-__date__ = "$Date: 2004/03/08 17:02:11 $"
+__version__ = "$Revision: 1.17 $"
+__date__ = "$Date: 2004/03/10 09:18:30 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -141,18 +141,6 @@
     def OnPreferencesEventUpdateUI (self, notification):
         notification.data ['Enable'] = False
         
-    def OnViewSidebarEventUpdateUI (self, notification):
-        notification.data ['Enable'] = False
-
-    def OnViewNavigationBarEventUpdateUI (self, notification):
-        notification.data ['Enable'] = False
-
-    def OnViewBookmarksBarEventUpdateUI (self, notification):
-        notification.data ['Enable'] = False
-
-    def OnViewStatusBarEventUpdateUI (self, notification):
-        notification.data ['Enable'] = False
-    
     # Test Methods
 
     def OnGenerateContentItems(self, notification):

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.18 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.19
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.18	Mon Mar  8 09:02:09 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml	Wed Mar 10 01:18:29 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.18 $ -->
-<!-- $Date: 2004/03/08 17:02:09 $ -->
+<!-- $Revision: 1.19 $ -->
+<!-- $Date: 2004/03/10 09:18:29 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -23,8 +23,9 @@
     <blockEvents itemref="events:Copy"/>
     <blockEvents itemref="events:Paste"/>
     <blockEvents itemref="events:Preferences"/>
-    <blockEvents itemref="events:ViewSidebar"/>
+    <blockEvents itemref="events:ViewSideBar"/>
     <blockEvents itemref="events:ViewNavigationBar"/>
+    <blockEvents itemref="events:ViewBookmarksBar"/>
     <blockEvents itemref="events:ViewStatusBar"/>    
     <blockEvents itemref="events:SelectionChanged"/>
     <blockEvents itemref="events:EnterPressed"/>
@@ -71,18 +72,23 @@
     <methodName>OnPreferencesEvent</methodName>
   </BlockEvent>
 
-  <BlockEvent itemName="ViewSidebar">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnViewSidebarEvent</methodName>
+  <BlockEvent itemName="ViewSideBar">
+    <dispatchEnum>Broadcast</dispatchEnum>
+    <methodName>OnViewSideBarEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="ViewNavigationBar">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>Broadcast</dispatchEnum>
     <methodName>OnViewNavigationBarEvent</methodName>
   </BlockEvent>
 
+  <BlockEvent itemName="ViewBookmarksBar">
+    <dispatchEnum>Broadcast</dispatchEnum>
+    <methodName>OnViewBookmarksBarEvent</methodName>
+  </BlockEvent>
+
   <BlockEvent itemName="ViewStatusBar">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>Broadcast</dispatchEnum>
     <methodName>OnViewStatusBarEvent</methodName>
   </BlockEvent>
 

Index: osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py
diff -u osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py:1.3 osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py:1.4
--- osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py:1.3	Thu Feb 12 17:03:05 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/main/SideBar.py	Wed Mar 10 01:18:28 2004
@@ -1,9 +1,35 @@
-__version__ = "$Revision: 1.3 $"
-__date__ = "$Date: 2004/02/13 01:03:05 $"
+__version__ = "$Revision: 1.4 $"
+__date__ = "$Date: 2004/03/10 09:18:28 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
 import application.Globals as Globals
+import OSAF.framework.blocks.ControlBlocks as ControlBlocks
+from wxPython.wx import *
+
+        
+class SideBar(ControlBlocks.Tree):
+    def renderOneBlock(self, parent, parentWindow):
+        returnArguments = ControlBlocks.Tree.renderOneBlock(self, parent, parentWindow)
+        self.showOrHideSideBar(returnArguments[0])
+        return returnArguments
+    
+    def OnViewSideBarEvent(self, notification):
+        self.open = not self.open
+        self.showOrHideSideBar(Globals.association[self.getUUID()])
+
+    def showOrHideSideBar(self, sidebar):
+        if sidebar.IsShown() != self.open:
+            sidebar.Show(self.open)
+            parentWindow = Globals.association[self.parentBlock.getUUID()]
+            if self.open:
+                self.parentBlock.addToContainer(parentWindow, sidebar, None, None, None)
+            else:
+                self.parentBlock.removeFromContainer(parentWindow, sidebar, False)
+            self.parentBlock.handleChildren(parentWindow)
+            
+    def OnViewSideBarEventUpdateUI(self, notification):
+        notification.data['Check'] = self.open
 
 
 class SideBarDelegate:

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.53 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.54
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.53	Wed Mar  3 15:38:25 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml	Wed Mar 10 01:18:30 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.53 $ -->
-<!-- $Date: 2004/03/03 23:38:25 $ -->
+<!-- $Revision: 1.54 $ -->
+<!-- $Date: 2004/03/10 09:18:30 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -294,21 +294,6 @@
     <methodName>OnPreferencesEvent</methodName>
   </docSchema:BlockEvent>
 
-  <BlockEvent itemName="ViewSidebar">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnViewSidebarEvent</methodName>
-  </BlockEvent>
-
-  <BlockEvent itemName="ViewNavigationBar">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnViewNavigationBarEvent</methodName>
-  </BlockEvent>
-
-  <BlockEvent itemName="ViewStatusBar">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnViewStatusBarEvent</methodName>
-  </BlockEvent>
-
   <docSchema:BlockEvent itemName="SelectionChanged">
     <dispatchEnum>Broadcast</dispatchEnum>
     <methodName>OnSelectionChangedEvent</methodName>
@@ -347,10 +332,9 @@
 
     <Attribute itemName="open">
       <type itemref="Boolean"/>
-      <defaultValue type="Boolean">False</defaultValue>
+      <defaultValue type="Boolean">True</defaultValue>
     </Attribute>
 
-
     <Attribute itemName="eventBoundary">
       <type itemref="Boolean"/>
       <defaultValue type="Boolean">False</defaultValue>
@@ -390,14 +374,17 @@
 
     <Attribute itemName="size">
       <type itemref="docSchema:SizeType"/>
+      <defaultValue type="docSchema:SizeType">0,0</defaultValue>
     </Attribute>
 
     <Attribute itemName="minimumSize">
       <type itemref="docSchema:SizeType"/>
+      <defaultValue type="docSchema:SizeType">0,0</defaultValue>
     </Attribute>
 
     <Attribute itemName="border">
       <type itemref="docSchema:RectType"/>
+      <defaultValue type="docSchema:RectType">0.0, 0.0, 0.0, 0.0</defaultValue>
     </Attribute>
     
     <Enumeration itemName="alignmentEnumType">
@@ -416,10 +403,12 @@
 
     <Attribute itemName="alignmentEnum">
       <type itemref="docSchema:RectangularChild/alignmentEnumType"/>
+      <defaultValue type="docSchema:RectangularChild/alignmentEnumType">grow</defaultValue>
     </Attribute>
 
     <Attribute itemName="stretchFactor">
       <type itemref="Float"/>
+      <defaultValue type="Float">1.0</defaultValue>
     </Attribute>
 
     <attributes itemref="docSchema:RectangularChild/size"/>
@@ -950,4 +939,3 @@
   </Kind>
 
 </Parcel>
-

Index: osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.23 osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.24
--- osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.23	Mon Mar  8 09:05:16 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml	Wed Mar 10 01:18:28 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.23 $ -->
-<!-- $Date: 2004/03/08 17:05:16 $ -->
+<!-- $Revision: 1.24 $ -->
+<!-- $Date: 2004/03/10 09:18:28 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -180,14 +180,14 @@
     <helpString></helpString>
   </MenuItem>
 
-  <MenuItem itemName="ViewSidebarItem">
+  <MenuItem itemName="ViewSideBarItem">
     <title>View Sidebar</title>
     <operation>InsertBefore</operation>
     <menuLocation>ViewMenu</menuLocation>
     <itemLocation></itemLocation>
-    <menuItemKind>Normal</menuItemKind>
+    <menuItemKind>Check</menuItemKind>
     <accel></accel>
-    <event itemref="events:ViewSidebar"/>
+    <event itemref="events:ViewSideBar"/>
     <helpString></helpString>
   </MenuItem>
 
@@ -196,18 +196,29 @@
     <operation>InsertBefore</operation>
     <menuLocation>ViewMenu</menuLocation>
     <itemLocation></itemLocation>
-    <menuItemKind>Normal</menuItemKind>
+    <menuItemKind>Check</menuItemKind>
     <accel></accel>
     <event itemref="events:ViewNavigationBar"/>
     <helpString></helpString>
   </MenuItem>
 
+  <MenuItem itemName="ViewBookmarksBarItem">
+    <title>View Bookmarks Bar</title>
+    <operation>InsertBefore</operation>
+    <menuLocation>ViewMenu</menuLocation>
+    <itemLocation></itemLocation>
+    <menuItemKind>Check</menuItemKind>
+    <accel></accel>
+    <event itemref="events:ViewBookmarksBar"/>
+    <helpString></helpString>
+  </MenuItem>
+
   <MenuItem itemName="ViewStatusBarItem">
     <title>View Status Bar</title>
     <operation>InsertBefore</operation>
     <menuLocation>ViewMenu</menuLocation>
     <itemLocation></itemLocation>
-    <menuItemKind>Normal</menuItemKind>
+    <menuItemKind>Check</menuItemKind>
     <accel></accel>
     <event itemref="events:ViewStatusBar"/>
     <helpString></helpString>
@@ -337,7 +348,8 @@
   <!--
     Status Bar
   -->
-  <StatusBar itemName="StatusBar">
+  <StatusBar itemName="StatusBar"
+             itemClass="OSAF.framework.blocks.NavigationBlocks.ChandlerStatusBar">
   </StatusBar>
 
   <!-- 
@@ -480,7 +492,9 @@
     <stretchFactor>0.0</stretchFactor>
   </EmbeddedContainer>  
 
-  <Tree itemName="Sidebar">
+  <Tree itemName="Sidebar"
+        itemClass="OSAF.views.main.SideBar.SideBar">
+
     <!-- Attributes -->
     <elementDelegate>OSAF.views.main.SideBar.SideBarDelegate</elementDelegate>
     <selection itemref="doc:AboutChandler"/>
@@ -562,8 +576,9 @@
     <childrenBlocks itemref="doc:EditSeparator2"/>
     <childrenBlocks itemref="doc:PreferencesItem"/>
     <childrenBlocks itemref="doc:ViewMenu"/>
-    <childrenBlocks itemref="doc:ViewSidebarItem"/>
+    <childrenBlocks itemref="doc:ViewSideBarItem"/>
     <childrenBlocks itemref="doc:ViewNavigationBarItem"/>
+    <childrenBlocks itemref="doc:ViewBookmarksBarItem"/>
     <childrenBlocks itemref="doc:ViewStatusBarItem"/>
     <childrenBlocks itemref="doc:TestMenu"/>
     <childrenBlocks itemref="doc:GenerateAllItem"/>

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.67 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.68
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.67	Wed Mar  3 15:38:25 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py	Wed Mar 10 01:18:30 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.67 $"
-__date__ = "$Date: 2004/03/03 23:38:25 $"
+__version__ = "$Revision: 1.68 $"
+__date__ = "$Date: 2004/03/10 09:18:30 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -33,13 +33,19 @@
             parent.SetSizer(sizer)
             return parent, sizer, parent
                 
-    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()
+    def addToContainer(self, parent, child, weight, flag, border, append=True):
+        if append:
+            parent.Add(child, int(weight), flag, border)
+        else:
+            parent.Prepend(child, int(weight), flag, border)
         parent.Layout()
+        
+    def removeFromContainer(self, parent, child, doDestroy=True):
+        parentSizer = parent.GetSizer()
+        parentSizer.Remove(child)
+        if doDestroy:
+            child.Destroy()
+        parentSizer.Layout()
 
 
 class EmbeddedContainer(RectangularChild):
@@ -62,13 +68,19 @@
             return panel, sizer, panel
         
 
-    def addToContainer (self, parent, child, weight, flag, border):
-        parent.Add(child, int(weight), flag, border)
+    def addToContainer (self, parent, child, weight, flag, border, append=True):
+        if append:
+            parent.Add(child, int(weight), flag, border)
+        else:
+            parent.Prepend(child, int(weight), flag, border)
+        parent.Layout()
         
-    def removeFromContainer(self, parent, child):
-        parent.Remove (child)
-        child.Destroy ()
-        parent.Layout ()
+    def removeFromContainer(self, parent, child, doDestroy=True):
+        parentSizer = parent.GetSizer()
+        parentSizer.Remove(child)
+        if doDestroy:
+            child.Destroy()
+        parentSizer.Layout()
     
     def OnSelectionChangedEvent(self, notification):
         node = notification.data['item']
@@ -85,7 +97,7 @@
                 oldChild = self.contentSpec.data[0]
                 wxOldChild = Globals.association [oldChild.getUUID()]
                 self.UnregisterEvents(oldChild)
-                self.removeFromContainer (embeddedSizer, wxOldChild)
+                self.removeFromContainer (embeddedPanel, wxOldChild)
                 oldChild.parentBlock = None
             
                 self.contentSpec.data = [newChild]
@@ -178,30 +190,44 @@
             style |= wxSP_3D
         return style
 
-    def addToContainer(self, parent, child, weight, flag, border):
+    def addToContainer(self, parent, child, weight, flag, border, append=True):
         if not hasattr(self, 'childrenToAdd'):
             self.childrenToAdd = []
         self.childrenToAdd.append(child)
-        
-    def removeFromContainer(self, parent, child):
-        # @@@ Must be implemented
-        pass
-        
+
+    def removeFromContainer(self, parent, child, doDestroy=True):
+        try:
+            self.childrenToAdd.remove(child)
+        except ValueError:
+            parent.Unsplit(child)
+            if doDestroy:
+                child.Destroy()
+                    
     def handleChildren(self, window):
-        assert (len (self.childrenToAdd) == 2)
+        numChildrenToAdd = len(self.childrenToAdd)
+        if numChildrenToAdd == 1:
+            window1 = window.GetWindow1()
+            if not window1:
+                window.Initialize(self.childrenToAdd[0])
+            else:
+                self.doSplitWindow(window, self.childrenToAdd[0], window1)
+        elif numChildrenToAdd == 2:
+            self.doSplitWindow(window, self.childrenToAdd[0], self.childrenToAdd[1])
+        self.childrenToAdd = []
+        return window
+
+    def doSplitWindow(self, window, window1, window2):
         width, height = window.GetSizeTuple()
         assert self.splitPercentage >= 0.0 and self.splitPercentage < 1.0
         if self.orientationEnum == "Horizontal":
-            window.SplitHorizontally(self.childrenToAdd[0],
-                                     self.childrenToAdd[1],
+            window.SplitHorizontally(window1,
+                                     window2,
                                      int (round (height * self.splitPercentage)))
         else:
-            window.SplitVertically(self.childrenToAdd[0],
-                                   self.childrenToAdd[1],
+            window.SplitVertically(window1,
+                                   window2,
                                    int (round (width * self.splitPercentage)))
-        self.childrenToAdd = []
-        return window
-
+    
 
 class TabbedContainer(RectangularChild):
     def renderOneBlock (self, parent, parentWindow):
@@ -229,12 +255,12 @@
                               self.Calculate_wxFlag(), self.Calculate_wxBorder())
         return tabbedContainer, tabbedContainer, tabbedContainer
 
-    def addToContainer(self, parent, child, weight, flag, border):
+    def addToContainer(self, parent, child, weight, flag, border, append=True):
         if not hasattr(self, 'childrenToAdd'):
             self.childrenToAdd = []
         self.childrenToAdd.append(child)
 
-    def removeFromContainer(self, parent, child):
+    def removeFromContainer(self, parent, child, doDestroy=True):
         # @@@ Must be implemented
         pass
 

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py:1.5 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py:1.6
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py:1.5	Mon Feb 16 08:30:49 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py	Wed Mar 10 01:18:30 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.5 $"
-__date__ = "$Date: 2004/02/16 16:30:49 $"
+__version__ = "$Revision: 1.6 $"
+__date__ = "$Date: 2004/03/10 09:18:30 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -12,6 +12,83 @@
 from wxPython.wx import *
 
 
+class wxBookmark(wxStaticText):
+    """
+      Under construction
+    """
+    def __init__(self, parent, text, onClickMethod, userData, id=-1):
+        wxStaticText.__init__(self, parent, id, text)
+        self.onClickMethod = onClickMethod
+        self.userData = userData
+        EVT_LEFT_DOWN(self, self.onClick)
+        
+    def onClick(self, event):
+        self.onClickMethod(self.userData)
+        
+
+class BookmarksBar(RectangularChild):
+    """
+      Under construction
+    """
+    def __init__(self, *arguments, **keywords):
+        super (BookmarksBar, self).__init__ (*arguments, **keywords)
+        self.bookmarksPath = None
+
+    def renderOneBlock(self, parent, parentWindow):
+        panel = wxPanel(parentWindow, -1)
+        sizer = wxBoxSizer(wxHORIZONTAL)
+        sizer.SetMinSize((self.minimumSize.width, self.minimumSize.height))
+        self.addBookmarks(panel, sizer)
+        panel.SetSizerAndFit(sizer)
+        self.getParentBlock(parentWindow).addToContainer(parent, panel,
+                                                         self.stretchFactor,
+                                                         self.Calculate_wxFlag(),
+                                                         self.Calculate_wxBorder())
+        self.showOrHideBookmarksBar(panel)
+        return panel, None, None
+    
+    def addBookmarks(self, parent, sizer):
+        for child in self.bookmarksPath.children:
+            self.addBookmark(parent, sizer, child.getItemDisplayName(), child.GetPath())
+        
+    def addBookmark(self, parent, sizer, title, path):
+        sizer.Add(10, 0, 0, wxEXPAND)
+        bookmark = wxBookmark(parent, title, self.bookmarkPressed, path)
+        sizer.Add(bookmark, 0)
+        sizer.Add(10, 0, 0, wxEXPAND)
+        
+    def bookmarkPressed(self, text):
+        item = Node.GetItemFromPath(text, '//parcels/OSAF/views/main/URLRoot')
+        """
+          If a parcel takes the focus upon a SelectionChanged event, we must take the focus back
+        temporarily so that the sidebar gets the event.  This is a temporary solution for Bug#1249.
+        """
+        Globals.wxApplication.mainFrame.SetFocus()
+        self.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
+                   {'item':item})
+        
+    def OnViewBookmarksBarEvent(self, notification):
+        self.open = not self.open
+        self.showOrHideBookmarksBar(Globals.association[self.getUUID()])
+        
+    def showOrHideBookmarksBar(self, bookmarksBar):
+        if bookmarksBar.IsShown() != self.open:
+            bookmarksBar.Show(self.open)
+            parentWindow = Globals.association[self.parentBlock.getUUID()]
+            if self.open:
+                self.parentBlock.addToContainer(parentWindow.GetSizer(), bookmarksBar, 
+                                                self.stretchFactor,
+                                                self.Calculate_wxFlag(),
+                                                self.Calculate_wxBorder(), 
+                                                False)
+            else:
+                self.parentBlock.removeFromContainer(parentWindow, bookmarksBar, False)
+            self.parentBlock.handleChildren(parentWindow)
+        
+    def OnViewBookmarksBarEventUpdateUI(self, notification):
+        notification.data['Check'] = self.open
+        
+
 class NavigationBar(Toolbar):
     """
       Under construction
@@ -19,8 +96,11 @@
     def renderOneBlock(self, parent, parentWindow):
         self.history = []
         self.future = []
-        return Toolbar.renderOneBlock(self, parent, parentWindow)
-        
+
+        returnArguments = Toolbar.renderOneBlock(self, parent, parentWindow)
+        self.showOrHideNavigationBar()
+        return returnArguments
+    
     def toolPressed(self, event):
         tool = Block.wxIDToObject(event.GetId())
         if tool.getItemName() == 'BackButton':
@@ -42,6 +122,20 @@
             self.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
                        {'item':item})
         
+    def OnViewNavigationBarEvent(self, notification):
+        self.open = not self.open
+        self.showOrHideNavigationBar()
+        
+    def showOrHideNavigationBar(self):
+        frame = Globals.wxApplication.mainFrame
+        navigationBar = frame.GetToolBar()
+        if navigationBar.IsShown() != self.open:
+            navigationBar.Show(self.open)
+            frame.Layout()
+        
+    def OnViewNavigationBarEventUpdateUI(self, notification):
+        notification.data['Check'] = self.open
+
     def GoBack(self):
         if len(self.history) > 1:
             currentLocation = self.history.pop()
@@ -80,57 +174,24 @@
         wxURLBox.SetValue(path)
         
         
-class wxBookmark(wxStaticText):
-    """
-      Under construction
-    """
-    def __init__(self, parent, text, onClickMethod, userData, id=-1):
-        wxStaticText.__init__(self, parent, id, text)
-        self.onClickMethod = onClickMethod
-        self.userData = userData
-        EVT_LEFT_DOWN(self, self.onClick)
-        
-    def onClick(self, event):
-        self.onClickMethod(self.userData)
-        
-
-class BookmarksBar(RectangularChild):
-    """
-      Under construction
-    """
-    def __init__(self, *arguments, **keywords):
-        super (BookmarksBar, self).__init__ (*arguments, **keywords)
-        self.bookmarksPath = None
-
+class ChandlerStatusBar(StatusBar):
     def renderOneBlock(self, parent, parentWindow):
-        panel = wxPanel(parentWindow, -1)
-        sizer = wxBoxSizer(wxHORIZONTAL)
-        sizer.SetMinSize((self.minimumSize.width, self.minimumSize.height))
-        self.addBookmarks(panel, sizer)
-        panel.SetSizerAndFit(sizer)
-        self.getParentBlock(parentWindow).addToContainer(parent, panel,
-                                                         self.stretchFactor,
-                                                         self.Calculate_wxFlag(),
-                                                         self.Calculate_wxBorder())
-        return panel, None, None
+        returnArguments = StatusBar.renderOneBlock(self, parent, parentWindow)
+        self.showOrHideStatusBar()
+        return returnArguments
     
-    def addBookmarks(self, parent, sizer):
-        for child in self.bookmarksPath.children:
-            self.addBookmark(parent, sizer, child.getItemDisplayName(), child.GetPath())
-        
-    def addBookmark(self, parent, sizer, title, path):
-        sizer.Add(10, 0, 0, wxEXPAND)
-        bookmark = wxBookmark(parent, title, self.bookmarkPressed, path)
-        sizer.Add(bookmark, 0)
-        sizer.Add(10, 0, 0, wxEXPAND)
-        
-    def bookmarkPressed(self, text):
-        item = Node.GetItemFromPath(text, '//parcels/OSAF/views/main/URLRoot')
-        """
-          If a parcel takes the focus upon a SelectionChanged event, we must take the focus back
-        temporarily so that the sidebar gets the event.  This is a temporary solution for Bug#1249.
-        """
-        Globals.wxApplication.mainFrame.SetFocus()
-        self.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
-                   {'item':item})
+    def OnViewStatusBarEvent(self, notification):
+        self.open = not self.open
+        self.showOrHideStatusBar()
+
+    def showOrHideStatusBar(self):
+        frame = Globals.wxApplication.mainFrame
+        statusBar = frame.GetStatusBar()
+        if statusBar.IsShown() != self.open:
+            statusBar.Show(self.open)
+            frame.Layout()
+            
+    def OnViewStatusBarEventUpdateUI(self, notification):
+        notification.data['Check'] = self.open
         
+        
\ No newline at end of file



More information about the Commits mailing list