diff options
author | Sascha 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) |
commit | fa2c61c7c9175db4c20d10c23c5beb307c91f07f (patch) | |
tree | a83ab76e3b3efd87b775be0444674beef06d7439 | |
parent | 77315c7d10dc06008ca80e67fe22a9ba279c5df4 (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.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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()) |