[Commits] (morgen) Added two non-blocking methods that the mail
subsystem can call to pass
commits at osafoundation.org
commits at osafoundation.org
Wed Aug 25 10:31:43 PDT 2004
Commit by: morgen
Modified files:
chandler/parcels/osaf/framework/sharing/Sharing.py 1.5 1.6
chandler/parcels/osaf/framework/sharing/parcel.xml 1.1 1.2
Log message:
Added two non-blocking methods that the mail subsystem can call to pass
events to the main thread: one for announcing inbound subscriptions, and
one for announcing an error.
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/Sharing.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/parcel.xml.diff?r1=text&tr1=1.1&r2=text&tr2=1.2
Index: chandler/parcels/osaf/framework/sharing/Sharing.py
diff -u chandler/parcels/osaf/framework/sharing/Sharing.py:1.5 chandler/parcels/osaf/framework/sharing/Sharing.py:1.6
--- chandler/parcels/osaf/framework/sharing/Sharing.py:1.5 Mon Aug 23 16:35:11 2004
+++ chandler/parcels/osaf/framework/sharing/Sharing.py Wed Aug 25 10:31:41 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.5 $"
-__date__ = "$Date: 2004/08/23 23:35:11 $"
+__version__ = "$Revision: 1.6 $"
+__date__ = "$Date: 2004/08/25 17:31:41 $"
__copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -18,6 +18,9 @@
event = Globals.parcelManager.lookup(SHARING, 'sharingUpdateEvent')
Globals.notificationManager.Subscribe([event], UUID(),
self._sharingUpdateCallback)
+ event = Globals.parcelManager.lookup(SHARING, 'errorEvent')
+ Globals.notificationManager.Subscribe([event], UUID(),
+ self._errorCallback)
def _sharingUpdateCallback(self, notification):
# When we receive the event, display a dialog
@@ -27,6 +30,12 @@
"Subscribe to %s?" % url):
subscribeToWebDavCollection(url)
+ def _errorCallback(self, notification):
+ # When we receive this event, display the error
+ error = notification.data['error']
+ application.dialogs.Util.showAlert( \
+ Globals.wxApplication.mainFrame, error)
+
def subscribeToWebDavCollection(url):
""" Given a URL, tell the webdav subsystem to fetch the collection it
@@ -44,13 +53,8 @@
addresses. """
for address in addresses:
print address
-
-def announceSharingUrl(url):
- """ Call this method to announce that an inbound sharing invitation has
- arrived. """
-
- event = Globals.parcelManager.lookup(SHARING, 'sharingUpdateEvent')
- event.Post( { 'share' : url } )
+ # validate the addresses
+ # parcels.osaf.mail.sharing.<sendinvite>(address, url)
def manualSubscribeToCollection():
""" Display a dialog box prompting the user for a webdav url to
@@ -83,3 +87,28 @@
osaf.framework.webdav.Dav.DAV(collection.sharedURL).get()
else:
print "Collection hasn't been shared yet"
+
+
+
+# Non-blocking methods that the mail thread can call to post events to the
+# main thread:
+
+def announceSharingUrl(url):
+ """ Call this method to announce that an inbound sharing invitation has
+ arrived. This method is non-blocking. """
+
+ def _announceSharingUrl(url):
+ event = Globals.parcelManager.lookup(SHARING, 'sharingUpdateEvent')
+ event.Post( { 'share' : url } )
+
+ Globals.wxApplication.PostAsyncEvent(_announceSharingUrl, url)
+
+def announceError(error):
+ """ Call this method to announce an error. This method is non-blocking. """
+
+ def _announceError(error):
+ event = Globals.parcelManager.lookup(SHARING, 'errorEvent')
+ event.Post( { 'error' : error } )
+
+ Globals.wxApplication.PostAsyncEvent(_announceError, error)
+
Index: chandler/parcels/osaf/framework/sharing/parcel.xml
diff -u chandler/parcels/osaf/framework/sharing/parcel.xml:1.1 chandler/parcels/osaf/framework/sharing/parcel.xml:1.2
--- chandler/parcels/osaf/framework/sharing/parcel.xml:1.1 Mon Aug 23 11:58:39 2004
+++ chandler/parcels/osaf/framework/sharing/parcel.xml Wed Aug 25 10:31:42 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
-<!-- $Date: 2004/08/23 18:58:39 $ -->
+<!-- $Revision: 1.2 $ -->
+<!-- $Date: 2004/08/25 17:31:42 $ -->
<!-- Copyright (c) 2003 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -21,4 +21,9 @@
<description value="This event is posted when an inbound sharing update is received. The sharing parcel subscribes to it." />
</notif:Event>
+ <notif:Event itsName="errorEvent">
+ <displayName value="Error Event" />
+ <description value="This event is posted from the mail system if an invite fails to be sent." />
+ </notif:Event>
+
</Parcel>
More information about the Commits
mailing list