- 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:
parent
a3e1570747
commit
e99dd967fe
|
@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
|
|||
|
||||
=================================================
|
||||
|
||||
21.07.2020
|
||||
|
||||
- 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)
|
||||
|
||||
20.07.2020
|
||||
|
||||
- fixed a bug in the FlatCAMGerber.on_mark_cb_click_table() method when moving a Gerber object
|
||||
|
|
|
@ -99,6 +99,11 @@ class RadioSet(QtWidgets.QWidget):
|
|||
return
|
||||
log.error("Value given is not part of this RadioSet: %s" % str(val))
|
||||
|
||||
def setOptionsDisabled(self, options: list, val: bool) -> None:
|
||||
for option in self.choices:
|
||||
if option['label'] in options:
|
||||
option['radio'].setDisabled(val)
|
||||
|
||||
|
||||
# class RadioGroupChoice(QtWidgets.QWidget):
|
||||
# def __init__(self, label_1, label_2, to_check, hide_list, show_list, parent=None):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
11
app_Main.py
11
app_Main.py
|
@ -1578,11 +1578,16 @@ class App(QtCore.QObject):
|
|||
|
||||
self.set_ui_title(name=_("New Project - Not saved"))
|
||||
|
||||
# disable the Excellon path optimizations made with Google OR-Tools if the app is run on a 32bit platform
|
||||
current_platform = platform.architecture()[0]
|
||||
if current_platform != '64bit':
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio.set_value('T')
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio.setDisabled(True)
|
||||
# set Excellon path optimizations algorithm to TSA if the app is run on a 32bit platform
|
||||
# modes 'M' or 'B' are not allowed when the app is running in 32bit platform
|
||||
if self.defaults['excellon_optimization_type'] in ['M', 'B']:
|
||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio.set_value('T')
|
||||
# set Geometry path optimizations algorithm to Rtree if the app is run on a 32bit platform
|
||||
# modes 'M' or 'B' are not allowed when the app is running in 32bit platform
|
||||
if self.defaults['geometry_optimization_type'] in ['M', 'B']:
|
||||
self.ui.geometry_defaults_form.geometry_gen_group.opt_algorithm_radio.set_value('R')
|
||||
|
||||
# ###########################################################################################################
|
||||
# ########################################### EXCLUSION AREAS ###############################################
|
||||
|
|
Loading…
Reference in New Issue