- fixed bug: on first ever usage of FlatCAM beta the last loaded language (alphabetically) is used instead of English (in current state is Russian)

- made sure the the GUI settings are cleared on each new install
- added a new signal that is triggered by change in visibility for the Shell Dock and will change the status of the shell label in the status bar. In this way the label will really be changed each time the shell is toggled
This commit is contained in:
Marius Stanciu 2020-06-07 22:32:36 +03:00 committed by Marius
parent a71292af30
commit e2df2c3b62
4 changed files with 51 additions and 24 deletions

View File

@ -15,6 +15,9 @@ CHANGELOG for FlatCAM beta
- in Excellon parser added a way to "guestimate" the units if no units are detected in the header. I may need to make it optional in Preferences
- changed the Excellon defaults for zeros suppression to TZ (assumed that most Excellon without units in header will come out of older Eagle) and the Excellon export default is now with coordinates in decimal
- made sure that the message that exclusion areas are deleted is displayed only if there are shapes in the exclusion areas storage
- fixed bug: on first ever usage of FlatCAM beta the last loaded language (alphabetically) is used instead of English (in current state is Russian)
- made sure the the GUI settings are cleared on each new install
- added a new signal that is triggered by change in visibility for the Shell Dock and will change the status of the shell label in the status bar. In this way the label will really be changed each time the shell is toggled
6.06.2020

View File

@ -1705,6 +1705,8 @@ class MainGUI(QtWidgets.QMainWindow):
self.geom_update[int, int, int, int, int].connect(self.save_geometry)
self.final_save.connect(self.app.final_save)
self.shell_dock.visibilityChanged.connect(self.on_shelldock_toggled)
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
@ -1823,7 +1825,12 @@ class MainGUI(QtWidgets.QMainWindow):
subprocess.Popen(['xdg-open', self.app.data_path])
self.app.inform.emit('[success] %s' % _("FlatCAM Preferences Folder opened."))
def on_gui_clear(self):
def on_gui_clear(self, signal=None, forced_clear=False):
"""
Will clear the settings that are stored in QSettings.
"""
log.debug("Clearing the settings in QSettings. GUI settings cleared.")
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
theme_settings.setValue('theme', 'white')
@ -1831,20 +1838,22 @@ class MainGUI(QtWidgets.QMainWindow):
resource_loc = self.app.resource_location
msgbox = QtWidgets.QMessageBox()
msgbox.setText(_("Are you sure you want to delete the GUI Settings? \n"))
msgbox.setWindowTitle(_("Clear GUI Settings"))
msgbox.setWindowIcon(QtGui.QIcon(resource_loc + '/trash32.png'))
msgbox.setIcon(QtWidgets.QMessageBox.Question)
response = None
if forced_clear is False:
msgbox = QtWidgets.QMessageBox()
msgbox.setText(_("Are you sure you want to delete the GUI Settings? \n"))
msgbox.setWindowTitle(_("Clear GUI Settings"))
msgbox.setWindowIcon(QtGui.QIcon(resource_loc + '/trash32.png'))
msgbox.setIcon(QtWidgets.QMessageBox.Question)
bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
msgbox.setDefaultButton(bt_no)
msgbox.exec_()
response = msgbox.clickedButton()
msgbox.setDefaultButton(bt_no)
msgbox.exec_()
response = msgbox.clickedButton()
if response == bt_yes:
if forced_clear is True or response == bt_yes:
qsettings = QSettings("Open Source", "FlatCAM")
for key in qsettings.allKeys():
qsettings.remove(key)
@ -3664,18 +3673,8 @@ class MainGUI(QtWidgets.QMainWindow):
if self.shell_dock.isVisible():
self.shell_dock.hide()
self.app.plotcanvas.native.setFocus()
self.shell_status_label.setStyleSheet("")
self.app.inform[str, bool].emit(_("Shell disabled."), False)
else:
self.shell_dock.show()
self.shell_status_label.setStyleSheet("""
QLabel
{
color: black;
background-color: lightcoral;
}
""")
self.app.inform[str, bool].emit(_("Shell enabled."), False)
# I want to take the focus and give it to the Tcl Shell when the Tcl Shell is run
# self.shell._edit.setFocus()
@ -3691,6 +3690,20 @@ class MainGUI(QtWidgets.QMainWindow):
# no_km)
# QtWidgets.qApp.sendEvent(self.shell._edit, f)
def on_shelldock_toggled(self, visibility):
if visibility is True:
self.shell_status_label.setStyleSheet("""
QLabel
{
color: black;
background-color: lightcoral;
}
""")
self.app.inform[str, bool].emit(_("Shell enabled."), False)
else:
self.shell_status_label.setStyleSheet("")
self.app.inform[str, bool].emit(_("Shell disabled."), False)
class ShortcutsTab(QtWidgets.QWidget):

View File

@ -135,7 +135,7 @@ def apply_language(domain, lang=None):
if settings.contains("language"):
name = settings.value('language')
else:
name = settings.value('English')
name = 'English'
# in case the 'language' parameter is not in QSettings add it to QSettings and it's value is
# the default language, English
settings.setValue('language', 'English')

View File

@ -449,6 +449,17 @@ class App(QtCore.QObject):
# ###########################################################################################################
self.pool = Pool()
# ###########################################################################################################
# ###################################### Clear GUI Settings - once at first start ###########################
# ###########################################################################################################
if self.defaults["first_run"] is True:
# on first run clear the previous QSettings, therefore clearing the GUI settings
qsettings = QSettings("Open Source", "FlatCAM")
for key in qsettings.allKeys():
qsettings.remove(key)
# This will write the setting to the platform specific storage.
del qsettings
# ###########################################################################################################
# ###################################### Setting the Splash Screen ##########################################
# ###########################################################################################################
@ -579,7 +590,7 @@ class App(QtCore.QObject):
# ################################ It's done only once after install #####################################
# ###########################################################################################################
if self.defaults["first_run"] is True:
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'COMPACT'
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'minimal'
initial_lay = 'minimal'
self.ui.general_defaults_form.general_gui_group.on_layout(lay=initial_lay)