Rebase and minor adjustments

This commit is contained in:
Roy-043
2025-06-12 22:11:27 +02:00
committed by Yorik van Havre
parent 60753068ec
commit fca41e4003
8 changed files with 73 additions and 180 deletions

View File

@@ -78,66 +78,31 @@ class TaskPanelCircularArray:
"""
def __init__(self):
self.name = "Circular array"
_log(translate("draft","Task panel:") + " {}".format(translate("draft","Circular array")))
# The .ui file must be loaded into an attribute
# called `self.form` so that it is displayed in the task panel.
ui_file = ":/ui/TaskPanel_CircularArray.ui"
self.form = Gui.PySideUic.loadUi(ui_file)
icon_name = "Draft_CircularArray"
svg = ":/icons/" + icon_name
pix = QtGui.QPixmap(svg)
icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
self.form.setWindowIcon(icon)
self.form.setWindowTitle(translate("draft","Circular array"))
self.form.label_icon.setPixmap(pix.scaled(32, 32))
self.form = Gui.PySideUic.loadUi(":/ui/TaskPanel_CircularArray.ui")
self.form.setWindowTitle(translate("draft", "Circular array"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_CircularArray.svg"))
# -------------------------------------------------------------------
# Default values for the internal function,
# and for the task panel interface
start_distance = U.Quantity(50.0, App.Units.Length)
length_unit = start_distance.getUserPreferred()[2]
self.r_distance = 2 * start_distance.Value
self.tan_distance = start_distance.Value
self.form.spinbox_r_distance.setProperty('rawValue',
self.r_distance)
self.form.spinbox_r_distance.setProperty('unit', length_unit)
self.form.spinbox_tan_distance.setProperty('rawValue',
self.tan_distance)
self.form.spinbox_tan_distance.setProperty('unit', length_unit)
self.number = 3
self.symmetry = 1
self.form.spinbox_number.setValue(self.number)
self.form.spinbox_symmetry.setValue(self.symmetry)
# Default values for the internal function, and for the task panel interface
self.center = App.Vector()
# TODO: the axis is currently fixed, it should be editable
# or selectable from the task panel
self.axis = App.Vector(0, 0, 1)
start_point = U.Quantity(0.0, App.Units.Length)
length_unit = start_point.getUserPreferred()[2]
self.center = App.Vector(start_point.Value,
start_point.Value,
start_point.Value)
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_x.setProperty('unit', length_unit)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_y.setProperty('unit', length_unit)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.input_c_z.setProperty('unit', length_unit)
self.r_distance = 100
self.tan_distance = 50
self.number = 3
self.symmetry = 1
self.fuse = params.get_param("Draft_array_fuse")
self.use_link = params.get_param("Draft_array_Link")
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.spinbox_r_distance.setProperty('rawValue', self.r_distance)
self.form.spinbox_tan_distance.setProperty('rawValue', self.tan_distance)
self.form.spinbox_number.setValue(self.number)
self.form.spinbox_symmetry.setValue(self.symmetry)
self.form.checkbox_fuse.setChecked(self.fuse)
self.form.checkbox_link.setChecked(self.use_link)
# -------------------------------------------------------------------

View File

@@ -78,20 +78,10 @@ class TaskPanelOrthoArray:
"""
def __init__(self):
self.name = "Orthogonal array"
_log(translate("draft","Task panel:") + " {}".format(translate("draft","Orthogonal array")))
# The .ui file must be loaded into an attribute
# called `self.form` so that it is displayed in the task panel.
ui_file = ":/ui/TaskPanel_OrthoArray.ui"
self.form = Gui.PySideUic.loadUi(ui_file)
icon_name = "Draft_Array"
svg = ":/icons/" + icon_name
pix = QtGui.QPixmap(svg)
icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
self.form.setWindowIcon(icon)
self.form.setWindowTitle(translate("draft","Orthogonal array"))
self.form = Gui.PySideUic.loadUi(":/ui/TaskPanel_OrthoArray.ui")
self.form.setWindowTitle(translate("draft", "Orthogonal array"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_Array.svg"))
# -------------------------------------------------------------------
# Default values for the internal function,
@@ -100,32 +90,21 @@ class TaskPanelOrthoArray:
start_y = params.get_param("YInterval", "Mod/Draft/OrthoArrayLinearMode")
start_z = params.get_param("ZInterval", "Mod/Draft/OrthoArrayLinearMode")
length_unit = App.Units.Quantity(0.0, App.Units.Length).getUserPreferred()[2]
self.v_x = App.Vector(start_x, 0, 0)
self.v_y = App.Vector(0, start_y, 0)
self.v_z = App.Vector(0, 0, start_z)
self.form.input_X_x.setProperty('rawValue', self.v_x.x)
self.form.input_X_x.setProperty('unit', length_unit)
self.form.input_X_y.setProperty('rawValue', self.v_x.y)
self.form.input_X_y.setProperty('unit', length_unit)
self.form.input_X_z.setProperty('rawValue', self.v_x.z)
self.form.input_X_z.setProperty('unit', length_unit)
self.form.input_Y_x.setProperty('rawValue', self.v_y.x)
self.form.input_Y_x.setProperty('unit', length_unit)
self.form.input_Y_y.setProperty('rawValue', self.v_y.y)
self.form.input_Y_y.setProperty('unit', length_unit)
self.form.input_Y_z.setProperty('rawValue', self.v_y.z)
self.form.input_Y_z.setProperty('unit', length_unit)
self.form.input_Z_x.setProperty('rawValue', self.v_z.x)
self.form.input_Z_x.setProperty('unit', length_unit)
self.form.input_Z_y.setProperty('rawValue', self.v_z.y)
self.form.input_Z_y.setProperty('unit', length_unit)
self.form.input_Z_z.setProperty('rawValue', self.v_z.z)
self.form.input_Z_z.setProperty('unit', length_unit)
self.n_x = params.get_param("XNumOfElements", "Mod/Draft/OrthoArrayLinearMode")
self.n_y = params.get_param("YNumOfElements", "Mod/Draft/OrthoArrayLinearMode")
@@ -245,8 +224,8 @@ class TaskPanelOrthoArray:
# we should not ever do this but maybe a sanity check here?
if self.linear_mode:
if not (self.form.radiobutton_x_axis.isChecked() or
self.form.radiobutton_y_axis.isChecked() or
if not (self.form.radiobutton_x_axis.isChecked() or
self.form.radiobutton_y_axis.isChecked() or
self.form.radiobutton_z_axis.isChecked()):
_err(translate("draft","In Linear mode, at least one axis must be selected."))
return False
@@ -442,7 +421,7 @@ class TaskPanelOrthoArray:
if self.linear_mode:
self.form.button_linear_mode.setText(translate("draft", "Switch to ortho mode"))
# check radiobutton based on current cfg
self.update_axis_ui()

View File

@@ -78,54 +78,24 @@ class TaskPanelPolarArray:
"""
def __init__(self):
self.name = "Polar array"
_log(translate("draft","Task panel:") + " {}".format(self.name))
# The .ui file must be loaded into an attribute
# called `self.form` so that it is displayed in the task panel.
ui_file = ":/ui/TaskPanel_PolarArray.ui"
self.form = Gui.PySideUic.loadUi(ui_file)
icon_name = "Draft_PolarArray"
svg = ":/icons/" + icon_name
pix = QtGui.QPixmap(svg)
icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
self.form.setWindowIcon(icon)
self.form.setWindowTitle(translate("draft","Polar array"))
self.form.label_icon.setPixmap(pix.scaled(32, 32))
self.form = Gui.PySideUic.loadUi(":/ui/TaskPanel_PolarArray.ui")
self.form.setWindowTitle(translate("draft", "Polar array"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_PolarArray.svg"))
# -------------------------------------------------------------------
# Default values for the internal function,
# and for the task panel interface
start_angle = U.Quantity(360.0, App.Units.Angle)
angle_unit = start_angle.getUserPreferred()[2]
self.angle = start_angle.Value
# Default values for the internal function, and for the task panel interface
self.center = App.Vector()
self.angle = 360
self.number = 5
self.form.spinbox_angle.setProperty('rawValue', self.angle)
self.form.spinbox_angle.setProperty('unit', angle_unit)
self.form.spinbox_number.setValue(self.number)
start_point = U.Quantity(0.0, App.Units.Length)
length_unit = start_point.getUserPreferred()[2]
self.center = App.Vector(start_point.Value,
start_point.Value,
start_point.Value)
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_x.setProperty('unit', length_unit)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_y.setProperty('unit', length_unit)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.input_c_z.setProperty('unit', length_unit)
self.fuse = params.get_param("Draft_array_fuse")
self.use_link = params.get_param("Draft_array_Link")
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.spinbox_angle.setProperty('rawValue', self.angle)
self.form.spinbox_number.setValue(self.number)
self.form.checkbox_fuse.setChecked(self.fuse)
self.form.checkbox_link.setChecked(self.use_link)
# -------------------------------------------------------------------

View File

@@ -51,16 +51,9 @@ class ShapeStringTaskPanel:
def __init__(self, point=None, size=None, string="", font=""):
self.form = Gui.PySideUic.loadUi(":/ui/TaskShapeString.ui")
self.form.setObjectName("ShapeStringTaskPanel")
self.form.setWindowTitle(translate("draft", "ShapeString"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_ShapeString.svg"))
unit_length = App.Units.Quantity(0.0, App.Units.Length).getUserPreferred()[2]
self.form.sbX.setProperty("unit", unit_length)
self.form.sbY.setProperty("unit", unit_length)
self.form.sbZ.setProperty("unit", unit_length)
self.form.sbHeight.setProperty("unit", unit_length)
self.global_mode = params.get_param("GlobalMode")
self.form.cbGlobalMode.setChecked(self.global_mode)
self.change_coord_labels()