Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2013-02-18 18:28:17 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2013-02-18 18:28:17 (GMT)
commitfa2c61c7c9175db4c20d10c23c5beb307c91f07f (patch)
treea83ab76e3b3efd87b775be0444674beef06d7439
parent77315c7d10dc06008ca80e67fe22a9ba279c5df4 (diff)
Fix handling of unrecognised SANE option types
Settings of unknown types would previously reference a variable that hasn't been set within the same iteration of the loop. Instead we now end the current iteration early.
-rw-r--r--scan.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/scan.py b/scan.py
index 3840180..283c1b9 100644
--- a/scan.py
+++ b/scan.py
@@ -92,6 +92,7 @@ class SettingsToolbar(gtk.ToolPalette):
def _add_options(self):
groups = self._get_groups()
+ logging.debug('SettingsToolbar._add_options(): groups=%r', groups)
name_map = dict([(self._scanner[py_name].name, py_name)
for py_name in self._scanner.optlist])
@@ -131,8 +132,14 @@ class SettingsToolbar(gtk.ToolPalette):
widget = self._add_string(option, value)
elif (option.type == sane.TYPE_BUTTON):
widget = self._add_action(option, value)
+ else:
+ logging.warning('Skipping setting %r of unknown type %r',
+ option_name, option.type)
+ continue
if not widget:
+ logging.warning('Skipping setting %r (type %r) without'
+ ' widget', option_name, option.type)
continue
widget.set_sensitive(option.is_settable())