[pitivi: 4/8] preset: Cleanup savePreset and isRemoveButtonSensitive
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 4/8] preset: Cleanup savePreset and isRemoveButtonSensitive
- Date: Tue, 27 Sep 2011 22:05:37 +0000 (UTC)
commit 46efa55262c8edcac549684e715bba16e6d55ad1
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Thu Sep 15 11:15:17 2011 -0400
preset: Cleanup savePreset and isRemoveButtonSensitive
pitivi/ui/preset.py | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/pitivi/ui/preset.py b/pitivi/ui/preset.py
index 32dd2f8..443e147 100644
--- a/pitivi/ui/preset.py
+++ b/pitivi/ui/preset.py
@@ -237,7 +237,7 @@ class PresetManager(object):
for field, (setter, getter) in self.widget_map.iteritems():
values[field] = getter()
- def isCurrentPresetChanged(self):
+ def _isCurrentPresetChanged(self):
"""Return whether the widgets values differ from those of the preset."""
if not self.cur_preset:
# There is no preset selected, nothing to do.
@@ -282,29 +282,25 @@ class PresetManager(object):
# presets are installed; they are not expected to be editable.
return False
else:
- values = self.presets[self.cur_preset]
- return any((values[field] != getter()
- for field, (setter, getter)
- in self.widget_map.iteritems()))
+ return self._isCurrentPresetChanged()
def isRemoveButtonSensitive(self):
"""Check if Remove buttons should be sensitive"""
if not self.cur_preset or self.cur_preset == "No preset":
return False
+ try:
+ full_path = self.presets[self.cur_preset]["filepath"]
+ (dir, name) = os.path.split(full_path)
+ except KeyError:
+ # This is a newly created preset that has not yet been saved
+ # We cannot remove it since it does not exist
+ return False
+ if dir == self.default_path or not isWritable(full_path):
+ # default_path is the system-wide directory where the default
+ # presets are installed; they are not expected to be editable.
+ return False
else:
- try:
- full_path = self.presets[self.cur_preset]["filepath"]
- (dir, name) = os.path.split(full_path)
- except KeyError:
- # This is a newly created preset that has not yet been saved
- # We cannot remove it since it does not exist
- return False
- if dir == self.default_path or not isWritable(full_path):
- # default_path is the system-wide directory where the default
- # presets are installed; they are not expected to be editable.
- return False
- else:
- return True
+ return True
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]