From 72dd81848f970d1ff7290c40781b6a2188734ea0 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 22 Mar 2023 16:43:27 +0200 Subject: [PATCH] - in the toolbars now there is text under the icons (which can be turned off from the toolbar context menu) - the GUI state is now saved and restored through QSettings --- CHANGELOG.md | 5 + appGUI/MainGUI.py | 303 +++++++++------------ appGUI/preferences/PreferencesUIManager.py | 41 --- appHandlers/AppIO.py | 7 - appMain.py | 9 +- defaults.py | 21 +- 6 files changed, 141 insertions(+), 245 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2823691..79309118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM Evo beta ================================================= +22.03.2023 + +- in the toolbars now there is text under the icons (which can be turned off from the toolbar context menu) +- the GUI state is now saved and restored through QSettings + 13.03.2023 - in Tcl Commands: export_dxf and export_gerber, fixed a mistake in declaring a wrong name of a required option diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 29888602..7cbb171c 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -49,8 +49,6 @@ if '_' not in builtins.__dict__: class MainGUI(QtWidgets.QMainWindow): - # Emitted when persistent window geometry needs to be retained - geom_update = QtCore.pyqtSignal(int, int, int, int, int, name='geomUpdate') final_save = QtCore.pyqtSignal(name='saveBeforeExit') # screenChanged = QtCore.pyqtSignal(QtGui.QScreen, QtGui.QScreen) @@ -1064,14 +1062,18 @@ class MainGUI(QtWidgets.QMainWindow): # ########################## File Toolbar# ############################### # ######################################################################## self.file_open_gerber_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/open_gerber32.png'), _("Open Gerber")) + QtGui.QIcon(self.app.resource_location + '/open_gerber32.png'), _("Gerber")) + self.file_open_gerber_btn.setToolTip(_("Open a Gerber file.")) self.file_open_excellon_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), _("Open Excellon")) + QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), _("Excellon")) + self.file_open_excellon_btn.setToolTip(_("Open a Excellon file.")) self.toolbarfile.addSeparator() self.file_open_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/folder32.png'), _("Open Project")) + QtGui.QIcon(self.app.resource_location + '/folder32.png'), _("Open")) + self.file_open_btn.setToolTip(_("Open a project.")) self.file_save_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/save_as.png'), _("Save project")) + QtGui.QIcon(self.app.resource_location + '/save_as.png'), _("Save")) + self.file_save_btn.setToolTip(_("Save the current project.")) # ######################################################################## # ########################## Edit Toolbar# ############################### @@ -1096,24 +1098,33 @@ class MainGUI(QtWidgets.QMainWindow): self.toolbaredit.addSeparator() self.copy_btn = self.toolbaredit.addAction( QtGui.QIcon(self.app.resource_location + '/copy_file32.png'), _("Copy")) + self.copy_btn.setToolTip(_("Copy a selection of objects.")) self.delete_btn = self.toolbaredit.addAction( QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete")) + self.delete_btn.setToolTip(_("Delete a selection of objects.")) self.toolbaredit.addSeparator() self.distance_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance Tool")) - self.distance_min_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool")) + QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance")) + self.distance_btn.setToolTip(_("Measure a distance between two or more points.")) + # self.distance_min_btn = self.toolbaredit.addAction( + # QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Min Distance")) + # self.distance_min_btn.setToolTip(_("Measure the minimum distance between two objects.")) self.origin_btn = self.toolbaredit.addAction( QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin')) - self.move2origin_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/move2origin32.png'), _('Move to Origin')) - self.center_in_origin_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/custom_origin32.png'), _('Custom Origin')) + self.origin_btn.setToolTip(_("Set an origin to a custom location.")) + # self.move2origin_btn = self.toolbaredit.addAction( + # QtGui.QIcon(self.app.resource_location + '/move2origin32.png'), _('To Orig.')) + # self.move2origin_btn.setToolTip(_("Move selected objects to the origin.")) + # self.center_in_origin_btn = self.toolbaredit.addAction( + # QtGui.QIcon(self.app.resource_location + '/custom_origin32.png'), _('C Origin')) + # self.center_in_origin_btn.setToolTip(_("Move the selected objects to custom positions.")) self.jmp_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/jump_to32.png'), _('Jump to Location')) + QtGui.QIcon(self.app.resource_location + '/jump_to32.png'), _('Jump to')) + self.jmp_btn.setToolTip(_("Move the mouse cursor to a defined position and center into view.")) self.locate_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate in Object')) + QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate')) + self.locate_btn.setToolTip(_("Locate a predefined position on a selected object.")) # ######################################################################## # ########################## View Toolbar# ############################### @@ -1180,20 +1191,20 @@ class MainGUI(QtWidgets.QMainWindow): self.toolbarplugins.addSeparator() self.align_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align Objects")) + QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align")) # self.sub_btn = self.toolbarplugins.addAction( # QtGui.QIcon(self.app.resource_location + '/sub32.png'), _("Subtract Tool")) self.toolbarplugins.addSeparator() - self.extract_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/extract32.png'), _("Extract")) + # self.extract_btn = self.toolbarplugins.addAction( + # QtGui.QIcon(self.app.resource_location + '/extract32.png'), _("Extract")) self.copperfill_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/copperfill32.png'), _("Copper Thieving")) + QtGui.QIcon(self.app.resource_location + '/copperfill32.png'), _("Thieving")) self.markers_tool_btn = self.toolbarplugins.addAction( QtGui.QIcon(self.app.resource_location + '/corners_32.png'), _("Markers")) self.punch_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/punch32.png'), _("Punch Gerber")) + QtGui.QIcon(self.app.resource_location + '/punch32.png'), _("Punch")) self.calculators_btn = self.toolbarplugins.addAction( QtGui.QIcon(self.app.resource_location + '/calculator32.png'), _("Calculators")) @@ -1997,7 +2008,6 @@ class MainGUI(QtWidgets.QMainWindow): self.app_icon.addFile(self.app.resource_location + '/app256.png', QtCore.QSize(256, 256)) self.setWindowIcon(self.app_icon) - self.setGeometry(100, 100, 1024, 650) self.setWindowTitle('FlatCAM Evo %s %s - %s' % (self.app.version, ('BETA' if self.app.beta else ''), @@ -2022,6 +2032,20 @@ class MainGUI(QtWidgets.QMainWindow): self.grb_editor_cmenu.menuAction().setVisible(False) self.e_editor_cmenu.menuAction().setVisible(False) + # ######################################################################## + # construct the Toolbar Lock menu entry to the context menu of the QMainWindow + # ######################################################################## + self.lock_action = QtGui.QAction() + self.lock_action.setText(_("Lock Toolbars")) + self.lock_action.setCheckable(True) + + # ######################################################################## + # construct the Show Text menu entry to the context menu of the QMainWindow + # ######################################################################## + self.show_text_action = QtGui.QAction() + self.show_text_action.setText(_("Show Text")) + self.show_text_action.setCheckable(True) + # ######################################################################## # ######################## BUILD PREFERENCES ############################# # ######################################################################## @@ -2039,19 +2063,18 @@ class MainGUI(QtWidgets.QMainWindow): QtCore.QCoreApplication.instance().installEventFilter(self) # ######################################################################## - # ################## RESTORE THE TOOLBAR STATE from file ################# + # ################## RESTORE UI from QSettings ################# # ######################################################################## - flat_settings = QSettings("Open Source", "FlatCAM") - if flat_settings.contains("saved_gui_state"): - saved_gui_state = flat_settings.value('saved_gui_state') - self.restoreState(saved_gui_state) - self.app.log.debug("MainGUI.__init__() --> UI state restored from QSettings.") + qsettings = QSettings("Open Source", "FlatCAM") + if qsettings.contains("saved_gui_state"): + self.restoreState(qsettings.value('saved_gui_state'), 0) + tb_lock_state = qsettings.value('toolbar_lock', "true") + show_text_state = qsettings.value('menu_show_text', "true") + win_geo = qsettings.value('window_geometry', (100, 100, 800, 400)) + splitter_left = qsettings.value('splitter_left', 1) - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - - if flat_settings.contains("layout"): - layout = flat_settings.value('layout', type=str) + if qsettings.contains("layout"): + layout = qsettings.value('layout', type=str) self.exc_edit_toolbar.setDisabled(True) self.geo_edit_toolbar.setDisabled(True) self.grb_edit_toolbar.setDisabled(True) @@ -2062,36 +2085,27 @@ class MainGUI(QtWidgets.QMainWindow): self.geo_edit_toolbar.setDisabled(True) self.grb_edit_toolbar.setDisabled(True) - flat_settings.setValue('layout', "standard") - # This will write the setting to the platform specific storage. - del flat_settings - self.app.log.debug("MainGUI.__init__() --> UI layout restored from options. QSettings set to 'standard'") - - # construct the Toolbar Lock menu entry to the context menu of the QMainWindow - self.lock_action = QtGui.QAction() - self.lock_action.setText(_("Lock Toolbars")) - self.lock_action.setCheckable(True) - - qsettings = QSettings("Open Source", "FlatCAM") - if qsettings.contains("toolbar_lock"): - lock_val = qsettings.value('toolbar_lock') - if lock_val == 'true': - lock_state = True - self.lock_action.setChecked(True) - else: - - lock_state = False - self.lock_action.setChecked(False) - else: - lock_state = True - qsettings.setValue('toolbar_lock', lock_state) - + qsettings.setValue('layout', "standard") # This will write the setting to the platform specific storage. del qsettings + self.app.log.debug("MainGUI.__init__() --> UI layout restored from options. QSettings set to 'standard'") - self.lock_toolbar(lock=lock_state) + self.lock_action.setChecked(True if tb_lock_state == 'true' else False) + self.show_text_action.setChecked(True if show_text_state == 'true' else False) + + self.setGeometry(win_geo[0], win_geo[1], win_geo[2], win_geo[3]) + self.app.log.debug("MainGUI.__init__() --> UI state restored from QSettings.") + + self.splitter.setSizes([splitter_left, 0]) + + self.lock_toolbar(lock=True if tb_lock_state == 'true' else False) + self.show_text_under_action(show_text=True if show_text_state == 'true' else False) + + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) self.lock_action.triggered[bool].connect(self.lock_toolbar) + self.show_text_action.triggered.connect(self.show_text_under_action) self.pref_open_button.clicked.connect(self.on_preferences_open_folder) self.clear_btn.clicked.connect(lambda: self.on_gui_clear()) @@ -2105,12 +2119,6 @@ class MainGUI(QtWidgets.QMainWindow): # self.plot_tab_area.tab_attached.connect(lambda x: print(x)) # self.plot_tab_area.tab_detached.connect(lambda x: print(x)) - # restore the toolbar view - self.restore_toolbar_view() - - # restore the GUI geometry - self.restore_main_win_geom() - # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2123,7 +2131,6 @@ class MainGUI(QtWidgets.QMainWindow): self.height = None self.titlebar_height = None - self.geom_update[int, int, int, int, int].connect(self.save_geometry) self.final_save.connect(self.app.final_save) # Notebook and Plot Tab Area signals @@ -2239,92 +2246,6 @@ class MainGUI(QtWidgets.QMainWindow): else: self.hide() - def save_geometry(self, x, y, width, height, notebook_width): - """ - Will save the application geometry and positions in the options dicitionary to be restored at the next - launch of the application. - - :param x: X position of the main window - :param y: Y position of the main window - :param width: width of the main window - :param height: height of the main window - :param notebook_width: the notebook width is adjustable so it get saved here, too. - - :return: None - """ - self.app.options["global_def_win_x"] = x - self.app.options["global_def_win_y"] = y - self.app.options["global_def_win_w"] = width - self.app.options["global_def_win_h"] = height - self.app.options["global_def_notebook_width"] = notebook_width - # self.app.preferencesUiManager.save_defaults() - - def restore_main_win_geom(self): - try: - self.setGeometry(self.app.options["global_def_win_x"], - self.app.options["global_def_win_y"], - self.app.options["global_def_win_w"], - self.app.options["global_def_win_h"]) - self.splitter.setSizes([self.app.options["global_def_notebook_width"], 0]) - except KeyError as e: - self.app.log.debug("appGUI.MainGUI.restore_main_win_geom() --> %s" % str(e)) - - def restore_toolbar_view(self): - """ - Some toolbars may be hidden by user and here we restore the state of the toolbars visibility that - was saved in the 'options' dictionary. - - :return: None - """ - tb = self.app.options["global_toolbar_view"] - - if tb & 1: - self.toolbarfile.setVisible(True) - else: - self.toolbarfile.setVisible(False) - - if tb & 2: - self.toolbaredit.setVisible(True) - else: - self.toolbaredit.setVisible(False) - - if tb & 4: - self.toolbarview.setVisible(True) - else: - self.toolbarview.setVisible(False) - - if tb & 8: - self.toolbarplugins.setVisible(True) - else: - self.toolbarplugins.setVisible(False) - - if tb & 16: - self.exc_edit_toolbar.setVisible(True) - else: - self.exc_edit_toolbar.setVisible(False) - - if tb & 32: - self.geo_edit_toolbar.setVisible(True) - else: - self.geo_edit_toolbar.setVisible(False) - - if tb & 64: - self.grb_edit_toolbar.setVisible(True) - else: - self.grb_edit_toolbar.setVisible(False) - - # if tb & 128: - # self.ui.grid_toolbar.setVisible(True) - # else: - # self.ui.grid_toolbar.setVisible(False) - - # Grid Toolbar is controlled by its own setting - - if tb & 256: - self.toolbarshell.setVisible(True) - else: - self.toolbarshell.setVisible(False) - def on_tab_setup_context_menu(self): initial_checked = self.app.defaults["global_tabs_detachable"] action_name = str(_("Detachable Tabs")) @@ -2462,14 +2383,18 @@ class MainGUI(QtWidgets.QMainWindow): # ##################### File Toolbar ##################################### # ######################################################################## self.file_open_gerber_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/open_gerber32.png'), _("Open Gerber")) + QtGui.QIcon(self.app.resource_location + '/open_gerber32.png'), _("Gerber")) + self.file_open_gerber_btn.setToolTip(_("Open a Gerber file.")) self.file_open_excellon_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), _("Open Excellon")) + QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), _("Excellon")) + self.file_open_excellon_btn.setToolTip(_("Open a Excellon file.")) self.toolbarfile.addSeparator() self.file_open_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/folder32.png'), _("Open Project")) + QtGui.QIcon(self.app.resource_location + '/folder32.png'), _("Open")) + self.file_open_btn.setToolTip(_("Open a project.")) self.file_save_btn = self.toolbarfile.addAction( - QtGui.QIcon(self.app.resource_location + '/save_as.png'), _("Save Project")) + QtGui.QIcon(self.app.resource_location + '/save_as.png'), _("Save")) + self.file_save_btn.setToolTip(_("Save the current project.")) # ######################################################################## # ######################### Edit Toolbar ################################# @@ -2491,27 +2416,35 @@ class MainGUI(QtWidgets.QMainWindow): # in order to hide it we hide the returned action self.editor_exit_btn_ret_action = self.toolbaredit.addWidget(self.editor_exit_btn) - self.toolbaredit.addSeparator() self.copy_btn = self.toolbaredit.addAction( QtGui.QIcon(self.app.resource_location + '/copy_file32.png'), _("Copy")) + self.copy_btn.setToolTip(_("Copy a selection of objects.")) self.delete_btn = self.toolbaredit.addAction( QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete")) + self.delete_btn.setToolTip(_("Delete a selection of objects.")) self.toolbaredit.addSeparator() self.distance_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance Tool")) - self.distance_min_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool")) + QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance")) + self.distance_btn.setToolTip(_("Measure a distance between two or more points.")) + # self.distance_min_btn = self.toolbaredit.addAction( + # QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Min Distance")) + # self.distance_min_btn.setToolTip(_("Measure the minimum distance between two objects.")) self.origin_btn = self.toolbaredit.addAction( QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin')) - self.move2origin_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/move2origin32.png'), _('Move to Origin')) - self.center_in_origin_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/custom_origin32.png'), _('Custom Origin')) + self.origin_btn.setToolTip(_("Set an origin to a custom location.")) + # self.move2origin_btn = self.toolbaredit.addAction( + # QtGui.QIcon(self.app.resource_location + '/move2origin32.png'), _('To Orig.')) + # self.move2origin_btn.setToolTip(_("Move selected objects to the origin.")) + # self.center_in_origin_btn = self.toolbaredit.addAction( + # QtGui.QIcon(self.app.resource_location + '/custom_origin32.png'), _('C Origin')) + # self.center_in_origin_btn.setToolTip(_("Move the selected objects to custom positions.")) self.jmp_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/jump_to32.png'), _('Jump to Location')) + QtGui.QIcon(self.app.resource_location + '/jump_to32.png'), _('Jump to')) + self.jmp_btn.setToolTip(_("Move the mouse cursor to a defined position and center into view.")) self.locate_btn = self.toolbaredit.addAction( - QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate in Object')) + QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate')) + self.locate_btn.setToolTip(_("Locate a predefined position on a selected object.")) # ######################################################################## # ########################## View Toolbar# ############################### @@ -2576,16 +2509,16 @@ class MainGUI(QtWidgets.QMainWindow): self.toolbarplugins.addSeparator() self.align_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align Objects")) + QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align")) # self.sub_btn = self.toolbarplugins.addAction( # QtGui.QIcon(self.app.resource_location + '/sub32.png'), _("Subtract")) self.toolbarplugins.addSeparator() - self.extract_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/extract32.png'), _("Extract")) + # self.extract_btn = self.toolbarplugins.addAction( + # QtGui.QIcon(self.app.resource_location + '/extract32.png'), _("Extract")) self.copperfill_btn = self.toolbarplugins.addAction( - QtGui.QIcon(self.app.resource_location + '/copperfill32.png'), _("Copper Thieving")) + QtGui.QIcon(self.app.resource_location + '/copperfill32.png'), _("Thieving")) self.markers_tool_btn = self.toolbarplugins.addAction( QtGui.QIcon(self.app.resource_location + '/corners_32.png'), _("Markers")) self.punch_btn = self.toolbarplugins.addAction( @@ -2798,6 +2731,7 @@ class MainGUI(QtWidgets.QMainWindow): menu.addSeparator() menu.addAction(self.lock_action) + menu.addAction(self.show_text_action) return menu def lock_toolbar(self, lock=False): @@ -2817,6 +2751,26 @@ class MainGUI(QtWidgets.QMainWindow): if isinstance(widget, QtWidgets.QToolBar): widget.setMovable(True) + qsettings = QSettings("Open Source", "FlatCAM") + qsettings.setValue('toolbar_lock', lock) + # This will write the setting to the platform specific storage. + del qsettings + + def show_text_under_action(self, show_text=True): + if show_text: + for widget in self.children(): + if isinstance(widget, QtWidgets.QToolBar): + widget.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon) + else: + for widget in self.children(): + if isinstance(widget, QtWidgets.QToolBar): + widget.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) + + qsettings = QSettings("Open Source", "FlatCAM") + qsettings.setValue('menu_show_text', show_text) + # This will write the setting to the platform specific storage. + del qsettings + def on_fullscreen(self, disable=False): """ @@ -4570,12 +4524,17 @@ class MainGUI(QtWidgets.QMainWindow): if self.app.save_in_progress: self.app.inform.emit('[WARNING_NOTCL] %s' % _("Application is saving the project. Please wait ...")) else: - grect = self.geometry() + g_rect = self.geometry() - # self.splitter.sizes()[0] is actually the size of the "notebook" + qsettings = QSettings("Open Source", "FlatCAM") + qsettings.setValue('saved_gui_state', self.saveState(0)) + qsettings.setValue('toolbar_lock', self.lock_action.isChecked()) + qsettings.setValue('menu_show_text', self.show_text_action.isChecked()) if not self.isMaximized(): - self.geom_update.emit(grect.x(), grect.y(), grect.width(), grect.height(), self.splitter.sizes()[0]) - + qsettings.setValue('window_geometry', (g_rect.x(), g_rect.y(), g_rect.width(), g_rect.height())) + qsettings.setValue('splitter_left', self.splitter.sizes()[0]) + # This will write the setting to the platform specific storage. + del qsettings try: self.final_save.emit() except SystemError: diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index c2d67100..9eed28de 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -1267,9 +1267,6 @@ class PreferencesUIManager(QtCore.QObject): self.defaults.propagate_defaults() - if first_time is False: - self.save_toolbar_view() - # Save the options to disk filename = os.path.join(data_path, "current_defaults_%s.FlatConfig" % self.defaults.version) @@ -1286,44 +1283,6 @@ class PreferencesUIManager(QtCore.QObject): # update the autosave timer self.ui.app.save_project_auto_update() - def save_toolbar_view(self): - """ - Will save the toolbar view state to the defaults - - :return: None - """ - - # Save the toolbar view - tb_status = 0 - if self.ui.toolbarfile.isVisible(): - tb_status += 1 - - if self.ui.toolbaredit.isVisible(): - tb_status += 2 - - if self.ui.toolbarview.isVisible(): - tb_status += 4 - - if self.ui.toolbarplugins.isVisible(): - tb_status += 8 - - if self.ui.exc_edit_toolbar.isVisible(): - tb_status += 16 - - if self.ui.geo_edit_toolbar.isVisible(): - tb_status += 32 - - if self.ui.grb_edit_toolbar.isVisible(): - tb_status += 64 - - if self.ui.status_toolbar.isVisible(): - tb_status += 128 - - if self.ui.toolbarshell.isVisible(): - tb_status += 256 - - self.defaults["global_toolbar_view"] = tb_status - def on_preferences_edited(self): """ Executed when a preference was changed in the Edit -> Preferences tab. diff --git a/appHandlers/AppIO.py b/appHandlers/AppIO.py index c786b227..e547ed3f 100644 --- a/appHandlers/AppIO.py +++ b/appHandlers/AppIO.py @@ -2854,13 +2854,6 @@ class AppIO(QtCore.QObject): str(filename), _("Retry to save it."))) # noqa - tb_settings = QSettings("Open Source", "FlatCAM") - lock_state = self.app.ui.lock_action.isChecked() - tb_settings.setValue('toolbar_lock', lock_state) - - # This will write the setting to the platform specific storage. - del tb_settings - # if quit: # t = threading.Thread(target=lambda: self.check_project_file_size(1, filename=filename)) # t.start() diff --git a/appMain.py b/appMain.py index 08ab60bd..27a6da86 100644 --- a/appMain.py +++ b/appMain.py @@ -2094,10 +2094,10 @@ class App(QtCore.QObject): self.ui.delete_btn.triggered.connect(self.on_delete) self.ui.distance_btn.triggered.connect(lambda: self.distance_tool.run(toggle=True)) - self.ui.distance_min_btn.triggered.connect(lambda: self.distance_min_tool.run(toggle=True)) + # self.ui.distance_min_btn.triggered.connect(lambda: self.distance_min_tool.run(toggle=True)) self.ui.origin_btn.triggered.connect(self.on_set_origin) - self.ui.move2origin_btn.triggered.connect(self.on_move2origin) - self.ui.center_in_origin_btn.triggered.connect(self.on_custom_origin) + # self.ui.move2origin_btn.triggered.connect(self.on_move2origin) + # self.ui.center_in_origin_btn.triggered.connect(self.on_custom_origin) self.ui.jmp_btn.triggered.connect(self.on_jump_to) self.ui.locate_btn.triggered.connect(lambda: self.on_locate(obj=self.collection.get_active())) @@ -3877,9 +3877,6 @@ class App(QtCore.QObject): 'hud_font_size', self.ui.general_pref_form.general_app_set_group.hud_font_size_spinner.get_value() ) - - stgs.setValue('toolbar_lock', self.ui.lock_action.isChecked()) - # This will write the setting to the platform specific storage. del stgs diff --git a/defaults.py b/defaults.py index 3cd24993..fa8a4b6d 100644 --- a/defaults.py +++ b/defaults.py @@ -42,7 +42,6 @@ class AppDefaults: "global_move_ref": 'abs', - "global_toolbar_view": 511, "global_gui_layout": 0, # can be 0:"normal" or 1:"columnar" "global_background_timeout": 300000, # Default value is 5 minutes @@ -60,13 +59,6 @@ class AppDefaults: "global_last_folder": None, "global_last_save_folder": None, - # Default window geometry - "global_def_win_x": 100, - "global_def_win_y": 100, - "global_def_win_w": 1024, - "global_def_win_h": 650, - "global_def_notebook_width": 1, - # Constants... "global_defaults_save_period_ms": 20000, # Time between default saves. "global_shell_shape": [500, 300], # Shape of the shell in pixels. @@ -952,18 +944,13 @@ class AppDefaults: except IOError: log.error("Could not load defaults file.") inform.emit('[ERROR] %s' % _("Could not load the file.")) - # in case the defaults file can't be loaded, show all toolbars - self.defaults["global_toolbar_view"] = 511 return # Parse the JSON try: defaults = simplejson.loads(options) except Exception: - # in case the defaults file can't be loaded, show all toolbars - self.defaults["global_toolbar_view"] = 511 - e = sys.exc_info()[0] - log.error(str(e)) + log.error(str(sys.exc_info()[0])) inform.emit('[ERROR] %s' % _("Failed to parse defaults file.")) return if defaults is None: @@ -1123,8 +1110,6 @@ class AppOptions: except IOError: log.error("Could not load defaults file.") inform.emit('[ERROR] %s' % _("Could not load the file.")) - # in case the defaults file can't be loaded, show all toolbars - self.options["global_toolbar_view"] = 511 return # Parse the JSON @@ -1132,9 +1117,7 @@ class AppOptions: options = simplejson.loads(options) except Exception: # in case the defaults file can't be loaded, show all toolbars - self.defaults["global_toolbar_view"] = 511 - e = sys.exc_info()[0] - log.error(str(e)) + log.error(str(sys.exc_info()[0])) inform.emit('[ERROR] %s' % _("Failed to parse defaults file.")) return if options is None: