[conduit/gsoc09_alexandre] First mockup version of the select dataprovider dialog.



commit f4c483919757f7d60f90cf10539292959569b256
Author: Alexandre Rosenfeld <airmind gmail com>
Date:   Thu Jun 18 21:54:44 2009 -0300

    First mockup version of the select dataprovider dialog.

 conduit/DBus.py                           |    6 ++++
 conduit/gtkui/SelectDataproviderDialog.py |   41 +++++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 5 deletions(-)
---
diff --git a/conduit/DBus.py b/conduit/DBus.py
index 5d64ccd..64de6cb 100644
--- a/conduit/DBus.py
+++ b/conduit/DBus.py
@@ -414,6 +414,12 @@ class SyncSetDBusItem(DBusItem):
 
         self.syncSet.add_conduit(c)
         
+    @dbus.service.method(SYNCSET_DBUS_IFACE, in_signature='ss', out_signature='s')
+    def RequestDataprovider(self, filter_mime_out, filter_mime_in):
+        from conduit.gtkui.SelectDataproviderDialog import SelectDataproviderDialog
+        return SelectDataproviderDialog(str(filter_mime_out), str(filter_mime_in)).run()
+            
+        
     @dbus.service.method(SYNCSET_DBUS_IFACE, in_signature='o', out_signature='')
     def DeleteConduit(self, cond):
         self._print("DeleteConduit: %s" % cond)
diff --git a/conduit/gtkui/SelectDataproviderDialog.py b/conduit/gtkui/SelectDataproviderDialog.py
index 3d26b3a..ff25792 100644
--- a/conduit/gtkui/SelectDataproviderDialog.py
+++ b/conduit/gtkui/SelectDataproviderDialog.py
@@ -23,10 +23,41 @@ import conduit.gtkui.Database as Database
 
 class SelectDataproviderDialog(object):
 
-    def __init__(self, filter_mime = None):
-        self.window = gtk.Assistant()
-        
-        conduit.GLOBALS.moduleManager.get_modules_by_type("source","sink","twoway")
+    def __init__(self, filter_mime_in = None, filter_mime_out = None):
+        #self.window = gtk.Assistant()
+        self.window = gtk.Dialog("My dialog",
+                     None,
+                     gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+                     (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
+                      gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
 
-        self.dataproviders_list
+        self.dp_model = gtk.ListStore(gtk.gdk.Pixbuf, str)
+        
+        dpw_list = conduit.GLOBALS.moduleManager.get_modules_by_type("source","sink","twoway")
+        module_wrapper_list = [m for m in dpw_list if m.enabled]
+        
+        #Add them to the module
+        for mod in module_wrapper_list:
+            #if (not filter_mime_in or mod.in_type == filter_mime_in) and
+            #   (not filter_mime_out or mod.out_type == filter_mime_out):
+            self.dp_model.append((mod.get_descriptive_icon(), mod.name,))
+        
+        self.combobox = gtk.ComboBox(self.dp_model)
 
+        pixbuf_render = gtk.CellRendererPixbuf()
+        self.combobox.pack_start(pixbuf_render, False)
+        self.combobox.set_attributes(pixbuf_render, pixbuf = 0)
+        
+        txt_render = gtk.CellRendererText()
+        self.combobox.pack_start(txt_render)
+        self.combobox.set_attributes(txt_render, text = 1)
+        #self.combobox.insert_column_with_attributes(0, "Dps", gtk.CellRendererText(), text = 0)
+        
+        self.window.get_content_area().pack_start(self.combobox)
+        
+    def run(self):
+        self.window.show_all()
+        self.window.run()
+        self.window.hide()
+        return ""
+            



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