From: Uwe Hermann Date: Tue, 16 Apr 2013 18:27:53 +0000 (+0200) Subject: Put everything in a SigrokMeter class. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=730cbd1fe394da4bc0646fe8f46f58a8a8827b0d;p=sigrok-meter.git Put everything in a SigrokMeter class. --- diff --git a/sigrok-meter b/sigrok-meter index d1c9863..e80b634 100755 --- a/sigrok-meter +++ b/sigrok-meter @@ -21,19 +21,23 @@ 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()