[Commits] (john) - Made all items in tables uneditable except for
new collections
commits at osafoundation.org
commits at osafoundation.org
Fri Sep 17 09:54:59 PDT 2004
Commit by: john
Modified files:
chandler/parcels/osaf/contentmodel/ItemCollection.py 1.18 1.19
chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py 1.5 1.6
chandler/parcels/osaf/framework/blocks/ControlBlocks.py 1.120 1.121
Log message:
- Made all items in tables uneditable except for new collections
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/ItemCollection.py.diff?r1=text&tr1=1.18&r2=text&tr2=1.19
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/ControlBlocks.py.diff?r1=text&tr1=1.120&r2=text&tr2=1.121
Index: chandler/parcels/osaf/contentmodel/ItemCollection.py
diff -u chandler/parcels/osaf/contentmodel/ItemCollection.py:1.18 chandler/parcels/osaf/contentmodel/ItemCollection.py:1.19
--- chandler/parcels/osaf/contentmodel/ItemCollection.py:1.18 Wed Sep 15 14:04:35 2004
+++ chandler/parcels/osaf/contentmodel/ItemCollection.py Fri Sep 17 09:54:56 2004
@@ -1,4 +1,4 @@
-__date__ = "$Date: 2004/09/15 21:04:35 $"
+__date__ = "$Date: 2004/09/17 16:54:56 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -233,7 +233,7 @@
def index (self, item):
try:
return self.results.getIndexPosition (self.indexName, item)
- except NoSuchIndexError, e:
+ except NoSuchIndexError:
self.createIndex()
return self._results.getIndexPosition (self.indexName, item)
Index: chandler/parcels/osaf/framework/blocks/ControlBlocks.py
diff -u chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.120 chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.121
--- chandler/parcels/osaf/framework/blocks/ControlBlocks.py:1.120 Thu Sep 16 12:49:14 2004
+++ chandler/parcels/osaf/framework/blocks/ControlBlocks.py Fri Sep 17 09:54:58 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.120 $"
-__date__ = "$Date: 2004/09/16 19:49:14 $"
+__version__ = "$Revision: 1.121 $"
+__date__ = "$Date: 2004/09/17 16:54:58 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -209,10 +209,11 @@
class AttributeDelegate (ListDelegate):
- def GetColumnCount (self):
- return len (self.blockItem.columnAttributeNames)
-
def GetElementType (self, row, column):
+ """
+ An apparent bug in wxWidgets occurs when there are no items in a table,
+ the Table asks for the type of cell 0,0
+ """
try:
item = self.blockItem.contents [row]
except IndexError:
@@ -257,7 +258,7 @@
def OnInit (self):
elementDelegate = self.blockItem.elementDelegate
if not elementDelegate:
- elementDelegate = 'osaf.framework.blocks.ControlBlocks.AttributeDelegate'
+ elementDelegate = 'osaf.framework.blocks.ControlBlocks.ListDelegate'
mixinAClass (self, elementDelegate)
def OnSize(self, event):
@@ -329,24 +330,28 @@
class wxTableData(wx.grid.PyGridTableBase):
def __init__(self, *arguments, **keywords):
super (wxTableData, self).__init__ (*arguments, **keywords)
- self.defaultAttribute = wx.grid.GridCellAttr()
- self.defaultAttribute.SetReadOnly (True)
+ self.defaultRWAttribute = wx.grid.GridCellAttr()
+ self.defaultROAttribute = wx.grid.GridCellAttr()
+ self.defaultROAttribute.SetReadOnly (True)
def __del__ (self):
- self.defaultAttribute.DecRef()
+ self.defaultRWAttribute.DecRef()
+ self.defaultROAttribute.DecRef()
def GetNumberRows (self):
"""
We've got the usual chicken & egg problems: wxWidgets calls GetNumberRows &
GetNumberCols before wiring up the view instance variable
"""
- if self.GetView():
- return self.GetView().GetElementCount()
+ view = self.GetView()
+ if view:
+ return view.GetElementCount()
return 1
def GetNumberCols (self):
- if self.GetView():
- return self.GetView().GetColumnCount()
+ view = self.GetView()
+ if view:
+ return view.GetColumnCount()
return 1
def GetColLabelValue (self, column):
@@ -371,8 +376,18 @@
def GetAttr (self, row, column, kind):
attribute = self.base_GetAttr (row, column, kind)
- if not attribute and self.GetTypeName (row, column) == "_default":
- attribute = self.defaultAttribute
+ if not attribute:
+ type = self.GetTypeName (row, column)
+ delegate = AttributeEditor.GetAttributeEditor (type)
+ attribute = self.defaultROAttribute
+ """
+ An apparent bug in table asks for an attribute even when
+ there are no entries in the table
+ """
+ view = self.GetView()
+ if (view.GetElementCount() != 0 and
+ delegate.ReadOnly (view.GetElementValue (row, column))):
+ attribute = self.defaultRWAttribute
attribute.IncRef()
return attribute
Index: chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py
diff -u chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py:1.5 chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py:1.6
--- chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py:1.5 Thu Sep 16 12:46:13 2004
+++ chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py Fri Sep 17 09:54:57 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.5 $"
-__date__ = "$Date: 2004/09/16 19:46:13 $"
+__version__ = "$Revision: 1.6 $"
+__date__ = "$Date: 2004/09/17 16:54:57 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -43,6 +43,9 @@
GetAttributeEditor = classmethod (GetAttributeEditor)
class StringAttributeEditor (AttributeEditor):
+ def ReadOnly (self, (item, attribute)):
+ return str (item.itsParent.itsPath) == '//userdata'
+
def Draw (self, dc, rect, item, attributeName, isSelected):
"""
Currently only handles left justified multiline text.
More information about the Commits
mailing list