[pitivi: 80/94] presets: cleanup the saveAll method
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 80/94] presets: cleanup the saveAll method
- Date: Sun, 11 Sep 2011 16:19:10 +0000 (UTC)
commit c225aca41d742ccbb7f8607b90b9b467776bc0dc
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Thu Sep 8 15:04:48 2011 -0400
presets: cleanup the saveAll method
pitivi/ui/preset.py | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/ui/preset.py b/pitivi/ui/preset.py
index 5b6743a..f552d2f 100644
--- a/pitivi/ui/preset.py
+++ b/pitivi/ui/preset.py
@@ -87,15 +87,17 @@ class PresetManager(object):
if not os.path.exists(self.user_path):
os.makedirs(self.user_path)
for name, properties in self.ordered:
- try:
- filepath = self.presets[name]["filepath"]
- except KeyError:
- filename = name + ".json"
- filepath = os.path.join(self.user_path, filename)
-
if not name == "No preset":
- fout = open(filepath, "w")
- self.saveSection(fout, name)
+ try:
+ filepath = self.presets[name]["filepath"]
+ except KeyError:
+ filename = name + ".json"
+ filepath = os.path.join(self.user_path, filename)
+ try:
+ fout = open(filepath, "w")
+ self.saveSection(fout, name)
+ except IOError:
+ pass # TODO: show an error infobar
def _loadPreset(self, parser, section):
"""Load the specified section from the specified config parser.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]