def _load_hidden_configuration(self): self.scroll_delay = float( g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/scroll_delay', 500)) / 1000.0 self.scroll_amount = g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/scroll_amount', 5) self.animated_menus = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/animated_menus', True) self.animation_delay = g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/animation_delay', 100) / 1000.0 self.key_hold_duration = g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/key_hold_duration', 2000) / 1000.0 self.macro_handler.use_x_test = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/use_x_test', True) self.disable_svg_glow = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/disable_svg_glow', False) self.fade_screen_on_close = g15gconf.get_bool_or_default( self.conf_client, '/apps/gnome15/fade_screen_on_close', True) self.all_off_on_disconnect = g15gconf.get_bool_or_default( self.conf_client, '/apps/gnome15/all_off_on_disconnect', True) self.fade_keyboard_backlight_on_close = g15gconf.get_bool_or_default( self.conf_client, '/apps/gnome15/fade_keyboard_backlight_on_close', True) self.start_in_threads = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/start_in_threads', False) self._mark_all_pages_dirty()
def _load_hidden_configuration(self): self.scroll_delay = float(g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/scroll_delay', 500)) / 1000.0 self.scroll_amount = g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/scroll_amount', 5) self.animated_menus = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/animated_menus', True) self.animation_delay = g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/animation_delay', 100) / 1000.0 self.key_hold_duration = g15gconf.get_int_or_default(self.conf_client, '/apps/gnome15/key_hold_duration', 2000) / 1000.0 self.macro_handler.use_x_test = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/use_x_test', True) self.disable_svg_glow = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/disable_svg_glow', False) self.fade_screen_on_close = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/fade_screen_on_close', True) self.all_off_on_disconnect = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/all_off_on_disconnect', True) self.fade_keyboard_backlight_on_close = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/fade_keyboard_backlight_on_close', True) self.start_in_threads = g15gconf.get_bool_or_default(self.conf_client, '/apps/gnome15/start_in_threads', False) self._mark_all_pages_dirty()
def __init__(self, parent, gconf_client, gconf_key, file_path, item_name, default_refresh=60): """ Constructor Keyword arguments: parent -- parent GTK component (for modality) gconf_client -- gconf client gconf_key -- gconf key prefix for this plugin file_path -- location of accounts file item_name -- name of item in XML files """ self.gconf_client = gconf_client self.gconf_key = gconf_key self.visible_options = None self._save_timer = None self._adjusting = False self.account_mgr = G15AccountManager(file_path, item_name) self.widget_tree = gtk.Builder() self.widget_tree.add_from_file( os.path.join(g15globals.ui_dir, "accounts.ui")) # Models self.type_model = self.widget_tree.get_object("TypeModel") self.account_model = self.widget_tree.get_object("AccountModel") self.type_model.clear() for t in self.get_account_types(): self.type_model.append([t, self.get_account_type_name(t)]) # Widgets self.account_type = self.widget_tree.get_object("TypeCombo") self.account_list = self.widget_tree.get_object("AccountList") self.url_renderer = self.widget_tree.get_object("URLRenderer") # Updates self.update_adjustment = self.widget_tree.get_object( "UpdateAdjustment") self.update_adjustment.set_value( g15gconf.get_int_or_default(gconf_client, gconf_key + "/update_time", default_refresh)) # Connect to events self.account_list.connect("cursor-changed", self._select_account) self.account_type.connect("changed", self._type_changed) self.update_adjustment.connect("value-changed", self._update_time_changed) self.url_renderer.connect("edited", self._url_edited) self.widget_tree.get_object("NewAccount").connect( "clicked", self._new_url) self.widget_tree.get_object("RemoveAccount").connect( "clicked", self._remove_url) # Configure widgets self._reload_model() self._select_account() # Hide non-relevant stuff self.widget_tree.get_object("TypeContainer").set_visible( len(self.get_account_types()) > 1) # Additional options place_holder = self.widget_tree.get_object("OptionsContainer") opts = self.create_general_options() if opts: opts.reparent(place_holder) # Show dialog dialog = self.widget_tree.get_object("AccountDialog") dialog.set_transient_for(parent) ah = gconf_client.notify_add(gconf_key + "/urls", self._urls_changed) dialog.run() dialog.hide() gconf_client.notify_remove(ah)
def __init__(self, parent, gconf_client, gconf_key, file_path, item_name, default_refresh = 60): """ Constructor Keyword arguments: parent -- parent GTK component (for modality) gconf_client -- gconf client gconf_key -- gconf key prefix for this plugin file_path -- location of accounts file item_name -- name of item in XML files """ self.gconf_client = gconf_client self.gconf_key = gconf_key self.visible_options = None self._save_timer = None self._adjusting = False self.account_mgr = G15AccountManager(file_path, item_name) self.widget_tree = gtk.Builder() self.widget_tree.add_from_file(os.path.join(g15globals.ui_dir, "accounts.ui")) # Models self.type_model = self.widget_tree.get_object("TypeModel") self.account_model = self.widget_tree.get_object("AccountModel") self.type_model.clear() for t in self.get_account_types(): self.type_model.append([ t, self.get_account_type_name(t) ]) # Widgets self.account_type = self.widget_tree.get_object("TypeCombo") self.account_list = self.widget_tree.get_object("AccountList") self.url_renderer = self.widget_tree.get_object("URLRenderer") # Updates self.update_adjustment = self.widget_tree.get_object("UpdateAdjustment") self.update_adjustment.set_value(g15gconf.get_int_or_default(gconf_client, gconf_key + "/update_time", default_refresh)) # Connect to events self.account_list.connect("cursor-changed", self._select_account) self.account_type.connect("changed", self._type_changed) self.update_adjustment.connect("value-changed", self._update_time_changed) self.url_renderer.connect("edited", self._url_edited) self.widget_tree.get_object("NewAccount").connect("clicked", self._new_url) self.widget_tree.get_object("RemoveAccount").connect("clicked", self._remove_url) # Configure widgets self._reload_model() self._select_account() # Hide non-relevant stuff self.widget_tree.get_object("TypeContainer").set_visible(len(self.get_account_types()) > 1) # Additional options place_holder = self.widget_tree.get_object("OptionsContainer") opts = self.create_general_options() if opts: opts.reparent(place_holder) # Show dialog dialog = self.widget_tree.get_object("AccountDialog") dialog.set_transient_for(parent) ah = gconf_client.notify_add(gconf_key + "/urls", self._urls_changed); dialog.run() dialog.hide() gconf_client.notify_remove(ah)
def get_int_or_default(gconf_client, key, default=None): return g15gconf.get_int_or_default(gconf_client, key, default)