- when creating a nw project the user is asked if he wants to save the preferences

This commit is contained in:
Marius Stanciu
2021-08-18 01:31:58 +03:00
committed by Marius
parent db8a85c493
commit 08e6eaa084
3 changed files with 19 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta
- fixed the "Set Color" functionality broken by recent changes
- updated the "Set Color" functionality to store the used color in a correct way
- when creating a nw project the user is asked if he wants to save the preferences
17.08.2021

View File

@@ -1152,7 +1152,7 @@ class PreferencesUIManager:
:param silent: Whether to display a message in status bar or not; boolean
:param data_path: The path where to save the preferences file (current_defaults.FlatConfig)
When the application is portable it should be a mobile location.
When the application is portable it should be a mobile location.
:param first_time: Boolean. If True will execute some code when the app is run first time
:return: None
"""

View File

@@ -9861,6 +9861,23 @@ class MenuFileHandlers(QtCore.QObject):
self.app.ui.plot_tab_area.insertTab(0, self.app.ui.plot_tab, _("Plot Area"))
self.app.ui.plot_tab_area.protectTab(0)
msgbox = QtWidgets.QMessageBox()
msgbox.setText(_("Do you want to save the current settings/preferences?"))
msgbox.setWindowTitle(_("Save preferences"))
msgbox.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png'))
msgbox.setIcon(QtWidgets.QMessageBox.Icon.Question)
bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.ButtonRole.YesRole)
bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.ButtonRole.NoRole)
# bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.ButtonRole.RejectRole)
msgbox.setDefaultButton(bt_yes)
msgbox.exec()
response = msgbox.clickedButton()
if response == bt_yes:
self.app.preferencesUiManager.save_defaults()
# take the focus of the Notebook on Project Tab.
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)