conduit r1622 - in trunk: . conduit



Author: jstowers
Date: Sat Aug  2 07:32:04 2008
New Revision: 1622
URL: http://svn.gnome.org/viewvc/conduit?rev=1622&view=rev

Log:
	* conduit/Conduit.py:
	* conduit/ModuleWrapper.py: Utility functions to test if a conduit can
	be synchronized (it has a source and a sink for example).


Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/conduit/Conduit.py
   trunk/conduit/ModuleWrapper.py

Modified: trunk/conduit/Conduit.py
==============================================================================
--- trunk/conduit/Conduit.py	(original)
+++ trunk/conduit/Conduit.py	Sat Aug  2 07:32:04 2008
@@ -176,6 +176,16 @@
         """
         return self.syncManager.sync_in_progress(self)
         
+    def can_sync(self):
+        """
+        Returns True if this conduit can be synchronized. It must have a
+        source and a sync, that are not pending
+        """
+        return  self.datasource != None \
+                and len(self.datasinks) > 0 \
+                and not self.datasource.is_pending() \
+                and not self.datasinks[0].is_pending()
+        
     def get_dataproviders_by_key(self, key):
         """
         Use list comprehension to return all dp's with a given key

Modified: trunk/conduit/ModuleWrapper.py
==============================================================================
--- trunk/conduit/ModuleWrapper.py	(original)
+++ trunk/conduit/ModuleWrapper.py	Sat Aug  2 07:32:04 2008
@@ -256,6 +256,9 @@
         
     def instantiate_module(self):
         self.module = self.klass(*self.initargs)
+        
+    def is_pending(self):
+        return self.module == None
 
 class PendingDataproviderWrapper(ModuleWrapper):
     def __init__(self, key):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]