[Commits] (john) Fix bug #1224

commits at osafoundation.org commits at osafoundation.org
Mon Apr 19 08:57:37 PDT 2004


Commit by: john
Modified files:
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml 1.19 1.20
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py 1.20 1.21
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml 1.57 1.58
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py 1.72 1.73
osaf/chandler/Chandler/application/Globals.py 1.7 1.8
osaf/chandler/Chandler/application/Application.py 1.214 1.215

Log message:
Fix bug #1224


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml.diff?r1=text&tr1=1.19&r2=text&tr2=1.20
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py.diff?r1=text&tr1=1.20&r2=text&tr2=1.21
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml.diff?r1=text&tr1=1.57&r2=text&tr2=1.58
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.72&r2=text&tr2=1.73
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/application/Globals.py.diff?r1=text&tr1=1.7&r2=text&tr2=1.8
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/application/Application.py.diff?r1=text&tr1=1.214&r2=text&tr2=1.215

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.72 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.73
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.72	Thu Apr 15 15:55:49 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py	Mon Apr 19 08:57:00 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.72 $"
-__date__ = "$Date: 2004/04/15 22:55:49 $"
+__version__ = "$Revision: 1.73 $"
+__date__ = "$Date: 2004/04/19 15:57:00 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -65,6 +65,7 @@
         else:
             newChild.parentBlock = self
             self.RegisterEvents(newChild)
+            Globals.mainView.onSetActiveView(newChild)
             return panel, sizer, panel
         
 
@@ -102,8 +103,10 @@
             
                 self.contentSpec.data = [newChild]
                 newChild.parentBlock = self
-                self.RegisterEvents(newChild)
                 newChild.render (embeddedSizer, embeddedPanel)
+                self.RegisterEvents(newChild)
+                Globals.mainView.onSetActiveView(newChild)
+                
                 embeddedSizer.Layout()
 
     def RegisterEvents(self, block):

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.19 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.20
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml:1.19	Wed Mar 10 01:18:29 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Events/parcel.xml	Mon Apr 19 08:56:55 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.19 $ -->
-<!-- $Date: 2004/03/10 09:18:29 $ -->
+<!-- $Revision: 1.20 $ -->
+<!-- $Date: 2004/04/19 15:56:55 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -38,37 +38,37 @@
   </EventData>
 
   <BlockEvent itemName="Quit">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnQuitEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="Undo">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnUndoEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="Redo">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnRedoEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="Cut">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>FocusBubbleUp</dispatchEnum>
     <methodName>OnCutEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="Copy">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>FocusBubbleUp</dispatchEnum>
     <methodName>OnCopyEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="Paste">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>FocusBubbleUp</dispatchEnum>
     <methodName>OnPasteEvent</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="Preferences">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnPreferencesEvent</methodName>
   </BlockEvent>
 
@@ -114,32 +114,32 @@
 
   <!-- Test Events -->
   <BlockEvent itemName="GenerateContentItems">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnGenerateContentItems</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="ImportContacts">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnImportContacts</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="GenerateContacts">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnGenerateContacts</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="GenerateCalendarEvents">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnGenerateCalendarEvents</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="GenerateNotes">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnGenerateNotes</methodName>
   </BlockEvent>
 
   <BlockEvent itemName="CheckRepository">
-    <dispatchEnum>BubbleUp</dispatchEnum>
+    <dispatchEnum>ActiveViewBubbleUp</dispatchEnum>
     <methodName>OnCheckRepository</methodName>
   </BlockEvent>
 

Index: osaf/chandler/Chandler/application/Globals.py
diff -u osaf/chandler/Chandler/application/Globals.py:1.7 osaf/chandler/Chandler/application/Globals.py:1.8
--- osaf/chandler/Chandler/application/Globals.py:1.7	Mon Feb 16 08:30:53 2004
+++ osaf/chandler/Chandler/application/Globals.py	Mon Apr 19 08:57:01 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.7 $"
-__date__ = "$Date: 2004/02/16 16:30:53 $"
+__version__ = "$Revision: 1.8 $"
+__date__ = "$Date: 2004/04/19 15:57:01 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -18,5 +18,6 @@
 repository = None             # The repository
 mainView = None               # The main View
 wxApplication = None          # The wxWindows application object
+activeView = None             # The last view that was displayed
 
 

Index: osaf/chandler/Chandler/application/Application.py
diff -u osaf/chandler/Chandler/application/Application.py:1.214 osaf/chandler/Chandler/application/Application.py:1.215
--- osaf/chandler/Chandler/application/Application.py:1.214	Thu Apr 15 15:55:54 2004
+++ osaf/chandler/Chandler/application/Application.py	Mon Apr 19 08:57:01 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.214 $"
-__date__ = "$Date: 2004/04/15 22:55:54 $"
+__version__ = "$Revision: 1.215 $"
+__date__ = "$Date: 2004/04/19 15:57:01 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -279,17 +279,10 @@
                                                        UUID(),
                                                        Globals.mainView.dispatchEvent)
 
+            Globals.mainView.onSetActiveView(mainView)
             mainView.render (self.mainFrame, self.mainFrame)
 
             self.mainFrame.Show()
-            """
-              Menus on the Mac were not appearing on startup (you needed to switch
-            to another app to get them to appear).  Adding this call to onSetFocus
-            is a temporary workaround for this bug (Bug#1204).  Once we are on top
-            of wxWindows 2.5 we should revisit whether or not this is still a 
-            problem and fix it properly if so.
-            """
-            Globals.mainView.onSetFocus()
             return True                     #indicates we succeeded with initialization
         return False                        #or failed.
 
@@ -350,7 +343,6 @@
         focus = wx.Window_FindFocus()
         if self.focus != focus:
             self.focus = focus
-            Globals.mainView.onSetFocus()
         event.Skip()
 
     def OnExit(self):

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.57 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.58
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.57	Thu Apr  1 11:42:45 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml	Mon Apr 19 08:57:00 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.57 $ -->
-<!-- $Date: 2004/04/01 19:42:45 $ -->
+<!-- $Revision: 1.58 $ -->
+<!-- $Date: 2004/04/19 15:57:00 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -184,6 +184,7 @@
   <Attribute itemName="selection">
     <type itemref="SingleRef"/>
   </Attribute>
+
   <!--
     Block Events
   -->
@@ -194,7 +195,8 @@
 
     <Enumeration itemName="dispatchEnumType">
       <values>Broadcast</values>
-      <values>BubbleUp</values>
+      <values>FocusBubbleUp</values>
+      <values>ActiveViewBubbleUp</values>
       <values>SendToBlock</values>
     </Enumeration>
 
@@ -230,83 +232,10 @@
     <type itemref="docSchema:BlockEvent"/>
     <cardinality>list</cardinality>
   </Attribute>
-  
-  <!--
-    Currently broken because constructor for BlockEvent is not being
-    called - bug 1144
-  -->
-
-  <docSchema:BlockEvent itemName="Test__init__NotCalled">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnQuitEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <!--
-    Constant Block Events
-      We keep track of the global constant events in a collection so
-    we can easily look them up to subscribe
-  -->
 
   <Kind itemName="EventData">
     <attributes itemref="docSchema:blockEvents"/>
   </Kind>
-
-  <!--
-    Currently broken because __init__ for BlockEvent isn't being
-    called - DJA
-  <docSchema:EventData itemName="GlobalEvents">
-    <blockEvents itemref="docSchema:Quit"/>
-    <blockEvents itemref="docSchema:Undo"/>
-    <blockEvents itemref="docSchema:Redo"/>
-    <blockEvents itemref="docSchema:Cut"/>
-    <blockEvents itemref="docSchema:Copy"/>
-    <blockEvents itemref="docSchema:Paste"/>
-    <blockEvents itemref="docSchema:Preferences"/>
-    <blockEvents itemref="docSchema:Right"/>
-    <blockEvents itemref="docSchema:Left"/>
-    <blockEvents itemref="docSchema:SelectionChanged"/>
-  </docSchema:EventData>
-
-  <docSchema:BlockEvent itemName="Quit">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnQuitEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="Undo">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnUndoEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="Redo">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnRedoEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="Cut">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnCutEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="Copy">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnCopyEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="Paste">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnPasteEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="Preferences">
-    <dispatchEnum>BubbleUp</dispatchEnum>
-    <methodName>OnPreferencesEvent</methodName>
-  </docSchema:BlockEvent>
-
-  <docSchema:BlockEvent itemName="SelectionChanged">
-    <dispatchEnum>Broadcast</dispatchEnum>
-    <methodName>OnSelectionChangedEvent</methodName>
-  </docSchema:BlockEvent>
-  -->
 
   <!--
     Block

Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.20 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.21
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.20	Thu Apr 15 15:55:49 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py	Mon Apr 19 08:57:00 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.20 $"
-__date__ = "$Date: 2004/04/15 22:55:49 $"
+__version__ = "$Revision: 1.21 $"
+__date__ = "$Date: 2004/04/19 15:57:00 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -31,6 +31,15 @@
             member (notification)
             return True
         
+        def bubleUpCallMethod (block, methodName, notification):
+            """
+              Call a method on a block or if it doesn't handle it try it's parents
+            """
+            while (block):
+                if  callMethod (block, methodName, notification):
+                    break
+                block = block.parentBlock
+        
         def broadcast (block, methodName, notification):
             """
               Call method named methodName on every block and it's children
@@ -73,12 +82,14 @@
                 block = block.parentBlock
                 
             broadcast (block, methodName, notification)
-        elif event.dispatchEnum == 'BubbleUp':
+        elif event.dispatchEnum == 'FocusBubbleUp':
             block = self.getFocusBlock()
-            while (block):
-                if  callMethod (block, methodName, notification):
-                    break
-                block = block.parentBlock
+            bubleUpCallMethod (block, methodName, notification)
+
+        elif event.dispatchEnum == 'ActiveViewBubbleUp':
+            block = Globals.activeView
+            bubleUpCallMethod (block, methodName, notification)
+
         elif __debug__:
             assert (False)
 
@@ -91,8 +102,9 @@
             except AttributeError:
                 focusWindow = focusWindow.GetParent()
         return Globals.mainView
-    
-    def onSetFocus (self):
+
+
+    def onSetActiveView (self, block):
         """
           Cruise up the parent hierarchy looking for the parent of the first
         menu or menuItem. If it's not the same as the last time the focus
@@ -100,7 +112,7 @@
         """
         from OSAF.framework.blocks.MenuBlocks import Menu, MenuItem
 
-        block = self.getFocusBlock()
+        Globals.activeView = block
         while (block):
             for child in block.childrenBlocks:
                 if isinstance (child, Menu) or isinstance (child, MenuItem):



More information about the Commits mailing list