summaryrefslogtreecommitdiff
path: root/rapid/prefsrapid.py
diff options
context:
space:
mode:
authorJulien Valroff <julien@kirya.net>2011-04-16 16:39:17 +0200
committerJulien Valroff <julien@kirya.net>2011-04-16 16:39:17 +0200
commit5539b9c5aa11891c66104fe51ebb5e9b4ad31538 (patch)
treea08efd10faf1ac622a62e29d17da6d4f1f0aeac3 /rapid/prefsrapid.py
parent07934178861343ee213674120db367b8faeef1be (diff)
parent75b28642dd41fb4a7925b42cb24274de90a4f52c (diff)
Merge commit 'upstream/0.4.0_beta1' into experimental
Diffstat (limited to 'rapid/prefsrapid.py')
-rw-r--r--rapid/prefsrapid.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/rapid/prefsrapid.py b/rapid/prefsrapid.py
index 491d75d..81a425b 100644
--- a/rapid/prefsrapid.py
+++ b/rapid/prefsrapid.py
@@ -218,6 +218,12 @@ class RapidPreferences(prefs.Preferences):
return True
return False
+ def most_recent_job_code(self):
+ if len(self.job_codes) > 0:
+ return self.job_codes[0]
+ else:
+ return None
+
def get_pref_lists_by_file_type(self, file_type):
"""
Returns tuple of subfolder and file rename pref lists for the given
@@ -355,20 +361,27 @@ def check_prefs_for_validity(prefs):
"""
Checks preferences for validity (called at program startup)
- Returns true if the passed in preferences are valid, else returns False
+ Returns tuple with two values:
+ 1. true if the passed in preferences are valid, else returns False
+ 2. message if prefs are invalid
"""
- try:
- tests = ((prefs.image_rename, pd.PhotoNamePrefs),
- (prefs.subfolder, pd.PhotoSubfolderPrefs),
- (prefs.video_rename, pd.VideoNamePrefs),
- (prefs.video_subfolder, pd.VideoSubfolderPrefs))
- for pref, pref_widgets in tests:
- p = pref_widgets(pref)
+
+ msg = ''
+ valid = True
+ tests = ((prefs.image_rename, pd.PhotoNamePrefs),
+ (prefs.subfolder, pd.PhotoSubfolderPrefs),
+ (prefs.video_rename, pd.VideoNamePrefs),
+ (prefs.video_subfolder, pd.VideoSubfolderPrefs))
+ for pref, pref_widgets in tests:
+ p = pref_widgets(pref)
+ try:
p.check_prefs_for_validity()
- except:
- return False
- return True
+ except pd.PrefError as e:
+ valid = False
+ msg += e.msg + "\n"
+
+ return (valid, msg)
def insert_pref_lists(prefs, rpd_file):
"""