- fixed an issue in old default file detection and in saving the factory defaults file
- in Preferences window removed the Import/Export Preferences buttons because they are redundant with the entries in the File -> Menu -> Backup. and added a button to Restore Defaults - when in Basic mode the Tool type of the tool in the Geometry UI Tool Table after isolating a Gerber object is automatically selected as 'C1' - let the multiprocessing Pool have as many processes as needed - added a new Preferences setting allowing a custom mouse line width (to make it thicker or thinner)
This commit is contained in:
@@ -1211,23 +1211,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
self.pref_tab_bottom_layout_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
||||
self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1)
|
||||
|
||||
self.pref_import_button = QtWidgets.QPushButton()
|
||||
self.pref_import_button.setText(_("Import Preferences"))
|
||||
self.pref_import_button.setMinimumWidth(130)
|
||||
self.pref_import_button.setToolTip(
|
||||
_("Import a full set of FlatCAM settings from a file\n"
|
||||
"previously saved on HDD.\n\n"
|
||||
"FlatCAM automatically save a 'factory_defaults' file\n"
|
||||
"on the first start. Do not delete that file."))
|
||||
self.pref_tab_bottom_layout_1.addWidget(self.pref_import_button)
|
||||
|
||||
self.pref_export_button = QtWidgets.QPushButton()
|
||||
self.pref_export_button.setText(_("Export Preferences"))
|
||||
self.pref_export_button.setMinimumWidth(130)
|
||||
self.pref_export_button.setToolTip(
|
||||
_("Export a full set of FlatCAM settings in a file\n"
|
||||
"that is saved on HDD."))
|
||||
self.pref_tab_bottom_layout_1.addWidget(self.pref_export_button)
|
||||
self.pref_defaults_button = QtWidgets.QPushButton()
|
||||
self.pref_defaults_button.setText(_("Restore Defaults"))
|
||||
self.pref_defaults_button.setMinimumWidth(130)
|
||||
self.pref_defaults_button.setToolTip(
|
||||
_("Restore the entire set of default valaues\n"
|
||||
"to the initial values loaded after first launch."))
|
||||
self.pref_tab_bottom_layout_1.addWidget(self.pref_defaults_button)
|
||||
|
||||
self.pref_open_button = QtWidgets.QPushButton()
|
||||
self.pref_open_button.setText(_("Open Pref Folder"))
|
||||
|
||||
@@ -310,6 +310,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
||||
# Update cursor
|
||||
self.fcapp.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
||||
symbol='++', edge_color=self.fcapp.cursor_color_3D,
|
||||
edge_width=self.fcapp.defaults["global_cursor_width"],
|
||||
size=self.fcapp.defaults["global_cursor_size"])
|
||||
|
||||
def new_text_group(self, collection=None):
|
||||
|
||||
@@ -375,16 +375,19 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||
pass
|
||||
# log.debug("Cache updated the screen!")
|
||||
|
||||
def new_cursor(self, axes=None, big=None):
|
||||
def new_cursor(self, axes=None, big=None, color=None):
|
||||
# if axes is None:
|
||||
# c = MplCursor(axes=self.axes, color='black', linewidth=1)
|
||||
# else:
|
||||
# c = MplCursor(axes=axes, color='black', linewidth=1)
|
||||
|
||||
if self.app.defaults['global_theme'] == 'white':
|
||||
color = '#000000'
|
||||
if color:
|
||||
color = color
|
||||
else:
|
||||
color = '#FFFFFF'
|
||||
if self.app.defaults['global_theme'] == 'white':
|
||||
color = '#000000'
|
||||
else:
|
||||
color = '#FFFFFF'
|
||||
|
||||
if big is True:
|
||||
self.big_cursor = True
|
||||
@@ -398,7 +401,7 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||
|
||||
return c
|
||||
|
||||
def draw_cursor(self, x_pos, y_pos):
|
||||
def draw_cursor(self, x_pos, y_pos, color=None):
|
||||
"""
|
||||
Draw a cursor at the mouse grid snapped position
|
||||
|
||||
@@ -408,10 +411,13 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||
"""
|
||||
# there is no point in drawing mouse cursor when panning as it jumps in a confusing way
|
||||
if self.app.app_cursor.enabled is True and self.panning is False:
|
||||
if self.app.defaults['global_theme'] == 'white':
|
||||
color = '#000000'
|
||||
if color:
|
||||
color = color
|
||||
else:
|
||||
color = '#FFFFFF'
|
||||
if self.app.defaults['global_theme'] == 'white':
|
||||
color = '#000000'
|
||||
else:
|
||||
color = '#FFFFFF'
|
||||
|
||||
if self.big_cursor is False:
|
||||
try:
|
||||
@@ -421,10 +427,11 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||
# The size of the cursor is multiplied by 1.65 because that value made the cursor similar with the
|
||||
# one in the OpenGL(3D) graphic engine
|
||||
pointer_size = int(float(self.app.defaults["global_cursor_size"] ) * 1.65)
|
||||
elements = self.axes.plot(x, y, '+', color=color, ms=pointer_size, mew=1, animated=True)
|
||||
elements = self.axes.plot(x, y, '+', color=color, ms=pointer_size,
|
||||
mew=self.app.defaults["global_cursor_width"], animated=True)
|
||||
for el in elements:
|
||||
self.axes.draw_artist(el)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# this happen at app initialization since self.app.geo_editor does not exist yet
|
||||
# I could reshuffle the object instantiating order but what's the point?
|
||||
# I could crash something else and that's pythonic, too
|
||||
|
||||
@@ -1009,6 +1009,18 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
|
||||
grid0.addWidget(self.cursor_size_lbl, 21, 0)
|
||||
grid0.addWidget(self.cursor_size_entry, 21, 1)
|
||||
|
||||
self.cursor_width_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor Width'))
|
||||
self.cursor_width_lbl.setToolTip(
|
||||
_("Set the line width of the mouse cursor, in pixels.")
|
||||
)
|
||||
|
||||
self.cursor_width_entry = FCSpinner()
|
||||
self.cursor_width_entry.set_range(1, 10)
|
||||
self.cursor_width_entry.setWrapping(True)
|
||||
|
||||
grid0.addWidget(self.cursor_width_lbl, 22, 0)
|
||||
grid0.addWidget(self.cursor_width_entry, 22, 1)
|
||||
|
||||
# Delete confirmation
|
||||
self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
|
||||
self.delete_conf_cb.setToolTip(
|
||||
@@ -1016,7 +1028,7 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
|
||||
"whenever the Delete object(s) event is triggered, either by\n"
|
||||
"menu shortcut or key shortcut.")
|
||||
)
|
||||
grid0.addWidget(self.delete_conf_cb, 22, 0, 1, 2)
|
||||
grid0.addWidget(self.delete_conf_cb, 23, 0, 1, 2)
|
||||
|
||||
self.layout.addStretch()
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ def apply_patches():
|
||||
try:
|
||||
self._update_child_widget_dim()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("VisPyPatches.apply_patches._update_clipper() -> %s" % str(e))
|
||||
|
||||
Grid._prepare_draw = _prepare_draw
|
||||
Grid._update_clipper = _update_clipper
|
||||
@@ -72,7 +72,7 @@ def apply_patches():
|
||||
|
||||
if GL:
|
||||
GL.glDisable(GL.GL_LINE_SMOOTH)
|
||||
GL.glLineWidth(1.0)
|
||||
GL.glLineWidth(2.0)
|
||||
|
||||
if self._changed['pos']:
|
||||
self.pos_buf.set_data(self._pos)
|
||||
|
||||
Reference in New Issue
Block a user