conduit r1415 - in trunk: . conduit/modules/BoxDotNetModule conduit/modules/FlickrModule conduit/modules/GoogleModule conduit/modules/PicasaDesktopModule conduit/utils



Author: jstowers
Date: Mon Apr  7 09:57:47 2008
New Revision: 1415
URL: http://svn.gnome.org/viewvc/conduit?rev=1415&view=rev

Log:
2008-04-07  John Stowers  <john stowers gmail com>

	* conduit/modules/PicasaDesktopModule/PicasaDesktopModule.py: Less debug
	spam at startup

	* conduit/utils/__init__.py: Add utility functions for setting the dialog
	cursor

	* conduit/modules/BoxDotNetModule/BoxDotNetModule.py:
	* conduit/modules/FlickrModule/FlickrModule.py:
	* conduit/modules/GoogleModule/GoogleModule.py: Set dialog cursor when 
	doing background work.



Modified:
   trunk/ChangeLog
   trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py
   trunk/conduit/modules/FlickrModule/FlickrModule.py
   trunk/conduit/modules/GoogleModule/GoogleModule.py
   trunk/conduit/modules/PicasaDesktopModule/PicasaDesktopModule.py
   trunk/conduit/utils/__init__.py

Modified: trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py
==============================================================================
--- trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py	(original)
+++ trunk/conduit/modules/BoxDotNetModule/BoxDotNetModule.py	Mon Apr  7 09:57:47 2008
@@ -281,17 +281,14 @@
         def on_login_finish(*args):
             if self.token:
                 build_folder_store()
-                foldernamecombo.set_sensitive(True)
-            else:
-                foldernamecombo.set_sensitive(False)
-            #dlg.window.set_cursor(None)
+            Utils.dialog_reset_cursor(dlg)
             
         def on_response(sender, responseID):
             if responseID == gtk.RESPONSE_OK:
                 self.foldername = foldernamecombo.child.get_text()
                 
         def load_button_clicked(button):
-            #dlg.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+            Utils.dialog_set_busy_cursor(dlg)
             conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                                             self,
                                             on_login_finish,
@@ -331,16 +328,9 @@
         foldernamecombo.pack_start(cell, True)
         foldernamecombo.set_text_column(0)
 
-        # already load the folders if we're logged in
-        if self.token:
-            build_folder_store()
-            foldernamecombo.set_sensitive(True)
-        else:
-            foldernamecombo.child.set_text(self.foldername)
-            foldernamecombo.set_sensitive(False)
-
         # load button
         load_button.connect('clicked', load_button_clicked)
+        foldernamecombo.child.set_text(self.foldername)
 
         # run the dialog
         Utils.run_dialog_non_blocking(dlg, on_response, window)

Modified: trunk/conduit/modules/FlickrModule/FlickrModule.py
==============================================================================
--- trunk/conduit/modules/FlickrModule/FlickrModule.py	(original)
+++ trunk/conduit/modules/FlickrModule/FlickrModule.py	Mon Apr  7 09:57:47 2008
@@ -265,6 +265,7 @@
         def on_login_finish(*args):
             if self.logged_in:
                 build_photoset_model()
+            Utils.dialog_reset_cursor(dlg)
                 
         def on_response(sender, responseID):
             if responseID == gtk.RESPONSE_OK:
@@ -275,6 +276,7 @@
         
         def load_click(button, window, usernameEntry):
             self._set_username(usernameEntry.get_text())
+            Utils.dialog_set_busy_cursor(dlg)
             conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                                             self,
                                             on_login_finish,

Modified: trunk/conduit/modules/GoogleModule/GoogleModule.py
==============================================================================
--- trunk/conduit/modules/GoogleModule/GoogleModule.py	(original)
+++ trunk/conduit/modules/GoogleModule/GoogleModule.py	Mon Apr  7 09:57:47 2008
@@ -642,6 +642,7 @@
         def on_login_finish(*args):
             if self.loggedIn:
                 build_album_model()
+            Utils.dialog_reset_cursor(dlg)
                 
         def on_response(sender, responseID):
             if responseID == gtk.RESPONSE_OK:
@@ -653,6 +654,7 @@
         def login_click(button, window, usernameEntry, passwordEntry):
             self._set_username(usernameEntry.get_text())
             self._set_password(passwordEntry.get_text())
+            Utils.dialog_set_busy_cursor(dlg)
             conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                                             self,
                                             on_login_finish,
@@ -714,7 +716,6 @@
         #disable album lookup if no username entered
         enabled = len(self.username) > 0
         login_button.set_sensitive(enabled)
-        #album_combo.set_sensitive(enabled)
 
         # Now run the dialog 
         Utils.run_dialog_non_blocking(dlg, on_response, window)

Modified: trunk/conduit/modules/PicasaDesktopModule/PicasaDesktopModule.py
==============================================================================
--- trunk/conduit/modules/PicasaDesktopModule/PicasaDesktopModule.py	(original)
+++ trunk/conduit/modules/PicasaDesktopModule/PicasaDesktopModule.py	Mon Apr  7 09:57:47 2008
@@ -13,23 +13,24 @@
 
 from gettext import gettext as _
 
-MODULES = {
-	"PicasaDesktopSource" : { "type": "dataprovider" }
-}
-
 FILENAME_IDX = 0
 DISPLAYNAME_IDX = 1
 PHOTOS_IDX = 2
 PICASA_DIR = os.path.join(os.path.expanduser("~"),".picasa")
 
-# check if path exists
-if not os.path.exists(PICASA_DIR):
-    raise Exceptions.NotSupportedError("Picasa Not Installed")
+if os.path.exists(PICASA_DIR):
+    MODULES = {
+    	"PicasaDesktopSource" : { "type": "dataprovider" }
+    }
+    log.info("Picasa desktop directory detected")
+else:
+    MODULES = {}
+    log.info("Picasa desktop not installed")
 
 class PicasaDesktopSource(DataProvider.DataSource):
 
     _name_ = _("Picasa Desktop")
-    _description_ = _("Sync your Picasa photos")
+    _description_ = _("Sync Picasa from Picasa Desktop")
     _category_ = conduit.dataproviders.CATEGORY_PHOTOS
     _module_type_ = "source"
     _in_type_ = "file/photo"

Modified: trunk/conduit/utils/__init__.py
==============================================================================
--- trunk/conduit/utils/__init__.py	(original)
+++ trunk/conduit/utils/__init__.py	Mon Apr  7 09:57:47 2008
@@ -164,6 +164,19 @@
         #        window,events)
 
     dialog.show()
+    
+def dialog_set_busy_cursor(dlg):
+    """
+    Sets the dialog to display the busy cursor
+    """
+    import gtk.gdk
+    dlg.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+    
+def dialog_reset_cursor(dlg):
+    """
+    Resets the dialog to display the plain Gtk cursor
+    """
+    dlg.window.set_cursor(None)
 
 def md5_string(string):
     """



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