conduit r1892 - in trunk: . conduit conduit/gtkui conduit/modules
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1892 - in trunk: . conduit conduit/gtkui conduit/modules
- Date: Sun, 22 Feb 2009 09:30:17 +0000 (UTC)
Author: jstowers
Date: Sun Feb 22 09:30:16 2009
New Revision: 1892
URL: http://svn.gnome.org/viewvc/conduit?rev=1892&view=rev
Log:
2009-02-22 John Stowers <john stowers gmail com>
* conduit/Web.py: When showing the web browser
window, find any top level dialogs and un-modal them.
This is a consequence of Conduit sharing a single
login window among many dataproviders which may launch
modal config dialogs.
* conduit/gtkui/ConfigContainer.py: Remove set_busy
method, which does not fit into new config architecture.
* conduit/Synchronization.py: Documentation for
run_blocking function used for running web logins.
* conduit/gtkui/WindowConfigurator.py: No need to
inherit from GObject.
* conduit/modules/TestModule.py: Test the new web
login behaviour.
Modified:
trunk/ChangeLog
trunk/conduit/Synchronization.py
trunk/conduit/Web.py
trunk/conduit/gtkui/ConfigContainer.py
trunk/conduit/gtkui/WindowConfigurator.py
trunk/conduit/modules/TestModule.py
Modified: trunk/conduit/Synchronization.py
==============================================================================
--- trunk/conduit/Synchronization.py (original)
+++ trunk/conduit/Synchronization.py Sun Feb 22 09:30:16 2009
@@ -132,6 +132,12 @@
self.syncWorkers[c].join(timeout)
def run_blocking_dataprovider_function_calls(self, dataprovider, callback, *functions):
+ """
+ Runs functions in a seperate thread, calling callback when complete
+ @param dataprovider: The dataprovider associated with the functions to be run
+ @param callback: The function to call when all functions have been run
+ @param functions: A list of functions to call
+ """
#need to get the conduit assocated with this dataprovider because the sync-completed
#signal is emmited from the conduit object
conds = []
Modified: trunk/conduit/Web.py
==============================================================================
--- trunk/conduit/Web.py (original)
+++ trunk/conduit/Web.py Sun Feb 22 09:30:16 2009
@@ -79,6 +79,16 @@
self.notebook = gtk.Notebook()
self.window.add(self.notebook)
+ #If we have been launched from a Gtk.Dialog (usually a configure
+ #dialog), then we should be transient for that dialog, and we
+ #must ensure that the dialog is no longer modal so we can close the browser
+ for w in gtk.window_list_toplevels():
+ if type(w) == gtk.Dialog:
+ #center the browser window over the dialog
+ self.window.set_transient_for(w)
+ #disable dialog modality
+ w.set_modal(False)
+
self.window.set_default_size(700, 600)
self.window.set_position(gtk.WIN_POS_CENTER)
self.window.show_all()
Modified: trunk/conduit/gtkui/ConfigContainer.py
==============================================================================
--- trunk/conduit/gtkui/ConfigContainer.py (original)
+++ trunk/conduit/gtkui/ConfigContainer.py Sun Feb 22 09:30:16 2009
@@ -207,13 +207,6 @@
super(ConfigContainer, self).show()
self.config_widget.show_all()
- #def set_busy(self, busy):
- # if busy:
- # self.old_cursor = self.widgetTable.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
- # else:
- # self.widgetTable.set_cursor(self.old_cursor)
- # gtk.gdk.flush()
-
def apply_config(self, items = None, sections = None):
'''
Save the current configuration state to the dataprovider and to each
Modified: trunk/conduit/gtkui/WindowConfigurator.py
==============================================================================
--- trunk/conduit/gtkui/WindowConfigurator.py (original)
+++ trunk/conduit/gtkui/WindowConfigurator.py Sun Feb 22 09:30:16 2009
@@ -1,5 +1,4 @@
import os.path
-import gobject
import gtk, gtk.glade
import logging
log = logging.getLogger("gtkui.WindowConfigurator")
@@ -8,13 +7,11 @@
import conduit
import conduit.gtkui.ConfigContainer as ConfigContainer
-class WindowConfigurator(gobject.GObject):
+class WindowConfigurator:
"""
A window configurator to embed a configuration widget.
"""
-
CONFIG_WINDOW_TITLE_TEXT = _("Configure")
-
#Show multiple containers or only shows the currently selected dataprovider
#This should be set to False until all dataproviders use the new system
MULTIPLE_VIEW = False
@@ -29,9 +26,7 @@
"""
@param window: Parent window (this dialog is modal)
@type window: C{gtk.Window}
- """
- gobject.GObject.__init__(self)
-
+ """
self.showing = False
self.built_configs = False
Modified: trunk/conduit/modules/TestModule.py
==============================================================================
--- trunk/conduit/modules/TestModule.py (original)
+++ trunk/conduit/modules/TestModule.py Sun Feb 22 09:30:16 2009
@@ -566,6 +566,24 @@
)
def config_setup(self, config):
+
+ def _login(*args):
+ log.debug("Logging in")
+ Web.LoginMagic("The Internets", self.url, login_function=lambda: True)
+
+ def _login_finished(*args):
+ log.debug("Login finished")
+ #Utils.dialog_reset_cursor(dlg)
+ pass
+
+ def _login_clicked(button):
+ #Utils.dialog_set_busy_cursor(dlg)
+ log.debug("Login clicked")
+ conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
+ self,
+ _login_finished,
+ _login)
+
TestTwoWay.config_setup(self, config)
config.add_section("Browser Settings")
config.add_item("Url", "text",
@@ -574,14 +592,14 @@
config.add_item("Browser", "text",
config_name = "browser"
)
-
- def _login(self):
- return True
+ config.add_item("Launch Browser", "button",
+ initial_value = _login_clicked
+ )
def refresh(self):
TestTwoWay.refresh(self)
log.debug("REFRESH (thread: %s)" % thread.get_ident())
- Web.LoginMagic(self._name_, self.url, browser=self.browser, login_function=self._login)
+ Web.LoginMagic(self._name_, self.url, browser=self.browser, login_function=lambda: True)
class TestSinkNeedConfigure(_TestBase, DataProvider.DataSink):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]