[Commits] (jed) Moved SelectionContainer.

commits at osafoundation.org commits at osafoundation.org
Thu Aug 26 16:25:35 PDT 2004


Commit by: jed
Modified files:
chandler/parcels/osaf/framework/blocks/ControlBlocks.py 1.107 1.108
chandler/parcels/osaf/framework/blocks/ContainerBlocks.py 1.127 1.128
chandler/parcels/osaf/framework/blocks/parcel.xml 1.108 1.109

Log message:
Moved SelectionContainer.
Added ScrolledWindow.
Made the detail view scrollable.  There is still a bug where the initial view of the detail view does not scroll.  If you change the selected item the detail view will scroll.

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/ControlBlocks.py.diff?r1=text&tr1=1.107&r2=text&tr2=1.108
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.127&r2=text&tr2=1.128
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/parcel.xml.diff?r1=text&tr1=1.108&r2=text&tr2=1.109

Index: chandler/parcels/osaf/framework/blocks/ControlBlocks.py
diff -u chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.107 chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.108
--- chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.107	Tue Aug 24 16:06:16 2004
+++ chandler/parcels/osaf/framework/blocks/ControlBlocks.py	Thu Aug 26 16:25:33 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.107 $"
-__date__ = "$Date: 2004/08/24 23:06:16 $"
+__version__ = "$Revision: 1.108 $"
+__date__ = "$Date: 2004/08/26 23:25:33 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -1047,50 +1047,6 @@
         self.selection = notification.data['item']
         self.synchronizeWidget ()
 
-class wxScrolledWindow (wx.ScrolledWindow):
-    pass
-
-class SelectionContainer(BoxContainer):
-    """
-    SelectionContainer
-    Keeps track of the current selected item
-    """
-    def __init__(self, *arguments, **keywords):
-        super (SelectionContainer, self).__init__ (*arguments, **keywords)
-        self.selection = None
-
-    def xinstantiateWidget (self):
-        # DLDTBD - figure out how to share this code with BoxContainer
-        if self.orientationEnum == 'Horizontal':
-            orientation = wx.HORIZONTAL
-        else:
-            orientation = wx.VERTICAL
-
-        sizer = wx.BoxSizer(orientation)
-        sizer.SetMinSize((200,200))
-
-        if self.parentBlock:
-            parentWidget = self.parentBlock.widget
-        else:
-            parentWidget = Globals.wxApplication.mainFrame
- 
-        widget = wxScrolledWindow (parentWidget, Block.getWidgetID(self), \
-                                   size=(300,300), style=wx.VSCROLL)
-        widget.SetSizerAndFit (sizer)
-
-        widget.Show (self.isShown)
-        return widget
-
-    def onSelectionChangedEvent (self, notification):
-        """
-          just remember the new selected ContentItem.
-        """
-        item = notification.data['item']
-        self.selection = item
-
-    def selectedItem(self):
-        # return the item being viewed
-        return self.selection
     
 class ContentItemDetail(BoxContainer):
     """

Index: chandler/parcels/osaf/framework/blocks/ContainerBlocks.py
diff -u chandler/parcels/osaf/framework/blocks/ContainerBlocks.py:1.127 chandler/parcels/osaf/framework/blocks/ContainerBlocks.py:1.128
--- chandler/parcels/osaf/framework/blocks/ContainerBlocks.py:1.127	Tue Aug 24 16:06:16 2004
+++ chandler/parcels/osaf/framework/blocks/ContainerBlocks.py	Thu Aug 26 16:25:34 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.127 $"
-__date__ = "$Date: 2004/08/24 23:06:16 $"
+__version__ = "$Revision: 1.128 $"
+__date__ = "$Date: 2004/08/26 23:25:34 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -183,6 +183,58 @@
                     embeddedSizer.Layout()
 
         
+class wxScrolledContainer (wx.ScrolledWindow):
+    def wxSynchronizeWidget(self, *arguments, **keywords):
+        if self.blockItem.isShown:
+            sizer = self.GetSizer()
+            sizer.Clear()
+            for childBlock in self.blockItem.childrenBlocks:
+                if childBlock.isShown and isinstance (childBlock, RectangularChild):
+                    sizer.Add (childBlock.widget,
+                               childBlock.stretchFactor, 
+                               wxRectangularChild.CalculateWXFlag(childBlock), 
+                               wxRectangularChild.CalculateWXBorder(childBlock))
+            self.Layout()
+            self.SetScrollRate(0,1)
+
+        
+class ScrolledContainer(BoxContainer):
+    def instantiateWidget (self):
+        if self.orientationEnum == 'Horizontal':
+            orientation = wx.HORIZONTAL
+        else:
+            orientation = wx.VERTICAL
+
+        sizer = wx.BoxSizer(orientation)
+        sizer.SetMinSize((self.minimumSize.width, self.minimumSize.height))
+
+        widget = wxScrolledContainer (self.parentBlock.widget, Block.getWidgetID(self))
+        widget.SetSizer (sizer)
+
+        return widget
+    
+  
+class SelectionContainer(ScrolledContainer):
+    """
+    SelectionContainer
+    Keeps track of the current selected item
+    """
+    def __init__(self, *arguments, **keywords):
+        super (SelectionContainer, self).__init__ (*arguments, **keywords)
+        self.selection = None
+
+    def onSelectionChangedEvent (self, notification):
+        """
+          just remember the new selected ContentItem.
+        """
+        item = notification.data['item']
+        self.selection = item
+
+    def selectedItem(self):
+        # return the item being viewed
+        return self.selection    
+
+        
 class wxSplitterWindow(wx.SplitterWindow):
 
     def __init__(self, *arguments, **keywords):

Index: chandler/parcels/osaf/framework/blocks/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/parcel.xml:1.108 chandler/parcels/osaf/framework/blocks/parcel.xml:1.109
--- chandler/parcels/osaf/framework/blocks/parcel.xml:1.108	Fri Aug 20 09:44:52 2004
+++ chandler/parcels/osaf/framework/blocks/parcel.xml	Thu Aug 26 16:25:34 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.108 $ -->
-<!-- $Date: 2004/08/20 16:44:52 $ -->
+<!-- $Revision: 1.109 $ -->
+<!-- $Date: 2004/08/26 23:25:34 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -457,6 +457,14 @@
   </Kind>
   
   <!--
+    ScrolledContainer
+  -->
+  <Kind itsName="ScrolledContainer">
+    <classes key="python">osaf.framework.blocks.ContainerBlocks.ScrolledContainer</classes>
+    <superKinds itemref="docSchema:BoxContainer"/>
+  </Kind>  
+  
+  <!--
     EmbeddedContainer
   -->
   <Kind itsName="EmbeddedContainer">
@@ -1084,8 +1092,8 @@
   <!-- SelectionContainer -->
  
   <Kind itsName="SelectionContainer">
-    <classes key="python">osaf.framework.blocks.ControlBlocks.SelectionContainer</classes>
-    <superKinds itemref="docSchema:BoxContainer"/>
+    <classes key="python">osaf.framework.blocks.ContainerBlocks.SelectionContainer</classes>
+    <superKinds itemref="docSchema:ScrolledContainer"/>
 
     <attributes itemref="docSchema:selection"/>
   </Kind>    



More information about the Commits mailing list