From f4fe0560b7bf1aa6a910a40fd36386aab01cbd94 Mon Sep 17 00:00:00 2001 From: Sayamindu Dasgupta Date: Mon, 24 Aug 2009 15:59:39 +0000 Subject: Add checks for oddball variable values --- 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 -- cgit v0.9.1