def paste_items_as_siblings(filename, baseid, description='Paste as siblings'): group = core_api.get_next_history_group(filename) return copypaste.paste_items(filename, baseid, 'siblings', group=group, description=description)
def paste_items_as_children(filename, baseid, description='Paste as children'): group = core_api.get_next_history_group(filename) return copypaste.paste_items(filename, baseid, 'children', group=group, description=description)
def apply(self): group = core_api.get_next_history_group(self.filename) description = 'Apply editor' # Note that apply_editor_event is also bound directly by the textarea apply_editor_event.signal(filename=self.filename, id_=self.id_, group=group, description=description) tree.dbs[self.filename].dbhistory.refresh()
def apply(self): group = core_api.get_next_history_group(self.filename) description = 'Apply editor' # Note that apply_editor_event is also bound directly by the textarea apply_editor_event.signal(filename=self.filename, id_=self.id_, group=group, description=description) tree.dbs[self.filename].dbhistory.refresh()
def populate_tree(self, event): if core_api.block_databases(): filename = wxgui_api.get_selected_database_filename() # This method may be launched even if no database is open if filename: group = core_api.get_next_history_group(filename) description = 'Populate tree' i = 0 while i < 10: dbitems = core_api.get_items_ids(filename) try: itemid = random.choice(dbitems) except IndexError: # No items in the database yet itemid = 0 mode = 'child' else: mode = random.choice(('child', 'sibling')) # See the comment in wxgui.tree.expand_item_ancestors # for the reason why calling this method is necessary wxgui_api.expand_item_ancestors(filename, itemid) text = self._populate_tree_text() id_ = self._populate_tree_item(mode, filename, itemid, group, text, description) # It should also be checked if the database supports # organism_basicrules (bug #330) if organism_api and wxscheduler_basicrules_api and \ filename in \ organism_api.get_supported_open_databases(): self._populate_tree_rules(filename, id_, group, description) if links_api and wxlinks_api and len(dbitems) > 0 and \ filename in \ links_api.get_supported_open_databases(): self._populate_tree_link(filename, id_, dbitems, group, description) i += 1 wxgui_api.refresh_history(filename) core_api.release_databases()
def populate_tree(self, event): if core_api.block_databases(): filename = wxgui_api.get_selected_database_filename() # This method may be launched even if no database is open if filename: group = core_api.get_next_history_group(filename) description = 'Populate tree' i = 0 while i < 10: dbitems = core_api.get_items_ids(filename) try: itemid = random.choice(dbitems) except IndexError: # No items in the database yet itemid = 0 mode = 'child' else: mode = random.choice(('child', 'sibling')) # See the comment in wxgui.tree.expand_item_ancestors # for the reason why calling this method is necessary wxgui_api.expand_item_ancestors(filename, itemid) text = self._populate_tree_text() id_ = self._populate_tree_item(mode, filename, itemid, group, text, description) # It should also be checked if the database supports # organism_basicrules (bug #330) if organism_api and wxscheduler_basicrules_api and \ filename in \ organism_api.get_supported_open_databases(): self._populate_tree_rules(filename, id_, group, description) if links_api and wxlinks_api and len(dbitems) > 0 and \ filename in \ links_api.get_supported_open_databases(): self._populate_tree_link(filename, id_, dbitems, group, description) i += 1 wxgui_api.refresh_history(filename) core_api.release_databases()
def delete_items(self, ids, description="Delete items"): group = core_api.get_next_history_group(self.filename) roots = core_api.find_independent_items(self.filename, ids) for root in roots: rootpid = core_api.get_item_parent(self.filename, root) core_api.delete_subtree(self.filename, root, group=group, description=description) if rootpid > 0: rootpid2 = core_api.get_item_parent(self.filename, rootpid) rootparent2 = self.get_tree_item_safe(rootpid2) self._refresh_item_arrow(rootparent2, rootpid, self.get_tree_item(rootpid))
def delete_items(self, ids, description="Delete items"): group = core_api.get_next_history_group(self.filename) roots = core_api.find_independent_items(self.filename, ids) for root in roots: rootpid = core_api.get_item_parent(self.filename, root) core_api.delete_subtree(self.filename, root, group=group, description=description) if rootpid > 0: rootpid2 = core_api.get_item_parent(self.filename, rootpid) rootparent2 = self.get_tree_item_safe(rootpid2) self._refresh_item_arrow(rootparent2, rootpid, self.get_tree_item(rootpid))
def paste_items_as_siblings(filename, baseid, description='Paste as siblings'): group = core_api.get_next_history_group(filename) return copypaste.paste_items(filename, baseid, 'siblings', group=group, description=description)
def paste_items_as_children(filename, baseid, description='Paste as children'): group = core_api.get_next_history_group(filename) return copypaste.paste_items(filename, baseid, 'children', group=group, description=description)