diff --git a/b_asic/GUI/main_window.py b/b_asic/GUI/main_window.py index 9f232ad8dea3f7e1a04c24af3b132598c036ad51..7a387efb363e9f3863e36e82a24aa0f903a3a654 100644 --- a/b_asic/GUI/main_window.py +++ b/b_asic/GUI/main_window.py @@ -261,6 +261,9 @@ class MainWindow(QMainWindow): def check_equality(signal, signal_2): # check operation types + if not (signal.source is not None or signal_2.source is not None): + return False + if not (signal.source.operation.type_name() == signal_2.source.operation.type_name() \ and signal.destination.operation.type_name() == signal_2.destination.operation.type_name()): return False diff --git a/b_asic/GUI/properties_window.py b/b_asic/GUI/properties_window.py index af6cf76222c88d26ed6528e50e4429e8d9319268..4b8ef0200ea953810a1402daebb34a062357e966 100644 --- a/b_asic/GUI/properties_window.py +++ b/b_asic/GUI/properties_window.py @@ -1,7 +1,7 @@ from PySide2.QtWidgets import QDialog, QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout,\ QLabel, QCheckBox, QGridLayout from PySide2.QtCore import Qt -from PySide2.QtGui import QIntValidator +from PySide2.QtGui import QDoubleValidator class PropertiesWindow(QDialog): def __init__(self, operation, main_window): @@ -25,10 +25,10 @@ class PropertiesWindow(QDialog): if hasattr(self.operation.operation, "value"): self.constant_layout = QHBoxLayout() self.constant_layout.setSpacing(50) - self.constant_value = QLabel("Constant:") + self.constant_value = QLabel("Value:") self.edit_constant = QLineEdit(str(self.operation.operation.value)) - self.only_accept_int = QIntValidator() - self.edit_constant.setValidator(self.only_accept_int) + self.only_accept_float = QDoubleValidator() + self.edit_constant.setValidator(self.only_accept_float) self.constant_layout.addWidget(self.constant_value) self.constant_layout.addWidget(self.edit_constant) self.vertical_layout.addLayout(self.constant_layout) @@ -66,7 +66,7 @@ class PropertiesWindow(QDialog): input_value.setPlaceholderText(str(self.operation.operation.latency)) except ValueError: input_value.setPlaceholderText("-1") - int_valid = QIntValidator() + int_valid = QDoubleValidator() int_valid.setBottom(-1) input_value.setValidator(int_valid) input_value.setFixedWidth(50) @@ -101,7 +101,7 @@ class PropertiesWindow(QDialog): input_value.setPlaceholderText(str(self.operation.operation.latency)) except ValueError: input_value.setPlaceholderText("-1") - int_valid = QIntValidator() + int_valid = QDoubleValidator() int_valid.setBottom(-1) input_value.setValidator(int_valid) input_value.setFixedWidth(50) @@ -125,7 +125,7 @@ class PropertiesWindow(QDialog): self.operation.operation.name = self.edit_name.text() self.operation.label.setPlainText(self.operation.name) if hasattr(self.operation.operation, "value"): - self.operation.operation.value = int(self.edit_constant.text()) + self.operation.operation.value = float(self.edit_constant.text().replace(",", ".")) if self.check_show_name.isChecked(): self.operation.label.setOpacity(1) self.operation.is_show_name = True @@ -133,6 +133,6 @@ class PropertiesWindow(QDialog): self.operation.label.setOpacity(0) self.operation.is_show_name = False - self.operation.operation.set_latency_offsets({port: int(self.latency_fields[port].text()) if self.latency_fields[port].text() and int(self.latency_fields[port].text()) > 0 else None for port in self.latency_fields}) + self.operation.operation.set_latency_offsets({port: float(self.latency_fields[port].text().replace(",", ".")) if self.latency_fields[port].text() and float(self.latency_fields[port].text().replace(",", ".")) > 0 else None for port in self.latency_fields}) self.reject() \ No newline at end of file diff --git a/b_asic/GUI/simulate_sfg_window.py b/b_asic/GUI/simulate_sfg_window.py index 9e60e3dbeb1f8036e55e0992eb65feb985aa6c31..a4cfd24a699bda5c6f569ad2b246d7754ea5d878 100644 --- a/b_asic/GUI/simulate_sfg_window.py +++ b/b_asic/GUI/simulate_sfg_window.py @@ -1,7 +1,7 @@ from PySide2.QtWidgets import QDialog, QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout,\ QLabel, QCheckBox, QSpinBox, QGroupBox, QFrame, QFormLayout, QGridLayout, QSizePolicy, QFileDialog, QShortcut from PySide2.QtCore import Qt, Signal -from PySide2.QtGui import QIntValidator, QKeySequence +from PySide2.QtGui import QDoubleValidator, QKeySequence from matplotlib.backends import qt_compat from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas @@ -70,7 +70,7 @@ class SimulateSFGWindow(QDialog): input_layout.addWidget(input_label) input_value = QLineEdit() input_value.setPlaceholderText("0") - input_value.setValidator(QIntValidator()) + input_value.setValidator(QDoubleValidator()) input_value.setFixedWidth(50) input_layout.addWidget(input_value) input_layout.addStretch() @@ -97,7 +97,7 @@ class SimulateSFGWindow(QDialog): "iteration_count": self.input_fields[sfg]["iteration_count"].value(), "show_plot": self.input_fields[sfg]["show_plot"].isChecked(), "all_results": self.input_fields[sfg]["all_results"].isChecked(), - "input_values": [int(widget.text()) if widget.text() else 0 for widget in self.input_fields[sfg]["input_values"]] + "input_values": [float(widget.text().replace(",", ".")) if widget.text() else 0 for widget in self.input_fields[sfg]["input_values"]] } # If we plot we should also print the entire data, since you can't really interact with the graph. diff --git a/b_asic/save_load_structure.py b/b_asic/save_load_structure.py index 88e1d4fba5e22866df2d59358618dfcebd0bc575..8c416b8643a127c2b07754934050a3eb54f8dfc0 100644 --- a/b_asic/save_load_structure.py +++ b/b_asic/save_load_structure.py @@ -76,4 +76,4 @@ def python_to_sfg(path: str) -> SFG: code = compile(f.read(), path, 'exec') exec(code, globals(), locals()) - return locals()["prop"]["name"], locals()["positions"] if "positions" in locals() else None \ No newline at end of file + return locals()["prop"]["name"], locals()["positions"] if "positions" in locals() else {} \ No newline at end of file