예제 #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
예제 #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
예제 #3
0
 def solverRemoveClicked(self):
     ui_nodes = lib_uiquery.get_selected_ui_table_row(
         self.solver_tableView, self.solver_model, self.solver_filterModel)
     names = map(lambda x: x.name(), ui_nodes)
     col_nodes = lib_uiquery.convert_ui_nodes_to_nodes(
         ui_nodes, 'collection_node')
     assert len(names) == len(col_nodes)
     for name, col in zip(names, col_nodes):
         step = lib_col.get_named_solver_step_from_collection(col, name)
         lib_col.remove_solver_step_from_collection(col, step)
     self.updateSolverModel()
     self.updateSolveValidState()
     return
예제 #4
0
    def removeClicked(self):
        ui_nodes = lib_uiquery.get_selected_ui_table_row(
            self.tableView, self.model, self.filterModel)
        names = map(lambda x: x.name(), ui_nodes)
        col_nodes = lib_uiquery.convert_ui_nodes_to_nodes(
            ui_nodes, 'collection_node')
        assert len(names) == len(col_nodes)
        for name, col in zip(names, col_nodes):
            step = lib_col.get_named_solver_step_from_collection(col, name)
            lib_col.remove_solver_step_from_collection(col, step)

        self.itemRemoved.emit()
        self.dataChanged.emit()
        self.viewUpdated.emit()
        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
예제 #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