browser.py
changeset 72 539c2dd47f3b
parent 57 ba323bbed6a4
child 104 d8ff52a0390f
--- a/browser.py	Tue Mar 05 11:24:47 2013 +0100
+++ b/browser.py	Tue Mar 05 11:27:34 2013 +0100
@@ -10,22 +10,24 @@
 
 
 class MyApplication(Application, SimpleTool):
+
     PLACEHOLDER = '__placeholder__'
+
     def __init__(self):
         Application.__init__(self)
         SimpleTool.__init__(self, name='browser', desc='PostgreSQL database browser.')
         self.init()
 
-        self.top.connect('keypress', self.on_top_keypress)
+        self.top.add_handler('keypress', self.on_top_keypress)
 
         self.browser = pgbrowser.PgBrowser(self.pgm.get_conn('target'))
         self.model = TreeModel()
         self.view = TreeView(self.model)
-        self.view.connect('expand', self.on_view_expand)
-        self.top.add(self.view)
+        self.view.add_handler('expand', self.on_view_expand)
 
-        vert = VerticalLayout()
-        self.top.layout(vert)
+        scroll = ScrollView()
+        scroll.add(self.view)
+        self.top.add(scroll, halign='fill', valign='fill')
 
         self.populate_schemas()
 
@@ -53,13 +55,13 @@
         for table_name in table_list:
             node.add(TreeNode(table_name))
 
-    def on_view_expand(self, node):
-        if node.parent.name == 'schemas' and node.children[0].name == self.PLACEHOLDER:
-            schema_name = node.name
-            self.populate_tables(node.children[0], schema_name)
+    def on_view_expand(self, ev):
+        if ev.node.parent.name == 'schemas' and ev.node.children[0].name == self.PLACEHOLDER:
+            schema_name = ev.node.name
+            self.populate_tables(ev.node.children[0], schema_name)
 
-    def on_top_keypress(self, keyname, char):
-        if keyname == 'escape':
+    def on_top_keypress(self, ev):
+        if ev.keyname == 'escape':
             self.terminate()