- moved more methods out of App_Main class

This commit is contained in:
Marius Stanciu 2020-05-18 21:53:52 +03:00 committed by Marius
parent 04b8de9fd3
commit 10cb6149fb
7 changed files with 242 additions and 278 deletions

View File

@ -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 # I want to take the focus and give it to the Tcl Shell when the Tcl Shell is run
# self.shell._edit.setFocus() # 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 # HACK - simulate a mouse click - alternative
# no_km = QtCore.Qt.KeyboardModifier(QtCore.Qt.NoModifier) # no KB modifier # no_km = QtCore.Qt.KeyboardModifier(QtCore.Qt.NoModifier) # no KB modifier

View File

@ -341,6 +341,12 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
# Load the defaults values into the Excellon Format and Excellon Zeros fields # Load the defaults values into the Excellon Format and Excellon Zeros fields
self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button) 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): def optimization_selection(self):
if self.excellon_optimization_radio.get_value() == 'M': 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_format_upper_mm"].set_value('3')
self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L') self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L')
self.app.preferencesUiManager.defaults_form_fields["excellon_units"].set_value('INCH') 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()

View File

@ -1,4 +1,4 @@
from PyQt5 import QtWidgets, QtCore from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt, QSettings from PyQt5.QtCore import Qt, QSettings
from AppGUI.GUIElements import FCSpinner, RadioSet, FCTextArea, FCEntry 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_label, 11, 0)
grid_lay.addWidget(self.sel_limit_entry, 11, 1) grid_lay.addWidget(self.sel_limit_entry, 11, 1)
# self.layout.addStretch() # 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

View File

@ -1,4 +1,4 @@
from PyQt5 import QtWidgets, QtCore from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt, QSettings from PyQt5.QtCore import Qt, QSettings
from AppGUI.GUIElements import RadioSet, FCEntry, FCDoubleSpinner, FCCheckBox, FCComboBox from AppGUI.GUIElements import RadioSet, FCEntry, FCDoubleSpinner, FCCheckBox, FCComboBox
@ -314,3 +314,35 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.pagesize_combo, 17, 1) grid0.addWidget(self.pagesize_combo, 17, 1)
self.layout.addStretch() 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

View File

@ -84,55 +84,51 @@ class ToolEtchCompensation(AppTool):
grid0.addWidget(self.param_label, 4, 0, 1, 2) grid0.addWidget(self.param_label, 4, 0, 1, 2)
# Margin # Thickness
self.margin_label = QtWidgets.QLabel('%s:' % _('Margin')) self.thick_label = QtWidgets.QLabel('%s:' % _('Copper Thickness'))
self.margin_label.setToolTip( self.thick_label.setToolTip(
_("Distance by which to avoid\n" _("The thickness of the copper foil.\n"
"the edges of the Gerber object.") "In microns [um].")
) )
self.margin_entry = FCDoubleSpinner(callback=self.confirmation_message) self.thick_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.margin_entry.set_precision(self.decimals) self.thick_entry.set_precision(self.decimals)
self.margin_entry.set_range(0.0000, 9999.9999) self.thick_entry.set_range(0.0000, 9999.9999)
self.margin_entry.setObjectName(_("Margin")) self.thick_entry.setObjectName(_("Thickness"))
grid0.addWidget(self.margin_label, 5, 0, 1, 2) grid0.addWidget(self.thick_label, 5, 0, 1, 2)
grid0.addWidget(self.margin_entry, 6, 0, 1, 2) grid0.addWidget(self.thick_entry, 6, 0, 1, 2)
self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style")) self.ratio_label = QtWidgets.QLabel('%s:' % _("Ratio"))
self.join_label.setToolTip( self.ratio_label.setToolTip(
_("The way that the lines in the object outline will be joined.\n" _("The ratio of lateral etch versus depth etch.\n"
"Can be:\n" "Can be:\n"
"- rounded -> an arc is added between two joining lines\n" "- custom -> the user will enter a custom value\n"
"- square -> the lines meet in 90 degrees angle\n" "- preselection -> value which depends on a selection of etchants")
"- bevel -> the lines are joined by a third line")
) )
self.join_radio = RadioSet([ self.ratio_radio = RadioSet([
{'label': 'Rounded', 'value': 'r'}, {'label': _('PreSelection'), 'value': 'p'},
{'label': 'Square', 'value': 's'}, {'label': _('Custom'), 'value': 'c'}
{'label': 'Bevel', 'value': 'b'} ])
], orientation='vertical', stretch=False)
grid0.addWidget(self.join_label, 7, 0, 1, 2) grid0.addWidget(self.ratio_label, 7, 0, 1, 2)
grid0.addWidget(self.join_radio, 8, 0, 1, 2) grid0.addWidget(self.ratio_radio, 8, 0, 1, 2)
separator_line = QtWidgets.QFrame() separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 9, 0, 1, 2) grid0.addWidget(separator_line, 9, 0, 1, 2)
self.invert_btn = FCButton(_('Invert Gerber')) self.compensate_btn = FCButton(_('Compensate'))
self.invert_btn.setToolTip( self.compensate_btn.setToolTip(
_("Will invert the Gerber object: areas that have copper\n" _("Will increase the copper features thickness to compensate the lateral etch.")
"will be empty of copper and previous empty area will be\n"
"filled with copper.")
) )
self.invert_btn.setStyleSheet(""" self.compensate_btn.setStyleSheet("""
QPushButton QPushButton
{ {
font-weight: bold; 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() self.tools_box.addStretch()
@ -149,8 +145,9 @@ class ToolEtchCompensation(AppTool):
""") """)
self.tools_box.addWidget(self.reset_button) 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.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): def install(self, icon=None, separator=None, **kwargs):
AppTool.install(self, icon, separator, shortcut='', **kwargs) AppTool.install(self, icon, separator, shortcut='', **kwargs)
@ -184,8 +181,11 @@ class ToolEtchCompensation(AppTool):
self.app.ui.notebook.setTabText(2, _("Invert Tool")) self.app.ui.notebook.setTabText(2, _("Invert Tool"))
def set_tool_ui(self): def set_tool_ui(self):
self.margin_entry.set_value(float(self.app.defaults["tools_invert_margin"])) self.thick_entry.set_value(18)
self.join_radio.set_value(self.app.defaults["tools_invert_join_style"]) self.ratio_radio.set_value('p')
def on_ratio_change(self, val):
pass
def on_grb_invert(self): def on_grb_invert(self):
margin = self.margin_entry.get_value() margin = self.margin_entry.get_value()

View File

@ -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) self.ui.general_defaults_form.general_app_set_group.cursor_radio.activated_custom.connect(self.on_cursor_type)
# ######################################## Tools related signals ############################################ # ######################################## 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 # portability changed signal
self.ui.general_defaults_form.general_app_group.portability_cb.stateChanged.connect(self.on_portable_checked) 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 # Object list
self.object_status_changed.connect(self.collection.on_collection_updated) 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 # when there are arguments at application startup this get launched
self.args_at_startup[list].connect(self.on_startup_args) 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 = True
self.app_cursor.enabled = False 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): def on_tab_rmb_click(self, checked):
self.ui.notebook.set_detachable(val=checked) self.ui.notebook.set_detachable(val=checked)
self.defaults["global_tabs_detachable"] = checked self.defaults["global_tabs_detachable"] = checked

View File

@ -25,6 +25,7 @@ CHANGELOG for FlatCAM beta
- solved a circular import - solved a circular import
- updated the language translation files to the latest changes (no translation) - 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 - 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 17.05.2020