[pitivi] prefs: Remove method and shuffle the setup code



commit fb5fce74792418798f40afed787ef247381ee055
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Sep 15 23:21:46 2016 +0200

    prefs: Remove method and shuffle the setup code
    
    Reviewed-by: Jakub Brindza <jakub brindza gmail com>
    Differential Revision: https://phabricator.freedesktop.org/D1313

 pitivi/dialogs/prefs.py |   38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)
---
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 6e4b037..c3e75e6 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -429,10 +429,26 @@ class CustomShortcutDialog(Gtk.Dialog):
         self.app = app
         self.preferences = pref_dialog
         self.customised_item = customised_item
+
+        self.set_title(_("Set shortcut"))
+        self.set_size_request(500, 300)
+        self.set_transient_for(self.preferences)
+        self.get_titlebar().set_decoration_layout('close:')
+        self.add_events(Gdk.EventMask.KEY_PRESS_MASK)
+
         self.shortcut_changed = False
+        self.conflicting_action = None
 
-        # Initialise all potential widgets used in the dialog.
+        # Setup the widgets used in the dialog.
+        prompt_label = Gtk.Label()
+        prompt_label.set_markup(_("Enter new shortcut for <b>%s</b>,\nor press Esc to "
+                                  "cancel.") % customised_item.title)
+        prompt_label.props.margin_top = PADDING * 3
+        prompt_label.props.margin_bottom = PADDING * 3
         self.accelerator_label = Gtk.Label()
+        self.accelerator_label.set_markup("<span size='20000'><b>%s</b></span>"
+                                          % customised_item.get_accel())
+        self.accelerator_label.props.margin_bottom = PADDING
         self.currently_used = Gtk.Label()
         self.currently_used.set_text(_("This is the currently set accelerator"
                                        " for this shortcut.\n You may want to"
@@ -442,31 +458,11 @@ class CustomShortcutDialog(Gtk.Dialog):
                                      " might interfere with typing.\n"
                                      " Try using Control, Shift or Alt"
                                      " with some other key, please."))
-        self.conflicting_action = None
         self.conflict_label = Gtk.Label()
         self.apply_button = Gtk.Button()
         self.replace_button = Gtk.Button()
 
-        self.set_size_request(500, 300)
-        self.set_transient_for(self.preferences)
-        self.get_titlebar().set_decoration_layout('close:')
-        self.add_events(Gdk.EventMask.KEY_PRESS_MASK)
-        self.display_customisation_dialog(customised_item)
-        self.replace_button.set_visible(False)
-
-    def display_customisation_dialog(self, customised_item):
-        """Populates the dialog with relevant information and displays it."""
-        self.set_title(_("Set shortcut"))
         content_area = self.get_content_area()
-        prompt_label = Gtk.Label()
-        prompt_label.set_markup(_("Enter new shortcut for <b>%s</b>,\nor press Esc to "
-                                  "cancel.") % customised_item.title)
-        prompt_label.props.margin_top = PADDING * 3
-        prompt_label.props.margin_bottom = PADDING * 3
-        self.accelerator_label.set_markup("<span size='20000'><b>%s</b></span>"
-                                          % customised_item.get_accel())
-        self.accelerator_label.props.margin_bottom = PADDING
-
         content_area.add(prompt_label)
         content_area.add(self.accelerator_label)
         content_area.add(self.conflict_label)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]