- remade file names in the app
- fixed the issue with factory_defaults being saved every time the app start - fixed the preferences not being saved to a file when the Save button is pressed in Edit -> Preferences - fixed and updated the Transform Tools in the Editors
This commit is contained in:
83
appGUI/preferences/utilities/AutoCompletePrefGroupUI.py
Normal file
83
appGUI/preferences/utilities/AutoCompletePrefGroupUI.py
Normal file
@@ -0,0 +1,83 @@
|
||||
from PyQt5 import QtWidgets, QtGui
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from appGUI.GUIElements import FCButton, FCTextArea, FCEntry
|
||||
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||
|
||||
import gettext
|
||||
import appTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
settings = QSettings("Open Source", "FlatCAM")
|
||||
if settings.contains("machinist"):
|
||||
machinist_setting = settings.value('machinist', type=int)
|
||||
else:
|
||||
machinist_setting = 0
|
||||
|
||||
|
||||
class AutoCompletePrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, decimals=4, parent=None):
|
||||
# OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
|
||||
super().__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("Autocompleter Keywords")))
|
||||
self.decimals = decimals
|
||||
|
||||
self.restore_btn = FCButton(_("Restore"))
|
||||
self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
|
||||
self.del_all_btn = FCButton(_("Delete All"))
|
||||
self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
|
||||
|
||||
hlay0 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay0)
|
||||
hlay0.addWidget(self.restore_btn)
|
||||
hlay0.addWidget(self.del_all_btn)
|
||||
|
||||
# ## Gerber associations
|
||||
self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
|
||||
self.grb_list_label.setToolTip(
|
||||
_("List of keywords used by\n"
|
||||
"the autocompleter in FlatCAM.\n"
|
||||
"The autocompleter is installed\n"
|
||||
"in the Code Editor and for the Tcl Shell.")
|
||||
)
|
||||
self.layout.addWidget(self.grb_list_label)
|
||||
|
||||
qsettings = QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("textbox_font_size"):
|
||||
tb_fsize = qsettings.value('textbox_font_size', type=int)
|
||||
else:
|
||||
tb_fsize = 10
|
||||
|
||||
self.kw_list_text = FCTextArea()
|
||||
self.kw_list_text.setReadOnly(True)
|
||||
# self.grb_list_text.sizeHint(custom_sizehint=150)
|
||||
self.layout.addWidget(self.kw_list_text)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(tb_fsize)
|
||||
self.kw_list_text.setFont(font)
|
||||
|
||||
self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
|
||||
self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
|
||||
self.kw_entry = FCEntry()
|
||||
|
||||
hlay1 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay1)
|
||||
hlay1.addWidget(self.kw_label)
|
||||
hlay1.addWidget(self.kw_entry)
|
||||
|
||||
self.add_btn = FCButton(_("Add keyword"))
|
||||
self.add_btn.setToolTip(_("Add a keyword to the list"))
|
||||
self.del_btn = FCButton(_("Delete keyword"))
|
||||
self.del_btn.setToolTip(_("Delete a keyword from the list"))
|
||||
|
||||
hlay2 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay2)
|
||||
hlay2.addWidget(self.add_btn)
|
||||
hlay2.addWidget(self.del_btn)
|
||||
|
||||
# self.layout.addStretch()
|
||||
102
appGUI/preferences/utilities/FAExcPrefGroupUI.py
Normal file
102
appGUI/preferences/utilities/FAExcPrefGroupUI.py
Normal file
@@ -0,0 +1,102 @@
|
||||
from PyQt5 import QtWidgets, QtGui
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from appGUI.GUIElements import VerticalScrollArea, FCButton, FCTextArea, FCEntry
|
||||
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||
|
||||
import gettext
|
||||
import appTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
settings = QSettings("Open Source", "FlatCAM")
|
||||
if settings.contains("machinist"):
|
||||
machinist_setting = settings.value('machinist', type=int)
|
||||
else:
|
||||
machinist_setting = 0
|
||||
|
||||
|
||||
class FAExcPrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, decimals=4, parent=None):
|
||||
# OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
|
||||
super().__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("Excellon File associations")))
|
||||
self.decimals = decimals
|
||||
|
||||
self.layout.setContentsMargins(2, 2, 2, 2)
|
||||
|
||||
self.vertical_lay = QtWidgets.QVBoxLayout()
|
||||
scroll_widget = QtWidgets.QWidget()
|
||||
|
||||
scroll = VerticalScrollArea()
|
||||
scroll.setWidget(scroll_widget)
|
||||
scroll.setWidgetResizable(True)
|
||||
scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
|
||||
self.restore_btn = FCButton(_("Restore"))
|
||||
self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
|
||||
self.del_all_btn = FCButton(_("Delete All"))
|
||||
self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
|
||||
|
||||
hlay0 = QtWidgets.QHBoxLayout()
|
||||
hlay0.addWidget(self.restore_btn)
|
||||
hlay0.addWidget(self.del_all_btn)
|
||||
self.vertical_lay.addLayout(hlay0)
|
||||
|
||||
# # ## Excellon associations
|
||||
list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
|
||||
list_label.setToolTip(
|
||||
_("List of file extensions to be\n"
|
||||
"associated with FlatCAM.")
|
||||
)
|
||||
self.vertical_lay.addWidget(list_label)
|
||||
|
||||
qsettings = QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("textbox_font_size"):
|
||||
tb_fsize = qsettings.value('textbox_font_size', type=int)
|
||||
else:
|
||||
tb_fsize = 10
|
||||
|
||||
self.exc_list_text = FCTextArea()
|
||||
self.exc_list_text.setReadOnly(True)
|
||||
# self.exc_list_text.sizeHint(custom_sizehint=150)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(tb_fsize)
|
||||
self.exc_list_text.setFont(font)
|
||||
|
||||
self.vertical_lay.addWidget(self.exc_list_text)
|
||||
|
||||
self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
|
||||
self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
|
||||
self.ext_entry = FCEntry()
|
||||
|
||||
hlay1 = QtWidgets.QHBoxLayout()
|
||||
self.vertical_lay.addLayout(hlay1)
|
||||
hlay1.addWidget(self.ext_label)
|
||||
hlay1.addWidget(self.ext_entry)
|
||||
|
||||
self.add_btn = FCButton(_("Add Extension"))
|
||||
self.add_btn.setToolTip(_("Add a file extension to the list"))
|
||||
self.del_btn = FCButton(_("Delete Extension"))
|
||||
self.del_btn.setToolTip(_("Delete a file extension from the list"))
|
||||
|
||||
hlay2 = QtWidgets.QHBoxLayout()
|
||||
self.vertical_lay.addLayout(hlay2)
|
||||
hlay2.addWidget(self.add_btn)
|
||||
hlay2.addWidget(self.del_btn)
|
||||
|
||||
self.exc_list_btn = FCButton(_("Apply Association"))
|
||||
self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
|
||||
"FlatCAM and the files with above extensions.\n"
|
||||
"They will be active after next logon.\n"
|
||||
"This work only in Windows."))
|
||||
self.vertical_lay.addWidget(self.exc_list_btn)
|
||||
|
||||
scroll_widget.setLayout(self.vertical_lay)
|
||||
self.layout.addWidget(scroll)
|
||||
|
||||
# self.vertical_lay.addStretch()
|
||||
89
appGUI/preferences/utilities/FAGcoPrefGroupUI.py
Normal file
89
appGUI/preferences/utilities/FAGcoPrefGroupUI.py
Normal file
@@ -0,0 +1,89 @@
|
||||
from PyQt5 import QtWidgets, QtGui
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from appGUI.GUIElements import FCButton, FCTextArea, FCEntry
|
||||
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||
|
||||
import gettext
|
||||
import appTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
settings = QSettings("Open Source", "FlatCAM")
|
||||
if settings.contains("machinist"):
|
||||
machinist_setting = settings.value('machinist', type=int)
|
||||
else:
|
||||
machinist_setting = 0
|
||||
|
||||
|
||||
class FAGcoPrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, decimals=4, parent=None):
|
||||
# OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
|
||||
super(FAGcoPrefGroupUI, self).__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("GCode File associations")))
|
||||
self.decimals = decimals
|
||||
|
||||
self.restore_btn = FCButton(_("Restore"))
|
||||
self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
|
||||
self.del_all_btn = FCButton(_("Delete All"))
|
||||
self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
|
||||
|
||||
hlay0 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay0)
|
||||
hlay0.addWidget(self.restore_btn)
|
||||
hlay0.addWidget(self.del_all_btn)
|
||||
|
||||
# ## G-Code associations
|
||||
self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
|
||||
self.gco_list_label.setToolTip(
|
||||
_("List of file extensions to be\n"
|
||||
"associated with FlatCAM.")
|
||||
)
|
||||
self.layout.addWidget(self.gco_list_label)
|
||||
|
||||
qsettings = QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("textbox_font_size"):
|
||||
tb_fsize = qsettings.value('textbox_font_size', type=int)
|
||||
else:
|
||||
tb_fsize = 10
|
||||
|
||||
self.gco_list_text = FCTextArea()
|
||||
self.gco_list_text.setReadOnly(True)
|
||||
# self.gco_list_text.sizeHint(custom_sizehint=150)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(tb_fsize)
|
||||
self.gco_list_text.setFont(font)
|
||||
|
||||
self.layout.addWidget(self.gco_list_text)
|
||||
|
||||
self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
|
||||
self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
|
||||
self.ext_entry = FCEntry()
|
||||
|
||||
hlay1 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay1)
|
||||
hlay1.addWidget(self.ext_label)
|
||||
hlay1.addWidget(self.ext_entry)
|
||||
|
||||
self.add_btn = FCButton(_("Add Extension"))
|
||||
self.add_btn.setToolTip(_("Add a file extension to the list"))
|
||||
self.del_btn = FCButton(_("Delete Extension"))
|
||||
self.del_btn.setToolTip(_("Delete a file extension from the list"))
|
||||
|
||||
hlay2 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay2)
|
||||
hlay2.addWidget(self.add_btn)
|
||||
hlay2.addWidget(self.del_btn)
|
||||
|
||||
self.gco_list_btn = FCButton(_("Apply Association"))
|
||||
self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
|
||||
"FlatCAM and the files with above extensions.\n"
|
||||
"They will be active after next logon.\n"
|
||||
"This work only in Windows."))
|
||||
self.layout.addWidget(self.gco_list_btn)
|
||||
|
||||
# self.layout.addStretch()
|
||||
89
appGUI/preferences/utilities/FAGrbPrefGroupUI.py
Normal file
89
appGUI/preferences/utilities/FAGrbPrefGroupUI.py
Normal file
@@ -0,0 +1,89 @@
|
||||
from PyQt5 import QtWidgets, QtGui
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from appGUI.GUIElements import FCButton, FCTextArea, FCEntry
|
||||
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||
|
||||
import gettext
|
||||
import appTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
settings = QSettings("Open Source", "FlatCAM")
|
||||
if settings.contains("machinist"):
|
||||
machinist_setting = settings.value('machinist', type=int)
|
||||
else:
|
||||
machinist_setting = 0
|
||||
|
||||
|
||||
class FAGrbPrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, decimals=4, parent=None):
|
||||
# OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
|
||||
super(FAGrbPrefGroupUI, self).__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("Gerber File associations")))
|
||||
self.decimals = decimals
|
||||
|
||||
self.restore_btn = FCButton(_("Restore"))
|
||||
self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
|
||||
self.del_all_btn = FCButton(_("Delete All"))
|
||||
self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
|
||||
|
||||
hlay0 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay0)
|
||||
hlay0.addWidget(self.restore_btn)
|
||||
hlay0.addWidget(self.del_all_btn)
|
||||
|
||||
# ## Gerber associations
|
||||
self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
|
||||
self.grb_list_label.setToolTip(
|
||||
_("List of file extensions to be\n"
|
||||
"associated with FlatCAM.")
|
||||
)
|
||||
self.layout.addWidget(self.grb_list_label)
|
||||
|
||||
qsettings = QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("textbox_font_size"):
|
||||
tb_fsize = qsettings.value('textbox_font_size', type=int)
|
||||
else:
|
||||
tb_fsize = 10
|
||||
|
||||
self.grb_list_text = FCTextArea()
|
||||
self.grb_list_text.setReadOnly(True)
|
||||
# self.grb_list_text.sizeHint(custom_sizehint=150)
|
||||
self.layout.addWidget(self.grb_list_text)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(tb_fsize)
|
||||
self.grb_list_text.setFont(font)
|
||||
|
||||
self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
|
||||
self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
|
||||
self.ext_entry = FCEntry()
|
||||
|
||||
hlay1 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay1)
|
||||
hlay1.addWidget(self.ext_label)
|
||||
hlay1.addWidget(self.ext_entry)
|
||||
|
||||
self.add_btn = FCButton(_("Add Extension"))
|
||||
self.add_btn.setToolTip(_("Add a file extension to the list"))
|
||||
self.del_btn = FCButton(_("Delete Extension"))
|
||||
self.del_btn.setToolTip(_("Delete a file extension from the list"))
|
||||
|
||||
hlay2 = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(hlay2)
|
||||
hlay2.addWidget(self.add_btn)
|
||||
hlay2.addWidget(self.del_btn)
|
||||
|
||||
self.grb_list_btn = FCButton(_("Apply Association"))
|
||||
self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
|
||||
"FlatCAM and the files with above extensions.\n"
|
||||
"They will be active after next logon.\n"
|
||||
"This work only in Windows."))
|
||||
|
||||
self.layout.addWidget(self.grb_list_btn)
|
||||
|
||||
# self.layout.addStretch()
|
||||
37
appGUI/preferences/utilities/UtilPreferencesUI.py
Normal file
37
appGUI/preferences/utilities/UtilPreferencesUI.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from PyQt5 import QtWidgets
|
||||
|
||||
from appGUI.preferences.utilities.AutoCompletePrefGroupUI import AutoCompletePrefGroupUI
|
||||
from appGUI.preferences.utilities.FAGrbPrefGroupUI import FAGrbPrefGroupUI
|
||||
from appGUI.preferences.utilities.FAGcoPrefGroupUI import FAGcoPrefGroupUI
|
||||
from appGUI.preferences.utilities.FAExcPrefGroupUI import FAExcPrefGroupUI
|
||||
|
||||
|
||||
class UtilPreferencesUI(QtWidgets.QWidget):
|
||||
|
||||
def __init__(self, decimals, parent=None):
|
||||
QtWidgets.QWidget.__init__(self, parent=parent)
|
||||
self.layout = QtWidgets.QHBoxLayout()
|
||||
self.setLayout(self.layout)
|
||||
self.decimals = decimals
|
||||
|
||||
self.vlay = QtWidgets.QVBoxLayout()
|
||||
self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
|
||||
self.fa_excellon_group.setMinimumWidth(260)
|
||||
|
||||
self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
|
||||
self.fa_gcode_group.setMinimumWidth(260)
|
||||
|
||||
self.vlay.addWidget(self.fa_excellon_group)
|
||||
self.vlay.addWidget(self.fa_gcode_group)
|
||||
|
||||
self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
|
||||
self.fa_gerber_group.setMinimumWidth(260)
|
||||
|
||||
self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
|
||||
self.kw_group.setMinimumWidth(260)
|
||||
|
||||
self.layout.addLayout(self.vlay)
|
||||
self.layout.addWidget(self.fa_gerber_group)
|
||||
self.layout.addWidget(self.kw_group)
|
||||
|
||||
self.layout.addStretch()
|
||||
0
appGUI/preferences/utilities/__init__.py
Normal file
0
appGUI/preferences/utilities/__init__.py
Normal file
Reference in New Issue
Block a user