conduit r1368 - in trunk: . conduit/gtkui conduit/hildonui
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1368 - in trunk: . conduit/gtkui conduit/hildonui
- Date: Wed, 12 Mar 2008 12:20:46 +0000 (GMT)
Author: jstowers
Date: Wed Mar 12 12:20:46 2008
New Revision: 1368
URL: http://svn.gnome.org/viewvc/conduit?rev=1368&view=rev
Log:
2008-03-13 John Stowers <john stowers gmail com>
* conduit/gtkui/Tree.py:
* conduit/gtkui/UI.py:
* conduit/hildonui/List.py:
* conduit/hildonui/UI.py: Connect to, and use the GLOBAL.moduleManager
from the tree/list model classes. Get sources, sinks and twoways at once
and dont emit signals at initial load. Seems to make Conduit start
quicker.
Modified:
trunk/ChangeLog
trunk/conduit/gtkui/Tree.py
trunk/conduit/gtkui/UI.py
trunk/conduit/hildonui/List.py
trunk/conduit/hildonui/UI.py
Modified: trunk/conduit/gtkui/Tree.py
==============================================================================
--- trunk/conduit/gtkui/Tree.py (original)
+++ trunk/conduit/gtkui/Tree.py Wed Mar 12 12:20:46 2008
@@ -45,7 +45,7 @@
"""
COLUMN_TYPES = (gtk.gdk.Pixbuf, str, str, str, bool, str)
- def __init__(self, module_wrapper_list=[]):
+ def __init__(self):
"""
TreeModel constructor
@@ -60,8 +60,12 @@
self.cats = []
#Add dataproviders
- self.add_dataproviders(module_wrapper_list)
-
+ self.add_dataproviders(
+ conduit.GLOBALS.moduleManager.get_modules_by_type("source","sink","twoway")
+ )
+ conduit.GLOBALS.moduleManager.connect("dataprovider-available",self._on_dataprovider_available)
+ conduit.GLOBALS.moduleManager.connect("dataprovider-unavailable", self._on_dataprovider_unavailable)
+
def _is_category_heading(self, rowref):
return rowref.module_type == "category"
@@ -83,6 +87,13 @@
self.pathMappings[cat] = (i, )
for j, dp in enumerate(self.dataproviders[i]):
self.pathMappings[dp] = (i, j)
+
+ def _on_dataprovider_available(self, loader, dataprovider):
+ if dataprovider.enabled == True:
+ self.add_dataprovider(dataprovider)
+
+ def _on_dataprovider_unavailable(self, unloader, dataprovider):
+ self.remove_dataprovider(dataprovider)
def add_dataproviders(self, dpw=[]):
"""
@@ -93,7 +104,9 @@
#Add them to the module
for mod in module_wrapper_list:
- self.add_dataprovider(mod, True)
+ #dont signal the GUI to update, providing this model
+ #is added to a view after it has finished being constructed
+ self.add_dataprovider(mod, False)
def add_dataprovider(self, dpw, signal=True):
"""
Modified: trunk/conduit/gtkui/UI.py
==============================================================================
--- trunk/conduit/gtkui/UI.py (original)
+++ trunk/conduit/gtkui/UI.py Wed Mar 12 12:20:46 2008
@@ -127,14 +127,6 @@
#Set up the expander used for resolving sync conflicts
self.conflictResolver = ConflictResolver.ConflictResolver(self.widgets)
- #setup the module manager
- self.moduleManager = moduleManager
- self.dataproviderTreeModel.add_dataproviders(self.moduleManager.get_modules_by_type("source"))
- self.dataproviderTreeModel.add_dataproviders(self.moduleManager.get_modules_by_type("sink"))
- self.dataproviderTreeModel.add_dataproviders(self.moduleManager.get_modules_by_type("twoway"))
- self.moduleManager.connect("dataprovider-available", self.on_dataprovider_available)
- self.moduleManager.connect("dataprovider-unavailable", self.on_dataprovider_unavailable)
-
#final GUI setup
self.cancelSyncButton = self.widgets.get_widget('cancel')
self.hpane.set_position(conduit.GLOBALS.settings.get("gui_hpane_postion"))
@@ -212,19 +204,6 @@
conduit.GLOBALS.syncManager.is_busy()
)
- def on_dataprovider_available(self, loader, dataprovider):
- """
- Adds the new dataprovider to the treeview
- """
- if dataprovider.enabled == True:
- self.dataproviderTreeModel.add_dataprovider(dataprovider)
-
- def on_dataprovider_unavailable(self, unloader, dataprovider):
- """
- Removes the dataprovider from the treeview and replaces it with pending dataproviders
- """
- self.dataproviderTreeModel.remove_dataprovider(dataprovider)
-
def on_synchronize_all_clicked(self, widget):
"""
Synchronize all valid conduits on the canvas
@@ -264,10 +243,10 @@
converterListStore.append( (string,) )
dataProviderListStore = gtk.ListStore( str, bool )
#get all dataproviders
- for i in self.moduleManager.get_modules_by_type("sink","source","twoway"):
+ for i in conduit.GLOBALS.moduleManager.get_modules_by_type("sink","source","twoway"):
dataProviderListStore.append(("Name: %s\nDescription: %s)" % (i.name, i.description), True))
#include files that could not be loaded
- for f in self.moduleManager.invalidFiles:
+ for f in conduit.GLOBALS.moduleManager.invalidFiles:
dataProviderListStore.append(("Error loading file: %s" % f, False))
#construct the dialog
@@ -453,7 +432,7 @@
#signal and NOT here
if dataproviderKey != "":
#Add a new instance if the dataprovider to the canvas.
- new = self.moduleManager.get_module_wrapper_with_instance(dataproviderKey)
+ new = conduit.GLOBALS.moduleManager.get_module_wrapper_with_instance(dataproviderKey)
self.canvas.add_dataprovider_to_canvas(dataproviderKey, new, x, y)
context.finish(True, True, etime)
Modified: trunk/conduit/hildonui/List.py
==============================================================================
--- trunk/conduit/hildonui/List.py (original)
+++ trunk/conduit/hildonui/List.py Wed Mar 12 12:20:46 2008
@@ -13,16 +13,23 @@
def __init__(self):
gtk.VBox.__init__(self)
+ # MODEL
# keep a dict of category - dp list
self.categories = {}
+ self.combo = gtk.combo_box_new_text ()
+ self.dp_store = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
+ # populate with dataproviders
+ self.add_dataproviders(
+ conduit.GLOBALS.moduleManager.get_modules_by_type("source","sink","twoway")
+ )
+ conduit.GLOBALS.moduleManager.connect("dataprovider-available", self.on_dataprovider_available)
+ conduit.GLOBALS.moduleManager.connect("dataprovider-unavailable", self.on_dataprovider_unavailable)
+ # VIEW
# category combo
- self.combo = gtk.combo_box_new_text ()
self.combo.connect ("changed", self.on_combo_changed)
self.pack_start(self.combo, False, False)
-
# tree view
- self.dp_store = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
self.tree = gtk.TreeView (self.dp_store)
col = gtk.TreeViewColumn()
render_pixbuf = gtk.CellRendererPixbuf()
@@ -45,6 +52,13 @@
self.tree.connect('drag-data-delete', self.on_drag_data_delete)
self.pack_start(self.tree, True, True)
+
+ def on_dataprovider_available(self, loader, dataprovider):
+ if dataprovider.enabled:
+ self.add_dataprovider (dataprovider)
+
+ def on_dataprovider_unavailable (self, loader, dataprovider):
+ self.remove_dataprovider (dataprovider)
def add_dataproviders(self, dpw=[]):
"""
@@ -55,9 +69,9 @@
#Add them to the module
for mod in module_wrapper_list:
- self.add_dataprovider(mod, True)
+ self.add_dataprovider(mod)
- def add_dataprovider (self, dpw, signal=True):
+ def add_dataprovider (self, dpw):
"""
Adds a new dataprovider
"""
Modified: trunk/conduit/hildonui/UI.py
==============================================================================
--- trunk/conduit/hildonui/UI.py (original)
+++ trunk/conduit/hildonui/UI.py Wed Mar 12 12:20:46 2008
@@ -31,7 +31,6 @@
log.debug("Adding %s to icon theme search path" % (i))
self.conduitApplication = conduitApplication
- self.moduleManager = moduleManager
self.type_converter = typeConverter
self.sync_manager = syncManager
self.syncSet = None
@@ -44,12 +43,7 @@
self.add_window(self.mainWindow)
self.provider_box = DataProviderBox ()
- self.provider_box.add_dataproviders(self.moduleManager.get_modules_by_type("source"))
- self.provider_box.add_dataproviders(self.moduleManager.get_modules_by_type("sink"))
- self.provider_box.add_dataproviders(self.moduleManager.get_modules_by_type("twoway"))
self.provider_box.combo.set_active (0)
- self.moduleManager.connect("dataprovider-available", self.on_dataprovider_available)
- self.moduleManager.connect("dataprovider-unavailable", self.on_dataprovider_unavailable)
# FIXME: we should do something hildon specific
self.canvas = Canvas(
@@ -108,7 +102,7 @@
#signal and NOT here
if dataproviderKey != "":
#Add a new instance if the dataprovider to the canvas.
- new = self.moduleManager.get_module_wrapper_with_instance(dataproviderKey)
+ new = conduit.GLOBALS.moduleManager.get_module_wrapper_with_instance(dataproviderKey)
self.canvas.add_dataprovider_to_canvas(dataproviderKey, new, x, y)
context.finish(True, True, etime)
@@ -149,20 +143,8 @@
#non gui tasks
if quit:
log.debug("Quitting...")
- #FIXME: I want to do this call over DBus but this hangs. Why?
- #sessionBus = dbus.SessionBus()
- #obj = sessionBus.get_object(conduit.DBUS_IFACE, "/activate")
- #conduitApp = dbus.Interface(obj, conduit.DBUS_IFACE)
- #conduitApp.Quit()
self.conduitApplication.Quit()
- def on_dataprovider_available(self, loader, dataprovider):
- if dataprovider.enabled:
- self.provider_box.add_dataprovider (dataprovider)
-
- def on_dataprovider_unavailable (self, loader, dataprovider):
- self.provider_box.remove_dataprovider (dataprovider)
-
class ConduitToolbar(gtk.Toolbar):
def __init__(self, syncSet, canvas):
gtk.Toolbar.__init__(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]