diff --git a/.vscode/launch.json b/.vscode/launch.json index 472bd0c56..009dfd414 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "Python: Current File (Integrated Terminal)", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", @@ -17,14 +17,14 @@ }, { "name": "Python: Code gen (GUI Ui only)", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/pyleecan/Generator/run_generate_GUI.py", "console": "integratedTerminal" }, { "name": "Python: Code gen (GUI resources only)", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/pyleecan/Generator/run_generate_GUI_resources.py", "console": "integratedTerminal", @@ -34,7 +34,7 @@ }, { "name": "Python: Code gen (Classes from csv)", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/pyleecan/Generator/run_generate_classes.py", "console": "integratedTerminal", @@ -45,7 +45,7 @@ }, { "name": "Python: Run GUI", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/pyleecan/run_GUI.py", "console": "integratedTerminal", @@ -56,7 +56,7 @@ }, { "name": "Python: Run class gen GUI", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/pyleecan/Generator/run_class_generator_GUI.py", "console": "integratedTerminal", @@ -67,7 +67,7 @@ }, { "name": "Python: Run script", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/script.py", "console": "integratedTerminal", @@ -78,7 +78,7 @@ }, { "name": "Python: Current File (External Terminal)", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${file}", "console": "externalTerminal" diff --git a/Tests/GUI/Dialog/DMachineSetup/PHole/test_PHoleMUD.py b/Tests/GUI/Dialog/DMachineSetup/PHole/test_PHoleMUD.py index 1bdeeb7b7..57fbc3a80 100644 --- a/Tests/GUI/Dialog/DMachineSetup/PHole/test_PHoleMUD.py +++ b/Tests/GUI/Dialog/DMachineSetup/PHole/test_PHoleMUD.py @@ -70,9 +70,15 @@ def test_load_dxf_11_magnets(self): assert wid_hole.g_mat_layout.count() == 13 for idx_mag_wid in range(1, wid_hole.g_mat_layout.count()): - idx_label = ( - wid_hole.g_mat_layout.itemAt(idx_mag_wid) - .wid.in_mat_type.text() - .split(" ")[-1] - ) + widget = wid_hole.g_mat_layout.itemAt(idx_mag_wid).widget() + idx_label = widget.in_mat_type.text().split(" ")[-1] assert int(idx_label) == idx_mag_wid - 1 + + +if __name__ == "__main__": + a = TestPHoleMUD() + a.setup_class() + a.setup_method() + a.test_load_dxf_11_magnets() + + print("Done") diff --git a/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py b/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py index 953452d24..87c0789f8 100644 --- a/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py +++ b/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py @@ -578,5 +578,5 @@ def test_set_empty_floatedit(self): # a.test_notch_addition_without_input() # a.test_notch_addition_wrong_input() # a.test_set_empty_floatedit() - a.teardown_class() + # a.teardown_class() print("Done") diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/DAVDuct.py b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/DAVDuct.py index d16097a62..49e398f6a 100644 --- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/DAVDuct.py +++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/DAVDuct.py @@ -44,7 +44,7 @@ def __init__(self, lamination): # Set Help URL self.b_help.hide() - self.b_new.clicked.connect(self.s_add) + self.b_new.clicked.connect(lambda: self.s_add(vent=None, idx_vent=None)) self.tab_vent.tabCloseRequested.connect(self.s_remove) self.b_plot.clicked.connect(self.plot) self.b_cancel.clicked.connect(self.reject) @@ -55,7 +55,7 @@ def keyPressEvent(self, event): self.valid_vent() event.accept() - def s_add(self, vent=False, idx_vent=None): + def s_add(self, vent=None, idx_vent=None): """Signal to add a new hole Parameters @@ -66,7 +66,7 @@ def s_add(self, vent=False, idx_vent=None): The ventilation to init the GUI with """ # Create a new hole if needed - if type(vent) is bool: + if vent is None: # Default Hole is Circular vent_obj = VentilationCirc() vent_obj._set_None() diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/DNotchTab.py b/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/DNotchTab.py index 0a8e3b2c7..6fedf5654 100644 --- a/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/DNotchTab.py +++ b/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/DNotchTab.py @@ -77,7 +77,7 @@ def __init__(self, machine, is_stator=False, material_dict=None): # self.b_help.hide() # Connect the slot - self.b_add.clicked.connect(self.s_add) + self.b_add.clicked.connect(lambda: self.s_add(notch=None, idx_notch=None)) self.tab_notch.tabCloseRequested.connect(self.s_remove) self.b_ok.clicked.connect(self.update_and_close) self.b_cancel.clicked.connect(self.reject) diff --git a/pyleecan/GUI/Dialog/DMachineSetup/SMHoleMag/SMHoleMag.py b/pyleecan/GUI/Dialog/DMachineSetup/SMHoleMag/SMHoleMag.py index 149db9417..2a69ac441 100644 --- a/pyleecan/GUI/Dialog/DMachineSetup/SMHoleMag/SMHoleMag.py +++ b/pyleecan/GUI/Dialog/DMachineSetup/SMHoleMag/SMHoleMag.py @@ -77,7 +77,7 @@ def __init__(self, machine, material_dict, is_stator=False): # Connect the slot self.tab_hole.tabCloseRequested.connect(self.s_remove) - self.b_add.clicked.connect(self.s_add) + self.b_add.clicked.connect(lambda: self.s_add(hole=None)) self.b_plot.clicked.connect(self.s_plot) @@ -108,7 +108,7 @@ def set_hole_pitch(self, Zh): + " [rad]" ) - def s_add(self, hole=False): + def s_add(self, hole=None): """Signal to add a new hole Parameters @@ -125,7 +125,7 @@ def s_add(self, hole=False): else: is_mag = True # Create a new hole if needed - if type(hole) is bool: + if hole is None: self.obj.hole.append(HoleM50()) hole = self.obj.hole[-1] hole._set_None() diff --git a/pyleecan/Methods/Machine/Lamination/build_yoke_side_line.py b/pyleecan/Methods/Machine/Lamination/build_yoke_side_line.py index e29bdd1f5..2921e0968 100644 --- a/pyleecan/Methods/Machine/Lamination/build_yoke_side_line.py +++ b/pyleecan/Methods/Machine/Lamination/build_yoke_side_line.py @@ -106,6 +106,13 @@ def merge_line_list(Z1, Z2, label, inter_list): ) ii += 1 line.prop_dict[BOUNDARY_PROP_LAB] = label + "-" + str(ii) + line_list.append( + Segment( + line.get_begin(), + line.get_end(), + prop_dict={BOUNDARY_PROP_LAB: label + "-" + str(ii)}, + ) + ) ii += 1 Zb = line.get_end() # Add last line (or Z1 to Z2 if no intersection)