]> sigrok.org Git - sigrok-meter.git/commitdiff
Put everything in a SigrokMeter class.
authorUwe Hermann <redacted>
Tue, 16 Apr 2013 18:27:53 +0000 (20:27 +0200)
committerUwe Hermann <redacted>
Tue, 16 Apr 2013 18:04:11 +0000 (20:04 +0200)
sigrok-meter

index d1c98636743a3c4e0f4b2b384e86fc07de1a4b88..e80b634035f01b77bb606fd575aa0c3ce1b07745 100755 (executable)
 
 from gi.repository import Gtk
 
-# Handler class for various GTK+ signals.
-class Handler:
+class SigrokMeter:
+    def __init__(self):
+        self.builder = Gtk.Builder()
+        self.builder.add_from_file("sigrok-meter.glade")
+        self.builder.connect_signals(self)
+        self.win = self.builder.get_object("main-window")
+        self.win.show_all()
+
     def onDeleteWindow(self, *args):
         Gtk.main_quit(*args)
-    def on_imagemenuitemAbout_activate(self, *args):
-        about = builder.get_object("aboutdialog")
+
+    def on_imagemenuitemAbout_activate(self, action):
+        about = self.builder.get_object("aboutdialog")
         about.run()
         about.hide()
 
-builder = Gtk.Builder()
-builder.add_from_file("sigrok-meter.glade")
-builder.connect_signals(Handler())
-win = builder.get_object("main-window")
-win.show_all()
-Gtk.main()
+if __name__ == '__main__':
+       SigrokMeter()
+       Gtk.main()