- increased the number of workers in FlatCAM and made the number of workers customizable from Preferences
This commit is contained in:
@@ -3519,6 +3519,25 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
|
||||
_( "Check this box if you want to have toolTips displayed\n"
|
||||
"when hovering with mouse over items throughout the App.")
|
||||
)
|
||||
self.worker_number_label = QtWidgets.QLabel(_('Workers number:'))
|
||||
self.worker_number_label.setToolTip(
|
||||
_("The number of Qthreads made available to the App.\n"
|
||||
"A bigger number may finish the jobs more quickly but\n"
|
||||
"depending on your computer speed, may make the App\n"
|
||||
"unresponsive. Can have a value between 2 and 16.\n"
|
||||
"Default value is 2.\n"
|
||||
"After change, it will be applied at next App start.")
|
||||
)
|
||||
self.worker_number_sb = FCSpinner()
|
||||
self.worker_number_sb.setToolTip(
|
||||
_("The number of Qthreads made available to the App.\n"
|
||||
"A bigger number may finish the jobs more quickly but\n"
|
||||
"depending on your computer speed, may make the App\n"
|
||||
"unresponsive. Can have a value between 2 and 16.\n"
|
||||
"Default value is 2.\n"
|
||||
"After change, it will be applied at next App start.")
|
||||
)
|
||||
self.worker_number_sb.set_range(2, 16)
|
||||
|
||||
# Just to add empty rows
|
||||
self.spacelabel = QtWidgets.QLabel('')
|
||||
@@ -3539,6 +3558,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
|
||||
self.form_box.addRow(self.project_startup_label, self.project_startup_cb)
|
||||
self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb)
|
||||
self.form_box.addRow(self.toggle_tooltips_label, self.toggle_tooltips_cb)
|
||||
self.form_box.addRow(self.worker_number_label, self.worker_number_sb)
|
||||
|
||||
self.form_box.addRow(self.spacelabel, self.spacelabel)
|
||||
|
||||
# Add the QFormLayout that holds the Application general defaults
|
||||
|
||||
@@ -1382,6 +1382,18 @@ class SpinBoxDelegate(QtWidgets.QItemDelegate):
|
||||
class FCSpinner(QtWidgets.QSpinBox):
|
||||
def __init__(self, parent=None):
|
||||
super(FCSpinner, self).__init__(parent)
|
||||
self.readyToEdit = True
|
||||
|
||||
def mousePressEvent(self, e, parent=None):
|
||||
super(FCSpinner, self).mousePressEvent(e) # required to deselect on 2e click
|
||||
if self.readyToEdit:
|
||||
self.lineEdit().selectAll()
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
super(FCSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.lineEdit().deselect()
|
||||
self.readyToEdit = True
|
||||
|
||||
def get_value(self):
|
||||
return str(self.value())
|
||||
@@ -1394,6 +1406,9 @@ class FCSpinner(QtWidgets.QSpinBox):
|
||||
return
|
||||
self.setValue(k)
|
||||
|
||||
def set_range(self, min_val, max_val):
|
||||
self.setRange(min_val, max_val)
|
||||
|
||||
# def sizeHint(self):
|
||||
# default_hint_size = super(FCSpinner, self).sizeHint()
|
||||
# return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
||||
@@ -1430,7 +1445,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||
self.setDecimals(val)
|
||||
|
||||
def set_range(self, min_val, max_val):
|
||||
self.setRange(self, min_val, max_val)
|
||||
self.setRange(min_val, max_val)
|
||||
|
||||
|
||||
class Dialog_box(QtWidgets.QWidget):
|
||||
|
||||
Reference in New Issue
Block a user