conduit r1928 - in trunk: . conduit/gtkui conduit/modules/FacebookModule conduit/modules/FlickrModule
- From: arosenfeld svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1928 - in trunk: . conduit/gtkui conduit/modules/FacebookModule conduit/modules/FlickrModule
- Date: Tue, 17 Mar 2009 17:19:27 +0000 (UTC)
Author: arosenfeld
Date: Tue Mar 17 17:19:27 2009
New Revision: 1928
URL: http://svn.gnome.org/viewvc/conduit?rev=1928&view=rev
Log:
2009-03-17 Alexandre Rosenfeld <airmind gmail com>
* conduit/gtkui/ConfigContainer.py:
* conduit/gtkui/WindowConfigurator.py:
* conduit/modules/FlickrModule/FlickrModule.py:
Added busy indication.
* conduit/gtkui/ConfigItems.py:
Made item label become disabled as well as the widget.
* conduit/modules/FacebookModule/FacebookModule.py:
* conduit/modules/FacebookModule/Makefile.am:
* conduit/modules/FacebookModule/config.glade:
Port to new config system.
Removed:
trunk/conduit/modules/FacebookModule/config.glade
Modified:
trunk/ChangeLog
trunk/conduit/gtkui/ConfigContainer.py
trunk/conduit/gtkui/ConfigItems.py
trunk/conduit/gtkui/WindowConfigurator.py
trunk/conduit/modules/FacebookModule/FacebookModule.py
trunk/conduit/modules/FacebookModule/Makefile.am
trunk/conduit/modules/FlickrModule/FlickrModule.py
Modified: trunk/conduit/gtkui/ConfigContainer.py
==============================================================================
--- trunk/conduit/gtkui/ConfigContainer.py (original)
+++ trunk/conduit/gtkui/ConfigContainer.py Tue Mar 17 17:19:27 2009
@@ -204,6 +204,10 @@
'''
super(ConfigContainer, self).show()
self.config_widget.show_all()
+
+ def set_busy(self, busy):
+ self.__busy = busy
+ self.configurator.set_busy(busy)
def apply_config(self, items = None, sections = None):
'''
Modified: trunk/conduit/gtkui/ConfigItems.py
==============================================================================
--- trunk/conduit/gtkui/ConfigItems.py (original)
+++ trunk/conduit/gtkui/ConfigItems.py Tue Mar 17 17:19:27 2009
@@ -368,6 +368,8 @@
def _set_enabled(self, enabled):
self.widget.set_sensitive(enabled)
+ if self.label:
+ self.label.set_sensitive(enabled)
def set_enabled(self, enabled):
'''
Modified: trunk/conduit/gtkui/WindowConfigurator.py
==============================================================================
--- trunk/conduit/gtkui/WindowConfigurator.py (original)
+++ trunk/conduit/gtkui/WindowConfigurator.py Tue Mar 17 17:19:27 2009
@@ -129,7 +129,14 @@
def get_widget(self):
return None
- def get_window(self):
+ def set_busy(self, busy):
+ if busy:
+ self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+ else:
+ self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW))
+
+ @property
+ def window(self):
return self.dialog
def run(self, config_container):
@@ -162,6 +169,7 @@
for container in containers:
container.hide()
self.dialog.hide()
+ self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW))
self.showing = False
if resp == gtk.RESPONSE_OK:
for container in containers:
Modified: trunk/conduit/modules/FacebookModule/FacebookModule.py
==============================================================================
--- trunk/conduit/modules/FacebookModule/FacebookModule.py (original)
+++ trunk/conduit/modules/FacebookModule/FacebookModule.py Tue Mar 17 17:19:27 2009
@@ -48,7 +48,9 @@
Image.ImageSink.__init__(self)
self.fapi = pyfacebook.Facebook(FacebookSink.API_KEY, FacebookSink.SECRET)
self.browser = conduit.BROWSER_IMPL
- self.albumname = ""
+ self.update_configuration(
+ albumname = ""
+ )
self.albums = {}
def _upload_photo (self, uploadInfo):
@@ -114,65 +116,46 @@
rsp = self.fapi.auth.getSession()
return rsp.has_key("secret") and rsp.has_key("session_key")
- def configure(self, window):
- import gtk
- import gobject
- def on_login_finish(*args):
- if self.fapi.uid:
- build_album_store()
- Utils.dialog_reset_cursor(dlg)
-
- def on_response(sender, responseID):
- if responseID == gtk.RESPONSE_OK:
- self.albumname = albumnamecombo.child.get_text()
-
- def load_button_clicked(button):
- Utils.dialog_set_busy_cursor(dlg)
+ def config_setup(self, config):
+
+ def _login_finished(*args):
+ try:
+ if self.fapi.uid:
+ status_label.value = _('Loading album list...')
+ try:
+ albums = self._get_albums().keys()
+ except:
+ status_label.value = _('Failed to connect')
+ else:
+ albums_config.choices = albums
+ status_label.value = _('Logged in')
+ else:
+ status_label.value = _('Failed to login')
+ finally:
+ album_section.enabled = True
+ config.set_busy(False)
+
+ def _load_albums(button):
+ config.set_busy(True)
+ album_section.enabled = False
+ status_label.value = 'Logging in, please wait...'
conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
- self,
- on_login_finish,
- self._login)
-
- def build_album_store():
- album_store.clear()
- album_count = 0
- album_iter = None
- for album_name in self._get_albums().keys():
- iter = album_store.append((album_name,))
- if album_name != "" and album_name == self.albumname:
- album_iter = iter
- album_count += 1
-
- if album_iter:
- albumnamecombo.set_active_iter(album_iter)
- elif self.albumname:
- albumnamecombo.child.set_text(self.albumname)
- elif album_count:
- albumnamecombo.set_active(0)
-
- tree = Utils.dataprovider_glade_get_widget(
- __file__,
- "config.glade",
- "FacebookConfigDialog")
-
- #get a whole bunch of widgets
- albumnamecombo = tree.get_widget("albumnamecombo")
- load_button = tree.get_widget("load_button")
- dlg = tree.get_widget("FacebookConfigDialog")
-
- # setup combobox
- album_store = gtk.ListStore(gobject.TYPE_STRING)
- albumnamecombo.set_model(album_store)
- cell = gtk.CellRendererText()
- albumnamecombo.pack_start(cell, True)
- albumnamecombo.set_text_column(0)
-
- # load button
- load_button.connect('clicked', load_button_clicked)
- albumnamecombo.child.set_text(self.albumname)
+ self, _login_finished, self._login)
- # run the dialog
- Utils.run_dialog_non_blocking(dlg, on_response, window)
+ status_label = config.add_item('Status', 'label',
+ initial_value = "Logged in" if self.fapi.uid else "Not logged in",
+ use_markup = True,
+ )
+
+ album_section = config.add_section("Album")
+ albums_config = config.add_item("Album name", "combotext",
+ config_name = "albumname",
+ choices = [],
+ )
+
+ load_albums_config = config.add_item("Load albums", "button",
+ initial_value = _load_albums
+ )
def refresh(self):
Image.ImageSink.refresh(self)
@@ -201,9 +184,3 @@
def is_configured (self, isSource, isTwoWay):
#Specifing an album is optional
return True
-
- def get_configuration(self):
- return {
- "albumname" : self.albumname
- }
-
Modified: trunk/conduit/modules/FacebookModule/Makefile.am
==============================================================================
--- trunk/conduit/modules/FacebookModule/Makefile.am (original)
+++ trunk/conduit/modules/FacebookModule/Makefile.am Tue Mar 17 17:19:27 2009
@@ -3,8 +3,5 @@
conduit_handlersdir = $(libdir)/conduit/modules/FacebookModule
conduit_handlers_PYTHON = FacebookModule.py
-conduit_handlers_DATA = config.glade
-EXTRA_DIST = config.glade
-
clean-local:
rm -rf *.pyc *.pyo
Modified: trunk/conduit/modules/FlickrModule/FlickrModule.py
==============================================================================
--- trunk/conduit/modules/FlickrModule/FlickrModule.py (original)
+++ trunk/conduit/modules/FlickrModule/FlickrModule.py Tue Mar 17 17:19:27 2009
@@ -295,9 +295,13 @@
status_label.value = '<span foreground="red">Failed to login.</span>'
finally:
load_photosets_config.enabled = True
+ account_section.enabled = True
+ config.set_busy(False)
def _load_photosets(button):
+ config.set_busy(True)
load_photosets_config.enabled = False
+ account_section.enabled = False
#FIXME: This applies the username value before OK/Apply is clicked,
#we should do a better job
username_config.apply()
@@ -305,7 +309,7 @@
conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
self, _login_finished, self._login)
- config.add_section('Account details')
+ account_section = config.add_section('Account details')
username_config = config.add_item('Username', 'text',
config_name = 'username',
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]