[Commits] (stearns) Icons are read-only. I think this'll fix bug 2422 (a NotImplementedError on "Create") because now all existing editors implement Create.

commits at osafoundation.org commits at osafoundation.org
Fri Feb 11 15:59:17 PST 2005


Commit by: stearns
Modified files:
chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py 1.22 1.23

Log message:
Icons are read-only. I think this'll fix bug 2422 (a NotImplementedError on "Create") because now all existing editors implement Create.

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py.diff?r1=text&tr1=1.22&r2=text&tr2=1.23

Index: chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py
diff -u chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py:1.22 chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py:1.23
--- chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py:1.22	Thu Feb  3 13:36:17 2005
+++ chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py	Fri Feb 11 15:59:15 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.22 $"
-__date__ = "$Date: 2005/02/03 21:36:17 $"
+__version__ = "$Revision: 1.23 $"
+__date__ = "$Date: 2005/02/11 23:59:15 $"
 __copyright__ = "Copyright (c) 2003-2005 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -112,7 +112,7 @@
         self.isShared = isShared
 
     def ReadOnly (self, (item, attribute)):
-        return str (item.itsParent.itsPath) !=  '//userdata'
+        return not str(item.itsPath).startswith('//userdata')
 
     def Draw (self, dc, rect, item, attributeName, isSelected):
         """ You must override Draw. """
@@ -237,7 +237,7 @@
 class RepositoryAttributeEditor (StringAttributeEditor):
     """ Uses Repository Type conversion to provide String representation. """
     def ReadOnly (self, (item, attribute)):
-        return False # not read-only allows editing the attribute
+        return False # Force editability even if we're in the "read-only" part of the repository
 
     def GetAttributeValue (self, item, attributeName):
         # attempt to access as a Chandler attribute first
@@ -463,9 +463,6 @@
 
 class LocationAttributeEditor (LabeledAttributeEditor):
     """ Knows that the data Type is a Location. """
-    def ReadOnly (self, (item, attribute)):
-        return False
-
     def GetAttributeValue (self, item, attributeName):
         # get the value, and if it doesn't exist, use the label
         try:
@@ -531,9 +528,6 @@
 
 class DateTimeDeltaAttributeEditor (LabeledAttributeEditor):
     """ Knows that the data Type is DateTimeDelta. """
-    def ReadOnly (self, (item, attribute)):
-        return False
-
     def GetAttributeValue (self, item, attributeName):
         # attempt to access as a plain Python attribute
         try:
@@ -617,6 +611,9 @@
         return value
 
 class IconAttributeEditor (BaseAttributeEditor):
+    def ReadOnly (self, (item, attribute)):
+        return True # The Icon editor doesn't support editing.
+
     def GetAttributeValue (self, item, attributeName):
         # simple implementation - get the value, assume it's a string
         try:



More information about the Commits mailing list