Пример #1
0
    def open_and_yield(self, wait_scan=False):
        """
        Compatible with run_test_driver, to be used in a yield statement
            editor = Project_Properties_Editor()
            yield editor.open_and_yield()
            ...

        if :param wait_scan: is True, this will wait for GPRconfig to complete
        its scanning before returning.
        """
        yield self._open_and_yield('open project properties')

        # Wait for the GPRconfig scan to complete before editing
        # and/or saving the Project Properties editor
        if wait_scan:
            # FIXME: we are ignoring git task for now, they can create a fake
            # deadlock when executing a test
            yield wait_tasks(["git"])

        self.treeview = get_widget_by_name('Project Properties Tree',
                                           self.dialogs)

        scenario_selector = get_widget_by_name(
            'Project Properties Scenario Selector', self.dialogs)
        self.scenario_selector_tree = get_widgets_by_type(
            Gtk.TreeView, scenario_selector)[0]
Пример #2
0
    def stage(self, files):
        """
        Stage one or more files for commit, by clicking in the tree

        :param [GPS.File] files:
        """
        for f in files:
            select_in_tree(self.tree, column=Commits.COLUMN_FILE, key=f)
        GPS.execute_action('vcs stage file')
        yield wait_tasks()
Пример #3
0
def driver():
    yield timeout(1000)
    als = GPS.LanguageServer.get_by_language_name("Ada")

    b = GPS.EditorBuffer.get(GPS.File("main.adb"))
    b.current_view().goto(b.at(4, 5))
    yield hook('language_server_response_processed')

    GPS.execute_action("Entity called by")
    yield hook('language_server_response_processed')
    yield timeout(1000)

    call_tree = get_widget_by_name("Call Graph Tree")
    selection = call_tree.get_selection()
    selection.unselect_all()
    model = call_tree.get_model()
    selection.select_iter(model.iter_nth_child(model.get_iter_first(), 0))

    GPS.execute_action("calltree expand selected")
    yield hook('language_server_response_processed')

    expected = [
        'Foo is called by ',
        [
            'Foo', ['Foo', ['computing...'], 'Main', ['computing...']], 'Main',
            ['computing...']
        ]
    ]

    yield timeout(1000)
    gps_assert(expected, dump_tree_model(model, 0),
               "The model didn't contain the expected text")

    # Now verify that double-clicking on the row that lists 'Main'
    # correctly open its editor and selects it.

    GPS.execute_action("close all editors")
    yield wait_tasks(other_than=known_tasks)

    click_in_tree(call_tree,
                  path=Gtk.TreePath("0:0:1"),
                  button=1,
                  events=double_click_events)
    yield wait_idle()

    buffer = GPS.EditorBuffer.get()
    gps_assert(
        buffer.file(), GPS.File("main.adb"),
        "double-clicking on a Call Trees row should open an " +
        "editor for the clicked entity")
    gps_assert((buffer.selection_start(), buffer.selection_end()),
               (buffer.at(2, 11), buffer.at(2, 15)),
               "Main should be selected in main.adb after double-clicking " +
               "on its row in the Call Trees")
Пример #4
0
    def save(self):
        """
        Press the Save button, saving the modifications that have been made in
        the project file and closing the dialog.

        Use as::
            yield dialog.save()
        """

        save_button = get_widget_by_name("project properties edit source")
        save_button.clicked()
        yield wait_tasks()
Пример #5
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()
Пример #6
0
    def open_and_yield(self, wait_scan=True):
        """
        Compatible with run_test_driver, to be used in a yield statement
            editor = Project_Properties_Editor()
            yield editor.open_and_yield()
            ...

        if :param wait_scan: is True, this will wait for GPRconfig to complete
        its scanning before returning.
        """
        yield self._open_and_yield('open project properties')

        # Wait for the GPRconfig scan to complete before editing
        # and/or saving the Project Properties editor
        if wait_scan:
            yield wait_tasks()

        self.treeview = get_widget_by_name(
            'Project Properties Tree', self.dialogs)
Пример #7
0
    def open_and_yield(self, wait_scan=True):
        """
        Compatible with run_test_driver, to be used in a yield statement
            editor = Project_Properties_Editor()
            yield editor.open_and_yield()
            ...

        if :param wait_scan: is True, this will wait for GPRconfig to complete
        its scanning before returning.
        """
        yield self._open_and_yield('open project properties')

        # Wait for the GPRconfig scan to complete before editing
        # and/or saving the Project Properties editor
        if wait_scan:
            yield wait_tasks()

        self.treeview = get_widget_by_name(
            'Project Properties Tree', self.dialogs)
Пример #8
0
    def __build_and_run_all_wf(self, main_name):
        """
        Workflow that calls "Build All" and then runs all the executables
        sequentially.
        """

        # Build All
        builder = promises.TargetWrapper("Build All")
        r0 = yield builder.wait_on_execute()
        if r0 is not 0:
            return

        # Call "Run Main Number ..." on each main
        i = 1
        while True:
            run_action = GPS.Action("Run Main Number %i" % (i))
            if not run_action.exists():
                break

            run_action.execute_if_possible()
            yield promises.wait_tasks()
            i += 1
Пример #9
0
 def commit_staged(self):
     GPS.execute_action('vcs commit staged files')
     yield wait_tasks()
Пример #10
0
 def stage_via_name(self, names):
     for name in names:
         select_in_tree(self.tree, column=Commits.COLUMN_NAME, key=name)
     GPS.execute_action("vcs toggle stage selected files")
     yield wait_tasks()