diff options
author | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-08-24 15:59:39 (GMT) |
---|---|---|
committer | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-08-24 15:59:39 (GMT) |
commit | f4fe0560b7bf1aa6a910a40fd36386aab01cbd94 (patch) | |
tree | 286f3fbdde80dc697f4ba237fa0439a141914e36 | |
parent | 9d7009880fc862c2e14f2ad4afb2c6d20bb6e439 (diff) |
Add checks for oddball variable values
-rw-r--r-- | bin/sugar-session | 14 | ||||
-rw-r--r-- | extensions/cpsection/keyboard/view.py | 10 |
2 files changed, 16 insertions, 8 deletions
diff --git a/bin/sugar-session b/bin/sugar-session index b0c4894..87269f0 100644 --- a/bin/sugar-session +++ b/bin/sugar-session @@ -145,17 +145,21 @@ def setup_keyboard_cb(gconf_client): for layout in layouts: layouts_list.append(layout.split('(')[0]) variants_list.append(layout.split('(')[1][:-1]) - - configrec.set_layouts(layouts_list) - configrec.set_variants(variants_list) + + if layouts_list is not None and layouts_list is not [] \ + and variants_list is not None and variants_list is not []: + configrec.set_layouts(layouts_list) + configrec.set_variants(variants_list) model = gconf_client.get_string(\ '/desktop/sugar/peripherals/keyboard/model') - configrec.set_model(model) + if model is not None: + configrec.set_model(model) options = gconf_client.get_list(\ '/desktop/sugar/peripherals/keyboard/options', gconf.VALUE_STRING) - configrec.set_options(options) + if options is not [] and options is not None: + configrec.set_options(options) configrec.activate(engine) except: diff --git a/extensions/cpsection/keyboard/view.py b/extensions/cpsection/keyboard/view.py index f9e4548..0aa352f 100644 --- a/extensions/cpsection/keyboard/view.py +++ b/extensions/cpsection/keyboard/view.py @@ -31,6 +31,9 @@ TITLE = _('Keyboard') _APPLY_TIMEOUT = 3000 +_logger = logging.getLogger('ControlPanel - Keyboard') + + class LayoutCombo(gtk.HBox): """ @@ -223,7 +226,7 @@ class Keyboard(SectionView): try: self._keyboard_manager.set_model(self._selected_kmodel) except: - pass #TODO: Show error + _logger.debug('Could not set new keyboard model') return False @@ -290,7 +293,8 @@ class Keyboard(SectionView): self._keyboard_manager.set_option_group(\ self._selected_group_switch_option) except: - pass #TODO: Show error + _logger.debug('Could not set new keyboard group switch option') + return False @@ -398,7 +402,7 @@ class Keyboard(SectionView): try: self._keyboard_manager.set_layouts(self._selected_klayouts) except: - pass #TODO: Show error + _logger.debug('Could not set new keyboard layouts') return False |