- updated the FCRadio class with a method that allow disabling certain options

- the Path optimization options for Excellon and Geometry objects are now available depending on the OS platform used (32bit vs 64bit)
This commit is contained in:
Marius Stanciu
2020-07-21 00:57:26 +03:00
committed by Marius
parent a3e1570747
commit e99dd967fe
5 changed files with 48 additions and 26 deletions

View File

@@ -1,9 +1,9 @@
import platform
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QSettings
from appGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCEntry, FCSliderWithSpinner, FCColorEntry
from appGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCSliderWithSpinner, FCColorEntry
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext
import appTranslation as fcTranslate
@@ -219,25 +219,13 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
"If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
"drill path optimization.\n"
"\n"
"If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
"Travelling Salesman algorithm for path optimization.")
"Some options are disabled when FlatCAM works in 32bit mode.")
)
self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
{'label': _('Basic'), 'value': 'B'},
{'label': _('TSA'), 'value': 'T'}],
orientation='vertical', stretch=False)
self.excellon_optimization_radio.setToolTip(
_("This sets the optimization type for the Excellon drill path.\n"
"If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
"MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
"If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
"If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
"drill path optimization.\n"
"\n"
"If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
"Travelling Salesman algorithm for path optimization.")
)
grid2.addWidget(self.excellon_optimization_label, 9, 0)
grid2.addWidget(self.excellon_optimization_radio, 9, 1)
@@ -319,15 +307,11 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
current_platform = platform.architecture()[0]
if current_platform == '64bit':
self.excellon_optimization_label.setDisabled(False)
self.excellon_optimization_radio.setDisabled(False)
self.excellon_optimization_radio.setOptionsDisabled([_('MetaHeuristic'), _('Basic')], False)
self.optimization_time_label.setDisabled(False)
self.optimization_time_entry.setDisabled(False)
self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
else:
self.excellon_optimization_label.setDisabled(True)
self.excellon_optimization_radio.setDisabled(True)
self.excellon_optimization_radio.setOptionsDisabled([_('MetaHeuristic'), _('Basic')], True)
self.optimization_time_label.setDisabled(True)
self.optimization_time_entry.setDisabled(True)
@@ -346,6 +330,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
# call it once to make sure it is updated at startup
self.on_update_exc_export(state=self.app.defaults["excellon_update"])
self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
def optimization_selection(self):
if self.excellon_optimization_radio.get_value() == 'M':
self.optimization_time_label.setDisabled(False)

View File

@@ -4,6 +4,8 @@ from PyQt5.QtCore import QSettings
from appGUI.GUIElements import FCCheckBox, FCSpinner, FCEntry, FCColorEntry, RadioSet
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import platform
import gettext
import appTranslation as fcTranslate
import builtins
@@ -98,8 +100,7 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
"- Basic -> Using Google OR-Tools Basic algorithm\n"
"- TSA -> Using Travelling Salesman algorithm\n"
"\n"
"If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
"Travelling Salesman algorithm for path optimization.")
"Some options are disabled when FlatCAM works in 32bit mode.")
)
self.opt_algorithm_radio = RadioSet(
@@ -165,8 +166,28 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
self.layout.addStretch()
current_platform = platform.architecture()[0]
if current_platform == '64bit':
self.opt_algorithm_radio.setOptionsDisabled([_('MetaHeuristic'), _('Basic')], False)
self.optimization_time_label.setDisabled(False)
self.optimization_time_entry.setDisabled(False)
else:
self.opt_algorithm_radio.setOptionsDisabled([_('MetaHeuristic'), _('Basic')], True)
self.optimization_time_label.setDisabled(True)
self.optimization_time_entry.setDisabled(True)
self.opt_algorithm_radio.activated_custom.connect(self.optimization_selection)
# Setting plot colors signals
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
def on_line_color_entry(self):
self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
def optimization_selection(self, val):
if val == 'M':
self.optimization_time_label.setDisabled(False)
self.optimization_time_entry.setDisabled(False)
else:
self.optimization_time_label.setDisabled(True)
self.optimization_time_entry.setDisabled(True)