- updated the border for fit view on OpenGL graphic mode

- Calibration Tool - added preferences values
- Calibration Tool - more work on it
This commit is contained in:
Marius Stanciu
2019-12-09 01:56:45 +02:00
committed by Marius
parent e54dd14e6c
commit 8969c03021
12 changed files with 618 additions and 388 deletions

View File

@@ -1596,6 +1596,10 @@ class GeometryObjectUI(ObjectUI):
self.grid3.addWidget(separator_line2, 19, 0, 1, 2)
self.apply_param_to_all = FCButton(_("Apply parameters to all tools"))
self.apply_param_to_all.setToolTip(
_("The parameters in the current form will be applied\n"
"on all the tools from the Tool Table.")
)
self.grid3.addWidget(self.apply_param_to_all, 20, 0, 1, 2)
self.grid3.addWidget(QtWidgets.QLabel(''), 21, 0, 1, 2)

View File

@@ -334,12 +334,32 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
except TypeError:
pass
# adjust the view camera to be slightly bigger than the bounds so the shape colleaction can be seen clearly
# adjust the view camera to be slightly bigger than the bounds so the shape collection can be seen clearly
# otherwise the shape collection boundary will have no border
rect.left *= 0.96
rect.bottom *= 0.96
rect.right *= 1.01
rect.top *= 1.01
dx = rect.right - rect.left
dy = rect.top - rect.bottom
x_factor = dx * 0.02
y_factor = dy * 0.02
rect.left -= x_factor
rect.bottom -= y_factor
rect.right += x_factor
rect.top += y_factor
# rect.left *= 0.96
# rect.bottom *= 0.96
# rect.right *= 1.04
# rect.top *= 1.04
# units = self.fcapp.defaults['units'].upper()
# if units == 'MM':
# compensation = 0.5
# else:
# compensation = 0.5 / 25.4
# rect.left -= compensation
# rect.bottom -= compensation
# rect.right += compensation
# rect.top += compensation
self.view.camera.rect = rect

View File

@@ -237,6 +237,9 @@ class Tools2PreferencesUI(QtWidgets.QWidget):
self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
self.tools2_fiducials_group.setMinimumWidth(220)
self.tools2_cal_group = Tools2CalPrefGroupUI(decimals=self.decimals)
self.tools2_cal_group.setMinimumWidth(220)
self.vlay = QtWidgets.QVBoxLayout()
self.vlay.addWidget(self.tools2_checkrules_group)
self.vlay.addWidget(self.tools2_optimal_group)
@@ -249,6 +252,7 @@ class Tools2PreferencesUI(QtWidgets.QWidget):
self.vlay3 = QtWidgets.QVBoxLayout()
self.vlay3.addWidget(self.tools2_fiducials_group)
self.vlay3.addWidget(self.tools2_cal_group)
self.layout.addLayout(self.vlay)
self.layout.addLayout(self.vlay1)
@@ -6291,7 +6295,7 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
super(Tools2FiducialsPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Fiducials Tools Options")))
self.setTitle(str(_("Fiducials Tool Options")))
self.decimals = decimals
# ## Grid Layout
@@ -6402,6 +6406,98 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
self.layout.addStretch()
class Tools2CalPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
super(Tools2CalPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Calibration Tool Options")))
self.decimals = decimals
# ## Grid Layout
grid_lay = QtWidgets.QGridLayout()
self.layout.addLayout(grid_lay)
grid_lay.setColumnStretch(0, 0)
grid_lay.setColumnStretch(1, 1)
self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
self.param_label.setToolTip(
_("Parameters used for this tool.")
)
grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
# Calibration source
self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
"It can be:\n"
"- Object -> click a hole geo for Excellon or a pad for Gerber\n"
"- Free -> click freely on canvas to acquire the calibration points"))
self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
{'label': _('Free'), 'value': 'free'}],
stretch=False)
grid_lay.addWidget(self.cal_source_lbl, 1, 0)
grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid_lay.addWidget(separator_line, 2, 0, 1, 2)
# Travel Z entry
travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
travelz_lbl.setToolTip(
_("Height (Z) for travelling between the points.")
)
self.travelz_entry = FCDoubleSpinner()
self.travelz_entry.set_range(-9999.9999, 9999.9999)
self.travelz_entry.set_precision(self.decimals)
self.travelz_entry.setSingleStep(0.1)
grid_lay.addWidget(travelz_lbl, 3, 0)
grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
# Verification Z entry
verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
verz_lbl.setToolTip(
_("Height (Z) for checking the point.")
)
self.verz_entry = FCDoubleSpinner()
self.verz_entry.set_range(-9999.9999, 9999.9999)
self.verz_entry.set_precision(self.decimals)
self.verz_entry.setSingleStep(0.1)
grid_lay.addWidget(verz_lbl, 4, 0)
grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
# Zero the Z of the verification tool
self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
self.zeroz_cb.setToolTip(
_("Include a sequence to zero the height (Z)\n"
"of the verification tool.")
)
grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
# Toochange Z entry
toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
toolchangez_lbl.setToolTip(
_("Height (Z) for mounting the verification probe.")
)
self.toolchangez_entry = FCDoubleSpinner()
self.toolchangez_entry.set_range(0.0000, 9999.9999)
self.toolchangez_entry.set_precision(self.decimals)
self.toolchangez_entry.setSingleStep(0.1)
grid_lay.addWidget(toolchangez_lbl, 6, 0)
grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
self.layout.addStretch()
class FAExcPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)

View File

@@ -117,18 +117,21 @@ def apply_patches():
minor.extend(np.linspace(maj + minstep,
maj + majstep - minstep,
minor_num))
major_frac = (major - offset) / scale
minor_frac = (np.array(minor) - offset) / scale
major_frac = major_frac[::-1] if flip else major_frac
use_mask = (major_frac > -0.0001) & (major_frac < 1.0001)
major_frac = major_frac[use_mask]
labels = [l for li, l in enumerate(labels) if use_mask[li]]
minor_frac = minor_frac[(minor_frac > -0.0001) &
(minor_frac < 1.0001)]
minor_frac = (np.array(minor) - offset) / scale
use_minor_mask = (minor_frac > -0.0001) & (minor_frac < 1.0001)
minor_frac = minor_frac[use_minor_mask]
return major_frac, minor_frac, labels
elif self.axis.scale_type == 'logarithmic':
return NotImplementedError
elif self.axis.scale_type == 'power':
return NotImplementedError
return major_frac, minor_frac, labels
Ticker._get_tick_frac_labels = _get_tick_frac_labels