示例#1
0
    def select_action(self, action):
        tree = get_widget_by_name('Key shortcuts tree', [self.editor])
        GPS.Preference("shortcuts-categories").set(False)
        # ??? Used to manipulate config menu, but this seems to fail now
        # toggle_local_config(self.editor, 'Show categories', False)

        for m in tree.get_model():
            if m[0].lower() == action.lower():
                tree.get_selection().select_path(m.path)
                return

        gps_assert(False, True, action + ' not found in key shortcuts editor')
示例#2
0
    def select_action(self, action):
        from GPS import process_all_events

        tree = get_widget_by_name('Key shortcuts tree', [self.editor])
        GPS.Preference("shortcuts-categories").set(False)
        # ??? Used to manipulate config menu, but this seems to fail now
        # toggle_local_config(self.editor, 'Show categories', False)

        for m in tree.get_model():
            if m[0].lower() == action.lower():
                tree.get_selection().select_path(m.path)
                return

        gps_assert(False, True, action + ' not found in key shortcuts editor')
示例#3
0
    def select_action_in_shortcuts_editor(action, key):
        """Select the line corresponding to action in the key shortcuts editor.
         Check that the keybinding is the one we are expecting"""

        editor = get_widget_by_name('Key shortcuts')
        gps_not_null(editor, 'Key shortcuts editor not open')
        toggle_local_config(editor, 'Show categories', False)
        process_all_events()
        tree = get_widget_by_name('Key shortcuts tree', [editor])

        for m in tree.get_model():
            if m[0].lower() == action.lower():
                current = m[1].decode('utf-8')
                gps_assert(current, key, 'Shortcut for ' + action +
                           ' is "%s", expecting "%s"' % (current, key))
                tree.get_selection().select_path(m.path)
                return editor

        gps_assert(False, True, action + ' not found in key shortcuts editor')
        return editor
示例#4
0
    def select_action_in_shortcuts_editor(action, key):
        """Select the line corresponding to action in the key shortcuts editor.
         Check that the keybinding is the one we are expecting"""

        editor = get_widget_by_name('Key shortcuts')
        gps_not_null(editor, 'Key shortcuts editor not open')
        toggle_local_config(editor, 'Show categories', False)
        process_all_events()
        tree = get_widget_by_name('Key shortcuts tree', [editor])

        for m in tree.get_model():
            if m[0].lower() == action.lower():
                current = m[1].decode('utf-8')
                gps_assert(current, key, 'Shortcut for ' + action +
                           ' is "%s", expecting "%s"' % (current, key))
                tree.get_selection().select_path(m.path)
                return editor

        gps_assert(False, True, action + ' not found in key shortcuts editor')
        return editor
示例#5
0
        def internal_onidle(windows):
            tree = pygps.get_widgets_by_type(
                Gtk.TreeView,
                GPS.MDI.get('Locations').pywidget())[0]
            model = tree.get_model()

            if tree.get_selection().get_mode() == Gtk.SelectionMode.MULTIPLE:
                m, selected = tree.get_selection().get_selected_rows()
                path = selected[0]
            else:
                path = model.get_path(tree.get_selection().get_selected()[1])

            process_all_events()
            click_in_tree(tree, path, button=3)

            def internal_onselected(windows):
                close_contextual(windows)
                process_all_events()
                onselected(*args, **kwargs)

            GLib.idle_add(internal_onselected, windows)
            activate_contextual(windows, menuName)
示例#6
0
        def internal_onidle(windows):
            tree = pygps.get_widgets_by_type(
                Gtk.TreeView,
                GPS.MDI.get('Locations').pywidget())[0]
            model = tree.get_model()

            if tree.get_selection().get_mode() == Gtk.SelectionMode.MULTIPLE:
                m, selected = tree.get_selection().get_selected_rows()
                path = selected[0]
            else:
                path = model.get_path(tree.get_selection().get_selected()[1])

            process_all_events()
            click_in_tree(tree, path, button=3)

            def internal_onselected(windows):
                close_contextual(windows)
                process_all_events()
                apply(onselected, args, kwargs)

            GLib.idle_add(internal_onselected, windows)
            activate_contextual(windows, menuName)
示例#7
0
        def internal_onidle(windows):
            tree = get_widget_by_name('Coverage')
            model = tree.get_model()
            path = model.get_path(tree.get_selection().get_selected()[1])

            process_all_events()
            click_in_tree(tree, path, button=3)

            def internal_onselected(windows):
                close_contextual(windows)
                process_all_events()
                onselected(*args, **kwargs)

            GLib.idle_add(internal_onselected, windows)
            activate_contextual(windows, menuName)
示例#8
0
        def internal_onidle(windows):
            tree = get_widget_by_name('Coverage')
            model = tree.get_model()
            path = model.get_path(tree.get_selection().get_selected()[1])

            process_all_events()
            click_in_tree(tree, path, button=3)

            def internal_onselected(windows):
                close_contextual(windows)
                process_all_events()
                apply(onselected, args, kwargs)

            GLib.idle_add(internal_onselected, windows)
            activate_contextual(windows, menuName)