def set_ada_naming_scheme(self, scheme=GNAT_NAMING_SCHEME): page = self.get_page('Sources/Naming/Ada') ent = [w for w in WidgetTree(page) if isinstance(w, Gtk.ComboBox) and w.get_active_text() == "GNAT default"] gps_not_null(ent, "Entry field for GNAT default not found") ent[0].set_active(scheme)
def get_page(self, path): """ Return the widget that is displayed when the user selects a specific page. :param path: see above for a description of path. :return: a widget """ rowpath = self.select(path) gps_not_null(rowpath, 'Page "%s" not found' % path) model = self.treeview.get_model() iter = model.get_iter(rowpath) return model[iter][Project_Properties_Editor.COLUMN_WIDGET]
def select_by_name(self, column, value): """ Find the first node in the tree that contains value in the given column, and select that row. :param int column: the model's column to check. :param str value: the value to find in the model. :return GtkTreePath: the path that was selected. """ p = pygps.tree.find_in_tree(self.treeview, column=column, key=value) gps_not_null(p, 'Row not found in tree: %s' % (value, )) self.treeview.get_selection().select_path(p) return p
def open_and_yield(self): """ Compatible with run_test_driver, to be used in a yield statement view = Variables_View() yield view.open_and_yield() ... """ yield self._open_and_yield("open debugger variables window") GPS.execute_action("open debugger variables window") self.view = GPS.MDI.get("Variables") gps_not_null(self.view, "Variables view not found") self.tree = get_widgets_by_type(Gtk.TreeView, self.view.pywidget()) self.tree = self.tree[0]
def open_and_yield(self): """ Compatible with run_test_driver, to be used in a yield statement view = Variables_View() yield view.open_and_yield() ... """ yield self._open_and_yield("open debugger variables window") GPS.execute_action("open debugger variables window") self.view = GPS.MDI.get("Debugger Variables") gps_not_null(self.view, "Variables view not found") self.tree = get_widgets_by_type(Gtk.TreeView, self.view.pywidget()) self.tree = self.tree[0]
def open(self): """ Opens a contextual menu by calling creator:: yield self.open() """ windows = Gtk.Window.list_toplevels() yield idle_modal_dialog(self.creator) self.menu = [ w for w in Gtk.Window.list_toplevels() if w not in windows and w.get_mapped() ] if gps_not_null(self.menu, 'Contextual menu not created'): self.menu = self.menu[0]
def select(self, label): """ Execute one of the items in the menu, as in: yield self.select('A is called by') The menu must already have been opened """ if gps_not_null(self.menu, 'Contextual menu not created yet'): t = pygps.MenuTree(self.menu, accel_prefix='') for (menu, menu_label, accel, level) in t: if menu_label == label: yield wait_idle() menu.activate() self.menu.destroy() # close the contextual menu yield wait_idle() return gps_assert( True, False, 'Contextual menu not found "%s" in %s' % (label, dump_menu('', self.menu)))
def __init__(self): GPS.execute_action("open breakpoints editor") self.view = GPS.MDI.get("Breakpoints") self.list = get_widgets_by_type(Gtk.TreeView, self.view.pywidget()) gps_not_null(self.list, 'List of breakpoints not found') self.list = self.list[0]