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()
def compare_contents(self, expected, column=1, msg=''): """ Compare the contents of the tree with some expected value. :param int column: the column to compare in the model :param expected: a list of the form [node_name, [child_name, [grand_child], child2_name],...] """ gps_assert(self.dump_model(column=column), expected, msg)
def compare_contents(self, expected, column=1, msg=''): """ Compare the contents of the tree with some expected value. :param int column: the column to compare in the model :param expected: a list of the form [node_name, [child_name, [grand_child], child2_name],...] """ gps_assert( self.dump_model(column=column), expected, msg)
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')
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)
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)
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')