Exemple #1
0
    def cut_items(self, no_confirm=False):
        if core_api.block_databases():
            # get_tree_selections() arguments must be compatible with the
            # ones used in self.delete_items()
            selection = wxgui_api.get_tree_selections(self.filename,
                                                none=False, descendants=True)

            if selection:
                items = []

                for item in selection:
                    id_ = wxgui_api.get_tree_item_id(self.filename, item)

                    if not wxgui_api.close_editor(self.filename, id_,
                                    ask='quiet' if no_confirm else 'discard'):
                        core_api.release_databases()
                        return False

                    items.append(id_)

                copypaste_api.copy_items(self.filename, items)

                wxgui_api.delete_items(self.filename, items,
                                description='Cut {} items'.format(len(items)))
                wxgui_api.refresh_history(self.filename)
                cut_items_event.signal()

            core_api.release_databases()
Exemple #2
0
    def cut_items(self, no_confirm=False):
        if core_api.block_databases():
            # get_tree_selections() arguments must be compatible with the
            # ones used in self.delete_items()
            selection = wxgui_api.get_tree_selections(self.filename,
                                                      none=False,
                                                      descendants=True)

            if selection:
                items = []

                for item in selection:
                    id_ = wxgui_api.get_tree_item_id(self.filename, item)

                    if not wxgui_api.close_editor(
                            self.filename,
                            id_,
                            ask='quiet' if no_confirm else 'discard'):
                        core_api.release_databases()
                        return False

                    items.append(id_)

                copypaste_api.copy_items(self.filename, items)

                wxgui_api.delete_items(self.filename,
                                       items,
                                       description='Cut {} items'.format(
                                           len(items)))
                wxgui_api.refresh_history(self.filename)
                cut_items_event.signal()

            core_api.release_databases()
Exemple #3
0
    def copy_items(self):
        if core_api.block_databases():
            # get_tree_selections() arguments must be compatible with the
            # ones used in self.delete_items()
            selection = wxgui_api.get_tree_selections(self.filename, none=False, descendants=True)

            if selection:
                items = []

                for item in selection:
                    items.append(wxgui_api.get_tree_item_id(self.filename, item))

                copypaste_api.copy_items(self.filename, items)

            core_api.release_databases()
Exemple #4
0
    def copy_items(self):
        if core_api.block_databases():
            # get_tree_selections() arguments must be compatible with the
            # ones used in self.delete_items()
            selection = wxgui_api.get_tree_selections(self.filename,
                                                      none=False,
                                                      descendants=True)

            if selection:
                items = []

                for item in selection:
                    items.append(
                        wxgui_api.get_tree_item_id(self.filename, item))

                copypaste_api.copy_items(self.filename, items)

            core_api.release_databases()