diff --git a/b_asic/GUI/main_window.py b/b_asic/GUI/main_window.py index b4e94b8091fc01a05b73050ae7ed8ae4d67aa29e..89c7c4fe319db99d2a975531613656c9e78d4550 100644 --- a/b_asic/GUI/main_window.py +++ b/b_asic/GUI/main_window.py @@ -191,15 +191,15 @@ class MainWindow(QMainWindow): operation_positions = {} for op_drag, op_scene in self.dragOperationSceneDict.items(): operation_positions[op_drag.operation.graph_id] = ( - op_scene.x(), - op_scene.y(), + int(op_scene.x()), + int(op_scene.y()), ) try: with open(module, "w+") as file_obj: file_obj.write( sfg_to_python( - sfg, suffix=f"positions = {str(operation_positions)}" + sfg, suffix=f"positions = {operation_positions}" ) ) except Exception as e: diff --git a/examples/twotapfirsfg.py b/examples/twotapfirsfg.py index 1456dbba99a0cdd1c4d0f7f5d22e33e49e92af1c..bd80f2427d34e260d67297db82f462a0fecb081b 100644 --- a/examples/twotapfirsfg.py +++ b/examples/twotapfirsfg.py @@ -2,9 +2,9 @@ """ B-ASIC automatically generated SFG file. Name: twotapfir -Last saved: 2023-01-23 11:29:09.423052. +Last saved: 2023-01-23 12:02:27.343483. """ -from b_asic import SFG, Signal, Input, Output, ConstantMultiplication, Delay, Input, Output, Addition +from b_asic import SFG, Signal, Input, Output, ConstantMultiplication, Addition, Delay, Input, Output # Inputs: in1 = Input(name="") @@ -32,4 +32,4 @@ twotapfir = SFG(inputs=[in1], outputs=[out1], name='twotapfir') # SFG Properties: prop = {'name':twotapfir} -positions = {'in1': (-264.0, -202.0), 't1': (-135.0, -204.0), 'out1': (216.0, 92.0), 'cmul1': (-181.0, -67.0), 'cmul2': (-27.0, -66.0), 'add1': (91.0, 93.0)} +positions = {'cmul1': (-181, -67), 'in1': (-264, -202), 'add1': (91, 93), 'cmul2': (-27, -66), 'out1': (216, 92), 't1': (-135, -204)} diff --git a/test/test_gui/twotapfir.py b/test/test_gui/twotapfir.py index dd9edd6a478df5263970267e27f769d7ff5e9f61..bd80f2427d34e260d67297db82f462a0fecb081b 100644 --- a/test/test_gui/twotapfir.py +++ b/test/test_gui/twotapfir.py @@ -1,20 +1,10 @@ + """ B-ASIC automatically generated SFG file. Name: twotapfir -Last saved: 2023-01-23 11:29:09.423052. +Last saved: 2023-01-23 12:02:27.343483. """ -from b_asic import ( - SFG, - Signal, - Input, - Output, - ConstantMultiplication, - Delay, - Input, - Output, - Addition, -) - +from b_asic import SFG, Signal, Input, Output, ConstantMultiplication, Addition, Delay, Input, Output # Inputs: in1 = Input(name="") @@ -22,16 +12,10 @@ in1 = Input(name="") out1 = Output(name="") # Operations: -cmul1 = ConstantMultiplication( - value=0.5, name="cmul", latency_offsets={'in0': None, 'out0': None} -) +cmul1 = ConstantMultiplication(value=0.5, name="cmul", latency_offsets={'in0': None, 'out0': None}) in1 = Input(name="") -add1 = Addition( - name="", latency_offsets={'in0': None, 'in1': None, 'out0': None} -) -cmul2 = ConstantMultiplication( - value=0.5, name="cmul2", latency_offsets={'in0': None, 'out0': None} -) +add1 = Addition(name="", latency_offsets={'in0': None, 'in1': None, 'out0': None}) +cmul2 = ConstantMultiplication(value=0.5, name="cmul2", latency_offsets={'in0': None, 'out0': None}) out1 = Output(name="") t1 = Delay(initial_value=0, name="") in1 = Input(name="") @@ -47,12 +31,5 @@ Signal(source=t1.output(0), destination=cmul2.input(0)) twotapfir = SFG(inputs=[in1], outputs=[out1], name='twotapfir') # SFG Properties: -prop = {'name': twotapfir} -positions = { - 'in1': (-264.0, -202.0), - 't1': (-135.0, -204.0), - 'out1': (216.0, 92.0), - 'cmul1': (-181.0, -67.0), - 'cmul2': (-27.0, -66.0), - 'add1': (91.0, 93.0), -} +prop = {'name':twotapfir} +positions = {'cmul1': (-181, -67), 'in1': (-264, -202), 'add1': (91, 93), 'cmul2': (-27, -66), 'out1': (216, 92), 't1': (-135, -204)}