commit d6fae9bf53f39279f56b968ee8a71de15a129ada Author: Kamran Riaz Khan krkhan@inspirated.com Date: Sun Jul 17 05:05:56 2011 +0500
Use dict of panels to reduce statement duplication. --- src/gui/arm.xml | 2 +- src/gui/controller.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/src/gui/arm.xml b/src/gui/arm.xml index 56c9620..56112c9 100644 --- a/src/gui/arm.xml +++ b/src/gui/arm.xml @@ -79,7 +79,7 @@ </columns> </object> <object class="GtkWindow" id="window_main"> - <property name="title" translatable="yes">arm</property> + <property name="title" translatable="yes">garm</property> <property name="default_width">640</property> <property name="default_height">480</property> <signal name="delete_event" handler="on_window_main_delete_event"/> diff --git a/src/gui/controller.py b/src/gui/controller.py index e6ffcbd..7172aa7 100644 --- a/src/gui/controller.py +++ b/src/gui/controller.py @@ -19,17 +19,15 @@ class GuiController: self.builder.add_from_file(filename) self.builder.connect_signals(self)
- self.logPanel = logPanel.LogPanel(self.builder) - self.logPanel.pack_widgets() - - self.bwStats = bandwidthStats.BandwidthStats(self.builder) - self.bwStats.pack_widgets() - - self.connPanel = connPanel.ConnectionPanel(self.builder) - self.connPanel.pack_widgets() - - self.generalPanel = generalPanel.GeneralPanel(self.builder) - self.generalPanel.pack_widgets() + self.panels = { + logPanel.LogPanel : None, + bandwidthStats.BandwidthStats : None, + connPanel.ConnectionPanel : None, + generalPanel.GeneralPanel : None } + + for panel in self.panels.keys(): + self.panels[panel] = panel(self.builder) + self.panels[panel].pack_widgets()
def run(self): window = self.builder.get_object('window_main')
tor-commits@lists.torproject.org