Skip to content
Snippets Groups Projects

Fixed save/load, sfg creating, simulation, bug fixes

Merged Jacob Wahlman requested to merge gui-bug-fixes into develop
4 files
+ 55
30
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 14
5
@@ -9,12 +9,10 @@ from b_asic import Signal
class Arrow(QGraphicsLineItem):
def __init__(self, source, destination, window, create_signal=True, parent=None):
def __init__(self, source, destination, window, signal=None, parent=None):
super(Arrow, self).__init__(parent)
self.source = source
# if an signal does not exist create one
if create_signal:
self.signal = Signal(source.port, destination.port)
self.signal = Signal(source.port, destination.port) if signal is None else signal
self.destination = destination
self._window = window
self.moveLine()
@@ -30,7 +28,18 @@ class Arrow(QGraphicsLineItem):
self.signal.remove_destination()
self.signal.remove_source()
self._window.scene.removeItem(self)
self._window.signalList.remove(self)
if self in self._window.signalList:
self._window.signalList.remove(self)
if self in self._window.signalPortDict:
for port1, port2 in self._window.signalPortDict[self]:
for operation, operation_ports in self._window.portDict.items():
if (port1 in operation_ports or port2 in operation_ports) and operation in self._window.opToSFG:
self._window.logger.info(f"Operation detected in existing sfg, removing sfg with name: {self._window.opToSFG[operation].name}.")
del self._window.sfg_dict[self._window.opToSFG[operation].name]
self._window.opToSFG = {op: self._window.opToSFG[op] for op in self._window.opToSFG if self._window.opToSFG[op] is not self._window.opToSFG[operation]}
del self._window.signalPortDict[self]
def moveLine(self):
self.setPen(QPen(Qt.black, 3))
Loading