Beispiel #1
0
    def create_sibling(self):
        if core_api.block_databases():
            # Do not use none=False in order to allow the creation of the
            # first item
            selection = self.get_selections(many=False)

            # If multiple items are selected, selection will be False
            if selection is not False:
                text = 'New item'

                if len(selection) > 0:
                    previd = self.get_item_id(selection[0])
                    parid = core_api.get_item_parent(self.filename, previd)

                    id_ = core_api.create_sibling(filename=self.filename,
                                parent=parid, previous=previd,
                                text=text, description='Insert item')
                else:
                    id_ = core_api.create_child(filename=self.filename,
                                                parent=0, text=text,
                                                description='Insert item')

                self.select_item(id_)
                self.dbhistory.refresh()

            core_api.release_databases()
Beispiel #2
0
    def create_sibling(self):
        if core_api.block_databases():
            # Do not use none=False in order to allow the creation of the
            # first item
            selection = self.get_selections(many=False)

            # If multiple items are selected, selection will be False
            if selection is not False:
                text = 'New item'

                if len(selection) > 0:
                    previd = self.get_item_id(selection[0])
                    parid = core_api.get_item_parent(self.filename, previd)

                    id_ = core_api.create_sibling(filename=self.filename,
                                parent=parid, previous=previd,
                                text=text, description='Insert item')
                else:
                    id_ = core_api.create_child(filename=self.filename,
                                                parent=0, text=text,
                                                description='Insert item')

                self.select_item(id_)
                self.dbhistory.refresh()

            core_api.release_databases()
Beispiel #3
0
    def create_child(self):
        if core_api.block_databases():
            selection = self.get_selections(none=False, many=False)

            if selection:
                pid = self.get_item_id(selection[0])

                id_ = core_api.create_child(filename=self.filename,
                                            parent=pid, text='New item',
                                            description='Insert sub-item')

                self.select_item(id_)
                self.dbhistory.refresh()

            core_api.release_databases()
Beispiel #4
0
    def create_child(self):
        if core_api.block_databases():
            selection = self.get_selections(none=False, many=False)

            if selection:
                pid = self.get_item_id(selection[0])

                id_ = core_api.create_child(filename=self.filename,
                                            parent=pid, text='New item',
                                            description='Insert sub-item')

                self.select_item(id_)
                self.dbhistory.refresh()

            core_api.release_databases()