[pygda/introspection] More fiddling



commit bc01008558133dbeea926ee043ad42cd0bfa2755
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 11 14:03:55 2011 +0100

    More fiddling

 examples/gda/list_data_sources.py |   25 +++++++++++--------------
 examples/gda/select.py            |    3 +--
 2 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/examples/gda/list_data_sources.py b/examples/gda/list_data_sources.py
index 850fcdd..d7ecb79 100755
--- a/examples/gda/list_data_sources.py
+++ b/examples/gda/list_data_sources.py
@@ -17,20 +17,18 @@
 # *
 # */
 
-import pygtk; pygtk.require("2.0")
-import gda
+from gi.repository import Gda
 
-def main ():
 
-    client = gda.Client();
+def main ():
 
     #TODO: This should probably be config_get_provider_list()
-    providers = gda.config_get_provider_list();
+    providers = Gda.Config.list_providers();
 
-    print "Number of providers = ", len(providers);
+    print "Number of providers = ", providers.get_n_rows();
 
     # Print the information about each Provider:
-    for info in providers: 
+    for info in providers:
         print "Provider: ID = ", info.id, "\n";
         # TODO: Wrap these public struct fields:
         #"  location = ", info.location, "\n",
@@ -41,24 +39,23 @@ def main ():
 
     # TODO: Wrap this public struct field:
     # params = info.get_gda_params();
-    # for param in params: 
+    # for param in params:
     #    print param, ", ";
 
     print "\n\n";
 
-    data_sources = gda.config_get_data_source_list();
+    data_sources = Gda.config_get_data_source_list();
 
     print "Number of data sources = ", len(data_sources), "\n\n";
 
     # Print the information about each data source:
     for info in data_sources:
-        print "Data source: name = ", info.name, "\n", 
-        "  provider = ", info.provider, "\n", 
-        "  connection string = ", info.cnc_string, "\n", 
-        "  description = ", info.description, "\n", 
+        print "Data source: name = ", info.name, "\n",
+        "  provider = ", info.provider, "\n",
+        "  connection string = ", info.cnc_string, "\n",
+        "  description = ", info.description, "\n",
         "  username = ", info.username, "\n\n";
 
 
 
 main ()
-
diff --git a/examples/gda/select.py b/examples/gda/select.py
index 06d052c..caede19 100755
--- a/examples/gda/select.py
+++ b/examples/gda/select.py
@@ -24,8 +24,7 @@ def main ():
     data_source_name = "datasource_pygda_example_select11";
 
     #TODO: This should be Gda.Config.find_data_source().
-    gdaconfig = Gda.Config.get();
-    data_source = gdaconfig.get_dsn_info(data_source_name);
+    data_source = Gda.Config.get_dsn_info(data_source_name);
     if not data_source:
         print "Creating the DataSource, because it does not exist yet.";
 



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