Esempio n. 1
0
    def __init__(
        self,
        collections: Mapping[str, Any],
        get_collection: Callable[[], Mapping[str, Any]],
        project_no_save: Callable[[], None],
        show_ticks: int,
        monochrome: bool,
        parent: QWidget
    ):
        """We put the 'collections' (from iteration widget) reference here."""
        super(CollectionsDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowFlags(self.windowFlags() | Qt.WindowMaximizeButtonHint
                            & ~Qt.WindowContextHelpButtonHint)
        self.collections = dict(collections)
        self.get_collection = get_collection
        self.project_no_save = project_no_save

        # Current profile name
        self.name = ""
        self.params = {}
        self.preview_canvas = PreviewCanvas(self)
        self.preview_layout.addWidget(self.preview_canvas)
        self.preview_canvas.set_show_ticks(show_ticks)
        self.preview_canvas.set_monochrome_mode(monochrome)
        self.common_list.addItems(all_collections())
        self.collections_list.addItems(self.collections)

        # Splitter
        self.main_splitter.setSizes([200, 200])
        self.sub_splitter.setSizes([100, 200])

        self.__has_collection()
        self.__can_open()
Esempio n. 2
0
    def __init__(self, parent: MainWindowBase) -> None:
        """Reference names:

        + Iteration collections.
        + Result data.
        + Main window function references.
        """
        super(DimensionalSynthesis, self).__init__(parent)
        self.setupUi(self)
        self.mech: Dict[str, Any] = {}
        self.path: Dict[int, List[_Coord]] = {}
        # Some reference of 'collections'
        self.collections = parent.collections.configure_widget.collections
        self.get_collection = parent.get_configure
        self.input_from = parent.input_from
        self.output_to = parent.output_to
        self.save_reply_box = parent.save_reply_box
        self.project_no_save = parent.project_no_save
        self.merge_result = parent.merge_result
        self.update_ranges = parent.main_canvas.update_ranges
        self.set_solving_path = parent.main_canvas.set_solving_path
        self.get_zoom = parent.main_canvas.get_zoom
        self.prefer = parent.prefer
        # Data and functions
        self.mechanism_data: List[Dict[str, Any]] = []
        self.alg_options: Dict[str, Union[int, float]] = {}
        self.alg_options.update(DEFAULT_PARAMS)
        self.alg_options.update(PARAMS[AlgorithmType.DE])
        # Canvas
        self.preview_canvas = PreviewCanvas(self)
        self.preview_layout.addWidget(self.preview_canvas)
        # Splitter
        self.main_splitter.setStretchFactor(0, 10)
        self.main_splitter.setStretchFactor(1, 100)
        self.up_splitter.setSizes([80, 100])
        self.down_splitter.setSizes([20, 80])
        # Table widget column width
        header = self.parameter_list.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.ResizeToContents)
        self.algorithm_options: Dict[AlgorithmType, QRadioButton] = {}
        for option in PARAMS:
            button = QRadioButton(option.value, self)
            button.clicked.connect(self.__set_algorithm_default)
            self.algorithm_options[option] = button
            self.algorithm_layout.addWidget(button)
        self.clear()
Esempio n. 3
0
    def __init__(self, parent: MainWindowBase):
        """Reference names:

        + Iteration collections.
        + Result data.
        + Main window function references.
        """
        super(Optimizer, self).__init__(parent)
        self.setupUi(self)
        self.mech = {}
        self.path = {}
        # Some reference of 'collections'
        self.collections = parent.collections.configure_widget.collections
        self.get_collection = parent.get_configure
        self.input_from = parent.input_from
        self.output_to = parent.output_to
        self.save_reply_box = parent.save_reply_box
        self.project_no_save = parent.project_no_save
        self.merge_result = parent.merge_result
        self.update_ranges = parent.main_canvas.update_ranges
        self.set_solving_path = parent.main_canvas.set_solving_path
        self.get_zoom = parent.main_canvas.get_zoom
        self.prefer = parent.prefer
        # Data and functions
        self.mechanism_data = []
        self.alg_options = default(AlgorithmType.DE)
        # Canvas
        self.preview_canvas = PreviewCanvas(self)
        self.preview_layout.addWidget(self.preview_canvas)
        # Splitter
        self.main_splitter.setStretchFactor(0, 10)
        self.main_splitter.setStretchFactor(1, 100)
        self.canvas_splitter.setSizes([80, 100])
        self.down_splitter.setSizes([20, 80])
        # Table widget column width
        header = self.parameter_list.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.ResizeToContents)
        self.algorithm_options = {}
        for opt in AlgorithmType:
            button = QRadioButton(opt.value, self)
            button.clicked.connect(self.__set_algorithm_default)
            self.algorithm_options[opt] = button
            self.algorithm_layout.addWidget(button)
        self.clear()