- 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
This commit is contained in:
Marius Stanciu
2021-09-09 01:19:33 +03:00
committed by Marius
parent 0f318ef909
commit 6712b98a93
7 changed files with 194 additions and 148 deletions

View File

@@ -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 8.09.2021
- in Calculator Plugin, in Units Calculator added more units conversions - in Calculator Plugin, in Units Calculator added more units conversions

View File

@@ -2352,7 +2352,10 @@ class FCComboBox2(FCComboBox):
return int(self.currentIndex()) return int(self.currentIndex())
def set_value(self, val): def set_value(self, val):
self.setCurrentIndex(val) try:
self.setCurrentIndex(val)
except TypeError:
self.setCurrentIndex(0)
class FCInputDialog(QtWidgets.QInputDialog): class FCInputDialog(QtWidgets.QInputDialog):

View File

@@ -634,7 +634,7 @@ class PreferencesUIManager:
"tools_fiducials_margin": self.ui.plugin2_pref_form.tools2_fiducials_group.margin_entry, "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_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_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, "tools_fiducials_line_thickness": self.ui.plugin2_pref_form.tools2_fiducials_group.line_thickness_entry,
# Calibration Tool # Calibration Tool

View File

@@ -1,6 +1,6 @@
from PyQt6 import QtWidgets 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 from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
@@ -21,17 +21,23 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
self.decimals = decimals self.decimals = decimals
self.defaults = defaults self.defaults = defaults
# ## Grid Layout # #############################################################################################################
grid_lay = FCGridLayout(v_spacing=5, h_spacing=3) # Parameters Frame
self.layout.addLayout(grid_lay) # #############################################################################################################
grid_lay.setColumnStretch(0, 0) self.param_label = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _('Parameters'))
grid_lay.setColumnStretch(1, 1)
self.param_label = FCLabel('<b>%s:</b>' % _('Parameters'))
self.param_label.setToolTip( self.param_label.setToolTip(
_("Parameters used for this tool.") _("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 # # DIAMETER #
self.dia_label = FCLabel('%s:' % _("Size")) self.dia_label = FCLabel('%s:' % _("Size"))
@@ -46,8 +52,8 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
self.dia_entry.setWrapping(True) self.dia_entry.setWrapping(True)
self.dia_entry.setSingleStep(0.1) self.dia_entry.setSingleStep(0.1)
grid_lay.addWidget(self.dia_label, 1, 0) grid_par.addWidget(self.dia_label, 2, 0)
grid_lay.addWidget(self.dia_entry, 1, 1) grid_par.addWidget(self.dia_entry, 2, 1)
# MARGIN # # MARGIN #
self.margin_label = FCLabel('%s:' % _("Margin")) self.margin_label = FCLabel('%s:' % _("Margin"))
@@ -59,21 +65,8 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
self.margin_entry.set_precision(self.decimals) self.margin_entry.set_precision(self.decimals)
self.margin_entry.setSingleStep(0.1) self.margin_entry.setSingleStep(0.1)
grid_lay.addWidget(self.margin_label, 2, 0) grid_par.addWidget(self.margin_label, 4, 0)
grid_lay.addWidget(self.margin_entry, 2, 1) grid_par.addWidget(self.margin_entry, 4, 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)
# Position for second fiducial # # Position for second fiducial #
self.pos_radio = RadioSet([ self.pos_radio = RadioSet([
@@ -88,21 +81,15 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
"- 'Down' - the order is: bottom-left, bottom-right, top-right.\n" "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
"- 'None' - there is no second fiducial. The order is: bottom-left, top-right.") "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
) )
grid_lay.addWidget(self.pos_label, 4, 0) grid_par.addWidget(self.pos_label, 6, 0)
grid_lay.addWidget(self.pos_radio, 4, 1) grid_par.addWidget(self.pos_radio, 6, 1)
separator_line = QtWidgets.QFrame() separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) 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 # # 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 = FCLabel('%s:' % _("Fiducial Type"))
self.fid_type_label.setToolTip( self.fid_type_label.setToolTip(
_("The type of fiducial.\n" _("The type of fiducial.\n"
@@ -110,8 +97,12 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
"- 'Cross' - cross lines fiducial.\n" "- 'Cross' - cross lines fiducial.\n"
"- 'Chess' - chess pattern fiducial.") "- '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 # # Line Thickness #
self.line_thickness_label = FCLabel('%s:' % _("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.set_precision(self.decimals)
self.line_thickness_entry.setSingleStep(0.1) self.line_thickness_entry.setSingleStep(0.1)
grid_lay.addWidget(self.line_thickness_label, 7, 0) grid_par.addWidget(self.line_thickness_label, 12, 0)
grid_lay.addWidget(self.line_thickness_entry, 7, 1) grid_par.addWidget(self.line_thickness_entry, 12, 1)
self.layout.addStretch() # #############################################################################################################
# Selection Frame
# #############################################################################################################
self.sel_label = FCLabel('<span style="color:green;"><b>%s</b></span>' % _("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)

View File

@@ -867,14 +867,14 @@ class CornersUI:
self.s_frame.setLayout(grid_sel) self.s_frame.setLayout(grid_sel)
# Type of placement of markers # Type of placement of markers
self.sel_label = FCLabel('%s:' % _("Type")) self.sel_label = FCLabel('%s: ' % _("Mode"))
self.sel_label.setToolTip( self.sel_label.setToolTip(
_("When the manual type is chosen, the markers\n" _("When the manual type is chosen, the markers\n"
"are manually placed on canvas.") "are manually placed on canvas.")
) )
self.sel_radio = RadioSet([ self.sel_radio = RadioSet([
{"label": _("Automatic"), "value": "a"}, {"label": _("Auto"), "value": "a"},
{"label": _("Manual"), "value": "m"}, {"label": _("Manual"), "value": "m"},
]) ])

View File

@@ -9,7 +9,7 @@ from PyQt6 import QtWidgets, QtCore, QtGui
from appTool import AppTool from appTool import AppTool
from appGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox, FCButton, FCLabel, \ from appGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox, FCButton, FCLabel, \
VerticalScrollArea, FCGridLayout VerticalScrollArea, FCGridLayout, FCFrame, FCComboBox2
from appCommon.Common import LoudDict from appCommon.Common import LoudDict
from shapely.geometry import Point, Polygon, MultiPolygon, LineString 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_cfid_button.clicked.connect(self.add_fiducials)
self.ui.add_sm_opening_button.clicked.connect(self.add_soldermask_opening) 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.pos_radio.activated_custom.connect(self.on_second_point)
self.ui.mode_radio.activated_custom.connect(self.on_method_change) self.ui.mode_radio.activated_custom.connect(self.on_method_change)
self.ui.reset_button.clicked.connect(self.set_tool_ui) 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.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.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.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.ui.line_thickness_entry.set_value(float(self.app.defaults["tools_fiducials_line_thickness"]))
self.click_points = [] self.click_points = []
@@ -213,7 +215,7 @@ class ToolFiducials(AppTool):
self.ui.separator_line.hide() self.ui.separator_line.hide()
self.ui.fid_type_label.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_label.hide()
self.ui.line_thickness_entry.hide() self.ui.line_thickness_entry.hide()
@@ -228,7 +230,7 @@ class ToolFiducials(AppTool):
self.ui.separator_line.show() self.ui.separator_line.show()
self.ui.fid_type_label.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_label.show()
self.ui.line_thickness_entry.show() self.ui.line_thickness_entry.show()
@@ -258,7 +260,7 @@ class ToolFiducials(AppTool):
pass pass
def on_fiducial_type(self, val): def on_fiducial_type(self, val):
if val == 'cross': if val == 2: # 'cross'
self.ui.line_thickness_label.setDisabled(False) self.ui.line_thickness_label.setDisabled(False)
self.ui.line_thickness_entry.setDisabled(False) self.ui.line_thickness_entry.setDisabled(False)
else: else:
@@ -271,7 +273,7 @@ class ToolFiducials(AppTool):
self.mode_method = self.ui.mode_radio.get_value() self.mode_method = self.ui.mode_radio.get_value()
self.margin_val = self.ui.margin_entry.get_value() self.margin_val = self.ui.margin_entry.get_value()
self.sec_position = self.ui.pos_radio.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 = [] 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): 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 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 points_list: list of coordinates for the fiducials
:param fid_size: the overall size of the fiducial or fiducial opening depending on the g_obj type :param g_obj: the Gerber object where to add the geometry
:param fid_type: the type of fiducial: circular or cross :param fid_size: the overall size of the fiducial or fiducial opening depending on the g_obj type
:param line_size: the line thickenss when the fiducial type is cross :param fid_type: the type of fiducial: circular, cross, chess
:param line_size: the line thickenss when the fiducial type is cross
:return: :return:
""" """
fid_size = self.ui.fid_size_entry.get_value() if fid_size is None else fid_size 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 line_thickness = self.ui.line_thickness_entry.get_value() if line_size is None else line_size
radius = fid_size / 2.0 radius = fid_size / 2.0
new_apertures = deepcopy(g_obj.tools) 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] geo_list = [Point(pt).buffer(radius, self.grb_steps_per_circle) for pt in points_list]
aperture_found = None aperture_found = None
@@ -403,7 +406,7 @@ class ToolFiducials(AppTool):
s_list.append(g_obj.solid_geometry) s_list.append(g_obj.solid_geometry)
s_list += geo_list s_list += geo_list
elif fid_type == 'cross': elif fid_type == 1: # 'cross'
geo_list = [] geo_list = []
for pt in points_list: for pt in points_list:
@@ -472,7 +475,7 @@ class ToolFiducials(AppTool):
for poly in geo_buff_list: for poly in geo_buff_list:
s_list.append(poly) s_list.append(poly)
else: else:
# chess pattern fiducial type # value 3 meaning 'chess' pattern fiducial type
geo_list = [] geo_list = []
def make_square_poly(center_pt, side_size): 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 sm_opening_dia = self.ui.fid_size_entry.get_value() * 2.0
# get the Gerber object on which the Fiducial will be inserted # get the Gerber object on which the Fiducial will be inserted
selection_index = self.ui.sm_object_combo.currentIndex() selection_index = self.ui.grb_object_combo.currentIndex()
model_index = self.app.collection.index(selection_index, 0, self.ui.sm_object_combo.rootModelIndex()) model_index = self.app.collection.index(selection_index, 0, self.ui.grb_object_combo.rootModelIndex())
try: try:
self.sm_object = model_index.internalPointer().obj self.sm_object = model_index.internalPointer().obj
@@ -612,7 +615,7 @@ class ToolFiducials(AppTool):
self.check_points() self.check_points()
def check_points(self): 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: if len(self.click_points) == 1:
self.ui.bottom_left_coords_entry.set_value(self.click_points[0]) self.ui.bottom_left_coords_entry.set_value(self.click_points[0])
@@ -801,16 +804,47 @@ class FidoUI:
) )
self.level.setCheckable(True) self.level.setCheckable(True)
self.title_box.addWidget(self.level) self.title_box.addWidget(self.level)
self.points_label = FCLabel('<b>%s:</b>' % _('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('<span style="color:darkorange;"><b>%s</b></span>' % _("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('<span style="color:green;"><b>%s</b></span>' % _('Coordinates'))
self.points_label.setToolTip( self.points_label.setToolTip(
_("A table with the fiducial points coordinates,\n" _("A table with the fiducial points coordinates,\n"
"in the format (x, y).") "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 = FCTable()
self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.tools_box.addWidget(self.points_table)
self.points_table.setColumnCount(3) self.points_table.setColumnCount(3)
self.points_table.setHorizontalHeaderLabels( self.points_table.setHorizontalHeaderLabels(
@@ -885,24 +919,28 @@ class FidoUI:
for row in range(self.points_table.rowCount()): for row in range(self.points_table.rowCount()):
self.points_table.cellWidget(row, 2).setFrame(False) 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) # Parameters Frame
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # #############################################################################################################
self.layout.addWidget(separator_line) self.param_label = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _('Parameters'))
# ## 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('<b>%s:</b>' % _('Parameters'))
self.param_label.setToolTip( self.param_label.setToolTip(
_("Parameters used for this tool.") _("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 # # DIAMETER #
self.size_label = FCLabel('%s:' % _("Size")) self.size_label = FCLabel('%s:' % _("Size"))
@@ -917,8 +955,8 @@ class FidoUI:
self.fid_size_entry.setWrapping(True) self.fid_size_entry.setWrapping(True)
self.fid_size_entry.setSingleStep(0.1) self.fid_size_entry.setSingleStep(0.1)
grid_lay.addWidget(self.size_label, 1, 0) grid_par.addWidget(self.size_label, 2, 0)
grid_lay.addWidget(self.fid_size_entry, 1, 1) grid_par.addWidget(self.fid_size_entry, 2, 1)
# MARGIN # # MARGIN #
self.margin_label = FCLabel('%s:' % _("Margin")) self.margin_label = FCLabel('%s:' % _("Margin"))
@@ -930,21 +968,8 @@ class FidoUI:
self.margin_entry.set_precision(self.decimals) self.margin_entry.set_precision(self.decimals)
self.margin_entry.setSingleStep(0.1) self.margin_entry.setSingleStep(0.1)
grid_lay.addWidget(self.margin_label, 2, 0) grid_par.addWidget(self.margin_label, 4, 0)
grid_lay.addWidget(self.margin_entry, 2, 1) grid_par.addWidget(self.margin_entry, 4, 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)
# Position for second fiducial # # Position for second fiducial #
self.pos_radio = RadioSet([ self.pos_radio = RadioSet([
@@ -959,20 +984,15 @@ class FidoUI:
"- 'Down' - the order is: bottom-left, bottom-right, top-right.\n" "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
"- 'None' - there is no second fiducial. The order is: bottom-left, top-right.") "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
) )
grid_lay.addWidget(self.pos_label, 4, 0) grid_par.addWidget(self.pos_label, 6, 0)
grid_lay.addWidget(self.pos_radio, 4, 1) grid_par.addWidget(self.pos_radio, 6, 1)
self.separator_line = QtWidgets.QFrame() self.separator_line = QtWidgets.QFrame()
self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) 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 # # 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 = FCLabel('%s:' % _("Fiducial Type"))
self.fid_type_label.setToolTip( self.fid_type_label.setToolTip(
_("The type of fiducial.\n" _("The type of fiducial.\n"
@@ -980,8 +1000,12 @@ class FidoUI:
"- 'Cross' - cross lines fiducial.\n" "- 'Cross' - cross lines fiducial.\n"
"- 'Chess' - chess pattern fiducial.") "- '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 # # Line Thickness #
self.line_thickness_label = FCLabel('%s:' % _("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.set_precision(self.decimals)
self.line_thickness_entry.setSingleStep(0.1) self.line_thickness_entry.setSingleStep(0.1)
grid_lay.addWidget(self.line_thickness_label, 7, 0) grid_par.addWidget(self.line_thickness_label, 12, 0)
grid_lay.addWidget(self.line_thickness_entry, 7, 1) grid_par.addWidget(self.line_thickness_entry, 12, 1)
separator_line_1 = QtWidgets.QFrame() # separator_line_1 = QtWidgets.QFrame()
separator_line_1.setFrameShape(QtWidgets.QFrame.Shape.HLine) # separator_line_1.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # separator_line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid_lay.addWidget(separator_line_1, 8, 0, 1, 2) # grid_par.addWidget(separator_line_1, 14, 0, 1, 2)
# Copper Gerber object # #############################################################################################################
self.grb_object_combo = FCComboBox() # Selection Frame
self.grb_object_combo.setModel(self.app.collection) # #############################################################################################################
self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) self.sel_label = FCLabel('<span style="color:green;"><b>%s</b></span>' % _("Selection"))
self.grb_object_combo.is_last = True self.tools_box.addWidget(self.sel_label)
self.grb_object_combo.obj_type = "Gerber"
self.grbobj_label = FCLabel("<b>%s:</b>" % _("GERBER")) self.s_frame = FCFrame()
self.grbobj_label.setToolTip( self.tools_box.addWidget(self.s_frame)
_("Gerber Object to which will be added a copper thieving.")
# 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_sel.addWidget(self.mode_label, 0, 0)
grid_lay.addWidget(self.grbobj_label, 9, 0, 1, 2) grid_sel.addWidget(self.mode_radio, 0, 1)
grid_lay.addWidget(self.grb_object_combo, 10, 0, 1, 2)
# ## Insert Copper Fiducial # ## Insert Copper Fiducial
self.add_cfid_button = FCButton(_("Add Fiducial")) self.add_cfid_button = FCButton(_("Add Fiducial"))
@@ -1028,26 +1065,7 @@ class FidoUI:
font-weight: bold; font-weight: bold;
} }
""") """)
grid_lay.addWidget(self.add_cfid_button, 11, 0, 1, 2) self.tools_box.addWidget(self.add_cfid_button)
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('<b>%s:</b>' % _("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)
# ## Insert Soldermask opening for Fiducial # ## Insert Soldermask opening for Fiducial
self.add_sm_opening_button = FCButton(_("Add Soldermask Opening")) self.add_sm_opening_button = FCButton(_("Add Soldermask Opening"))
@@ -1063,9 +1081,9 @@ class FidoUI:
font-weight: bold; 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 # ## Reset Tool
self.reset_button = FCButton(_("Reset Tool")) self.reset_button = FCButton(_("Reset Tool"))

View File

@@ -774,7 +774,7 @@ class Film(AppTool):
try: try:
doc_final = StringIO(doc_final) doc_final = StringIO(doc_final)
drawing = svg2rlg(doc_final) drawing = svg2rlg(doc_final)
renderPM.drawToFile(drawing, filename, 'PNG') renderPM.drawToFile(drawing, filename, fmt='PNG')
# if new_png_dpi == default_dpi: # if new_png_dpi == default_dpi:
# renderPM.drawToFile(drawing, filename, 'PNG') # renderPM.drawToFile(drawing, filename, 'PNG')