From daea908675f22392d2370b7513d5d112dd77d006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas=20Albadalejo?= Date: Mon, 14 Jul 2014 09:00:11 +0200 Subject: [PATCH] Changing app object name to MainApp instead of MainWindow --- src/stevedore.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/stevedore.py b/src/stevedore.py index fa66a3f..bc11879 100644 --- a/src/stevedore.py +++ b/src/stevedore.py @@ -27,7 +27,7 @@ from prefs import Preferences import time -class MainWindow(Gtk.Application): +class MainApplication(Gtk.Application): def __init__(self): Gtk.Application.__init__(self, application_id = "apps.gnome.stevedore", flags = Gio.ApplicationFlags.FLAGS_NONE) @@ -154,6 +154,25 @@ class MainWindow(Gtk.Application): self.status_bar.push(self.status_context_id, message) + def get_preferences_from_window(self): + """ + Gets the current Preferences window widgets and saves the options + """ + localhost_checkbox = self.builder.get_object('LocalCheckBox') + hostname_entry = self.builder.get_object('HostnameEntry') + port_entry = self.builder.get_object('PortEntry') + + if localhost_checkbox.get_active(): + self.preferences['localhost'] = True + self.preferences['host'] = 'localhost' + self.preferences['port'] = 0 + + else: + self.preferences['localhost'] = False + self.preferences['host'] = hostname_entry.get_text() + if port_entry.get_text() != '': + self.preferences['port'] = int(port_entry.get_text()) + # Events and "natural" callbacks def on_MainWindow_delete_event(self, obj, event = None): @@ -435,30 +454,11 @@ class MainWindow(Gtk.Application): """ self.get_preferences_from_window() - def get_preferences_from_window(self): - """ - Gets the current Preferences window widgets and saves the options - """ - localhost_checkbox = self.builder.get_object('LocalCheckBox') - hostname_entry = self.builder.get_object('HostnameEntry') - port_entry = self.builder.get_object('PortEntry') - - if localhost_checkbox.get_active(): - self.preferences['localhost'] = True - self.preferences['host'] = 'localhost' - self.preferences['port'] = 0 - - else: - self.preferences['localhost'] = False - self.preferences['host'] = hostname_entry.get_text() - if port_entry.get_text() != '': - self.preferences['port'] = int(port_entry.get_text()) - # run main loop def main(): - main_window = MainWindow() - main_window.run(None) + main_app = MainApplication() + main_app.run(None) if __name__ == "__main__": main()