- adjusted axis at startup for legacy graphic engine plotcanvas

- when the graphic engine is changed in Edit -> Preferences -> General -> App Preferences, the application will restart
This commit is contained in:
Marius Stanciu 2019-09-22 04:34:19 +03:00 committed by Marius
parent 42d26c1323
commit b0b2e37ac6
5 changed files with 19 additions and 3 deletions

View File

@ -126,6 +126,7 @@ class App(QtCore.QObject):
version = 8.97
version_date = "2019/09/20"
beta = True
engine = '3D'
# current date now
date = str(datetime.today()).rpartition('.')[0]
@ -1873,6 +1874,11 @@ class App(QtCore.QObject):
# ##############################
# ### GUI PREFERENCES SIGNALS ##
# ##############################
self.ui.general_defaults_form.general_app_group.ge_radio.activated_custom.connect(
lambda: fcTranslate.restart_program(app=self)
)
self.ui.general_options_form.general_app_group.units_radio.group_toggle_fn = self.on_toggle_units
self.ui.general_defaults_form.general_app_group.language_apply_btn.clicked.connect(
lambda: fcTranslate.on_language_apply_click(self, restart=True)
@ -2482,6 +2488,9 @@ class App(QtCore.QObject):
# when True, the app has to return from any thread
self.abort_flag = False
# set the value used in the Windows Title
self.engine = self.ui.general_defaults_form.general_app_group.ge_radio.get_value()
# ###############################################################################
# ############# Save defaults to factory_defaults.FlatConfig file ###############
# ############# It's done only once after install ###############
@ -2751,10 +2760,11 @@ class App(QtCore.QObject):
:param name: String that store the project path and project name
:return: None
"""
self.ui.setWindowTitle('FlatCAM %s %s - %s %s' %
self.ui.setWindowTitle('FlatCAM %s %s - %s - (%s) %s' %
(self.version,
('BETA' if self.beta else ''),
platform.architecture()[0],
self.engine,
name)
)

View File

@ -16,6 +16,7 @@ from PyQt5.QtCore import QSettings
from flatcamGUI.GUIElements import log
import gettext
# import builtins
#
# if '_' not in builtins.__dict__:
@ -154,12 +155,13 @@ def apply_language(domain, lang=None):
return name
def restart_program(app):
def restart_program(app, ask=None):
"""Restarts the current program.
Note: this function does not return. Any cleanup action (like
saving data) must be done before calling this function.
"""
if app.should_we_save and app.collection.get_list():
if app.should_we_save and app.collection.get_list() or ask is True:
msgbox = QtWidgets.QMessageBox()
msgbox.setText(_("There are files/objects modified in FlatCAM. "
"\n"

View File

@ -16,6 +16,8 @@ CAD program, and create G-Code for Isolation routing.
- fixed Paint tool to work in legacy graphic engine
- fixed CutOut Tool to work in legacy graphic engine
- fixed display of distance labels and code optimizations in ToolPaint and NCC Tool
- adjusted axis at startup for legacy graphic engine plotcanvas
- when the graphic engine is changed in Edit -> Preferences -> General -> App Preferences, the application will restart
21.09.2019

View File

@ -154,6 +154,7 @@ class PlotCanvasLegacy(QtCore.QObject):
self.canvas.setFocus()
self.native = self.canvas
self.adjust_axes(-10, -10, 100, 100)
# self.canvas.set_can_focus(True) # For key press
# Attach to parent

View File

@ -975,6 +975,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
# Add (label - input field) pair to the QFormLayout
self.form_box.addRow(self.unitslabel, self.units_radio)
self.form_box.addRow(self.ge_label, self.ge_radio)
self.form_box.addRow(QtWidgets.QLabel(''))
self.form_box.addRow(self.app_level_label, self.app_level_radio)
self.form_box.addRow(self.portability_label, self.portability_cb)
self.form_box.addRow(QtWidgets.QLabel(''))