Ticket #1341: sugar-1341.2.patch
File sugar-1341.2.patch, 6.2 KB (added by alsroot, 15 years ago) |
---|
-
extensions/cpsection/keyboard/model.py
From d1d5e650b4715433e9daad4c6599597ca41dc66a Mon Sep 17 00:00:00 2001 From: Aleksey Lim <alsroot@member.fsf.org> Date: Wed, 16 Sep 2009 12:01:27 +0000 Subject: Sugar craches during undo for the first Keyboard component startup #1341 --- extensions/cpsection/keyboard/model.py | 13 +++-- extensions/cpsection/keyboard/p | 88 ++++++++++++++++++++++++++++++++ extensions/cpsection/keyboard/view.py | 2 +- 3 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 extensions/cpsection/keyboard/p diff --git a/extensions/cpsection/keyboard/model.py b/extensions/cpsection/keyboard/model.py index a5721cd..dcfbc13 100644
a b class KeyboardManager(object): 87 87 if model: 88 88 return model 89 89 else: 90 return self._configrec.get_model() 90 model = self._configrec.get_model() 91 self.set_model(model) 92 return model 91 93 92 94 def get_current_layouts(self): 93 95 """Return the enabled keyboard layouts with variants""" … … class KeyboardManager(object): 107 109 layout_list.append('%s(%s)' % (layout, variants[i])) 108 110 i += 1 109 111 112 self.set_layouts(layout_list) 113 110 114 return layout_list 111 115 112 116 def get_current_option_group(self): 113 117 """Return the enabled option for switching keyboard group""" 114 118 options = self._gconf_client.get_list(_OPTIONS_KEY, gconf.VALUE_STRING) 115 119 116 120 if not options: 117 121 options = self._configrec.get_options() 122 self.set_option_group(options) 118 123 119 124 for option in options: 120 125 if option.startswith(_GROUP_NAME): 121 126 return option 122 127 123 128 return None 124 129 125 130 def get_max_layouts(self): … … class KeyboardManager(object): 135 140 def set_option_group(self, option_group): 136 141 """Sets the supplied option for switching keyboard group""" 137 142 #XXX: Merge, not overwrite previous options 138 options = [option_group ]143 options = [option_group or '' ] 139 144 self._gconf_client.set_list(_OPTIONS_KEY, gconf.VALUE_STRING, options) 140 145 self._configrec.set_options(options) 141 146 self._configrec.activate(self._engine) -
new file extensions/cpsection/keyboard/p
diff --git a/extensions/cpsection/keyboard/p b/extensions/cpsection/keyboard/p new file mode 100644 index 0000000..fdf9a64
- + 1 diff --git a/extensions/cpsection/keyboard/model.py b/extensions/cpsection/keyboard/model.py 2 index a5721cd..ab2cd88 100644 3 --- a/extensions/cpsection/keyboard/model.py 4 +++ b/extensions/cpsection/keyboard/model.py 5 @@ -18,6 +18,7 @@ 6 7 import xklavier 8 import gconf 9 +import logging 10 11 12 _GROUP_NAME = 'grp' # The XKB name for group switch options 13 @@ -87,7 +88,10 @@ class KeyboardManager(object): 14 if model: 15 return model 16 else: 17 - return self._configrec.get_model() 18 + model = self._configrec.get_model() 19 + logging.error('> %r', model) 20 + self._gconf_client.set_string(_MODEL_KEY, model) 21 + return model 22 23 def get_current_layouts(self): 24 """Return the enabled keyboard layouts with variants""" 25 @@ -107,14 +111,21 @@ class KeyboardManager(object): 26 layout_list.append('%s(%s)' % (layout, variants[i])) 27 i += 1 28 29 + logging.error('>> %r', layout_list) 30 + self._gconf_client.set_list(_LAYOUTS_KEY, gconf.VALUE_STRING, 31 + layout_list) 32 + 33 return layout_list 34 35 def get_current_option_group(self): 36 """Return the enabled option for switching keyboard group""" 37 options = self._gconf_client.get_list(_OPTIONS_KEY, gconf.VALUE_STRING) 38 - 39 + 40 if not options: 41 options = self._configrec.get_options() 42 + logging.error('>>> %r', options) 43 + self._gconf_client.set_list(_OPTIONS_KEY, gconf.VALUE_STRING, 44 + options) 45 46 for option in options: 47 if option.startswith(_GROUP_NAME): 48 @@ -128,6 +139,7 @@ class KeyboardManager(object): 49 50 def set_model(self, model): 51 """Sets the supplied keyboard model""" 52 + logging.error('-> %r', model) 53 self._gconf_client.set_string(_MODEL_KEY, model) 54 self._configrec.set_model(model) 55 self._configrec.activate(self._engine) 56 @@ -135,13 +147,18 @@ class KeyboardManager(object): 57 def set_option_group(self, option_group): 58 """Sets the supplied option for switching keyboard group""" 59 #XXX: Merge, not overwrite previous options 60 - options = [option_group] 61 + if option_group is None: 62 + options = [] 63 + else: 64 + options = [option_group] 65 + logging.error('->>> %r', options) 66 self._gconf_client.set_list(_OPTIONS_KEY, gconf.VALUE_STRING, options) 67 self._configrec.set_options(options) 68 self._configrec.activate(self._engine) 69 70 def set_layouts(self, layouts): 71 """Sets the supplied keyboard layouts (with variants)""" 72 + logging.error('->> %r', layouts) 73 self._gconf_client.set_list(_LAYOUTS_KEY, gconf.VALUE_STRING, layouts) 74 layouts_list = [] 75 variants_list = [] 76 diff --git a/extensions/cpsection/keyboard/view.py b/extensions/cpsection/keyboard/view.py 77 index 04edc4d..074d298 100644 78 --- a/extensions/cpsection/keyboard/view.py 79 +++ b/extensions/cpsection/keyboard/view.py 80 @@ -30,7 +30,7 @@ CLASS = 'Language' 81 ICON = 'module-keyboard' 82 TITLE = _('Keyboard') 83 84 -_APPLY_TIMEOUT = 3000 85 +_APPLY_TIMEOUT = 500 86 87 #TODO: This cpsection adds checks for xklavier in bin/sugar-session and 88 # src/jarabe/controlpanel/gui.py. We should get rid of these checks -
extensions/cpsection/keyboard/view.py
diff --git a/extensions/cpsection/keyboard/view.py b/extensions/cpsection/keyboard/view.py index 04edc4d..074d298 100644
a b CLASS = 'Language' 30 30 ICON = 'module-keyboard' 31 31 TITLE = _('Keyboard') 32 32 33 _APPLY_TIMEOUT = 300033 _APPLY_TIMEOUT = 500 34 34 35 35 #TODO: This cpsection adds checks for xklavier in bin/sugar-session and 36 36 # src/jarabe/controlpanel/gui.py. We should get rid of these checks