def tearDown(self): client = GConf.Client.get_default() if self._save_view_icons is None: client.unset(_VIEW_KEY) else: SugarExt.gconf_client_set_string_list(client, _VIEW_KEY, self._save_view_icons) if self._save_favorite_icons is None: client.unset(_FAVORITE_KEY) else: SugarExt.gconf_client_set_string_list(client, _FAVORITE_KEY, self._save_favorite_icons)
def tearDown(self): client = GConf.Client.get_default() if self._save_view_icons is None: client.unset(_VIEW_KEY) else: SugarExt.gconf_client_set_string_list(client, _VIEW_KEY, self._save_view_icons) if self._save_favorite_icons is None: client.unset(_FAVORITE_KEY) else: SugarExt.gconf_client_set_string_list(client, _FAVORITE_KEY, self._save_favorite_icons)
def _check_gconf_settings(): client = GConf.Client.get_default() # Zendesk client.set_string('/desktop/sugar/services/zendesk/url', 'https://oneedu.zendesk.com') client.set_string('/desktop/sugar/services/zendesk/token', 'eG8tc3VwcG9ydEBsYXB0b3Aub3JnLmF1L3Rva2VuOlZTaWM4' 'TThZbjZBRTJkMWxYNkFGbFhkZzUxSjlJSHFUQ01DYzNjOHY=') try: SugarExt.gconf_client_set_string_list( client, '/desktop/sugar/services/zendesk/fields', ['21891880', '21729904', '21729914']) except Exception as e: _logger.error('Could not set zendesk fields: %s' % e)
def set_option_group(self, option_group): """Sets the supplied option for switching keyboard group""" #XXX: Merge, not overwrite previous options if not option_group: options = [''] elif isinstance(option_group, list): options = option_group else: options = [option_group] # FIXME, gconf_client_set_list not introspectable #681433 # self._gconf_client.set_list(_OPTIONS_KEY, GConf.ValueType.STRING, # options) SugarExt.gconf_client_set_string_list(self._gconf_client, _OPTIONS_KEY, options) self._configrec.set_options(options) self._configrec.activate(self._engine)
def set_option_group(self, option_group): """Sets the supplied option for switching keyboard group""" #XXX: Merge, not overwrite previous options if not option_group: options = [''] elif isinstance(option_group, list): options = option_group else: options = [option_group] # FIXME, gconf_client_set_list not introspectable #681433 # self._gconf_client.set_list(_OPTIONS_KEY, GConf.ValueType.STRING, # options) SugarExt.gconf_client_set_string_list(self._gconf_client, _OPTIONS_KEY, options) self._configrec.set_options(options) self._configrec.activate(self._engine)
def set_layouts(self, layouts): """Sets the supplied keyboard layouts (with variants)""" if layouts is None or not layouts: return # FIXME, gconf_client_set_list not introspectable #681433 # self._gconf_client.set_list(_LAYOUTS_KEY, GConf.ValueType.STRING, # layouts) SugarExt.gconf_client_set_string_list(self._gconf_client, _LAYOUTS_KEY, layouts) layouts_list = [] variants_list = [] for layout in layouts: layouts_list.append(layout.split('(')[0]) variants_list.append(layout.split('(')[1][:-1]) self._configrec.set_layouts(layouts_list) self._configrec.set_variants(variants_list) self._configrec.activate(self._engine)
def set_layouts(self, layouts): """Sets the supplied keyboard layouts (with variants)""" if layouts is None or not layouts: return # FIXME, gconf_client_set_list not introspectable #681433 # self._gconf_client.set_list(_LAYOUTS_KEY, GConf.ValueType.STRING, # layouts) SugarExt.gconf_client_set_string_list(self._gconf_client, _LAYOUTS_KEY, layouts) layouts_list = [] variants_list = [] for layout in layouts: layouts_list.append(layout.split('(')[0]) variants_list.append(layout.split('(')[1][:-1]) self._configrec.set_layouts(layouts_list) self._configrec.set_variants(variants_list) self._configrec.activate(self._engine)
def _check_gconf_settings(): from gi.repository import GConf client = GConf.Client.get_default() # Training server client.set_string( '/desktop/sugar/services/training/url', 'https://training.one-education.org/training/report ') client.set_string('/desktop/sugar/services/training/api_key', 'SbCeK4nH8dpQJsHNn9djza9g') # Zendesk client.set_string('/desktop/sugar/services/zendesk/url', 'https://oneedu1392860248.zendesk.com') client.set_string('/desktop/sugar/services/zendesk/token', 'eG8tc3VwcG9ydEBsYXB0b3Aub3JnLmF1L3Rva2VuOjdHRkV5' 'STF2MFNRVzJyYmdFVXFFUWRpOE1Cc1I0NGdHVURhTWg2QWU=') try: SugarExt.gconf_client_set_string_list( client, '/desktop/sugar/services/zendesk/fields', ['21765610', '21605694', '21765620']) except Exception as e: _logger.error('Could not set zendesk fields: %s' % e)
def save_to_gconf(self, icon=False, name=False): view_icons = [] favorite_icons = [] favorite_names = [] for button in self._view_buttons: view_icons.append(self._view_icons[button]) favorite_icons.append(self._favorite_icons[button]) if self.favorite_names_enabled: favorite_names.append(self._favorite_names[button]) client = GConf.Client.get_default() SugarExt.gconf_client_set_string_list(client, _FAVORITE_KEY, favorite_icons) SugarExt.gconf_client_set_string_list(client, _VIEW_KEY, view_icons) if self.favorite_names_enabled: SugarExt.gconf_client_set_string_list(client, _FAVORITE_NAME_KEY, favorite_names) if icon: for x in self.activity._alerts: self.activity.remove_alert(x) alert = NotifyAlert(5) alert.props.title = _('Icon') alert.props.msg = _('For see icons, restart sugar is needed.') self.activity.add_alert(alert) alert.connect('response', lambda x, y: self.activity.remove_alert(x)) if name: for x in self.activity._alerts: self.activity.remove_alert(x) alert = NotifyAlert(5) alert.props.title = _('View Name') alert.props.msg = _('For seeing View name changes, ' 'restarting Sugar is required.') self.activity.add_alert(alert) alert.connect('response', lambda x, y: self.activity.remove_alert(x))
def test_set_views(self): self.target = _MOCK_LIST with self.run_view("gtk_main"): client = GConf.Client.get_default() SugarExt.gconf_client_set_string_list(client, _VIEW_KEY, _MOCK_LIST)
def test_set_views(self): self.target = _MOCK_LIST with self.run_view("gtk_main"): client = GConf.Client.get_default() SugarExt.gconf_client_set_string_list(client, _VIEW_KEY, _MOCK_LIST)