Exemplo n.º 1
0
    def removeActiveNode(self):
        """
        Delete the currently active collection.
        """
        col = lib_state.get_active_collection()
        if col is None:
            LOG.warning('No active collection to delete.')
            return
        title = 'Remove Collection?'
        text = 'Would you like to remove the current Collection?'
        text += '\n\nRemove "' + str(col.get_node()) + '"?'
        clicked_button = QtWidgets.QMessageBox.question(self, title, text)
        if clicked_button != QtWidgets.QMessageBox.Yes:
            LOG.warn('User cancelled operation.')
            return

        cols = lib_col.get_collections()
        prev_col = lib_col.get_previous_collection(cols, col)

        steps = lib_col.get_solver_steps_from_collection(col)
        for step in steps:
            lib_col.remove_solver_step_from_collection(col, step)

        lib_col.delete_collection(col)
        lib_state.set_active_collection(prev_col)

        self.itemRemoved.emit()
        self.itemChanged.emit()
        self.nameChanged.emit()
        return
Exemplo n.º 2
0
    def removeCollectionNode(self):
        col = lib_state.get_active_collection()
        if col is None:
            LOG.warning('No active collection to delete.')
            return

        cols = lib_col.get_collections()
        prev_col = lib_col.get_previous_collection(cols, col)

        steps = lib_col.get_solver_steps_from_collection(col)
        for step in steps:
            lib_col.remove_solver_step_from_collection(col, step)

        lib_col.delete_collection(col)
        lib_state.set_active_collection(prev_col)

        self.updateDynamicWindowTitle()
        self.updateStatusWithSolveResult()
        self.updateCollectionModel()
        self.updateObjectToggleButtons()
        self.updateObjectColumnVisibility()
        self.updateObjectModel()
        self.updateAttributeToggleButtons()
        self.updateAttributeColumnVisibility()
        self.updateAttributeModel()
        self.updateSolverModel()
        self.updateSolveValidState()
        return
Exemplo n.º 3
0
 def populateSolverModel(self, model):
     col = lib_state.get_active_collection()
     if col is None:
         return
     step_list = lib_col.get_solver_steps_from_collection(col)
     node_list = convert_to_ui.solverStepsToUINodes(step_list, col)
     self.solver_model.setNodeList(node_list)
     return
Exemplo n.º 4
0
 def populateSolverModel(self, model):
     valid = uiutils.isValidQtObject(model)
     if valid is False:
         return
     col = lib_state.get_active_collection()
     if col is None:
         step_list = []
     else:
         step_list = lib_col.get_solver_steps_from_collection(col)
     node_list = convert_to_ui.solverStepsToUINodes(step_list, col)
     self.solver_model.setNodeList(node_list)
     return
    def removeActiveNode(self):
        """
        Delete the currently active collection.
        """
        col = lib_state.get_active_collection()
        if col is None:
            LOG.warning('No active collection to delete.')
            return

        cols = lib_col.get_collections()
        prev_col = lib_col.get_previous_collection(cols, col)

        steps = lib_col.get_solver_steps_from_collection(col)
        for step in steps:
            lib_col.remove_solver_step_from_collection(col, step)

        lib_col.delete_collection(col)
        lib_state.set_active_collection(prev_col)

        self.itemRemoved.emit()
        self.itemChanged.emit()
        self.nameChanged.emit()
        return
Exemplo n.º 6
0
    def removeCollectionNode(self):
        col = lib_state.get_active_collection()
        if col is not None:
            # FIXME: Solver Steps continue to hold a reference to the
            # Collection after the collection node is deleted.
            steps = lib_col.get_solver_steps_from_collection(col)
            for step in steps:
                lib_col.remove_solver_step_from_collection(col, step)
            lib_col.delete_collection(col)
            lib_state.set_active_collection(None)
        else:
            LOG.warning('No active collection to delete.')
            return

        self.updateDynamicWindowTitle()
        self.updateCollectionModel()
        self.updateObjectModel()
        self.updateAttributeModel()
        self.updateSolverModel()
        self.updateSolveValidState()

        self.setStatusLine(const.STATUS_READY)
        return