Beispiel #1
0
    def toggle_language(self, lang):
        if not isinstance(lang, list):
            lang = [lang]

        page = self.get_page('Sources/Languages')
        tree = pygps.get_widgets_by_type(Gtk.TreeView, page)[0]
        found = 0
        for m in tree.get_model():
            if m[1] in lang:
                pygps.tree.click_in_tree(tree, m.path)
                found += 1
        gps_assert(found, len(lang), "Some languages not found %s" % lang)
Beispiel #2
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')
Beispiel #3
0
    def toggle_language(self, lang):
        if not isinstance(lang, list):
            lang = [lang]

        page = self.get_page('Sources/Languages')
        tree = pygps.get_widgets_by_type(Gtk.TreeView, page)[0]
        found = 0
        for m in tree.get_model():
            if m[1] in lang:
                pygps.tree.click_in_tree(tree, m.path)
                found += 1
        gps_assert(found, len(lang), "Some languages not found %s" % lang)
Beispiel #4
0
    def select_template(self, template):
        """
        Select the given template in the assistant's left tree view and
        click on the 'Next' button.

        :param template: The label of the template to select
        """

        tree = get_widgets_by_type(Gtk.TreeView, self.__assistant)[0]
        model = tree.get_model()
        path = pygps.tree.find_in_tree(tree, 0, template)
        pygps.tree.click_in_tree(tree, path)

        get_button_from_label("Next", self.__assistant).clicked()
Beispiel #5
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')
Beispiel #6
0
    def select_template(self, template):
        """
        Select the given template in the assistant's left tree view and
        click on the 'Next' button.

        :param template: The label of the template to select
        """

        tree = get_widgets_by_type(Gtk.TreeView, self.__assistant)[0]
        model = tree.get_model()
        path = pygps.tree.find_in_tree(tree, 0, template)
        pygps.tree.click_in_tree(tree, path)

        get_button_from_label("Next", self.__assistant).clicked()
Beispiel #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)
Beispiel #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)
Beispiel #9
0
    def yield_toggle_filter(self, name, filter_kind):
        """
        Toggle the filter identified by the given name and kind (eg:
        AnalysisReport.FilterKind.TOOL to toggle a tool filter).

        :param name: The name of the filter to toggle.
        :param kind: The filter's kind
        """

        tree = self.__get_filters_tree(filter_kind)
        model = tree.get_model()

        for row in model:
            if row[0] == name:
                pygps.tree.click_in_tree(tree, row.path, column=0)
                return

        yield wait_tasks()
Beispiel #10
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
Beispiel #11
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
Beispiel #12
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)
Beispiel #13
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)