- fixed bug with losing the visibility of toolbars if at first startup the user tries to change something in the Preferences before doing a first save of Preferences

This commit is contained in:
Marius Stanciu 2019-09-19 22:38:25 +03:00 committed by Marius
parent 26f34382bd
commit ca4616a858
2 changed files with 17 additions and 9 deletions

View File

@ -812,6 +812,10 @@ class App(QtCore.QObject):
for name in sorted(self.languages.values()):
self.ui.general_defaults_form.general_app_group.language_cb.addItem(name)
# #################################################################################
# #################### DEFAULTS - PREFERENCES STORAGE #############################
# #################################################################################
self.defaults = LoudDict()
self.defaults.set_change_callback(self.on_defaults_dict_change) # When the dictionary changes.
self.defaults.update({
@ -1231,17 +1235,17 @@ class App(QtCore.QObject):
chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
if self.defaults['global_serial'] == 0 or len(str(self.defaults['global_serial'])) < 10:
self.defaults['global_serial'] = ''.join([random.choice(chars) for i in range(20)])
self.save_defaults(silent=True)
self.save_defaults(silent=True, first_time=True)
self.propagate_defaults(silent=True)
self.restore_main_win_geom()
def auto_save_defaults():
try:
self.save_defaults(silent=True)
self.propagate_defaults(silent=True)
finally:
QtCore.QTimer.singleShot(self.defaults["global_defaults_save_period_ms"], auto_save_defaults)
# def auto_save_defaults():
# try:
# self.save_defaults(silent=True)
# self.propagate_defaults(silent=True)
# finally:
# QtCore.QTimer.singleShot(self.defaults["global_defaults_save_period_ms"], auto_save_defaults)
# the following lines activates automatic defaults save
# if user_defaults:
@ -1494,6 +1498,7 @@ class App(QtCore.QObject):
self.cnc_form = None
self.tools_form = None
self.fa_form = None
self.on_options_combo_change(0) # Will show the initial form
# ################################
@ -3460,6 +3465,7 @@ class App(QtCore.QObject):
:return: None
"""
tb = self.defaults["global_toolbar_view"]
if tb & 1:
self.ui.toolbarfile.setVisible(True)
else:
@ -4357,7 +4363,7 @@ class App(QtCore.QObject):
# log.debug("Application defaults saved ... Exit event.")
# QtWidgets.qApp.quit()
def save_defaults(self, silent=False, data_path=None):
def save_defaults(self, silent=False, data_path=None, first_time=False):
"""
Saves application default options
``self.defaults`` to current_defaults.FlatConfig file.
@ -4431,7 +4437,8 @@ class App(QtCore.QObject):
if self.ui.toolbarshell.isVisible():
tb_status += 256
self.defaults["global_toolbar_view"] = tb_status
if first_time is False:
self.defaults["global_toolbar_view"] = tb_status
# Save update options
try:

View File

@ -24,6 +24,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed bug in Gerber Editor -> selection area handler where if some of the selected shapes did not had the 'solid' geometry will silently abort selection of further shapes
- added new control in Edit -> Preferences -> General -> Gui Preferences -> Activity Icon. Will select a GIF from a selection, the one used to show that FlatCAM is working.
- changed the script icon to a smaller one in the sys tray menu
- fixed bug with losing the visibility of toolbars if at first startup the user tries to change something in the Preferences before doing a first save of Preferences
18.09.2019