- fixed the "headless" feature; running headless still start the GUI just it does not show it

- when running headless the sys tray icon will always be shown so the user can close the app correctly
- in the systray icon context menu I've added a menu entry to toggle the GUI
This commit is contained in:
Marius Stanciu
2021-08-25 13:53:00 +03:00
parent 9ed8306c5f
commit 67120e3214
4 changed files with 42 additions and 12 deletions

View File

@@ -2017,6 +2017,20 @@ class MainGUI(QtWidgets.QMainWindow):
self.app.version, ('BETA' if self.app.beta else ''), platform.architecture()[0], self.app.engine, name)
self.setWindowTitle(title)
def on_toggle_gui(self):
if self.isHidden():
mgui_settings = QSettings("Open Source", "FlatCAM")
if mgui_settings.contains("maximized_gui"):
maximized_ui = mgui_settings.value('maximized_gui', type=bool)
if maximized_ui is True:
self.showMaximized()
else:
self.show()
else:
self.show()
else:
self.hide()
def save_geometry(self, x, y, width, height, notebook_width):
"""
Will save the application geometry and positions in the defaults dicitionary to be restored at the next