Geometry editor prefs

This commit is contained in:
David Robertson 2020-05-09 16:26:54 +01:00
parent 9f2991c003
commit 805a1567d8
2 changed files with 29 additions and 59 deletions

View File

@ -175,10 +175,6 @@ class PreferencesUIManager:
"geometry_area_strategy": self.ui.geometry_defaults_form.geometry_adv_opt_group.strategy_radio, "geometry_area_strategy": self.ui.geometry_defaults_form.geometry_adv_opt_group.strategy_radio,
"geometry_area_overz": self.ui.geometry_defaults_form.geometry_adv_opt_group.over_z_entry, "geometry_area_overz": self.ui.geometry_defaults_form.geometry_adv_opt_group.over_z_entry,
# Geometry Editor
"geometry_editor_sel_limit": self.ui.geometry_defaults_form.geometry_editor_group.sel_limit_entry,
"geometry_editor_milling_type": self.ui.geometry_defaults_form.geometry_editor_group.milling_type_radio,
# CNCJob General # CNCJob General
"cncjob_plot": self.ui.cncjob_defaults_form.cncjob_gen_group.plot_cb, "cncjob_plot": self.ui.cncjob_defaults_form.cncjob_gen_group.plot_cb,
"cncjob_plot_kind": self.ui.cncjob_defaults_form.cncjob_gen_group.cncplot_method_radio, "cncjob_plot_kind": self.ui.cncjob_defaults_form.cncjob_gen_group.cncplot_method_radio,

View File

@ -1,67 +1,41 @@
from PyQt5 import QtWidgets from flatcamGUI.preferences.OptionUI import *
from PyQt5.QtCore import QSettings from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
from flatcamGUI.GUIElements import FCSpinner, RadioSet
from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins
fcTranslate.apply_language('strings') fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__: if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
settings = QSettings("Open Source", "FlatCAM")
if settings.contains("machinist"):
machinist_setting = settings.value('machinist', type=int)
else:
machinist_setting = 0
class GeometryEditorPrefGroupUI(OptionsGroupUI2):
class GeometryEditorPrefGroupUI(OptionsGroupUI): def __init__(self, decimals=4, **kwargs):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GeometryEditorPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Geometry Editor")))
self.decimals = decimals self.decimals = decimals
super().__init__(**kwargs)
self.setTitle(str(_("Geometry Editor")))
# Advanced Geometry Parameters def build_options(self) -> [OptionUI]:
self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters")) return [
self.param_label.setToolTip( HeadingOptionUI(label_text="Parameters"),
_("A list of Geometry Editor parameters.") SpinnerOptionUI(
) option="geometry_editor_sel_limit",
self.layout.addWidget(self.param_label) label_text="Selection limit",
label_tooltip="Set the number of selected geometry\n"
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
# Selection Limit
self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
self.sel_limit_label.setToolTip(
_("Set the number of selected geometry\n"
"items above which the utility geometry\n" "items above which the utility geometry\n"
"becomes just a selection rectangle.\n" "becomes just a selection rectangle.\n"
"Increases the performance when moving a\n" "Increases the performance when moving a\n"
"large number of geometric elements.") "large number of geometric elements.",
) min_value=0, max_value=9999, step=1
self.sel_limit_entry = FCSpinner() ),
self.sel_limit_entry.set_range(0, 9999) RadioSetOptionUI(
option="geometry_editor_milling_type",
grid0.addWidget(self.sel_limit_label, 0, 0) label_text="Milling Type",
grid0.addWidget(self.sel_limit_entry, 0, 1) label_tooltip="Milling type:\n"
# Milling Type
milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
milling_type_label.setToolTip(
_("Milling type:\n"
"- climb / best for precision milling and to reduce tool usage\n" "- climb / best for precision milling and to reduce tool usage\n"
"- conventional / useful when there is no backlash compensation") "- conventional / useful when there is no backlash compensation",
choices=[{'label': _('Climb'), 'value': 'cl'},
{'label': _('Conventional'), 'value': 'cv'}]
) )
self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'}, ]
{'label': _('Conventional'), 'value': 'cv'}])
grid0.addWidget(milling_type_label, 1, 0)
grid0.addWidget(self.milling_type_radio, 1, 1)
self.layout.addStretch()