[Commits] (vajda) - added view argument to notification callbacks
commits at osafoundation.org
commits at osafoundation.org
Wed Aug 25 18:00:58 PDT 2004
Commit by: vajda
Modified files:
chandler/application/Application.py 1.262 1.263
chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py 1.19 1.20
chandler/repository/persistence/Repository.py 1.80 1.81
chandler/repository/persistence/XMLRepositoryView.py 1.49 1.50
chandler/repository/query/Query.py 1.4 1.5
chandler/repository/util/Path.py 1.9 1.10
Log message:
- added view argument to notification callbacks
- fixed bug 1781
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/application/Application.py.diff?r1=text&tr1=1.262&r2=text&tr2=1.263
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py.diff?r1=text&tr1=1.19&r2=text&tr2=1.20
http://cvs.osafoundation.org/index.cgi/chandler/repository/persistence/Repository.py.diff?r1=text&tr1=1.80&r2=text&tr2=1.81
http://cvs.osafoundation.org/index.cgi/chandler/repository/persistence/XMLRepositoryView.py.diff?r1=text&tr1=1.49&r2=text&tr2=1.50
http://cvs.osafoundation.org/index.cgi/chandler/repository/query/Query.py.diff?r1=text&tr1=1.4&r2=text&tr2=1.5
http://cvs.osafoundation.org/index.cgi/chandler/repository/util/Path.py.diff?r1=text&tr1=1.9&r2=text&tr2=1.10
Index: chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py
diff -u chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py:1.19 chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py:1.20
--- chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py:1.19 Mon Jul 19 13:33:51 2004
+++ chandler/parcels/osaf/framework/notifications/tests/TestNotifications.py Wed Aug 25 18:00:52 2004
@@ -19,7 +19,7 @@
event = eventKind.newItem(None, Globals.repository)
return event
-def repositoryCallback(changes, notification, **kwds):
+def repositoryCallback(view, changes, notification, **kwds):
if notification == 'History':
eventPath = '//parcels/osaf/framework/commit_history'
else:
Index: chandler/repository/persistence/Repository.py
diff -u chandler/repository/persistence/Repository.py:1.80 chandler/repository/persistence/Repository.py:1.81
--- chandler/repository/persistence/Repository.py:1.80 Thu Jun 17 13:30:12 2004
+++ chandler/repository/persistence/Repository.py Wed Aug 25 18:00:52 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.80 $"
-__date__ = "$Date: 2004/06/17 20:30:12 $"
+__revision__ = "$Revision: 1.81 $"
+__date__ = "$Date: 2004/08/26 01:00:52 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -510,11 +510,6 @@
class RepositoryNotifications(dict):
- def __init__(self, repository):
-
- super(RepositoryNotifications, self).__init__()
- self.repository = repository
-
def changed(self, uuid, reason, **kwds):
value = self.get(uuid, Item.Nil)
@@ -528,15 +523,15 @@
self[uuid] = (reason, kwds)
- def dispatchHistory(self):
+ def dispatchHistory(self, view):
- callbacks = self.repository._notifications
+ callbacks = view.repository._notifications
if callbacks:
changes = []
for uuid, (reason, kwds) in self.iteritems():
changes.append( (uuid, reason, kwds) )
for callback in callbacks:
- callback(changes, 'History')
+ callback(view, changes, 'History')
self.clear()
Index: chandler/repository/util/Path.py
diff -u chandler/repository/util/Path.py:1.9 chandler/repository/util/Path.py:1.10
--- chandler/repository/util/Path.py:1.9 Sun Jul 18 04:20:17 2004
+++ chandler/repository/util/Path.py Wed Aug 25 18:00:55 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.9 $"
-__date__ = "$Date: 2004/07/18 11:20:17 $"
+__revision__ = "$Revision: 1.10 $"
+__date__ = "$Date: 2004/08/26 01:00:55 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -64,22 +64,23 @@
self._names = []
for arg in args:
+
if isinstance(arg, Path):
self._names.extend(arg._names)
- continue
-
- if arg.startswith('//'):
- self._names.append('//')
- arg = arg[2:]
- elif arg[0] == '/':
- self._names.append('/')
- arg = arg[1:]
- if arg.endswith('/'):
- arg = arg[:-1]
+ elif arg:
+ if arg.startswith('//'):
+ self._names.append('//')
+ arg = arg[2:]
+ elif arg[0] == '/':
+ self._names.append('/')
+ arg = arg[1:]
+
+ if arg.endswith('/'):
+ arg = arg[:-1]
- if not arg == '':
- self._names.extend(arg.split('/'))
+ if arg:
+ self._names.extend(arg.split('/'))
def append(self, name):
"""
Index: chandler/repository/query/Query.py
diff -u chandler/repository/query/Query.py:1.4 chandler/repository/query/Query.py:1.5
--- chandler/repository/query/Query.py:1.4 Wed Aug 25 14:11:41 2004
+++ chandler/repository/query/Query.py Wed Aug 25 18:00:54 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.4 $"
-__date__ = "$Date: 2004/08/25 21:11:41 $"
+__revision__ = "$Revision: 1.5 $"
+__date__ = "$Date: 2004/08/26 01:00:54 $"
__copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -14,7 +14,7 @@
import time
-class Query:
+class Query(object):
def __init__(self, repo, queryString = None):
"""
@@ -74,7 +74,7 @@
"""
self.__rep.removeNotificationCallback(self.queryCallback)
- def queryCallback(self, changes, notification, **kwds):
+ def queryCallback(self, view, changes, notification, **kwds):
"""
queryCallback implements the callback used by L{Repository.addNotificationCallback<repository.persistence.Repository.Repository.addNotificationCallback>}
@@ -95,7 +95,7 @@
self.execute()
changed = False
for uuid, reason, kwds in changes:
- i = self.__rep.findUUID(uuid)
+ i = view.findUUID(uuid)
#@@@ there's a big problem with this if there are paths through multiple items -- we're going to need something fairly sophisticated here.
if i is not None:
# log.debug("RepoQuery.queryCallback %s:%s" % (i, i.itsKind))
@@ -113,7 +113,7 @@
break #@@@ this means we stop after 1 item (like old code) efficient, but wrong
if changed:
log.debug("RepoQuery.queryCallback: %s %s query result" % (uuid, action))
- self.__rep.findPath('//parcels/osaf/framework/query_changed').Post( {'query' : i.itsUUID, 'action': action} )
+ view.findPath('//parcels/osaf/framework/query_changed').Post( {'query' : i.itsUUID, 'action': action} )
log.debug("queryCallback: %s:%f" % (self.queryString, time.time()-start))
def __iter__(self):
Index: chandler/application/Application.py
diff -u chandler/application/Application.py:1.262 chandler/application/Application.py:1.263
--- chandler/application/Application.py:1.262 Tue Aug 24 08:06:39 2004
+++ chandler/application/Application.py Wed Aug 25 18:00:51 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.262 $"
-__date__ = "$Date: 2004/08/24 15:06:39 $"
+__version__ = "$Revision: 1.263 $"
+__date__ = "$Date: 2004/08/26 01:00:51 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -22,7 +22,7 @@
wxEVT_MAIN_THREAD_CALLBACK = wx.NewEventType()
EVT_MAIN_THREAD_CALLBACK = wx.PyEventBinder(wxEVT_MAIN_THREAD_CALLBACK, 0)
-def repositoryCallback(changes, notification, **kwds):
+def repositoryCallback(view, changes, notification, **kwds):
# Postpone import to avoid circular imports
from osaf.framework.notifications.Notification import Notification
@@ -30,8 +30,7 @@
return
eventPath = '//parcels/osaf/framework/commit_history'
-
- event = Globals.repository.findPath(eventPath)
+ event = view.findPath(eventPath)
note = Notification(event)
note.threadid = id(threading.currentThread())
Index: chandler/repository/persistence/XMLRepositoryView.py
diff -u chandler/repository/persistence/XMLRepositoryView.py:1.49 chandler/repository/persistence/XMLRepositoryView.py:1.50
--- chandler/repository/persistence/XMLRepositoryView.py:1.49 Tue Aug 24 10:52:50 2004
+++ chandler/repository/persistence/XMLRepositoryView.py Wed Aug 25 18:00:53 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.49 $"
-__date__ = "$Date: 2004/08/24 17:52:50 $"
+__revision__ = "$Revision: 1.50 $"
+__date__ = "$Date: 2004/08/26 01:00:53 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -31,7 +31,7 @@
super(XMLRepositoryView, self).openView()
self._log = []
- self._notifications = RepositoryNotifications(self.repository)
+ self._notifications = RepositoryNotifications()
self._indexWriter = None
def _logItem(self, item):
@@ -195,7 +195,7 @@
size += self._saveItem(item, newVersion, store, ood)
if newVersion > self.version:
- histNotifications = RepositoryNotifications(repository)
+ histNotifications = RepositoryNotifications()
def unload(uuid, version, docId, status, parent):
@@ -214,7 +214,7 @@
unloads[item._uuid] = item
history.apply(unload, self.version, newVersion)
-
+
if txnStarted:
self._commitTransaction()
@@ -272,7 +272,7 @@
if histNotifications is not None:
count = len(histNotifications)
- histNotifications.dispatchHistory()
+ histNotifications.dispatchHistory(self)
delta = datetime.now() - after
if delta.seconds > 1:
self.logger.warning('%s %d notifications ran in %s',
More information about the Commits
mailing list