Ejemplo n.º 1
0
 def cancel(self):
     """
     Press the Cancel button. Use as::
         yield dialog.cancel()
     """
     get_button_from_label("Cancel", self.dialog).clicked()
     yield timeout(300)
Ejemplo n.º 2
0
 def ok(self):
     """
     Press the OK button. Use as::
         yield dialog.ok()
     """
     get_button_from_label("OK", self.dialog).clicked()
     yield timeout(300)
Ejemplo n.º 3
0
    def save(self, expect_modif=True):
        """
        Press the Save button and click on Yes in the Confimation dialog.

        If expect_modif is True, this method will click on Yes when
        the confimation dialog appears. Otherwise, it will raise an
        exception if the confimation dialog is present (since the project
        is not supposed to be modified) or return if not present.

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

        save_button = get_widget_by_name("project properties edit source")
        save_button.clicked()
        yield timeout(300)

        confirmation_dialog = get_window_by_title("Confirmation")
        yes_button = get_button_from_label("Yes", confirmation_dialog)

        if expect_modif:
            yes_button.clicked()
            yield timeout(300)
        elif yes_button:
            gps_assert(yes_button is None, True,
                       "The project has been marked as " +
                       "modified but it was not expected")
            no_button = get_button_from_label("No", confirmation_dialog)
            no_button.clicked()
Ejemplo n.º 4
0
    def cancel(self):
        """
        Cancel the assistant.
        """

        get_button_from_label("Cancel", self.__assistant).clicked()
        yield timeout(300)
Ejemplo n.º 5
0
 def cancel(self):
     """
     Press the Cancel button. Use as::
         yield dialog.cancel()
     """
     get_button_from_label("Cancel", self.dialog).clicked()
     yield timeout(300)
Ejemplo n.º 6
0
    def cancel(self):
        """
        Cancel the assistant.
        """

        get_button_from_label("Cancel", self.__assistant).clicked()
        yield timeout(300)
Ejemplo n.º 7
0
 def ok(self):
     """
     Press the OK button. Use as::
         yield dialog.ok()
     """
     get_button_from_label("OK", self.dialog).clicked()
     yield timeout(300)
Ejemplo n.º 8
0
    def apply(self):
        """
        Click on the 'Apply' button of the assistant to deploy the currently
        selected template.
        """

        get_button_from_label("Apply", self.__assistant).clicked()
        yield timeout(300)
Ejemplo n.º 9
0
    def apply(self):
        """
        Click on the 'Apply' button of the assistant to deploy the currently
        selected template.
        """

        get_button_from_label("Apply", self.__assistant).clicked()
        yield timeout(300)
Ejemplo n.º 10
0
    def open_and_yield(self):
        preferences_dialog = Preferences()
        yield preferences_dialog.open_and_yield()
        preferences_dialog.select_page("Key Shortcuts")

        self.editor = get_widget_by_name('Key shortcuts')

        if self.editor:
            self.modify_button = get_button_from_label('Modify', self.editor)
            self.remove_button = get_button_from_label('Remove', self.editor)
            self.close_button = get_button_from_label('Close')
Ejemplo n.º 11
0
    def open_and_yield(self):
        preferences_dialog = Preferences()
        yield preferences_dialog.open_and_yield()
        preferences_dialog.select_page("Key Shortcuts")

        self.editor = get_widget_by_name('Key shortcuts')

        if self.editor:
            self.modify_button = get_button_from_label('Modify', self.editor)
            self.remove_button = get_button_from_label('Remove', self.editor)
            self.close_button = get_button_from_label('Close')
Ejemplo n.º 12
0
    def open_and_yield(self):
        preferences_dialog = Preferences()
        yield preferences_dialog.open_and_yield()
        preferences_dialog.select_page("Key Shortcuts")

        self.editor = get_widget_by_name('Key shortcuts')

        if self.editor:
            self.modify_button = get_button_from_label('Add', self.editor)
            self.remove_button = get_button_from_label('Remove', self.editor)
            self.close_button = get_button_from_label('Close')
            self.key_theme_combo = get_widgets_by_type(Gtk.ComboBoxText,
                                                       self.editor)[0]
Ejemplo n.º 13
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]
        path = pygps.tree.find_in_tree(tree, 0, template)
        pygps.tree.click_in_tree(tree, path)

        get_button_from_label("Next", self.__assistant).clicked()
Ejemplo n.º 14
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()
Ejemplo n.º 15
0
    def open_and_yield(self):
        """
        Open the search dialog, and returns a handle to it.
        This is compatible with run_test_driver:
            editor = GPS.Search()
            yield editor.open_and_yield()
        """

        yield self._open_and_yield("Search")
        self.dialog = get_window_by_prefix('GPS - Search -')

        if self.dialog:
            combos = get_widgets_by_type(Gtk.ComboBox, self.dialog)

            self.find = get_button_from_label("Find", self.dialog)
            self.find_all = get_button_from_label("Find All", self.dialog)
            self.next = self.find  # This is in fact the same button

            self.replace = get_button_from_label("Replace", self.dialog)
            self.replace_all = get_button_from_label("Replace All",
                                                     self.dialog)
            self.close = get_button_from_label("Close", self.dialog)
            self.replace_and_find = get_button_from_label(
                "Replace & Find", self.dialog)
            self.scope = get_widget_by_name("search scope combo", self.dialog)
            self.pattern = combos[0].get_child()
            self.replace_text = combos[1].get_child()
            self.look_in = combos[3] if len(combos) >= 4 else combos[2]
            self.previous = get_button_from_label("Previous", self.dialog)

            toggle_buttons = get_widgets_by_type(Gtk.ToggleButton, self.dialog)
            self.regexp = toggle_buttons[0]
            self.case = toggle_buttons[1]
            self.whole_word = toggle_buttons[2]
Ejemplo n.º 16
0
    def open_and_yield(self):
        """
        Open the build targets editor dialog, and returns a handle to it.

        This is compatible with run_test_driver:
            editor = GPS.BuildTargetsEditor()
            yield editor.open_and_yield()
        """
        preferences_dialog = Preferences()
        yield preferences_dialog.open_and_yield()
        preferences_dialog.select_page("Build Targets")

        self.editor = get_widget_by_name("Build Targets Editor")
        self.notebook = pygps.get_widgets_by_type(Gtk.Notebook, self.editor)[0]
        self.close_button = get_button_from_label("Close",
                                                  preferences_dialog.dialog)
        self.apply_button = get_button_from_label("Apply",
                                                  preferences_dialog.dialog)
        self.tree = get_widgets_by_type(Gtk.TreeView, self.editor)[0]
Ejemplo n.º 17
0
def driver():
    yield wait_tasks()
    b = GS.EditorBuffer.get(GS.File("main.adb"))

    d = dialogs.Custom_Build_Dialog()
    yield d.open_and_yield()
    d.get_command_line_entry().set_text("cat output")
    get_button_from_label("Execute", d.dialog).clicked()
    yield wait_tasks()

    yield wait_for_mdi_child('Locations')
    tree = pygps.get_widgets_by_type(Gtk.TreeView,
                                     GPS.MDI.get("Locations").pywidget())[0]
    windows = Gtk.Window.list_toplevels()
    click_in_tree(tree, path=Gtk.TreePath("0:0:0"), column=1, button=3)
    activate_contextual(windows, contextual_name)
    close_contextual(windows)
    yield wait_idle()

    gps_assert(b.get_chars(), expected, "Autofix failed")
Ejemplo n.º 18
0
    def open_and_yield(self, docked=False):
        """
        Open the search dialog, and returns a handle to it.
        This is compatible with run_test_driver:
            editor = GPS.Search()
            yield editor.open_and_yield()
        """

        yield self._open_and_yield("Search")
        if docked:
            self.dialog = GPS.MDI.get("Search").pywidget()
        else:
            self.dialog = get_window_by_prefix('GNAT Studio - Search -')

        if self.dialog:
            combos = get_widgets_by_type(Gtk.ComboBox, self.dialog)

            self.find = get_button_from_label("Find", self.dialog)
            self.find_all = get_button_from_label("Find All", self.dialog)
            self.next = self.find  # This is in fact the same button

            self.replace = get_button_from_label("Replace", self.dialog)
            self.replace_all = get_button_from_label("Replace All",
                                                     self.dialog)
            self.close = get_button_from_label("Close", self.dialog)
            self.replace_and_find = get_button_from_label(
                "Replace & Find", self.dialog)
            self.scope = get_widget_by_name("search scope combo", self.dialog)
            self.pattern = combos[0].get_child()
            self.replace_text = combos[1].get_child()
            self.look_in = combos[3] if len(combos) >= 4 else combos[2]
            self.previous = get_button_from_label("Previous", self.dialog)

            toggle_buttons = get_widgets_by_type(Gtk.ToggleButton, self.dialog)
            self.regexp = toggle_buttons[0]
            self.case = toggle_buttons[1]
            self.whole_word = toggle_buttons[2]

            # Disable confirmation dialog for 'Replace all' button
            GPS.Preference("Ask-Confirmation-For-Replace-All").set(False)
Ejemplo n.º 19
0
    def open_and_yield(self):
        """
        Open the search dialog, and returns a handle to it.
        This is compatible with run_test_driver:
            editor = GPS.Search()
            yield editor.open_and_yield()
        """

        yield self._open_and_yield("Search")
        self.dialog = get_window_by_prefix('GPS - Search -')

        if self.dialog:
            combos = get_widgets_by_type(Gtk.ComboBox, self.dialog)

            self.find = get_button_from_label("Find", self.dialog)
            self.find_all = get_button_from_label("Find All", self.dialog)
            self.next = self.find   # This is in fact the same button

            self.replace = get_button_from_label("Replace", self.dialog)
            self.replace_all = get_button_from_label(
                "Replace All",
                self.dialog)
            self.close = get_button_from_label("Close", self.dialog)
            self.replace_and_find = get_button_from_label(
                "Replace & Find", self.dialog)
            self.scope = get_widget_by_name(
                "search scope combo", self.dialog)
            self.pattern = combos[0].get_child()
            self.replace_text = combos[1].get_child()
            self.look_in = combos[3] if len(combos) >= 4 else combos[2]
            self.previous = get_button_from_label("Previous", self.dialog)

            toggle_buttons = get_widgets_by_type(Gtk.ToggleButton, self.dialog)
            self.regexp = toggle_buttons[0]
            self.case = toggle_buttons[1]
            self.whole_word = toggle_buttons[2]
Ejemplo n.º 20
0
 def ok(self):
     get_button_from_label("Execute", self.dialogs).clicked()
     yield wait_idle()