- moved more methods out of App_Main class
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user