diff --git a/b_asic/GUI/about_window.py b/b_asic/GUI/about_window.py index e7be9386df8943069e46364a91758f6958ffd74a..f6ca3ae815e7bf7cd9c4066ed43565712b0b33ce 100644 --- a/b_asic/GUI/about_window.py +++ b/b_asic/GUI/about_window.py @@ -19,7 +19,7 @@ QUESTIONS = { class KeybindsWindow(QDialog): def __init__(self, window): - super(KeybindsWindow, self).__init__() + super().__init__() self._window = window self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle("B-ASIC Keybinds") @@ -59,7 +59,7 @@ class KeybindsWindow(QDialog): class AboutWindow(QDialog): def __init__(self, window): - super(AboutWindow, self).__init__() + super().__init__() self._window = window self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle("About B-ASIC") @@ -97,7 +97,7 @@ class AboutWindow(QDialog): class FaqWindow(QDialog): def __init__(self, window): - super(FaqWindow, self).__init__() + super().__init__() self._window = window self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle("Frequently Asked Questions") diff --git a/b_asic/GUI/arrow.py b/b_asic/GUI/arrow.py index 5fe2bbbe21ed416360949bd6a31cdc50bb54896f..720a7381bf60c29cb601dd94905d2ced4245d5b8 100644 --- a/b_asic/GUI/arrow.py +++ b/b_asic/GUI/arrow.py @@ -10,7 +10,7 @@ from b_asic.signal import Signal class Arrow(QGraphicsLineItem): def __init__(self, source, destination, window, signal=None, parent=None): - super(Arrow, self).__init__(parent) + super().__init__(parent) self.source = source self.signal = Signal(source.port, destination.port) if signal is None else signal self.destination = destination diff --git a/b_asic/GUI/drag_button.py b/b_asic/GUI/drag_button.py index b0c479098561483ba322a404cb395e0fea1909e6..8b406cf1bdf8f4b497c1c0f484fb3c005fb1742e 100644 --- a/b_asic/GUI/drag_button.py +++ b/b_asic/GUI/drag_button.py @@ -36,7 +36,7 @@ class DragButton(QPushButton): self._m_drag = False self._mouse_press_pos = None self._mouse_move_pos = None - super(DragButton, self).__init__(parent) + super().__init__(parent) def contextMenuEvent(self, event): menu = QMenu() @@ -62,7 +62,7 @@ class DragButton(QPushButton): self._mouse_press_pos = event.pos() self._mouse_move_pos = event.pos() - super(DragButton, self).mousePressEvent(event) + super().mousePressEvent(event) def mouseMoveEvent(self, event): if event.buttons() == Qt.LeftButton and self._m_press: @@ -78,7 +78,7 @@ class DragButton(QPushButton): self._window.scene.update() self._window.graphic_view.update() - super(DragButton, self).mouseMoveEvent(event) + super().mouseMoveEvent(event) def mouseReleaseEvent(self, event): self._m_press = False @@ -93,7 +93,7 @@ class DragButton(QPushButton): else: self.select_button(event.modifiers()) - super(DragButton, self).mouseReleaseEvent(event) + super().mouseReleaseEvent(event) def _toggle_button(self, pressed=False): self.pressed = not pressed diff --git a/b_asic/GUI/main_window.py b/b_asic/GUI/main_window.py index 24e16b23e9359378e2b27301ffc7748252ef06d3..bcfe780e4569b53ce428a667a1d1a9c986f783aa 100644 --- a/b_asic/GUI/main_window.py +++ b/b_asic/GUI/main_window.py @@ -20,8 +20,8 @@ from b_asic.GUI.utils import decorate_class, handle_error from b_asic.GUI.simulate_sfg_window import SimulateSFGWindow, Plot from b_asic.GUI.select_sfg_window import SelectSFGWindow -from b_asic import FastSimulation -from b_asic.simulation import Simulation +# from b_asic import FastSimulation +from b_asic.simulation import Simulation as FastSimulation from b_asic.operation import Operation from b_asic.port import InputPort, OutputPort from b_asic.signal_flow_graph import SFG @@ -30,7 +30,7 @@ import b_asic.core_operations as c_oper import b_asic.special_operations as s_oper from b_asic.save_load_structure import * -from numpy import linspace +import numpy as np from qtpy.QtWidgets import QApplication, QWidget, QMainWindow, QLabel, QAction,\ QStatusBar, QMenuBar, QLineEdit, QPushButton, QSlider, QScrollArea, QVBoxLayout,\ @@ -49,7 +49,7 @@ logging.basicConfig(level=logging.INFO) @decorate_class(handle_error) class MainWindow(QMainWindow): def __init__(self): - super(MainWindow, self).__init__() + super().__init__() self.ui = Ui_main_window() self.ui.setupUi(self) self.setWindowIcon(QIcon('small_logo.png')) @@ -140,7 +140,7 @@ class MainWindow(QMainWindow): 10, 10, self.ui.operation_box.width(), self.height()) self.graphic_view.setGeometry(self.ui.operation_box.width( ) + 20, 60, self.width() - self.ui.operation_box.width() - 20, self.height()-30) - super(MainWindow, self).resizeEvent(event) + super().resizeEvent(event) def wheelEvent(self, event): if event.modifiers() == Qt.ControlModifier: @@ -355,7 +355,7 @@ class MainWindow(QMainWindow): """Determine the distance between each port on the side of an operation. The method returns the distance that each port should have from 0. """ - return [length / 2] if ports == 1 else linspace(0, length, ports) + return [length / 2] if ports == 1 else np.linspace(0, length, ports) def add_ports(self, operation): _output_ports_dist = self._determine_port_distance( @@ -364,12 +364,14 @@ class MainWindow(QMainWindow): 55 - 17, operation.operation.input_count) self.portDict[operation] = list() + print(_output_ports_dist) + print(_input_ports_dist) for i, dist in enumerate(_input_ports_dist): port = PortButton( ">", operation, operation.operation.input(i), self) self.portDict[operation].append(port) operation.ports.append(port) - port.move(0, dist) + port.move(0, round(dist)) port.show() for i, dist in enumerate(_output_ports_dist): @@ -377,7 +379,7 @@ class MainWindow(QMainWindow): ">", operation, operation.operation.output(i), self) self.portDict[operation].append(port) operation.ports.append(port) - port.move(55 - 12, dist) + port.move(55 - 12, round(dist)) port.show() def get_operations_from_namespace(self, namespace): diff --git a/b_asic/GUI/port_button.py b/b_asic/GUI/port_button.py index 6e9b206574a6c15ddf7eb53185014c231064b9c1..8ec0e3decb38480305ec5139b7102a9958a87d7d 100644 --- a/b_asic/GUI/port_button.py +++ b/b_asic/GUI/port_button.py @@ -9,7 +9,7 @@ class PortButton(QPushButton): connectionRequested = Signal(QPushButton) moved = Signal() def __init__(self, name, operation, port, window, parent=None): - super(PortButton, self).__init__(name, operation, parent) + super().__init__(name, parent=operation) self.pressed = False self._window = window self.port = port @@ -30,10 +30,10 @@ class PortButton(QPushButton): if event.button() == Qt.LeftButton: self.select_port(event.modifiers()) - super(PortButton, self).mousePressEvent(event) + super().mousePressEvent(event) def mouseReleaseEvent(self, event): - super(PortButton, self).mouseReleaseEvent(event) + super().mouseReleaseEvent(event) def _toggle_port(self, pressed=False): self.pressed = not pressed @@ -56,4 +56,3 @@ class PortButton(QPushButton): for signal in self._window.signalList: signal.update() - diff --git a/b_asic/GUI/properties_window.py b/b_asic/GUI/properties_window.py index 1ec93f1c5d5c8a9bbbc1d9142722617876b096d7..e24e7bf58a2aef66cfbd722172891e51ee998f07 100644 --- a/b_asic/GUI/properties_window.py +++ b/b_asic/GUI/properties_window.py @@ -6,7 +6,7 @@ from qtpy.QtGui import QDoubleValidator class PropertiesWindow(QDialog): def __init__(self, operation, main_window): - super(PropertiesWindow, self).__init__() + super().__init__() self.operation = operation self._window = main_window self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) @@ -143,4 +143,4 @@ class PropertiesWindow(QDialog): 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 + self.reject() diff --git a/b_asic/GUI/select_sfg_window.py b/b_asic/GUI/select_sfg_window.py index 2901213ec06a571de01bf6ae32178bf004496c12..3542492d5ac51877f25e60a882ab39fda8af1019 100644 --- a/b_asic/GUI/select_sfg_window.py +++ b/b_asic/GUI/select_sfg_window.py @@ -12,7 +12,7 @@ class SelectSFGWindow(QDialog): ok = Signal() def __init__(self, window): - super(SelectSFGWindow, self).__init__() + super().__init__() self._window = window self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle("Select SFG") diff --git a/b_asic/GUI/show_pc_window.py b/b_asic/GUI/show_pc_window.py index 6ad31cac14cbd426f5d379f25ecd997914d3ff74..c3cbd32b4d37e6a5fdb7cd9a7914bd0301ea70c1 100644 --- a/b_asic/GUI/show_pc_window.py +++ b/b_asic/GUI/show_pc_window.py @@ -9,7 +9,7 @@ class ShowPCWindow(QDialog): pc = Signal() def __init__(self, window): - super(ShowPCWindow, self).__init__() + super().__init__() self._window = window self.check_box_dict = dict() self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) diff --git a/b_asic/GUI/simulate_sfg_window.py b/b_asic/GUI/simulate_sfg_window.py index 8fd5226765ff0875659b8184cde55a704c969d1d..c3df452f1a98a49b8407ebd509e18d08586ee307 100644 --- a/b_asic/GUI/simulate_sfg_window.py +++ b/b_asic/GUI/simulate_sfg_window.py @@ -12,7 +12,7 @@ class SimulateSFGWindow(QDialog): simulate = Signal() def __init__(self, window): - super(SimulateSFGWindow, self).__init__() + super().__init__() self._window = window self.properties = dict() self.sfg_to_layout = dict()