diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b73b532..3f44ff27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta ================================================= +9.09.2021 + +- in Fiducials Plugin updated the GUI to the new style +- Fiducials Plugin: replaced a Radio button with a Combobox2 and optimized the UI +- The Combobox2 GUI element no longer issue an exception if it is tried to set a string value, it will set automatically the index 0 + 8.09.2021 - in Calculator Plugin, in Units Calculator added more units conversions diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 412ba9c1..c6c54aa5 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -2352,7 +2352,10 @@ class FCComboBox2(FCComboBox): return int(self.currentIndex()) def set_value(self, val): - self.setCurrentIndex(val) + try: + self.setCurrentIndex(val) + except TypeError: + self.setCurrentIndex(0) class FCInputDialog(QtWidgets.QInputDialog): diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index 36a14dbd..62e34507 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -634,7 +634,7 @@ class PreferencesUIManager: "tools_fiducials_margin": self.ui.plugin2_pref_form.tools2_fiducials_group.margin_entry, "tools_fiducials_mode": self.ui.plugin2_pref_form.tools2_fiducials_group.mode_radio, "tools_fiducials_second_pos": self.ui.plugin2_pref_form.tools2_fiducials_group.pos_radio, - "tools_fiducials_type": self.ui.plugin2_pref_form.tools2_fiducials_group.fid_type_radio, + "tools_fiducials_type": self.ui.plugin2_pref_form.tools2_fiducials_group.fid_type_combo, "tools_fiducials_line_thickness": self.ui.plugin2_pref_form.tools2_fiducials_group.line_thickness_entry, # Calibration Tool diff --git a/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py b/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py index 56926718..d749372f 100644 --- a/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py @@ -1,6 +1,6 @@ from PyQt6 import QtWidgets -from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCLabel, FCGridLayout +from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCLabel, FCGridLayout, FCComboBox2, FCFrame from appGUI.preferences.OptionsGroupUI import OptionsGroupUI import gettext @@ -21,17 +21,23 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): self.decimals = decimals self.defaults = defaults - # ## Grid Layout - grid_lay = FCGridLayout(v_spacing=5, h_spacing=3) - self.layout.addLayout(grid_lay) - grid_lay.setColumnStretch(0, 0) - grid_lay.setColumnStretch(1, 1) - - self.param_label = FCLabel('%s:' % _('Parameters')) + # ############################################################################################################# + # Parameters Frame + # ############################################################################################################# + self.param_label = FCLabel('%s' % _('Parameters')) self.param_label.setToolTip( _("Parameters used for this tool.") ) - grid_lay.addWidget(self.param_label, 0, 0, 1, 2) + self.layout.addWidget(self.param_label) + + par_frame = FCFrame() + self.layout.addWidget(par_frame) + + # ## Grid Layout + grid_par = FCGridLayout(v_spacing=5, h_spacing=3) + grid_par.setColumnStretch(0, 0) + grid_par.setColumnStretch(1, 1) + par_frame.setLayout(grid_par) # DIAMETER # self.dia_label = FCLabel('%s:' % _("Size")) @@ -46,8 +52,8 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): self.dia_entry.setWrapping(True) self.dia_entry.setSingleStep(0.1) - grid_lay.addWidget(self.dia_label, 1, 0) - grid_lay.addWidget(self.dia_entry, 1, 1) + grid_par.addWidget(self.dia_label, 2, 0) + grid_par.addWidget(self.dia_entry, 2, 1) # MARGIN # self.margin_label = FCLabel('%s:' % _("Margin")) @@ -59,21 +65,8 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): self.margin_entry.set_precision(self.decimals) self.margin_entry.setSingleStep(0.1) - grid_lay.addWidget(self.margin_label, 2, 0) - grid_lay.addWidget(self.margin_entry, 2, 1) - - # Mode # - self.mode_radio = RadioSet([ - {'label': _('Auto'), 'value': 'auto'}, - {"label": _("Manual"), "value": "manual"} - ], stretch=False) - self.mode_label = FCLabel('%s:' % _("Mode")) - self.mode_label.setToolTip( - _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n" - "- 'Manual' - manual placement of fiducials.") - ) - grid_lay.addWidget(self.mode_label, 3, 0) - grid_lay.addWidget(self.mode_radio, 3, 1) + grid_par.addWidget(self.margin_label, 4, 0) + grid_par.addWidget(self.margin_entry, 4, 1) # Position for second fiducial # self.pos_radio = RadioSet([ @@ -88,21 +81,15 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n" "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.") ) - grid_lay.addWidget(self.pos_label, 4, 0) - grid_lay.addWidget(self.pos_radio, 4, 1) + grid_par.addWidget(self.pos_label, 6, 0) + grid_par.addWidget(self.pos_radio, 6, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - grid_lay.addWidget(separator_line, 5, 0, 1, 2) + grid_par.addWidget(separator_line, 8, 0, 1, 2) # Fiducial type # - self.fid_type_radio = RadioSet([ - {'label': _('Circular'), 'value': 'circular'}, - {"label": _("Cross"), "value": "cross"}, - {"label": _("Chess"), "value": "chess"} - ], stretch=False) - self.fid_type_label = FCLabel('%s:' % _("Fiducial Type")) self.fid_type_label.setToolTip( _("The type of fiducial.\n" @@ -110,8 +97,12 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): "- 'Cross' - cross lines fiducial.\n" "- 'Chess' - chess pattern fiducial.") ) - grid_lay.addWidget(self.fid_type_label, 6, 0) - grid_lay.addWidget(self.fid_type_radio, 6, 1) + + self.fid_type_combo = FCComboBox2() + self.fid_type_combo.addItems([_('Circular'), _("Cross"), _("Chess")]) + + grid_par.addWidget(self.fid_type_label, 10, 0) + grid_par.addWidget(self.fid_type_combo, 10, 1) # Line Thickness # self.line_thickness_label = FCLabel('%s:' % _("Line thickness")) @@ -123,7 +114,35 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): self.line_thickness_entry.set_precision(self.decimals) self.line_thickness_entry.setSingleStep(0.1) - grid_lay.addWidget(self.line_thickness_label, 7, 0) - grid_lay.addWidget(self.line_thickness_entry, 7, 1) + grid_par.addWidget(self.line_thickness_label, 12, 0) + grid_par.addWidget(self.line_thickness_entry, 12, 1) - self.layout.addStretch() + # ############################################################################################################# + # Selection Frame + # ############################################################################################################# + self.sel_label = FCLabel('%s' % _("Selection")) + self.layout.addWidget(self.sel_label) + + s_frame = FCFrame() + self.layout.addWidget(s_frame) + + # Grid Layout + grid_sel = FCGridLayout(v_spacing=5, h_spacing=3) + grid_sel.setColumnStretch(0, 0) + grid_sel.setColumnStretch(1, 1) + s_frame.setLayout(grid_sel) + + # Mode # + self.mode_radio = RadioSet([ + {'label': _('Auto'), 'value': 'auto'}, + {"label": _("Manual"), "value": "manual"} + ], stretch=False) + self.mode_label = FCLabel('%s:' % _("Mode")) + self.mode_label.setToolTip( + _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n" + "- 'Manual' - manual placement of fiducials.") + ) + grid_sel.addWidget(self.mode_label, 0, 0) + grid_sel.addWidget(self.mode_radio, 0, 1) + + self.layout.addStretch(1) diff --git a/appPlugins/ToolCorners.py b/appPlugins/ToolCorners.py index 3c256689..75693b1b 100644 --- a/appPlugins/ToolCorners.py +++ b/appPlugins/ToolCorners.py @@ -867,14 +867,14 @@ class CornersUI: self.s_frame.setLayout(grid_sel) # Type of placement of markers - self.sel_label = FCLabel('%s:' % _("Type")) + self.sel_label = FCLabel('%s: ' % _("Mode")) self.sel_label.setToolTip( _("When the manual type is chosen, the markers\n" "are manually placed on canvas.") ) self.sel_radio = RadioSet([ - {"label": _("Automatic"), "value": "a"}, + {"label": _("Auto"), "value": "a"}, {"label": _("Manual"), "value": "m"}, ]) diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py index d1ff5702..6e565eca 100644 --- a/appPlugins/ToolFiducials.py +++ b/appPlugins/ToolFiducials.py @@ -9,7 +9,7 @@ from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox, FCButton, FCLabel, \ - VerticalScrollArea, FCGridLayout + VerticalScrollArea, FCGridLayout, FCFrame, FCComboBox2 from appCommon.Common import LoudDict from shapely.geometry import Point, Polygon, MultiPolygon, LineString @@ -149,7 +149,7 @@ class ToolFiducials(AppTool): self.ui.add_cfid_button.clicked.connect(self.add_fiducials) self.ui.add_sm_opening_button.clicked.connect(self.add_soldermask_opening) - self.ui.fid_type_radio.activated_custom.connect(self.on_fiducial_type) + self.ui.fid_type_combo.currentIndexChanged.connect(self.on_fiducial_type) self.ui.pos_radio.activated_custom.connect(self.on_second_point) self.ui.mode_radio.activated_custom.connect(self.on_method_change) self.ui.reset_button.clicked.connect(self.set_tool_ui) @@ -166,7 +166,9 @@ class ToolFiducials(AppTool): self.ui.margin_entry.set_value(float(self.app.defaults["tools_fiducials_margin"])) self.ui.mode_radio.set_value(self.app.defaults["tools_fiducials_mode"]) self.ui.pos_radio.set_value(self.app.defaults["tools_fiducials_second_pos"]) - self.ui.fid_type_radio.set_value(self.app.defaults["tools_fiducials_type"]) + self.ui.fid_type_combo.set_value(self.app.defaults["tools_fiducials_type"]) + # needed so the visibility of some objects will be updated + self.on_fiducial_type(val=self.ui.fid_type_combo.get_value()) self.ui.line_thickness_entry.set_value(float(self.app.defaults["tools_fiducials_line_thickness"])) self.click_points = [] @@ -213,7 +215,7 @@ class ToolFiducials(AppTool): self.ui.separator_line.hide() self.ui.fid_type_label.hide() - self.ui.fid_type_radio.hide() + self.ui.fid_type_combo.hide() self.ui.line_thickness_label.hide() self.ui.line_thickness_entry.hide() @@ -228,7 +230,7 @@ class ToolFiducials(AppTool): self.ui.separator_line.show() self.ui.fid_type_label.show() - self.ui.fid_type_radio.show() + self.ui.fid_type_combo.show() self.ui.line_thickness_label.show() self.ui.line_thickness_entry.show() @@ -258,7 +260,7 @@ class ToolFiducials(AppTool): pass def on_fiducial_type(self, val): - if val == 'cross': + if val == 2: # 'cross' self.ui.line_thickness_label.setDisabled(False) self.ui.line_thickness_entry.setDisabled(False) else: @@ -271,7 +273,7 @@ class ToolFiducials(AppTool): self.mode_method = self.ui.mode_radio.get_value() self.margin_val = self.ui.margin_entry.get_value() self.sec_position = self.ui.pos_radio.get_value() - fid_type = self.ui.fid_type_radio.get_value() + fid_type = self.ui.fid_type_combo.get_value() self.click_points = [] @@ -349,22 +351,23 @@ class ToolFiducials(AppTool): def add_fiducials_geo(self, points_list, g_obj, fid_size=None, fid_type=None, line_size=None): """ Add geometry to the solid_geometry of the copper Gerber object - :param points_list: list of coordinates for the fiducials - :param g_obj: the Gerber object where to add the geometry - :param fid_size: the overall size of the fiducial or fiducial opening depending on the g_obj type - :param fid_type: the type of fiducial: circular or cross - :param line_size: the line thickenss when the fiducial type is cross + + :param points_list: list of coordinates for the fiducials + :param g_obj: the Gerber object where to add the geometry + :param fid_size: the overall size of the fiducial or fiducial opening depending on the g_obj type + :param fid_type: the type of fiducial: circular, cross, chess + :param line_size: the line thickenss when the fiducial type is cross :return: """ fid_size = self.ui.fid_size_entry.get_value() if fid_size is None else fid_size - fid_type = 'circular' if fid_type is None else fid_type + fid_type = 0 if fid_type is None else fid_type # default is 'circular' <=> 0 line_thickness = self.ui.line_thickness_entry.get_value() if line_size is None else line_size radius = fid_size / 2.0 new_apertures = deepcopy(g_obj.tools) - if fid_type == 'circular': + if fid_type == 0: # 'circular' geo_list = [Point(pt).buffer(radius, self.grb_steps_per_circle) for pt in points_list] aperture_found = None @@ -403,7 +406,7 @@ class ToolFiducials(AppTool): s_list.append(g_obj.solid_geometry) s_list += geo_list - elif fid_type == 'cross': + elif fid_type == 1: # 'cross' geo_list = [] for pt in points_list: @@ -472,7 +475,7 @@ class ToolFiducials(AppTool): for poly in geo_buff_list: s_list.append(poly) else: - # chess pattern fiducial type + # value 3 meaning 'chess' pattern fiducial type geo_list = [] def make_square_poly(center_pt, side_size): @@ -567,8 +570,8 @@ class ToolFiducials(AppTool): sm_opening_dia = self.ui.fid_size_entry.get_value() * 2.0 # get the Gerber object on which the Fiducial will be inserted - selection_index = self.ui.sm_object_combo.currentIndex() - model_index = self.app.collection.index(selection_index, 0, self.ui.sm_object_combo.rootModelIndex()) + selection_index = self.ui.grb_object_combo.currentIndex() + model_index = self.app.collection.index(selection_index, 0, self.ui.grb_object_combo.rootModelIndex()) try: self.sm_object = model_index.internalPointer().obj @@ -612,7 +615,7 @@ class ToolFiducials(AppTool): self.check_points() def check_points(self): - fid_type = self.ui.fid_type_radio.get_value() + fid_type = self.ui.fid_type_combo.get_value() if len(self.click_points) == 1: self.ui.bottom_left_coords_entry.set_value(self.click_points[0]) @@ -801,16 +804,47 @@ class FidoUI: ) self.level.setCheckable(True) self.title_box.addWidget(self.level) - - self.points_label = FCLabel('%s:' % _('Fiducials Coordinates')) + + self.tools_frame = QtWidgets.QFrame() + self.tools_frame.setContentsMargins(0, 0, 0, 0) + self.layout.addWidget(self.tools_frame) + self.tools_box = QtWidgets.QVBoxLayout() + self.tools_box.setContentsMargins(0, 0, 0, 0) + self.tools_frame.setLayout(self.tools_box) + + self.title_box = QtWidgets.QHBoxLayout() + self.tools_box.addLayout(self.title_box) + + # ############################################################################################################# + # Gerber Source Object + # ############################################################################################################# + self.obj_combo_label = FCLabel('%s' % _("Source Object")) + self.obj_combo_label.setToolTip( + _("Gerber object for adding fiducials and soldermask openings.") + ) + + self.grb_object_combo = FCComboBox() + self.grb_object_combo.setModel(self.app.collection) + self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) + self.grb_object_combo.is_last = True + self.grb_object_combo.obj_type = "Gerber" + + self.tools_box.addWidget(self.obj_combo_label) + self.tools_box.addWidget(self.grb_object_combo) + + # ############################################################################################################# + # Coordinates Table Frame + # ############################################################################################################# + self.points_label = FCLabel('%s' % _('Coordinates')) self.points_label.setToolTip( _("A table with the fiducial points coordinates,\n" "in the format (x, y).") ) - self.layout.addWidget(self.points_label) + self.tools_box.addWidget(self.points_label) self.points_table = FCTable() self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) + self.tools_box.addWidget(self.points_table) self.points_table.setColumnCount(3) self.points_table.setHorizontalHeaderLabels( @@ -885,24 +919,28 @@ class FidoUI: for row in range(self.points_table.rowCount()): self.points_table.cellWidget(row, 2).setFrame(False) - self.layout.addWidget(self.points_table) + # separator_line = QtWidgets.QFrame() + # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) + # self.layout.addWidget(separator_line) - separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - self.layout.addWidget(separator_line) - - # ## Grid Layout - grid_lay = FCGridLayout(v_spacing=5, h_spacing=3) - self.layout.addLayout(grid_lay) - grid_lay.setColumnStretch(0, 0) - grid_lay.setColumnStretch(1, 1) - - self.param_label = FCLabel('%s:' % _('Parameters')) + # ############################################################################################################# + # Parameters Frame + # ############################################################################################################# + self.param_label = FCLabel('%s' % _('Parameters')) self.param_label.setToolTip( _("Parameters used for this tool.") ) - grid_lay.addWidget(self.param_label, 0, 0, 1, 2) + self.tools_box.addWidget(self.param_label) + + par_frame = FCFrame() + self.tools_box.addWidget(par_frame) + + # ## Grid Layout + grid_par = FCGridLayout(v_spacing=5, h_spacing=3) + grid_par.setColumnStretch(0, 0) + grid_par.setColumnStretch(1, 1) + par_frame.setLayout(grid_par) # DIAMETER # self.size_label = FCLabel('%s:' % _("Size")) @@ -917,8 +955,8 @@ class FidoUI: self.fid_size_entry.setWrapping(True) self.fid_size_entry.setSingleStep(0.1) - grid_lay.addWidget(self.size_label, 1, 0) - grid_lay.addWidget(self.fid_size_entry, 1, 1) + grid_par.addWidget(self.size_label, 2, 0) + grid_par.addWidget(self.fid_size_entry, 2, 1) # MARGIN # self.margin_label = FCLabel('%s:' % _("Margin")) @@ -930,21 +968,8 @@ class FidoUI: self.margin_entry.set_precision(self.decimals) self.margin_entry.setSingleStep(0.1) - grid_lay.addWidget(self.margin_label, 2, 0) - grid_lay.addWidget(self.margin_entry, 2, 1) - - # Mode # - self.mode_radio = RadioSet([ - {'label': _('Auto'), 'value': 'auto'}, - {"label": _("Manual"), "value": "manual"} - ], stretch=False) - self.mode_label = FCLabel(_("Mode:")) - self.mode_label.setToolTip( - _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n" - "- 'Manual' - manual placement of fiducials.") - ) - grid_lay.addWidget(self.mode_label, 3, 0) - grid_lay.addWidget(self.mode_radio, 3, 1) + grid_par.addWidget(self.margin_label, 4, 0) + grid_par.addWidget(self.margin_entry, 4, 1) # Position for second fiducial # self.pos_radio = RadioSet([ @@ -959,20 +984,15 @@ class FidoUI: "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n" "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.") ) - grid_lay.addWidget(self.pos_label, 4, 0) - grid_lay.addWidget(self.pos_radio, 4, 1) + grid_par.addWidget(self.pos_label, 6, 0) + grid_par.addWidget(self.pos_radio, 6, 1) self.separator_line = QtWidgets.QFrame() self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - grid_lay.addWidget(self.separator_line, 5, 0, 1, 2) + grid_par.addWidget(self.separator_line, 8, 0, 1, 2) # Fiducial type # - self.fid_type_radio = RadioSet([ - {'label': _('Circular'), 'value': 'circular'}, - {"label": _("Cross"), "value": "cross"}, - {"label": _("Chess"), "value": "chess"} - ], stretch=False) self.fid_type_label = FCLabel('%s:' % _("Fiducial Type")) self.fid_type_label.setToolTip( _("The type of fiducial.\n" @@ -980,8 +1000,12 @@ class FidoUI: "- 'Cross' - cross lines fiducial.\n" "- 'Chess' - chess pattern fiducial.") ) - grid_lay.addWidget(self.fid_type_label, 6, 0) - grid_lay.addWidget(self.fid_type_radio, 6, 1) + + self.fid_type_combo = FCComboBox2() + self.fid_type_combo.addItems([_('Circular'), _("Cross"), _("Chess")]) + + grid_par.addWidget(self.fid_type_label, 10, 0) + grid_par.addWidget(self.fid_type_combo, 10, 1) # Line Thickness # self.line_thickness_label = FCLabel('%s:' % _("Line thickness")) @@ -993,28 +1017,41 @@ class FidoUI: self.line_thickness_entry.set_precision(self.decimals) self.line_thickness_entry.setSingleStep(0.1) - grid_lay.addWidget(self.line_thickness_label, 7, 0) - grid_lay.addWidget(self.line_thickness_entry, 7, 1) + grid_par.addWidget(self.line_thickness_label, 12, 0) + grid_par.addWidget(self.line_thickness_entry, 12, 1) - separator_line_1 = QtWidgets.QFrame() - separator_line_1.setFrameShape(QtWidgets.QFrame.Shape.HLine) - separator_line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - grid_lay.addWidget(separator_line_1, 8, 0, 1, 2) + # separator_line_1 = QtWidgets.QFrame() + # separator_line_1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + # separator_line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) + # grid_par.addWidget(separator_line_1, 14, 0, 1, 2) - # Copper Gerber object - self.grb_object_combo = FCComboBox() - self.grb_object_combo.setModel(self.app.collection) - self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) - self.grb_object_combo.is_last = True - self.grb_object_combo.obj_type = "Gerber" + # ############################################################################################################# + # Selection Frame + # ############################################################################################################# + self.sel_label = FCLabel('%s' % _("Selection")) + self.tools_box.addWidget(self.sel_label) - self.grbobj_label = FCLabel("%s:" % _("GERBER")) - self.grbobj_label.setToolTip( - _("Gerber Object to which will be added a copper thieving.") + self.s_frame = FCFrame() + self.tools_box.addWidget(self.s_frame) + + # Grid Layout + grid_sel = FCGridLayout(v_spacing=5, h_spacing=3) + grid_sel.setColumnStretch(0, 0) + grid_sel.setColumnStretch(1, 1) + self.s_frame.setLayout(grid_sel) + + # Mode # + self.mode_radio = RadioSet([ + {'label': _('Auto'), 'value': 'auto'}, + {"label": _("Manual"), "value": "manual"} + ], stretch=False) + self.mode_label = FCLabel(_("Mode:")) + self.mode_label.setToolTip( + _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n" + "- 'Manual' - manual placement of fiducials.") ) - - grid_lay.addWidget(self.grbobj_label, 9, 0, 1, 2) - grid_lay.addWidget(self.grb_object_combo, 10, 0, 1, 2) + grid_sel.addWidget(self.mode_label, 0, 0) + grid_sel.addWidget(self.mode_radio, 0, 1) # ## Insert Copper Fiducial self.add_cfid_button = FCButton(_("Add Fiducial")) @@ -1028,26 +1065,7 @@ class FidoUI: font-weight: bold; } """) - grid_lay.addWidget(self.add_cfid_button, 11, 0, 1, 2) - - separator_line_2 = QtWidgets.QFrame() - separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) - separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - grid_lay.addWidget(separator_line_2, 12, 0, 1, 2) - - # Soldermask Gerber object # - self.sm_object_label = FCLabel('%s:' % _("Soldermask Gerber")) - self.sm_object_label.setToolTip( - _("The Soldermask Gerber object.") - ) - self.sm_object_combo = FCComboBox() - self.sm_object_combo.setModel(self.app.collection) - self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) - self.sm_object_combo.is_last = True - self.sm_object_combo.obj_type = "Gerber" - - grid_lay.addWidget(self.sm_object_label, 13, 0, 1, 2) - grid_lay.addWidget(self.sm_object_combo, 14, 0, 1, 2) + self.tools_box.addWidget(self.add_cfid_button) # ## Insert Soldermask opening for Fiducial self.add_sm_opening_button = FCButton(_("Add Soldermask Opening")) @@ -1063,9 +1081,9 @@ class FidoUI: font-weight: bold; } """) - grid_lay.addWidget(self.add_sm_opening_button, 15, 0, 1, 2) + self.tools_box.addWidget(self.add_sm_opening_button) - self.layout.addStretch() + self.layout.addStretch(1) # ## Reset Tool self.reset_button = FCButton(_("Reset Tool")) diff --git a/appPlugins/ToolFilm.py b/appPlugins/ToolFilm.py index 76e7f1dd..22e52e9f 100644 --- a/appPlugins/ToolFilm.py +++ b/appPlugins/ToolFilm.py @@ -774,7 +774,7 @@ class Film(AppTool): try: doc_final = StringIO(doc_final) drawing = svg2rlg(doc_final) - renderPM.drawToFile(drawing, filename, 'PNG') + renderPM.drawToFile(drawing, filename, fmt='PNG') # if new_png_dpi == default_dpi: # renderPM.drawToFile(drawing, filename, 'PNG')