- moved more methods out of App_Main class
This commit is contained in:
parent
04b8de9fd3
commit
10cb6149fb
|
@ -3593,7 +3593,7 @@ class MainGUI(QtWidgets.QMainWindow):
|
|||
|
||||
# I want to take the focus and give it to the Tcl Shell when the Tcl Shell is run
|
||||
# self.shell._edit.setFocus()
|
||||
QtCore.QTimer.singleShot(0, lambda: self.ui.shell_dock.widget()._edit.setFocus())
|
||||
QtCore.QTimer.singleShot(0, lambda: self.shell_dock.widget()._edit.setFocus())
|
||||
|
||||
# HACK - simulate a mouse click - alternative
|
||||
# no_km = QtCore.Qt.KeyboardModifier(QtCore.Qt.NoModifier) # no KB modifier
|
||||
|
|
|
@ -341,6 +341,12 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
|||
|
||||
# Load the defaults values into the Excellon Format and Excellon Zeros fields
|
||||
self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button)
|
||||
# Make sure that when the Excellon loading parameters are changed, the change is reflected in the
|
||||
# Export Excellon parameters.
|
||||
self.update_excellon_cb.stateChanged.connect(self.on_update_exc_export)
|
||||
|
||||
# call it once to make sure it is updated at startup
|
||||
self.on_update_exc_export(state=self.app.defaults["excellon_update"])
|
||||
|
||||
def optimization_selection(self):
|
||||
if self.excellon_optimization_radio.get_value() == 'M':
|
||||
|
@ -413,3 +419,105 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
|||
self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_mm"].set_value('3')
|
||||
self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L')
|
||||
self.app.preferencesUiManager.defaults_form_fields["excellon_units"].set_value('INCH')
|
||||
|
||||
def on_update_exc_export(self, state):
|
||||
"""
|
||||
This is handling the update of Excellon Export parameters based on the ones in the Excellon General but only
|
||||
if the update_excellon_cb checkbox is checked
|
||||
|
||||
:param state: state of the checkbox whose signals is tied to his slot
|
||||
:return:
|
||||
"""
|
||||
if state:
|
||||
# first try to disconnect
|
||||
try:
|
||||
self.excellon_format_upper_in_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_format_lower_in_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_format_upper_mm_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_format_lower_mm_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.excellon_zeros_radio.activated_custom.disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_units_radio.activated_custom.disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
# the connect them
|
||||
self.excellon_format_upper_in_entry.returnPressed.connect(self.on_excellon_format_changed)
|
||||
self.excellon_format_lower_in_entry.returnPressed.connect(self.on_excellon_format_changed)
|
||||
self.excellon_format_upper_mm_entry.returnPressed.connect(self.on_excellon_format_changed)
|
||||
self.excellon_format_lower_mm_entry.returnPressed.connect(self.on_excellon_format_changed)
|
||||
self.excellon_zeros_radio.activated_custom.connect(self.on_excellon_zeros_changed)
|
||||
self.excellon_units_radio.activated_custom.connect(self.on_excellon_units_changed)
|
||||
else:
|
||||
# disconnect the signals
|
||||
try:
|
||||
self.excellon_format_upper_in_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_format_lower_in_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_format_upper_mm_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_format_lower_mm_entry.returnPressed.disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.excellon_zeros_radio.activated_custom.disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.excellon_units_radio.activated_custom.disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
def on_excellon_format_changed(self):
|
||||
"""
|
||||
Slot activated when the user changes the Excellon format values in Preferences -> Excellon -> Excellon General
|
||||
:return: None
|
||||
"""
|
||||
if self.excellon_units_radio.get_value().upper() == 'METRIC':
|
||||
self.app.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry.set_value(
|
||||
self.excellon_format_upper_mm_entry.get_value())
|
||||
self.app.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry.set_value(
|
||||
self.excellon_format_lower_mm_entry.get_value())
|
||||
else:
|
||||
self.app.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry.set_value(
|
||||
self.excellon_format_upper_in_entry.get_value())
|
||||
self.app.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry.set_value(
|
||||
self.excellon_format_lower_in_entry.get_value())
|
||||
|
||||
def on_excellon_zeros_changed(self, val):
|
||||
"""
|
||||
Slot activated when the user changes the Excellon zeros values in Preferences -> Excellon -> Excellon General
|
||||
:return: None
|
||||
"""
|
||||
self.app.ui.excellon_defaults_form.excellon_exp_group.zeros_radio.set_value(val + 'Z')
|
||||
|
||||
def on_excellon_units_changed(self, val):
|
||||
"""
|
||||
Slot activated when the user changes the Excellon unit values in Preferences -> Excellon -> Excellon General
|
||||
:return: None
|
||||
"""
|
||||
self.app.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio.set_value(val)
|
||||
self.on_excellon_format_changed()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from PyQt5 import QtWidgets, QtCore
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
from PyQt5.QtCore import Qt, QSettings
|
||||
|
||||
from AppGUI.GUIElements import FCSpinner, RadioSet, FCTextArea, FCEntry
|
||||
|
@ -205,3 +205,67 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI):
|
|||
grid_lay.addWidget(self.sel_limit_label, 11, 0)
|
||||
grid_lay.addWidget(self.sel_limit_entry, 11, 1)
|
||||
# self.layout.addStretch()
|
||||
|
||||
# QRCode Tool
|
||||
self.fill_color_entry.editingFinished.connect(self.on_qrcode_fill_color_entry)
|
||||
self.fill_color_button.clicked.connect(self.on_qrcode_fill_color_button)
|
||||
self.back_color_entry.editingFinished.connect(self.on_qrcode_back_color_entry)
|
||||
self.back_color_button.clicked.connect(self.on_qrcode_back_color_button)
|
||||
|
||||
def on_qrcode_fill_color_entry(self):
|
||||
self.app.defaults['tools_qrcode_fill_color'] = self.fill_color_entry.get_value()
|
||||
self.fill_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])
|
||||
)
|
||||
|
||||
def on_qrcode_fill_color_button(self):
|
||||
current_color = QtGui.QColor(self.app.defaults['tools_qrcode_fill_color'])
|
||||
|
||||
c_dialog = QtWidgets.QColorDialog()
|
||||
fill_color = c_dialog.getColor(initial=current_color)
|
||||
|
||||
if fill_color.isValid() is False:
|
||||
return
|
||||
|
||||
# if new color is different then mark that the Preferences are changed
|
||||
if fill_color != current_color:
|
||||
self.app.preferencesUiManager.on_preferences_edited()
|
||||
|
||||
self.fill_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(fill_color.name())
|
||||
)
|
||||
|
||||
new_val_sel = str(fill_color.name())
|
||||
self.fill_color_entry.set_value(new_val_sel)
|
||||
self.app.defaults['tools_qrcode_fill_color'] = new_val_sel
|
||||
|
||||
def on_qrcode_back_color_entry(self):
|
||||
self.app.defaults['tools_qrcode_back_color'] = self.back_color_entry.get_value()
|
||||
self.back_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])
|
||||
)
|
||||
|
||||
def on_qrcode_back_color_button(self):
|
||||
current_color = QtGui.QColor(self.app.defaults['tools_qrcode_back_color'])
|
||||
|
||||
c_dialog = QtWidgets.QColorDialog()
|
||||
back_color = c_dialog.getColor(initial=current_color)
|
||||
|
||||
if back_color.isValid() is False:
|
||||
return
|
||||
|
||||
# if new color is different then mark that the Preferences are changed
|
||||
if back_color != current_color:
|
||||
self.app.preferencesUiManager.on_preferences_edited()
|
||||
|
||||
self.back_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(back_color.name())
|
||||
)
|
||||
|
||||
new_val_sel = str(back_color.name())
|
||||
self.back_color_entry.set_value(new_val_sel)
|
||||
self.app.defaults['tools_qrcode_back_color'] = new_val_sel
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from PyQt5 import QtWidgets, QtCore
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
from PyQt5.QtCore import Qt, QSettings
|
||||
|
||||
from AppGUI.GUIElements import RadioSet, FCEntry, FCDoubleSpinner, FCCheckBox, FCComboBox
|
||||
|
@ -314,3 +314,35 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
|
|||
grid0.addWidget(self.pagesize_combo, 17, 1)
|
||||
|
||||
self.layout.addStretch()
|
||||
|
||||
# Film Tool
|
||||
self.film_color_entry.editingFinished.connect(self.on_film_color_entry)
|
||||
self.film_color_button.clicked.connect(self.on_film_color_button)
|
||||
|
||||
def on_film_color_entry(self):
|
||||
self.app.defaults['tools_film_color'] = self.film_color_entry.get_value()
|
||||
self.film_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(self.defaults['tools_film_color'])
|
||||
)
|
||||
|
||||
def on_film_color_button(self):
|
||||
current_color = QtGui.QColor(self.app.defaults['tools_film_color'])
|
||||
|
||||
c_dialog = QtWidgets.QColorDialog()
|
||||
film_color = c_dialog.getColor(initial=current_color)
|
||||
|
||||
if film_color.isValid() is False:
|
||||
return
|
||||
|
||||
# if new color is different then mark that the Preferences are changed
|
||||
if film_color != current_color:
|
||||
self.app.preferencesUiManager.on_preferences_edited()
|
||||
|
||||
self.film_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(film_color.name())
|
||||
)
|
||||
new_val_sel = str(film_color.name())
|
||||
self.film_color_entry.set_value(new_val_sel)
|
||||
self.app.defaults['tools_film_color'] = new_val_sel
|
||||
|
|
|
@ -84,55 +84,51 @@ class ToolEtchCompensation(AppTool):
|
|||
|
||||
grid0.addWidget(self.param_label, 4, 0, 1, 2)
|
||||
|
||||
# Margin
|
||||
self.margin_label = QtWidgets.QLabel('%s:' % _('Margin'))
|
||||
self.margin_label.setToolTip(
|
||||
_("Distance by which to avoid\n"
|
||||
"the edges of the Gerber object.")
|
||||
# Thickness
|
||||
self.thick_label = QtWidgets.QLabel('%s:' % _('Copper Thickness'))
|
||||
self.thick_label.setToolTip(
|
||||
_("The thickness of the copper foil.\n"
|
||||
"In microns [um].")
|
||||
)
|
||||
self.margin_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
||||
self.margin_entry.set_precision(self.decimals)
|
||||
self.margin_entry.set_range(0.0000, 9999.9999)
|
||||
self.margin_entry.setObjectName(_("Margin"))
|
||||
self.thick_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
||||
self.thick_entry.set_precision(self.decimals)
|
||||
self.thick_entry.set_range(0.0000, 9999.9999)
|
||||
self.thick_entry.setObjectName(_("Thickness"))
|
||||
|
||||
grid0.addWidget(self.margin_label, 5, 0, 1, 2)
|
||||
grid0.addWidget(self.margin_entry, 6, 0, 1, 2)
|
||||
grid0.addWidget(self.thick_label, 5, 0, 1, 2)
|
||||
grid0.addWidget(self.thick_entry, 6, 0, 1, 2)
|
||||
|
||||
self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style"))
|
||||
self.join_label.setToolTip(
|
||||
_("The way that the lines in the object outline will be joined.\n"
|
||||
self.ratio_label = QtWidgets.QLabel('%s:' % _("Ratio"))
|
||||
self.ratio_label.setToolTip(
|
||||
_("The ratio of lateral etch versus depth etch.\n"
|
||||
"Can be:\n"
|
||||
"- rounded -> an arc is added between two joining lines\n"
|
||||
"- square -> the lines meet in 90 degrees angle\n"
|
||||
"- bevel -> the lines are joined by a third line")
|
||||
"- custom -> the user will enter a custom value\n"
|
||||
"- preselection -> value which depends on a selection of etchants")
|
||||
)
|
||||
self.join_radio = RadioSet([
|
||||
{'label': 'Rounded', 'value': 'r'},
|
||||
{'label': 'Square', 'value': 's'},
|
||||
{'label': 'Bevel', 'value': 'b'}
|
||||
], orientation='vertical', stretch=False)
|
||||
self.ratio_radio = RadioSet([
|
||||
{'label': _('PreSelection'), 'value': 'p'},
|
||||
{'label': _('Custom'), 'value': 'c'}
|
||||
])
|
||||
|
||||
grid0.addWidget(self.join_label, 7, 0, 1, 2)
|
||||
grid0.addWidget(self.join_radio, 8, 0, 1, 2)
|
||||
grid0.addWidget(self.ratio_label, 7, 0, 1, 2)
|
||||
grid0.addWidget(self.ratio_radio, 8, 0, 1, 2)
|
||||
|
||||
separator_line = QtWidgets.QFrame()
|
||||
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
grid0.addWidget(separator_line, 9, 0, 1, 2)
|
||||
|
||||
self.invert_btn = FCButton(_('Invert Gerber'))
|
||||
self.invert_btn.setToolTip(
|
||||
_("Will invert the Gerber object: areas that have copper\n"
|
||||
"will be empty of copper and previous empty area will be\n"
|
||||
"filled with copper.")
|
||||
self.compensate_btn = FCButton(_('Compensate'))
|
||||
self.compensate_btn.setToolTip(
|
||||
_("Will increase the copper features thickness to compensate the lateral etch.")
|
||||
)
|
||||
self.invert_btn.setStyleSheet("""
|
||||
self.compensate_btn.setStyleSheet("""
|
||||
QPushButton
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
""")
|
||||
grid0.addWidget(self.invert_btn, 10, 0, 1, 2)
|
||||
grid0.addWidget(self.compensate_btn, 10, 0, 1, 2)
|
||||
|
||||
self.tools_box.addStretch()
|
||||
|
||||
|
@ -149,8 +145,9 @@ class ToolEtchCompensation(AppTool):
|
|||
""")
|
||||
self.tools_box.addWidget(self.reset_button)
|
||||
|
||||
self.invert_btn.clicked.connect(self.on_grb_invert)
|
||||
self.compensate_btn.clicked.connect(self.on_grb_invert)
|
||||
self.reset_button.clicked.connect(self.set_tool_ui)
|
||||
self.ratio_radio.activated_custom.connect(self.on_ratio_change)
|
||||
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
AppTool.install(self, icon, separator, shortcut='', **kwargs)
|
||||
|
@ -184,8 +181,11 @@ class ToolEtchCompensation(AppTool):
|
|||
self.app.ui.notebook.setTabText(2, _("Invert Tool"))
|
||||
|
||||
def set_tool_ui(self):
|
||||
self.margin_entry.set_value(float(self.app.defaults["tools_invert_margin"]))
|
||||
self.join_radio.set_value(self.app.defaults["tools_invert_join_style"])
|
||||
self.thick_entry.set_value(18)
|
||||
self.ratio_radio.set_value('p')
|
||||
|
||||
def on_ratio_change(self, val):
|
||||
pass
|
||||
|
||||
def on_grb_invert(self):
|
||||
margin = self.margin_entry.get_value()
|
||||
|
|
241
App_Main.py
241
App_Main.py
|
@ -959,21 +959,6 @@ class App(QtCore.QObject):
|
|||
self.ui.general_defaults_form.general_app_set_group.cursor_radio.activated_custom.connect(self.on_cursor_type)
|
||||
|
||||
# ######################################## Tools related signals ############################################
|
||||
# Film Tool
|
||||
self.ui.tools_defaults_form.tools_film_group.film_color_entry.editingFinished.connect(
|
||||
self.on_film_color_entry)
|
||||
self.ui.tools_defaults_form.tools_film_group.film_color_button.clicked.connect(
|
||||
self.on_film_color_button)
|
||||
|
||||
# QRCode Tool
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.editingFinished.connect(
|
||||
self.on_qrcode_fill_color_entry)
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.clicked.connect(
|
||||
self.on_qrcode_fill_color_button)
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.editingFinished.connect(
|
||||
self.on_qrcode_back_color_entry)
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.clicked.connect(
|
||||
self.on_qrcode_back_color_button)
|
||||
|
||||
# portability changed signal
|
||||
self.ui.general_defaults_form.general_app_group.portability_cb.stateChanged.connect(self.on_portable_checked)
|
||||
|
@ -981,15 +966,6 @@ class App(QtCore.QObject):
|
|||
# Object list
|
||||
self.object_status_changed.connect(self.collection.on_collection_updated)
|
||||
|
||||
# Make sure that when the Excellon loading parameters are changed, the change is reflected in the
|
||||
# Export Excellon parameters.
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.update_excellon_cb.stateChanged.connect(
|
||||
self.on_update_exc_export
|
||||
)
|
||||
|
||||
# call it once to make sure it is updated at startup
|
||||
self.on_update_exc_export(state=self.defaults["excellon_update"])
|
||||
|
||||
# when there are arguments at application startup this get launched
|
||||
self.args_at_startup[list].connect(self.on_startup_args)
|
||||
|
||||
|
@ -4127,223 +4103,6 @@ class App(QtCore.QObject):
|
|||
self.app_cursor.enabled = True
|
||||
self.app_cursor.enabled = False
|
||||
|
||||
def on_update_exc_export(self, state):
|
||||
"""
|
||||
This is handling the update of Excellon Export parameters based on the ones in the Excellon General but only
|
||||
if the update_excellon_cb checkbox is checked
|
||||
|
||||
:param state: state of the checkbox whose signals is tied to his slot
|
||||
:return:
|
||||
"""
|
||||
if state:
|
||||
# first try to disconnect
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom. \
|
||||
disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom. \
|
||||
disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
# the connect them
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.returnPressed.connect(
|
||||
self.on_excellon_format_changed)
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.returnPressed.connect(
|
||||
self.on_excellon_format_changed)
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed.connect(
|
||||
self.on_excellon_format_changed)
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed.connect(
|
||||
self.on_excellon_format_changed)
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom.connect(
|
||||
self.on_excellon_zeros_changed)
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom.connect(
|
||||
self.on_excellon_units_changed)
|
||||
else:
|
||||
# disconnect the signals
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed. \
|
||||
disconnect(self.on_excellon_format_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom. \
|
||||
disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom. \
|
||||
disconnect(self.on_excellon_zeros_changed)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
def on_excellon_format_changed(self):
|
||||
"""
|
||||
Slot activated when the user changes the Excellon format values in Preferences -> Excellon -> Excellon General
|
||||
:return: None
|
||||
"""
|
||||
if self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.get_value().upper() == 'METRIC':
|
||||
self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry.set_value(
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.get_value()
|
||||
)
|
||||
self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry.set_value(
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.get_value()
|
||||
)
|
||||
else:
|
||||
self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry.set_value(
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.get_value()
|
||||
)
|
||||
self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry.set_value(
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.get_value()
|
||||
)
|
||||
|
||||
def on_excellon_zeros_changed(self):
|
||||
"""
|
||||
Slot activated when the user changes the Excellon zeros values in Preferences -> Excellon -> Excellon General
|
||||
:return: None
|
||||
"""
|
||||
self.ui.excellon_defaults_form.excellon_exp_group.zeros_radio.set_value(
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.get_value() + 'Z'
|
||||
)
|
||||
|
||||
def on_excellon_units_changed(self):
|
||||
"""
|
||||
Slot activated when the user changes the Excellon unit values in Preferences -> Excellon -> Excellon General
|
||||
:return: None
|
||||
"""
|
||||
self.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio.set_value(
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.get_value()
|
||||
)
|
||||
self.on_excellon_format_changed()
|
||||
|
||||
def on_film_color_entry(self):
|
||||
self.defaults['tools_film_color'] = \
|
||||
self.ui.tools_defaults_form.tools_film_group.film_color_entry.get_value()
|
||||
self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(self.defaults['tools_film_color'])
|
||||
)
|
||||
|
||||
def on_film_color_button(self):
|
||||
current_color = QtGui.QColor(self.defaults['tools_film_color'])
|
||||
|
||||
c_dialog = QtWidgets.QColorDialog()
|
||||
film_color = c_dialog.getColor(initial=current_color)
|
||||
|
||||
if film_color.isValid() is False:
|
||||
return
|
||||
|
||||
# if new color is different then mark that the Preferences are changed
|
||||
if film_color != current_color:
|
||||
self.preferencesUiManager.on_preferences_edited()
|
||||
|
||||
self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(film_color.name())
|
||||
)
|
||||
new_val_sel = str(film_color.name())
|
||||
self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(new_val_sel)
|
||||
self.defaults['tools_film_color'] = new_val_sel
|
||||
|
||||
def on_qrcode_fill_color_entry(self):
|
||||
self.defaults['tools_qrcode_fill_color'] = \
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.get_value()
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])
|
||||
)
|
||||
|
||||
def on_qrcode_fill_color_button(self):
|
||||
current_color = QtGui.QColor(self.defaults['tools_qrcode_fill_color'])
|
||||
|
||||
c_dialog = QtWidgets.QColorDialog()
|
||||
fill_color = c_dialog.getColor(initial=current_color)
|
||||
|
||||
if fill_color.isValid() is False:
|
||||
return
|
||||
|
||||
# if new color is different then mark that the Preferences are changed
|
||||
if fill_color != current_color:
|
||||
self.preferencesUiManager.on_preferences_edited()
|
||||
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(fill_color.name())
|
||||
)
|
||||
|
||||
new_val_sel = str(fill_color.name())
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.set_value(new_val_sel)
|
||||
self.defaults['tools_qrcode_fill_color'] = new_val_sel
|
||||
|
||||
def on_qrcode_back_color_entry(self):
|
||||
self.defaults['tools_qrcode_back_color'] = \
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.get_value()
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])
|
||||
)
|
||||
|
||||
def on_qrcode_back_color_button(self):
|
||||
current_color = QtGui.QColor(self.defaults['tools_qrcode_back_color'])
|
||||
|
||||
c_dialog = QtWidgets.QColorDialog()
|
||||
back_color = c_dialog.getColor(initial=current_color)
|
||||
|
||||
if back_color.isValid() is False:
|
||||
return
|
||||
|
||||
# if new color is different then mark that the Preferences are changed
|
||||
if back_color != current_color:
|
||||
self.preferencesUiManager.on_preferences_edited()
|
||||
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.setStyleSheet(
|
||||
"background-color:%s;"
|
||||
"border-color: dimgray" % str(back_color.name())
|
||||
)
|
||||
|
||||
new_val_sel = str(back_color.name())
|
||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.set_value(new_val_sel)
|
||||
self.defaults['tools_qrcode_back_color'] = new_val_sel
|
||||
|
||||
def on_tab_rmb_click(self, checked):
|
||||
self.ui.notebook.set_detachable(val=checked)
|
||||
self.defaults["global_tabs_detachable"] = checked
|
||||
|
|
|
@ -25,6 +25,7 @@ CHANGELOG for FlatCAM beta
|
|||
- solved a circular import
|
||||
- updated the language translation files to the latest changes (no translation)
|
||||
- working on a new Tool: Etch Compensation Tool -> installed the tool and created the GUI and class template
|
||||
- moved more methods out of App_Main class
|
||||
|
||||
17.05.2020
|
||||
|
||||
|
|
Loading…
Reference in New Issue