def get_shortcuts_custom_shortcut_entry(client, del_callback=None): ''' @param client: a GConf Client type @return: a list contain ShortcutItem ''' base_dir = '/desktop/gnome/keybindings' dir_list = client.all_dirs(base_dir) item_list = [] global ACCEL_ENTRY_LIST for dirs in dir_list: name = client.get("%s/name" % (dirs)) if not name: continue name = name.get_string() binding = client.get("%s/binding" % (dirs)) if binding: binding = binding.get_string() else: binding = "" item = AccelEntry(binding, check_shortcut_conflict, can_del=True) if del_callback: item.connect("accel-del", del_callback) item.settings_description = name item.settings_key = dirs item.settings_obj = client item.settings_type = item.TYPE_GCONF item.settings_value_type = item.TYPE_STRING item_list.append(item) ACCEL_ENTRY_LIST += item_list return item_list
def get_shortcuts_custom_shortcut_entry(client, del_callback=None): ''' @param client: a GConf Client type @return: a list contain ShortcutItem ''' base_dir = '/desktop/gnome/keybindings' dir_list = client.all_dirs(base_dir) item_list = [] global ACCEL_ENTRY_LIST for dirs in dir_list: name = client.get("%s/name" %(dirs)) if not name: continue name = name.get_string() binding = client.get("%s/binding" %(dirs)) if binding: binding = binding.get_string() else: binding = "" item = AccelEntry(binding, check_shortcut_conflict, can_del=True) if del_callback: item.connect("accel-del", del_callback) item.settings_description = name item.settings_key = dirs item.settings_obj = client item.settings_type = item.TYPE_GCONF item.settings_value_type = item.TYPE_STRING item_list.append(item) ACCEL_ENTRY_LIST += item_list return item_list
def get_shortcuts_compiz_shortcut_entry(gsettings, key_dict): key_name = settings.shortcuts_compiz_get(key_dict['plugin'], key_dict['name']) item = AccelEntry(key_name, check_shortcut_conflict) item.settings_description = key_dict['description'] item.settings_key = key_dict['name'] item.settings_obj = gsettings item.settings_type = item.TYPE_CMP_GSETTINGS item.settings_plugin = key_dict['plugin'] return item
def get_shortcuts_dp_shortcut_entry(gsettings, key_dict): ''' get org.gnome.settings-daemon.plugins.keybindings keybindings @param accel_entry_list: a AccelEntry list that add this item ''' key1_name = parse_dp_shortcut_string(gsettings.get_string( key_dict['name'])) item = AccelEntry(key1_name[1], check_shortcut_conflict) item.settings_description = key_dict['description'] item.settings_key = key_dict['name'] item.settings_obj = gsettings item.settings_type = item.TYPE_DP_GSETTINGS item.settings_value_type = key_dict['command'] return item
def get_shortcuts_dp_shortcut_entry(gsettings, key_dict): ''' get org.gnome.settings-daemon.plugins.keybindings keybindings @param accel_entry_list: a AccelEntry list that add this item ''' key1_name = parse_dp_shortcut_string(gsettings.get_string(key_dict['name'])) item = AccelEntry(key1_name[1], check_shortcut_conflict) item.settings_description = key_dict['description'] item.settings_key = key_dict['name'] item.settings_obj = gsettings item.settings_type = item.TYPE_DP_GSETTINGS item.settings_value_type = key_dict['command'] return item
def get_all_shortcuts_entry(gst_list): global ACCEL_ENTRY_LIST item_dict = {} keys_list = {} keys_list[TYPE_WM] = gst_list[TYPE_WM].list_keys() keys_list[TYPE_MEDIA] = gst_list[TYPE_MEDIA].list_keys() keys_list[TYPE_DP] = gst_list[TYPE_DP].list_keys() keys_list[TYPE_COMPIZ] = [ "next-key", "prev-key", "put-viewport-1-key", "put-viewport-2-key", "put-viewport-3-key", "put-viewport-4-key" ] for group in shortcuts_group_dict: item_dict[group] = [] for key in shortcuts_group_dict[group]: if key['type'] in keys_list and key['name'] in keys_list[ key['type']]: if key['type'] == TYPE_DP: item = get_shortcuts_dp_shortcut_entry( gst_list[TYPE_DP], key) elif key['type'] == TYPE_COMPIZ: item = get_shortcuts_compiz_shortcut_entry( gst_list[TYPE_COMPIZ], key) if not item: continue else: if key['value-type'] == AccelEntry.TYPE_STRV: key_name = gst_list[key['type']].get_strv(key['name']) if key_name: key_name = key_name[0] else: key_name = "" else: key_name = gst_list[key['type']].get_string( key['name']) item = AccelEntry(key_name, check_shortcut_conflict) item.settings_description = key['description'] item.settings_key = key['name'] item.settings_obj = gst_list[key['type']] item.settings_type = item.TYPE_GSETTINGS item.settings_value_type = key['value-type'] item_dict[group].append(item) ACCEL_ENTRY_LIST += item_dict[group] return item_dict
def get_all_shortcuts_entry(gst_list): global ACCEL_ENTRY_LIST item_dict = {} keys_list = {} keys_list[TYPE_WM] = gst_list[TYPE_WM].list_keys() keys_list[TYPE_MEDIA] = gst_list[TYPE_MEDIA].list_keys() keys_list[TYPE_DP] = gst_list[TYPE_DP].list_keys() keys_list[TYPE_COMPIZ] = ["next-key", "prev-key", "put-viewport-1-key", "put-viewport-2-key", "put-viewport-3-key", "put-viewport-4-key"] for group in shortcuts_group_dict: item_dict[group] = [] for key in shortcuts_group_dict[group]: if key['type'] in keys_list and key['name'] in keys_list[key['type']]: if key['type'] == TYPE_DP: item = get_shortcuts_dp_shortcut_entry(gst_list[TYPE_DP], key) elif key['type'] == TYPE_COMPIZ: item = get_shortcuts_compiz_shortcut_entry(gst_list[TYPE_COMPIZ], key) if not item: continue else: if key['value-type'] == AccelEntry.TYPE_STRV: key_name = gst_list[key['type']].get_strv(key['name']) if key_name: key_name = key_name[0] else: key_name = "" else: key_name = gst_list[key['type']].get_string(key['name']) item = AccelEntry(key_name, check_shortcut_conflict) item.settings_description = key['description'] item.settings_key = key['name'] item.settings_obj = gst_list[key['type']] item.settings_type = item.TYPE_GSETTINGS item.settings_value_type = key['value-type'] item_dict[group].append(item) ACCEL_ENTRY_LIST += item_dict[group] return item_dict