[pitivi] prefs: Simplify some boolean expressions



commit 5afd8e291b8a66d55b7457932cd5a6ea689d544c
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Sep 15 22:53:50 2016 +0200

    prefs: Simplify some boolean expressions
    
    Reviewed-by: Jakub Brindza <jakub brindza gmail com>
    Differential Revision: https://phabricator.freedesktop.org/D1311

 pitivi/dialogs/prefs.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 3cb4b35..b5e1708 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -430,7 +430,6 @@ class CustomShortcutDialog(Gtk.Dialog):
         self.preferences = pref_dialog
         self.customised_item = customised_item
         self.shortcut_changed = False
-        self.valid_shortcut = False
 
         # Initialise all potential widgets used in the dialog.
         self.accelerator_label = Gtk.Label()
@@ -494,8 +493,7 @@ class CustomShortcutDialog(Gtk.Dialog):
 
         self.conflicting_action = self.app.shortcuts.get_conflicting_action(
             self.customised_item.action_name, custom_keyval, custom_mask)
-        self.valid_shortcut = valid and not self.conflicting_action
-        if self.valid_shortcut:
+        if valid and not self.conflicting_action:
             self.toggle_apply_accel_buttons(custom_keyval, custom_mask)
         else:
             if valid and not equal_accelerators:
@@ -506,10 +504,10 @@ class CustomShortcutDialog(Gtk.Dialog):
                                                % title)
 
         # Set visibility according to the booleans set above.
-        self.apply_button.set_visible(self.valid_shortcut)
-        self.conflict_label.set_visible(not self.valid_shortcut and valid and
+        self.apply_button.set_visible(valid and not bool(self.conflicting_action))
+        self.conflict_label.set_visible(valid and bool(self.conflicting_action) and
                                         not equal_accelerators)
-        self.replace_button.set_visible(not self.valid_shortcut and valid and
+        self.replace_button.set_visible(valid and bool(self.conflicting_action) and
                                         not equal_accelerators)
         self.currently_used.set_visible(equal_accelerators)
         self.invalid_used.set_visible(not valid)


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