[Commits] (jed) Added navigation.

commits at osafoundation.org commits at osafoundation.org
Fri Jan 30 15:57:19 PST 2004


Commit by: jed
Modified files:
osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml 1.5 1.6
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml 1.14 1.15
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml 1.39 1.40
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py 1.51 1.52

Log message:
Added navigation.


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml.diff?r1=text&tr1=1.14&r2=text&tr2=1.15
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml.diff?r1=text&tr1=1.39&r2=text&tr2=1.40
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.51&r2=text&tr2=1.52

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.51 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.52
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.51	Fri Jan 30 14:29:01 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py	Fri Jan 30 15:56:48 2004
@@ -183,7 +183,7 @@
         child.Destroy ()
         parent.Layout ()
     
-    def OnSelectionChangedEvent (self, notification):
+    def switchEmbeddedContents(self, newPath):
         oldChild = Globals.repository.find (self.contentSpec.data)
         wxOldChild = Globals.association [oldChild.getUUID()]
         embeddedPanel = Globals.association [self.getUUID()]
@@ -193,7 +193,7 @@
         embeddedSizer.Layout()
         oldChild.parentBlock = None
         
-        self.contentSpec.data = notification.data['item']      
+        self.contentSpec.data = newPath     
         newChild = Globals.repository.find (self.contentSpec.data)
         if newChild:
             newChild.parentBlock = self
@@ -380,11 +380,12 @@
 
 class SplitWindow(RectangularChild):
     def renderOneBlock (self, parent, parentWindow):
+        style = wxSP_LIVE_UPDATE|wxNO_FULL_REPAINT_ON_RESIZE
         splitWindow = wxSplitWindow(parentWindow,
                                     Block.getwxID(self), 
                                     wxDefaultPosition,
                                     (self.size.width, self.size.height),
-                                    style=wxSP_3D|wxSP_LIVE_UPDATE|wxNO_FULL_REPAINT_ON_RESIZE)
+                                    style=style)
         self.getParentBlock(parentWindow).addToContainer(parent, splitWindow, self.stretchFactor, 
                               self.Calculate_wxFlag(), self.Calculate_wxBorder())
         """
@@ -507,32 +508,45 @@
         toolbar = wxToolBar(Globals.wxApplication.mainFrame, -1)
         Globals.wxApplication.mainFrame.SetToolBar(toolbar)
         return toolbar, None, None
-        
+
+    def toolPressed(self, event):
+        pass
+    
+    def toolEnterPressed(self, event):
+        pass
 
 class ToolbarItem(RectangularChild):
     def renderOneBlock (self, parent, parentWindow):
         # @@@ Must use self.toolbarLocation rather than wxMainFrame.GetToolBar()
-        toolbar = Globals.wxApplication.mainFrame.GetToolBar()
+        tool = None
+        wxToolbar = Globals.wxApplication.mainFrame.GetToolBar()
+        toolbar = Globals.repository.find(wxToolbar.counterpartUUID)
         if self.toolbarItemKind == 'Button':
+            id = Block.getwxID(self)
             bitmap = wxImage (self.bitmap, wxBITMAP_TYPE_BMP).ConvertToBitmap()
-            toolbar.AddSimpleTool (0, bitmap, self.title, self.statusMessage)
+            tool = wxToolbar.AddSimpleTool (id, bitmap, 
+                                            self.title, self.statusMessage)
+            EVT_TOOL(parentWindow, id, toolbar.toolPressed)
         elif self.toolbarItemKind == 'Separator':
-            toolbar.AddSeparator()
+            wxToolbar.AddSeparator()
         elif self.toolbarItemKind == 'Check':
             pass
         elif self.toolbarItemKind == 'Radio':
             pass
         elif self.toolbarItemKind == 'Text':
-            textBox = wxTextCtrl (toolbar, -1, "", wxDefaultPosition, wxSize(300,-1), wxTE_PROCESS_ENTER)
-            textBox.SetName(self.title)
-            toolbar.AddControl (textBox)
+            tool = wxTextCtrl (wxToolbar, -1, "", 
+                                  wxDefaultPosition, 
+                                  wxSize(300,-1), 
+                                  wxTE_PROCESS_ENTER)
+            tool.SetName(self.title)
+            wxToolbar.AddControl (tool)
+            EVT_TEXT_ENTER(tool, tool.GetId(), toolbar.toolEnterPressed)
         elif __debug__:
             assert (False)
 
-        toolbar.Realize()
-
-        return None, None, None
+        wxToolbar.Realize()
 
+        return tool, None, None
 
 class Tree(RectangularChild):
     def renderOneBlock (self, parent, parentWindow):
@@ -577,6 +591,7 @@
 
     def __init__(self, *arguments, **keywords):
         wxTreeListCtrl.__init__ (self, *arguments, **keywords)
+        self.ignoreSelect = false
         EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnExpanding)
         EVT_TREE_ITEM_COLLAPSING(self, self.GetId(), self.OnCollapsing)
         EVT_LIST_COL_END_DRAG(self, self.GetId(), self.OnColumnDrag)
@@ -620,6 +635,8 @@
             pass
 
     def On_wxSelectionChanged(self, event):
+        if self.ignoreSelect:
+            return
         selection = ''
         id = self.GetSelection()
         while id.IsOk():
@@ -632,7 +649,10 @@
     
             chandlerEvent = Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged')
             notification = Notification(chandlerEvent, None, None)
-            notification.SetData ({'item':self.GetPyData(event.GetItem()),
+            eventId = event.GetItem()
+            notification.SetData ({'item':self.GetPyData(eventId),
+                                   'name':self.GetItemText(eventId),
+                                   'id':eventId,
                                    'type':'Normal'})
             Globals.notificationManager.PostNotification (notification)
 
@@ -719,7 +739,7 @@
         return treeList, None, None
 
     def Calculate_wxStyle (self):
-        style = wxTR_DEFAULT_STYLE
+        style = wxTR_DEFAULT_STYLE|wxNO_BORDER
         if self.hideRoot:
             style |= wxTR_HIDE_ROOT
         if self.noLines:
@@ -777,7 +797,65 @@
         return item.getItemDisplayName()
 
     def OnSelectionChangedEvent (self, notification):
-        event = Globals.repository.find('//parcels/OSAF/views/demo/SwitchEmbeddedChild')
-        notification = Notification(event, None, None)
-        notification.SetData(notification.data)
-        Globals.notificationManager.PostNotification (notification)
+        path = notification.data['item']
+        parcelViewer = Globals.repository.find('//parcels/OSAF/views/main/ParcelViewer')
+        parcelViewer.switchEmbeddedContents(path)
+
+    def SelectItem(self, itemId):
+        treeList = Globals.association[self.getUUID()]
+        treeList.ignoreSelect = true
+        treeList.SelectItem(itemId)
+        treeList.ignoreSelect = false
+        
+class NavigationBar(Toolbar):
+    def renderOneBlock(self, parent, parentWindow):
+        self.history = []
+        self.future = []
+        toolbar = wxToolBar(Globals.wxApplication.mainFrame, -1)
+        Globals.wxApplication.mainFrame.SetToolBar(toolbar)
+        return toolbar, None, None
+                
+    def toolPressed(self, event):
+        tool = Block.wxIDToObject(event.GetId())
+        if tool.getItemName() == 'BackButton':
+            self.GoBack()
+        elif tool.getItemName() == 'ForwardButton':
+            self.GoForward()
+
+    def tooEnterPressed(self, event):
+        tool = Block.wxIDToObject(event.GetId())
+        
+    def GoBack(self):
+        if len(self.history) > 1:
+            currentLocation = self.history.pop()
+            self.future.append(currentLocation)
+            newName, newPath, id = self.history[-1]
+            urlBox = Globals.repository.find('//parcels/OSAF/views/main/URLBox')
+            wxURLBox = Globals.association[urlBox.getUUID()]
+            wxURLBox.SetValue(newName)
+            parcelViewer = Globals.repository.find('//parcels/OSAF/views/main/ParcelViewer')
+            parcelViewer.switchEmbeddedContents(newPath)
+            sidebar = Globals.repository.find('//parcels/OSAF/views/main/Sidebar')
+            sidebar.SelectItem(id)
+    
+    def GoForward(self):
+        if len(self.future) > 0:
+            newLocation = self.future.pop()
+            self.history.append(newLocation)
+            urlBox = Globals.repository.find('//parcels/OSAF/views/main/URLBox')
+            wxURLBox = Globals.association[urlBox.getUUID()]
+            wxURLBox.SetValue(newLocation[0])
+            parcelViewer = Globals.repository.find('//parcels/OSAF/views/main/ParcelViewer')
+            parcelViewer.switchEmbeddedContents(newLocation[1])
+            sidebar = Globals.repository.find('//parcels/OSAF/views/main/Sidebar')
+            sidebar.SelectItem(newLocation[2])
+
+    def OnSelectionChangedEvent (self, notification):
+        name = notification.data['name']
+        path = notification.data['item']
+        id = notification.data['id']
+        self.history.append((name,path,id))
+        self.future = []
+        urlBox = Globals.repository.find('//parcels/OSAF/views/main/URLBox')
+        wxURLBox = Globals.association[urlBox.getUUID()]
+        wxURLBox.SetValue(name)

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.14 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.15
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.14	Thu Jan 29 13:44:58 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml	Fri Jan 30 15:56:47 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.14 $ -->
-<!-- $Date: 2004/01/29 21:44:58 $ -->
+<!-- $Revision: 1.15 $ -->
+<!-- $Date: 2004/01/30 23:56:47 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -88,6 +88,16 @@
   <BlockEvent itemName="EnterPressed">
     <dispatchEnum>Broadcast</dispatchEnum>
     <methodName>OnEnterPressedEvent</methodName>
+  </BlockEvent>
+
+  <BlockEvent itemName="ToolEnterPressed">
+    <dispatchEnum>Broadcast</dispatchEnum>
+    <methodName>OnToolEnterPressedEvent</methodName>
+  </BlockEvent>
+
+  <BlockEvent itemName="ToolPressed">
+    <dispatchEnum>Broadcast</dispatchEnum>
+    <methodName>OnToolPressedEvent</methodName>
   </BlockEvent>
 
 </core:Parcel>

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.39 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.40
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.39	Fri Jan 30 14:29:01 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml	Fri Jan 30 15:56:48 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.39 $ -->
-<!-- $Date: 2004/01/30 22:29:01 $ -->
+<!-- $Revision: 1.40 $ -->
+<!-- $Date: 2004/01/30 23:56:48 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -702,7 +702,7 @@
     <Attribute itemName="splitPercentage">
       <type itemref="Float"/>
     </Attribute>
-
+    
     <attributes itemref="docSchema:orientationEnum"/>
     <attributes itemref="docSchema:SplitWindow/splitPercentage"/>
   </Kind>  
@@ -887,6 +887,14 @@
   <Kind itemName="Sidebar">
     <classes key="python">OSAF.framework.blocks.ContainerBlocks.Sidebar</classes>
     <superKinds itemref="docSchema:TreeList"/>
+  </Kind>  
+
+  <!--
+    NavigationBar
+  -->
+  <Kind itemName="NavigationBar">
+    <classes key="python">OSAF.framework.blocks.ContainerBlocks.NavigationBar</classes>
+    <superKinds itemref="docSchema:Toolbar"/>
   </Kind>  
 
   <Kind itemName="RepositoryTreeList">

Index: osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.5 osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.6
--- osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.5	Tue Jan 27 14:48:55 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml	Fri Jan 30 15:56:47 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.5 $ -->
-<!-- $Date: 2004/01/27 22:48:55 $ -->
+<!-- $Revision: 1.6 $ -->
+<!-- $Date: 2004/01/30 23:56:47 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -205,17 +205,17 @@
   <!--
     Toolbars
   -->
-  <Toolbar itemName="Toolbar">
+  <NavigationBar itemName="NavigationBar">
     <!-- Attributes -->
     <toolSize>16,16</toolSize>
-  </Toolbar>
+  </NavigationBar>
 
   <!--
     ToolbarItems
   -->
   <ToolbarItem itemName="BackButton">
     <!-- Attributes -->
-    <toolbarLocation>Toolbar</toolbarLocation>
+    <toolbarLocation>NavigationBar</toolbarLocation>
     <title>Back</title>
     <bitmap>application/images/back.bmp</bitmap>
     <selectedBitmap></selectedBitmap>
@@ -225,7 +225,7 @@
 
   <ToolbarItem itemName="ForwardButton">
     <!-- Attributes -->
-    <toolbarLocation>Toolbar</toolbarLocation>
+    <toolbarLocation>NavigationBar</toolbarLocation>
     <title>Forward</title>
     <bitmap>application/images/forward.bmp</bitmap>
     <selectedBitmap></selectedBitmap>
@@ -235,7 +235,7 @@
 
   <ToolbarItem itemName="ReloadButton">
     <!-- Attributes -->
-    <toolbarLocation>Toolbar</toolbarLocation>
+    <toolbarLocation>NavigationBar</toolbarLocation>
     <title>Forward</title>
     <bitmap>application/images/reload.bmp</bitmap>
     <selectedBitmap></selectedBitmap>
@@ -251,7 +251,7 @@
 
   <ToolbarItem itemName="URLBox">
     <!-- Attributes -->
-    <toolbarLocation>Toolbar</toolbarLocation>
+    <toolbarLocation>NavigationBar</toolbarLocation>
     <title>URLBox</title>
     <toolbarItemKind>Text</toolbarItemKind>
     <statusMessage></statusMessage>
@@ -301,7 +301,7 @@
     <!-- Attributes -->
     <orientationEnum>Vertical</orientationEnum>
     <splitPercentage>0.25</splitPercentage>
-
+    
     <contentSpec itemref="doc:myQuery"/>
     <open>True</open>
     <size>900,580</size>
@@ -330,7 +330,7 @@
     <childrenBlocks itemref="doc:ViewStatusBarItem"/>
     
     <!-- Toolbar -->
-    <childrenBlocks itemref="doc:Toolbar"/>
+    <childrenBlocks itemref="doc:NavigationBar"/>
     <childrenBlocks itemref="doc:BackButton"/>
     <childrenBlocks itemref="doc:ForwardButton"/>
     <childrenBlocks itemref="doc:ReloadButton"/>



More information about the Commits mailing list