- Milling Tool - added plot awareness and connection to the Plot button in the tool; updated translation strings
This commit is contained in:
committed by
Marius Stanciu
parent
09403a19ab
commit
a59310ab4a
@@ -973,10 +973,10 @@ class ExtractUI:
|
||||
grid3.addWidget(self.e_sm_button, 24, 0, 1, 2)
|
||||
|
||||
# EXTRACT CUTOUT
|
||||
self.extract_sm_label = FCLabel('<b>%s</b>' % _("Extract Cutout").upper())
|
||||
self.extract_sm_label.setToolTip(
|
||||
self.extract_cut_label = FCLabel('<b>%s</b>' % _("Extract Cutout").upper())
|
||||
self.extract_cut_label.setToolTip(
|
||||
_("Extract a cutout from a given Gerber file."))
|
||||
grid3.addWidget(self.extract_sm_label, 26, 0, 1, 2)
|
||||
grid3.addWidget(self.extract_cut_label, 26, 0, 1, 2)
|
||||
|
||||
# Margin
|
||||
self.margin_cut_label = FCLabel('%s:' % _("Margin"))
|
||||
@@ -1015,7 +1015,7 @@ class ExtractUI:
|
||||
self.e_cut_button = QtWidgets.QPushButton(_("Extract Cutout"))
|
||||
self.e_cut_button.setIcon(QtGui.QIcon(self.app.resource_location + '/extract32.png'))
|
||||
self.e_cut_button.setToolTip(
|
||||
_("Extract soldermask from a given Gerber file.")
|
||||
_("Extract a cutout from a given Gerber file.")
|
||||
)
|
||||
self.e_cut_button.setStyleSheet("""
|
||||
QPushButton
|
||||
|
||||
@@ -378,6 +378,32 @@ class ToolMilling(AppTool, Excellon):
|
||||
|
||||
self.ui.offset_type_combo.set_value(0) # 'Path'
|
||||
|
||||
# handle the Plot checkbox
|
||||
self.plot_cb_handler()
|
||||
|
||||
def plot_cb_handler(self):
|
||||
# load the Milling object
|
||||
self.obj_name = self.ui.object_combo.currentText()
|
||||
|
||||
# Get source object.
|
||||
try:
|
||||
self.target_obj = self.app.collection.get_by_name(self.obj_name)
|
||||
except Exception:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), str(self.obj_name)))
|
||||
return
|
||||
|
||||
try:
|
||||
self.ui.plot_cb.stateChanged.disconnect()
|
||||
except (AttributeError, TypeError):
|
||||
pass
|
||||
|
||||
self.ui.plot_cb.stateChanged.connect(self.on_plot_clicked)
|
||||
if self.target_obj is not None:
|
||||
self.ui.plot_cb.set_value(self.target_obj.options['plot'])
|
||||
|
||||
def on_plot_clicked(self, state):
|
||||
self.target_obj.options['plot'] = True if state else False
|
||||
|
||||
def rebuild_ui(self):
|
||||
# read the table tools uid
|
||||
current_uid_list = []
|
||||
@@ -392,8 +418,6 @@ class ToolMilling(AppTool, Excellon):
|
||||
new_tools[new_uid] = deepcopy(self.iso_tools[current_uid])
|
||||
new_uid += 1
|
||||
|
||||
self.iso_tools = new_tools
|
||||
|
||||
# the tools table changed therefore we need to rebuild it
|
||||
QtCore.QTimer.singleShot(20, self.build_ui)
|
||||
|
||||
@@ -766,6 +790,9 @@ class ToolMilling(AppTool, Excellon):
|
||||
self.ui_connect()
|
||||
|
||||
def on_target_changed(self, val):
|
||||
# handle the Plot checkbox
|
||||
self.plot_cb_handler()
|
||||
|
||||
obj_type = 1 if val == 'exc' else 2
|
||||
self.ui.object_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||
self.ui.object_combo.setCurrentIndex(0)
|
||||
@@ -821,6 +848,9 @@ class ToolMilling(AppTool, Excellon):
|
||||
self.build_ui()
|
||||
|
||||
def on_object_changed(self):
|
||||
# handle the Plot checkbox
|
||||
self.plot_cb_handler()
|
||||
|
||||
# load the Milling object
|
||||
self.obj_name = self.ui.object_combo.currentText()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user