[Commits] (donn) Fix bug 2257: NoSuchAttributeError - "duration"

commits at osafoundation.org commits at osafoundation.org
Mon Dec 6 16:10:11 PST 2004


Commit by: donn
Modified files:
chandler/parcels/osaf/framework/blocks/ControlBlocks.py 1.147 1.148
chandler/parcels/osaf/framework/blocks/detail/Detail.py 1.55 1.56
chandler/parcels/osaf/framework/blocks/detail/parcel.xml 1.44 1.45

Log message:
Fix bug 2257: NoSuchAttributeError - "duration"
------------------------------------
* fixes the exceptions
* there is still a case where the duration doesn't show up

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/ControlBlocks.py.diff?r1=text&tr1=1.147&r2=text&tr2=1.148
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/Detail.py.diff?r1=text&tr1=1.55&r2=text&tr2=1.56
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/parcel.xml.diff?r1=text&tr1=1.44&r2=text&tr2=1.45

Index: chandler/parcels/osaf/framework/blocks/detail/Detail.py
diff -u chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.55 chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.56
--- chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.55	Thu Dec  2 12:13:35 2004
+++ chandler/parcels/osaf/framework/blocks/detail/Detail.py	Mon Dec  6 16:10:09 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.55 $"
-__date__ = "$Date: 2004/12/02 20:13:35 $"
+__version__ = "$Revision: 1.56 $"
+__date__ = "$Date: 2004/12/07 00:10:09 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -1004,8 +1004,23 @@
 class AECalendarDuration (DetailSynchronizer, ControlBlocks.AEBlock):
     """
     Example usage of an AEBlock, used for the duration edit field.
-    Only shows itself for a Calendar Event
+    Only shows itself for a Calendar Event.
+    @@@DLD - clean up!  We shouldn't even need this class.
+    We need a shouldShow method so we don't try to show ourselves for
+       items that don't have our attribute.
+    We need a synchronizeWidget method in order to show/hide ourself
+       before the default synchronizeWidget gets called, which does
+       all the Attribute Editor work.
     """
+    def synchronizeWidget (self):
+        # only shown for non-CalendarEventMixin kinds
+        item = self.selectedItem ()
+        if item is None:
+            self.isShown = False
+        else:
+            self.isShown = self.shouldShow (item)
+        super (AECalendarDuration, self).synchronizeWidget ()
+
     def shouldShow (self, item):
         # only shown for non-CalendarEventMixin kinds
         calendarMixinKind = Calendar.CalendarParcel.getCalendarEventMixinKind()

Index: chandler/parcels/osaf/framework/blocks/detail/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.44 chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.45
--- chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.44	Thu Dec  2 12:13:35 2004
+++ chandler/parcels/osaf/framework/blocks/detail/parcel.xml	Mon Dec  6 16:10:09 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.44 $ -->
-<!-- $Date: 2004/12/02 20:13:35 $ -->
+<!-- $Revision: 1.45 $ -->
+<!-- $Date: 2004/12/07 00:10:09 $ -->
 <!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -490,7 +490,8 @@
     <minimumSize>300, 24</minimumSize>
   </EditText>
 
-  <AEBlock itsName="AECalendarDuration">
+  <AEBlock itsName="AECalendarDuration"
+           itemClass="osaf.framework.blocks.detail.Detail.AECalendarDuration">
     <blockName value="AECalendarDuration"/>
     <characterStyle itemref="doc:LabelStyle"/>
     <textAlignmentEnum>Left</textAlignmentEnum>    

Index: chandler/parcels/osaf/framework/blocks/ControlBlocks.py
diff -u chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.147 chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.148
--- chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.147	Fri Dec  3 15:55:02 2004
+++ chandler/parcels/osaf/framework/blocks/ControlBlocks.py	Mon Dec  6 16:10:09 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.147 $"
-__date__ = "$Date: 2004/12/03 23:55:02 $"
+__version__ = "$Revision: 1.148 $"
+__date__ = "$Date: 2004/12/07 00:10:09 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -1408,14 +1408,15 @@
             self.drawAEBlock(clientDC)
 
     def drawAEBlock(self, dc):
-        item = self.blockItem.getItem ()
-        if item is not None:
-            blockRect = self.GetRect() # use the rect of the AE Block
-            rect = wx.Rect(0, 0, blockRect.width, blockRect.height)
-            attributeName = self.blockItem.viewAttribute
-            isSelected = self.isSelected
-            self.ensureEditor()
-            self.editor.Draw(dc, rect, item, attributeName, isSelected)
+        if self.blockItem.isShown: 
+            item = self.blockItem.getItem ()
+            if item is not None:
+                blockRect = self.GetRect() # use the rect of the AE Block
+                rect = wx.Rect(0, 0, blockRect.width, blockRect.height)
+                attributeName = self.blockItem.viewAttribute
+                isSelected = self.isSelected
+                self.ensureEditor()
+                self.editor.Draw(dc, rect, item, attributeName, isSelected)
 
     def ensureEditor(self):
         if self.editor is None:



More information about the Commits mailing list