- 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:
parent
448235b84a
commit
fcc52a2682
174
FlatCAMApp.py
174
FlatCAMApp.py
|
@ -512,6 +512,7 @@ class App(QtCore.QObject):
|
||||||
"global_layout": "compact",
|
"global_layout": "compact",
|
||||||
"global_cursor_type": "small",
|
"global_cursor_type": "small",
|
||||||
"global_cursor_size": 20,
|
"global_cursor_size": 20,
|
||||||
|
"global_cursor_width": 2,
|
||||||
|
|
||||||
# Gerber General
|
# Gerber General
|
||||||
"gerber_plot": True,
|
"gerber_plot": True,
|
||||||
|
@ -993,7 +994,7 @@ class App(QtCore.QObject):
|
||||||
# ##################### CREATE MULTIPROCESSING POOL ###########################
|
# ##################### CREATE MULTIPROCESSING POOL ###########################
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
self.pool = Pool(processes=cpu_count())
|
self.pool = Pool()
|
||||||
|
|
||||||
# ##########################################################################
|
# ##########################################################################
|
||||||
# ################## Setting the Splash Screen #############################
|
# ################## Setting the Splash Screen #############################
|
||||||
|
@ -1136,6 +1137,7 @@ class App(QtCore.QObject):
|
||||||
"global_delete_confirmation": self.ui.general_defaults_form.general_gui_set_group.delete_conf_cb,
|
"global_delete_confirmation": self.ui.general_defaults_form.general_gui_set_group.delete_conf_cb,
|
||||||
"global_cursor_type": self.ui.general_defaults_form.general_gui_set_group.cursor_radio,
|
"global_cursor_type": self.ui.general_defaults_form.general_gui_set_group.cursor_radio,
|
||||||
"global_cursor_size": self.ui.general_defaults_form.general_gui_set_group.cursor_size_entry,
|
"global_cursor_size": self.ui.general_defaults_form.general_gui_set_group.cursor_size_entry,
|
||||||
|
"global_cursor_width": self.ui.general_defaults_form.general_gui_set_group.cursor_width_entry,
|
||||||
|
|
||||||
# Gerber General
|
# Gerber General
|
||||||
"gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
|
"gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
|
||||||
|
@ -1548,6 +1550,30 @@ class App(QtCore.QObject):
|
||||||
# When the self.defaults dictionary changes will update the Preferences GUI forms
|
# When the self.defaults dictionary changes will update the Preferences GUI forms
|
||||||
self.defaults.set_change_callback(self.on_defaults_dict_change)
|
self.defaults.set_change_callback(self.on_defaults_dict_change)
|
||||||
|
|
||||||
|
# ##############################################################################
|
||||||
|
# ########################## FIRST RUN SECTION #################################
|
||||||
|
# ##################### It's done only once after install ####################
|
||||||
|
# ##############################################################################
|
||||||
|
|
||||||
|
if self.defaults["first_run"] is True:
|
||||||
|
|
||||||
|
self.save_factory_defaults(silent_message=False)
|
||||||
|
# and then make the factory_defaults.FlatConfig file read_only so it can't be modified after creation.
|
||||||
|
filename_factory = self.data_path + '/factory_defaults.FlatConfig'
|
||||||
|
os.chmod(filename_factory, S_IREAD | S_IRGRP | S_IROTH)
|
||||||
|
|
||||||
|
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'COMPACT'
|
||||||
|
initial_lay = 'compact'
|
||||||
|
self.on_layout(lay=initial_lay)
|
||||||
|
|
||||||
|
# Set the combobox in Preferences to the current layout
|
||||||
|
idx = self.ui.general_defaults_form.general_gui_set_group.layout_combo.findText(initial_lay)
|
||||||
|
self.ui.general_defaults_form.general_gui_set_group.layout_combo.setCurrentIndex(idx)
|
||||||
|
|
||||||
|
# after the first run, this object should be False
|
||||||
|
self.defaults["first_run"] = False
|
||||||
|
self.save_defaults(silent=True)
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# ############################## Data #########################################
|
# ############################## Data #########################################
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
@ -1953,8 +1979,7 @@ class App(QtCore.QObject):
|
||||||
self.ui.pref_apply_button.clicked.connect(lambda: self.on_save_button(save_to_file=False))
|
self.ui.pref_apply_button.clicked.connect(lambda: self.on_save_button(save_to_file=False))
|
||||||
self.ui.pref_close_button.clicked.connect(self.on_pref_close_button)
|
self.ui.pref_close_button.clicked.connect(self.on_pref_close_button)
|
||||||
|
|
||||||
self.ui.pref_import_button.clicked.connect(self.on_import_preferences)
|
self.ui.pref_defaults_button.clicked.connect(self.on_restore_defaults_preferences)
|
||||||
self.ui.pref_export_button.clicked.connect(self.on_export_preferences)
|
|
||||||
self.ui.pref_open_button.clicked.connect(self.on_preferences_open_folder)
|
self.ui.pref_open_button.clicked.connect(self.on_preferences_open_folder)
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
@ -2645,35 +2670,6 @@ class App(QtCore.QObject):
|
||||||
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
|
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
|
||||||
self.tool_shapes = ShapeCollectionLegacy(obj=self, app=self, name="tool")
|
self.tool_shapes = ShapeCollectionLegacy(obj=self, app=self, name="tool")
|
||||||
|
|
||||||
# ###############################################################################
|
|
||||||
# ############# Save defaults to factory_defaults.FlatConfig file ###############
|
|
||||||
# ############# It's done only once after install ###############
|
|
||||||
# ###############################################################################
|
|
||||||
factory_file = open(self.data_path + '/factory_defaults.FlatConfig')
|
|
||||||
fac_def_from_file = factory_file.read()
|
|
||||||
factory_defaults = json.loads(fac_def_from_file)
|
|
||||||
|
|
||||||
# if the file contain an empty dictionary then save the factory defaults into the file
|
|
||||||
if self.defaults["first_run"] is True:
|
|
||||||
self.save_factory_defaults(silent_message=False)
|
|
||||||
|
|
||||||
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'COMPACT'
|
|
||||||
initial_lay = 'compact'
|
|
||||||
self.on_layout(lay=initial_lay)
|
|
||||||
|
|
||||||
# Set the combobox in Preferences to the current layout
|
|
||||||
idx = self.ui.general_defaults_form.general_gui_set_group.layout_combo.findText(initial_lay)
|
|
||||||
self.ui.general_defaults_form.general_gui_set_group.layout_combo.setCurrentIndex(idx)
|
|
||||||
|
|
||||||
factory_file.close()
|
|
||||||
|
|
||||||
# and then make the factory_defaults.FlatConfig file read_only so it can't be modified after creation.
|
|
||||||
filename_factory = self.data_path + '/factory_defaults.FlatConfig'
|
|
||||||
os.chmod(filename_factory, S_IREAD | S_IRGRP | S_IROTH)
|
|
||||||
|
|
||||||
# after the first run, this object should be False
|
|
||||||
self.defaults["first_run"] = False
|
|
||||||
|
|
||||||
# ###############################################################################
|
# ###############################################################################
|
||||||
# ################# ADDING FlatCAM EDITORS section ##############################
|
# ################# ADDING FlatCAM EDITORS section ##############################
|
||||||
# ###############################################################################
|
# ###############################################################################
|
||||||
|
@ -3856,42 +3852,84 @@ class App(QtCore.QObject):
|
||||||
self.inform.emit('[ERROR] %s' % _("Failed to parse defaults file."))
|
self.inform.emit('[ERROR] %s' % _("Failed to parse defaults file."))
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'version' not in defaults or defaults['version'] != self.defaults['version']:
|
if defaults:
|
||||||
for k, v in defaults.items():
|
if 'version' not in defaults or defaults['version'] != self.defaults['version']:
|
||||||
if k in self.defaults and k != 'version':
|
for k, v in defaults.items():
|
||||||
self.defaults[k] = v
|
if k in self.defaults and k != 'version':
|
||||||
|
self.defaults[k] = v
|
||||||
|
|
||||||
# delete old factory defaults
|
# delete old factory defaults
|
||||||
try:
|
try:
|
||||||
fact_def_file_path = os.path.join(self.data_path, 'factory_defaults.FlatConfig')
|
fact_def_file_path = os.path.join(self.data_path, 'factory_defaults.FlatConfig')
|
||||||
os.chmod(fact_def_file_path, stat.S_IRWXO | stat.S_IWRITE | stat.S_IWGRP)
|
os.chmod(fact_def_file_path, stat.S_IRWXO | stat.S_IWRITE | stat.S_IWGRP)
|
||||||
os.remove(fact_def_file_path)
|
os.remove(fact_def_file_path)
|
||||||
|
|
||||||
# recreate a new factory defaults file and save the factory defaults data into it
|
# recreate a new factory defaults file and save the factory defaults data into it
|
||||||
f_f_def_s = open(self.data_path + "/factory_defaults.FlatConfig", "w")
|
f_f_def_s = open(self.data_path + "/factory_defaults.FlatConfig", "w")
|
||||||
json.dump(self.defaults, f_f_def_s, default=to_dict, indent=2, sort_keys=True)
|
json.dump(self.defaults, f_f_def_s, default=to_dict, indent=2, sort_keys=True)
|
||||||
f_f_def_s.close()
|
f_f_def_s.close()
|
||||||
|
|
||||||
# and then make the factory_defaults.FlatConfig file read_only so it can't be modified after creation.
|
# and then make the factory_defaults.FlatConfig file read_only so it can't be modified after creation.
|
||||||
os.chmod(fact_def_file_path, S_IREAD | S_IRGRP | S_IROTH)
|
os.chmod(fact_def_file_path, S_IREAD | S_IRGRP | S_IROTH)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("App.load_defaults() -> deleting old factory defaults file -> %s" % str(e))
|
log.debug("App.load_defaults() -> deleting old factory defaults file -> %s" % str(e))
|
||||||
|
|
||||||
|
self.old_defaults_found = True
|
||||||
|
else:
|
||||||
|
self.old_defaults_found = False
|
||||||
|
self.defaults.update(defaults)
|
||||||
|
|
||||||
self.old_defaults_found = True
|
|
||||||
else:
|
|
||||||
self.defaults.update(defaults)
|
|
||||||
log.debug("FlatCAM defaults loaded from: %s" % filename)
|
log.debug("FlatCAM defaults loaded from: %s" % filename)
|
||||||
|
|
||||||
def on_import_preferences(self):
|
def on_restore_defaults_preferences(self):
|
||||||
"""
|
"""
|
||||||
Loads the aplication's factory default settings from factory_defaults.FlatConfig into
|
Loads the application's factory default settings from factory_defaults.FlatConfig into
|
||||||
``self.defaults``.
|
``self.defaults``.
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
App.log.debug("App.on_restore_defaults_preferences()")
|
||||||
|
|
||||||
|
filename = self.data_path + '/factory_defaults.FlatConfig'
|
||||||
|
|
||||||
|
if filename == "":
|
||||||
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Preferences default restore was cancelled."))
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
f = open(filename)
|
||||||
|
options = f.read()
|
||||||
|
f.close()
|
||||||
|
except IOError:
|
||||||
|
self.log.error("Could not load factory defaults file.")
|
||||||
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Could not load factory defaults file."))
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
defaults_from_file = json.loads(options)
|
||||||
|
except Exception:
|
||||||
|
e = sys.exc_info()[0]
|
||||||
|
App.log.error(str(e))
|
||||||
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to parse factory defaults file."))
|
||||||
|
return
|
||||||
|
self.defaults.update(defaults_from_file)
|
||||||
|
# update the dict that is used to restore the values in the defaults form if Cancel is clicked in the
|
||||||
|
# Preferences window
|
||||||
|
self.current_defaults.update(defaults_from_file)
|
||||||
|
|
||||||
|
self.on_preferences_edited()
|
||||||
|
self.inform.emit('[success] %s' % _("Preferences default values are restored."))
|
||||||
|
|
||||||
|
def on_import_preferences(self):
|
||||||
|
"""
|
||||||
|
Loads the application default settings from a saved file into
|
||||||
|
``self.defaults`` dictionary.
|
||||||
|
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
|
||||||
self.report_usage("on_import_preferences")
|
self.report_usage("on_import_preferences")
|
||||||
App.log.debug("on_import_preferences()")
|
App.log.debug("App.on_import_preferences()")
|
||||||
|
|
||||||
filter_ = "Config File (*.FlatConfig);;All Files (*.*)"
|
filter_ = "Config File (*.FlatConfig);;All Files (*.*)"
|
||||||
try:
|
try:
|
||||||
|
@ -3905,8 +3943,7 @@ class App(QtCore.QObject):
|
||||||
filename = str(filename)
|
filename = str(filename)
|
||||||
|
|
||||||
if filename == "":
|
if filename == "":
|
||||||
self.inform.emit('[WARNING_NOTCL] %s' %
|
self.inform.emit('[WARNING_NOTCL] %s' % _("FlatCAM preferences import cancelled."))
|
||||||
_("FlatCAM preferences import cancelled."))
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
f = open(filename)
|
f = open(filename)
|
||||||
|
@ -3914,8 +3951,7 @@ class App(QtCore.QObject):
|
||||||
f.close()
|
f.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
self.log.error("Could not load defaults file.")
|
self.log.error("Could not load defaults file.")
|
||||||
self.inform.emit('[ERROR_NOTCL] %s' %
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Could not load defaults file."))
|
||||||
_("Could not load defaults file."))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -3923,8 +3959,7 @@ class App(QtCore.QObject):
|
||||||
except Exception:
|
except Exception:
|
||||||
e = sys.exc_info()[0]
|
e = sys.exc_info()[0]
|
||||||
App.log.error(str(e))
|
App.log.error(str(e))
|
||||||
self.inform.emit('[ERROR_NOTCL] %s' %
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to parse defaults file."))
|
||||||
_("Failed to parse defaults file."))
|
|
||||||
return
|
return
|
||||||
self.defaults.update(defaults_from_file)
|
self.defaults.update(defaults_from_file)
|
||||||
# update the dict that is used to restore the values in the defaults form if Cancel is clicked in the
|
# update the dict that is used to restore the values in the defaults form if Cancel is clicked in the
|
||||||
|
@ -3932,8 +3967,7 @@ class App(QtCore.QObject):
|
||||||
self.current_defaults.update(defaults_from_file)
|
self.current_defaults.update(defaults_from_file)
|
||||||
|
|
||||||
self.on_preferences_edited()
|
self.on_preferences_edited()
|
||||||
self.inform.emit('[success] %s: %s' %
|
self.inform.emit('[success] %s: %s' % (_("Imported Defaults from"), filename))
|
||||||
(_("Imported Defaults from"), filename))
|
|
||||||
|
|
||||||
def on_export_preferences(self):
|
def on_export_preferences(self):
|
||||||
"""
|
"""
|
||||||
|
@ -3965,8 +3999,7 @@ class App(QtCore.QObject):
|
||||||
defaults_from_file = {}
|
defaults_from_file = {}
|
||||||
|
|
||||||
if filename == "":
|
if filename == "":
|
||||||
self.inform.emit('[WARNING_NOTCL] %s' %
|
self.inform.emit('[WARNING_NOTCL] %s' % _("FlatCAM preferences export cancelled."))
|
||||||
_("FlatCAM preferences export cancelled."))
|
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
@ -3987,8 +4020,7 @@ class App(QtCore.QObject):
|
||||||
e = sys.exc_info()[0]
|
e = sys.exc_info()[0]
|
||||||
App.log.error("Could not load defaults file.")
|
App.log.error("Could not load defaults file.")
|
||||||
App.log.error(str(e))
|
App.log.error(str(e))
|
||||||
self.inform.emit('[ERROR_NOTCL] %s' %
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Could not load preferences file."))
|
||||||
_("Could not load preferences file."))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -4007,14 +4039,12 @@ class App(QtCore.QObject):
|
||||||
json.dump(defaults_from_file, f, default=to_dict, indent=2, sort_keys=True)
|
json.dump(defaults_from_file, f, default=to_dict, indent=2, sort_keys=True)
|
||||||
f.close()
|
f.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
self.inform.emit('[ERROR_NOTCL] %s' %
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write defaults to file."))
|
||||||
_("Failed to write defaults to file."))
|
|
||||||
return
|
return
|
||||||
if self.defaults["global_open_style"] is False:
|
if self.defaults["global_open_style"] is False:
|
||||||
self.file_opened.emit("preferences", filename)
|
self.file_opened.emit("preferences", filename)
|
||||||
self.file_saved.emit("preferences", filename)
|
self.file_saved.emit("preferences", filename)
|
||||||
self.inform.emit('[success] %s: %s' %
|
self.inform.emit('[success] %s: %s' % (_("Exported preferences to"), filename))
|
||||||
(_("Exported preferences to"), filename))
|
|
||||||
|
|
||||||
def on_preferences_open_folder(self):
|
def on_preferences_open_folder(self):
|
||||||
"""
|
"""
|
||||||
|
@ -7532,6 +7562,7 @@ class App(QtCore.QObject):
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app_cursor.set_data(np.asarray([(location[0], location[1])]),
|
self.app_cursor.set_data(np.asarray([(location[0], location[1])]),
|
||||||
symbol='++', edge_color=self.cursor_color_3D,
|
symbol='++', edge_color=self.cursor_color_3D,
|
||||||
|
edge_width=self.defaults["global_cursor_width"],
|
||||||
size=self.defaults["global_cursor_size"])
|
size=self.defaults["global_cursor_size"])
|
||||||
|
|
||||||
# Set the position label
|
# Set the position label
|
||||||
|
@ -8686,6 +8717,7 @@ class App(QtCore.QObject):
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
self.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
||||||
symbol='++', edge_color=self.cursor_color_3D,
|
symbol='++', edge_color=self.cursor_color_3D,
|
||||||
|
edge_width=self.defaults["global_cursor_width"],
|
||||||
size=self.defaults["global_cursor_size"])
|
size=self.defaults["global_cursor_size"])
|
||||||
else:
|
else:
|
||||||
pos = (pos_canvas[0], pos_canvas[1])
|
pos = (pos_canvas[0], pos_canvas[1])
|
||||||
|
|
|
@ -738,6 +738,10 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||||
|
|
||||||
self.ui.tool_type_label.hide()
|
self.ui.tool_type_label.hide()
|
||||||
self.ui.tool_type_radio.hide()
|
self.ui.tool_type_radio.hide()
|
||||||
|
|
||||||
|
# override the Preferences Value; in Basic mode the Tool Type is always Circular ('C1')
|
||||||
|
self.ui.tool_type_radio.set_value('circular')
|
||||||
|
|
||||||
self.ui.tipdialabel.hide()
|
self.ui.tipdialabel.hide()
|
||||||
self.ui.tipdia_spinner.hide()
|
self.ui.tipdia_spinner.hide()
|
||||||
self.ui.tipanglelabel.hide()
|
self.ui.tipanglelabel.hide()
|
||||||
|
@ -1436,7 +1440,10 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||||
def iso_init(geo_obj, app_obj):
|
def iso_init(geo_obj, app_obj):
|
||||||
# Propagate options
|
# Propagate options
|
||||||
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
||||||
geo_obj.tool_type = self.ui.tool_type_radio.get_value().upper()
|
if self.ui.tool_type_radio.get_value() == 'v':
|
||||||
|
geo_obj.tool_type = 'V'
|
||||||
|
else:
|
||||||
|
geo_obj.tool_type = 'C1'
|
||||||
|
|
||||||
# if milling type is climb then the move is counter-clockwise around features
|
# if milling type is climb then the move is counter-clockwise around features
|
||||||
mill_t = 1 if milling_type == 'cl' else 0
|
mill_t = 1 if milling_type == 'cl' else 0
|
||||||
|
|
|
@ -9,6 +9,14 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
25.12.2019
|
||||||
|
|
||||||
|
- 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)
|
||||||
|
|
||||||
24.12.2019
|
24.12.2019
|
||||||
|
|
||||||
- edited some icons so they don't contain white background
|
- edited some icons so they don't contain white background
|
||||||
|
|
|
@ -3690,6 +3690,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||||
|
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
self.snap_x = x
|
self.snap_x = x
|
||||||
|
@ -3739,6 +3740,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||||
|
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
def on_canvas_key_release(self, event):
|
def on_canvas_key_release(self, event):
|
||||||
|
|
|
@ -3831,6 +3831,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
||||||
|
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
self.snap_x = x
|
self.snap_x = x
|
||||||
|
|
|
@ -4543,6 +4543,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||||
|
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
self.snap_x = x
|
self.snap_x = x
|
||||||
|
|
|
@ -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_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
||||||
self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1)
|
self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1)
|
||||||
|
|
||||||
self.pref_import_button = QtWidgets.QPushButton()
|
self.pref_defaults_button = QtWidgets.QPushButton()
|
||||||
self.pref_import_button.setText(_("Import Preferences"))
|
self.pref_defaults_button.setText(_("Restore Defaults"))
|
||||||
self.pref_import_button.setMinimumWidth(130)
|
self.pref_defaults_button.setMinimumWidth(130)
|
||||||
self.pref_import_button.setToolTip(
|
self.pref_defaults_button.setToolTip(
|
||||||
_("Import a full set of FlatCAM settings from a file\n"
|
_("Restore the entire set of default valaues\n"
|
||||||
"previously saved on HDD.\n\n"
|
"to the initial values loaded after first launch."))
|
||||||
"FlatCAM automatically save a 'factory_defaults' file\n"
|
self.pref_tab_bottom_layout_1.addWidget(self.pref_defaults_button)
|
||||||
"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_open_button = QtWidgets.QPushButton()
|
self.pref_open_button = QtWidgets.QPushButton()
|
||||||
self.pref_open_button.setText(_("Open Pref Folder"))
|
self.pref_open_button.setText(_("Open Pref Folder"))
|
||||||
|
|
|
@ -310,6 +310,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.fcapp.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
self.fcapp.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
||||||
symbol='++', edge_color=self.fcapp.cursor_color_3D,
|
symbol='++', edge_color=self.fcapp.cursor_color_3D,
|
||||||
|
edge_width=self.fcapp.defaults["global_cursor_width"],
|
||||||
size=self.fcapp.defaults["global_cursor_size"])
|
size=self.fcapp.defaults["global_cursor_size"])
|
||||||
|
|
||||||
def new_text_group(self, collection=None):
|
def new_text_group(self, collection=None):
|
||||||
|
|
|
@ -375,16 +375,19 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||||
pass
|
pass
|
||||||
# log.debug("Cache updated the screen!")
|
# 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:
|
# if axes is None:
|
||||||
# c = MplCursor(axes=self.axes, color='black', linewidth=1)
|
# c = MplCursor(axes=self.axes, color='black', linewidth=1)
|
||||||
# else:
|
# else:
|
||||||
# c = MplCursor(axes=axes, color='black', linewidth=1)
|
# c = MplCursor(axes=axes, color='black', linewidth=1)
|
||||||
|
|
||||||
if self.app.defaults['global_theme'] == 'white':
|
if color:
|
||||||
color = '#000000'
|
color = color
|
||||||
else:
|
else:
|
||||||
color = '#FFFFFF'
|
if self.app.defaults['global_theme'] == 'white':
|
||||||
|
color = '#000000'
|
||||||
|
else:
|
||||||
|
color = '#FFFFFF'
|
||||||
|
|
||||||
if big is True:
|
if big is True:
|
||||||
self.big_cursor = True
|
self.big_cursor = True
|
||||||
|
@ -398,7 +401,7 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||||
|
|
||||||
return c
|
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
|
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
|
# 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.app_cursor.enabled is True and self.panning is False:
|
||||||
if self.app.defaults['global_theme'] == 'white':
|
if color:
|
||||||
color = '#000000'
|
color = color
|
||||||
else:
|
else:
|
||||||
color = '#FFFFFF'
|
if self.app.defaults['global_theme'] == 'white':
|
||||||
|
color = '#000000'
|
||||||
|
else:
|
||||||
|
color = '#FFFFFF'
|
||||||
|
|
||||||
if self.big_cursor is False:
|
if self.big_cursor is False:
|
||||||
try:
|
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
|
# 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
|
# one in the OpenGL(3D) graphic engine
|
||||||
pointer_size = int(float(self.app.defaults["global_cursor_size"] ) * 1.65)
|
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:
|
for el in elements:
|
||||||
self.axes.draw_artist(el)
|
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
|
# 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 reshuffle the object instantiating order but what's the point?
|
||||||
# I could crash something else and that's pythonic, too
|
# 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_lbl, 21, 0)
|
||||||
grid0.addWidget(self.cursor_size_entry, 21, 1)
|
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
|
# Delete confirmation
|
||||||
self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
|
self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
|
||||||
self.delete_conf_cb.setToolTip(
|
self.delete_conf_cb.setToolTip(
|
||||||
|
@ -1016,7 +1028,7 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
|
||||||
"whenever the Delete object(s) event is triggered, either by\n"
|
"whenever the Delete object(s) event is triggered, either by\n"
|
||||||
"menu shortcut or key shortcut.")
|
"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()
|
self.layout.addStretch()
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ def apply_patches():
|
||||||
try:
|
try:
|
||||||
self._update_child_widget_dim()
|
self._update_child_widget_dim()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print("VisPyPatches.apply_patches._update_clipper() -> %s" % str(e))
|
||||||
|
|
||||||
Grid._prepare_draw = _prepare_draw
|
Grid._prepare_draw = _prepare_draw
|
||||||
Grid._update_clipper = _update_clipper
|
Grid._update_clipper = _update_clipper
|
||||||
|
@ -72,7 +72,7 @@ def apply_patches():
|
||||||
|
|
||||||
if GL:
|
if GL:
|
||||||
GL.glDisable(GL.GL_LINE_SMOOTH)
|
GL.glDisable(GL.GL_LINE_SMOOTH)
|
||||||
GL.glLineWidth(1.0)
|
GL.glLineWidth(2.0)
|
||||||
|
|
||||||
if self._changed['pos']:
|
if self._changed['pos']:
|
||||||
self.pos_buf.set_data(self._pos)
|
self.pos_buf.set_data(self._pos)
|
||||||
|
|
|
@ -902,6 +902,7 @@ class ToolCopperThieving(FlatCAMTool):
|
||||||
|
|
||||||
self.app.app_cursor.set_data(np.asarray([(curr_pos[0], curr_pos[1])]),
|
self.app.app_cursor.set_data(np.asarray([(curr_pos[0], curr_pos[1])]),
|
||||||
symbol='++', edge_color=self.app.cursor_color_3D,
|
symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
# update the positions on status bar
|
# update the positions on status bar
|
||||||
|
|
|
@ -396,6 +396,7 @@ class Distance(FlatCAMTool):
|
||||||
# Update cursor
|
# Update cursor
|
||||||
self.app.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
self.app.app_cursor.set_data(np.asarray([(pos[0], pos[1])]),
|
||||||
symbol='++', edge_color=self.app.cursor_color_3D,
|
symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
else:
|
else:
|
||||||
pos = (pos_canvas[0], pos_canvas[1])
|
pos = (pos_canvas[0], pos_canvas[1])
|
||||||
|
|
|
@ -1349,6 +1349,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||||
|
|
||||||
self.app.app_cursor.set_data(np.asarray([(curr_pos[0], curr_pos[1])]),
|
self.app.app_cursor.set_data(np.asarray([(curr_pos[0], curr_pos[1])]),
|
||||||
symbol='++', edge_color=self.app.cursor_color_3D,
|
symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
# update the positions on status bar
|
# update the positions on status bar
|
||||||
|
|
|
@ -1290,6 +1290,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||||
|
|
||||||
self.app.app_cursor.set_data(np.asarray([(curr_pos[0], curr_pos[1])]),
|
self.app.app_cursor.set_data(np.asarray([(curr_pos[0], curr_pos[1])]),
|
||||||
symbol='++', edge_color=self.app.cursor_color_3D,
|
symbol='++', edge_color=self.app.cursor_color_3D,
|
||||||
|
edge_width=self.app.defaults["global_cursor_width"],
|
||||||
size=self.app.defaults["global_cursor_size"])
|
size=self.app.defaults["global_cursor_size"])
|
||||||
|
|
||||||
# update the positions on status bar
|
# update the positions on status bar
|
||||||
|
|
Loading…
Reference in New Issue