コード例 #1
0
ファイル: __init__.py プロジェクト: kynikos/outspline
    def paste_items_as_siblings(self, no_confirm=False):
        if core_api.block_databases():
            if no_confirm or copypaste_api.can_paste_safely(self.filename) or \
                    msgboxes.unsafe_paste_confirm().ShowModal() == wx.ID_OK:
                # Do not use none=False in order to allow pasting in an empty
                # database
                selection = wxgui_api.get_tree_selections(self.filename,
                                                                    many=False)

                # If multiple items are selected, selection will be False
                if selection is not False:
                    if len(selection) > 0:
                        baseid = wxgui_api.get_tree_item_id(self.filename,
                                                                selection[0])

                        roots, ids = copypaste_api.paste_items_as_siblings(
                            self.filename, baseid, description='Paste items')
                    else:
                        roots, ids = copypaste_api.paste_items_as_children(
                                self.filename, 0, description='Paste items')

                    wxgui_api.refresh_history(self.filename)

                    items_pasted_event.signal(filename=self.filename,
                                                        roots=roots, ids=ids)

            core_api.release_databases()
コード例 #2
0
ファイル: __init__.py プロジェクト: mikpim01/outspline
    def paste_items_as_siblings(self, no_confirm=False):
        if core_api.block_databases():
            if no_confirm or copypaste_api.can_paste_safely(self.filename) or \
                    msgboxes.unsafe_paste_confirm().ShowModal() == wx.ID_OK:
                # Do not use none=False in order to allow pasting in an empty
                # database
                selection = wxgui_api.get_tree_selections(self.filename,
                                                          many=False)

                # If multiple items are selected, selection will be False
                if selection is not False:
                    if len(selection) > 0:
                        baseid = wxgui_api.get_tree_item_id(
                            self.filename, selection[0])

                        roots, ids = copypaste_api.paste_items_as_siblings(
                            self.filename, baseid, description='Paste items')
                    else:
                        roots, ids = copypaste_api.paste_items_as_children(
                            self.filename, 0, description='Paste items')

                    wxgui_api.refresh_history(self.filename)

                    items_pasted_event.signal(filename=self.filename,
                                              roots=roots,
                                              ids=ids)

            core_api.release_databases()
コード例 #3
0
ファイル: __init__.py プロジェクト: xguse/outspline
    def paste_items_as_children(self, no_confirm=False):
        if core_api.block_databases():
            selection = wxgui_api.get_tree_selections(self.filename, none=False, many=False)

            if selection and (
                no_confirm
                or copypaste_api.can_paste_safely(self.filename)
                or msgboxes.unsafe_paste_confirm().ShowModal() == wx.ID_OK
            ):
                baseid = wxgui_api.get_tree_item_id(self.filename, selection[0])

                roots, ids = copypaste_api.paste_items_as_children(self.filename, baseid, description="Paste sub-items")

                wxgui_api.refresh_history(self.filename)

                items_pasted_event.signal(filename=self.filename, roots=roots, ids=ids)

            core_api.release_databases()
コード例 #4
0
ファイル: __init__.py プロジェクト: mikpim01/outspline
    def paste_items_as_children(self, no_confirm=False):
        if core_api.block_databases():
            selection = wxgui_api.get_tree_selections(self.filename,
                                                      none=False,
                                                      many=False)

            if selection and (no_confirm
                              or copypaste_api.can_paste_safely(self.filename)
                              or msgboxes.unsafe_paste_confirm().ShowModal()
                              == wx.ID_OK):
                baseid = wxgui_api.get_tree_item_id(self.filename,
                                                    selection[0])

                roots, ids = copypaste_api.paste_items_as_children(
                    self.filename, baseid, description='Paste sub-items')

                wxgui_api.refresh_history(self.filename)

                items_pasted_event.signal(filename=self.filename,
                                          roots=roots,
                                          ids=ids)

            core_api.release_databases()