[Commits] (twl) Additional work on 2535

commits at osafoundation.org commits at osafoundation.org
Mon Feb 28 12:05:11 PST 2005


Commit by: twl
Modified files:
chandler/repository/query/Query.py 1.31 1.32

Log message:
Additional work on 2535
Replace onItemLoad and onItemCopy with _fillItem to close window
during item loading where initialization could get confused


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/query/Query.py.diff?r1=text&tr1=1.31&r2=text&tr2=1.32

Index: chandler/repository/query/Query.py
diff -u chandler/repository/query/Query.py:1.31 chandler/repository/query/Query.py:1.32
--- chandler/repository/query/Query.py:1.31	Thu Feb 24 18:14:07 2005
+++ chandler/repository/query/Query.py	Mon Feb 28 12:05:10 2005
@@ -1,6 +1,6 @@
 
-__revision__  = "$Revision: 1.31 $"
-__date__      = "$Date: 2005/02/25 02:14:07 $"
+__revision__  = "$Revision: 1.32 $"
+__date__      = "$Date: 2005/02/28 20:05:10 $"
 __copyright__ = "Copyright (c) 2004, 2005 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -33,24 +33,32 @@
         super(Query, self).__init__(name, parent, kind)
 
         self._queryString = queryString
-        self._queryStringIsStale = True
         self.args = {}
         self._logical_plan = None
-        self._otherViewSubscribeCallbacks = {}
-        self._sameViewSubscribeCallbacks = {}
-        self._removedSinceCommit = []
-
-    def _warm_init(self):
+        self.__init()
+        
+    def __init(self):
+        """
+        __init is a private constructor method 
+        (following the convention in the rest of the repository)
+        """
+        # these attributes need to be setup after we reload
         self._otherViewSubscribeCallbacks = {}
         self._sameViewSubscribeCallbacks = {}
         self._removedSinceCommit = []
         self._queryStringIsStale = True
 
-    def onItemLoad(self, view):
-        self._warm_init()
-
-    def onItemCopy(self, original):
-        self._warm_init()
+    def _fillItem(self, name, parent, kind, **kwds):
+        """
+        Fill in the python attributes
+        """
+        # We're using _fillItem in lieu of onItemLoad and onItemCopy because there is
+        # a window during item loading where self.__init() will not get called until
+        # it is too late.
+        
+        # you must call super when using _fillItem
+        super(Query, self)._fillItem(name, parent, kind, **kwds)
+        self.__init()
 
     def getQueryString(self):
         return self._queryString



More information about the Commits mailing list