Merge branch 'Beta' into preferences-refactoring

This commit is contained in:
David Robertson
2020-05-06 01:42:32 +01:00
6 changed files with 162 additions and 115 deletions

View File

@@ -543,50 +543,15 @@ class App(QtCore.QObject):
self.save_project_auto_update()
self.autosave_timer.timeout.connect(self.save_project_auto)
# ###########################################################################################################
# ##################################### UPDATE PREFERENCES GUI FORMS ########################################
# ###########################################################################################################
self.preferencesUiManager = PreferencesUIManager(defaults=self.defaults, data_path=self.data_path, ui=self.ui,
inform=self.inform)
self.preferencesUiManager.defaults_write_form()
# When the self.defaults dictionary changes will update the Preferences GUI forms
self.defaults.set_change_callback(self.on_defaults_dict_change)
# ###########################################################################################################
# ##################################### FIRST RUN SECTION ###################################################
# ################################ It's done only once after install #####################################
# ###########################################################################################################
if self.defaults["first_run"] is True:
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'minimal'
initial_lay = 'minimal'
layout_field = self.preferencesUiManager.get_form_field("layout")
layout_field.setCurrentIndex(layout_field.findText(initial_lay))
self.ui.set_layout(initial_lay)
# after the first run, this object should be False
self.defaults["first_run"] = False
self.preferencesUiManager.save_defaults(silent=True)
# ###########################################################################################################
# ############################################ Data #########################################################
# ###########################################################################################################
self.recent = []
self.recent_projects = []
self.clipboard = QtWidgets.QApplication.clipboard()
self.project_filename = None
self.toggle_units_ignore = False
# ###########################################################################################################
# #################################### LOAD PREPROCESSORS ###################################################
# ###########################################################################################################
# ----------------------------------------- WARNING --------------------------------------------------------
# Preprocessors need to be loaded before the Preferences Manager builds the Preferences
# That's because the number of preprocessors can vary and here the comboboxes are populated
# -----------------------------------------------------------------------------------------------------------
# a dictionary that have as keys the name of the preprocessor files and the value is the class from
# the preprocessor file
self.preprocessors = load_preprocessors(self)
@@ -619,6 +584,44 @@ class App(QtCore.QObject):
self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb.addItem(name)
# ###########################################################################################################
# ##################################### UPDATE PREFERENCES GUI FORMS ########################################
# ###########################################################################################################
self.preferencesUiManager = PreferencesUIManager(defaults=self.defaults, data_path=self.data_path, ui=self.ui,
inform=self.inform)
self.preferencesUiManager.defaults_write_form()
# When the self.defaults dictionary changes will update the Preferences GUI forms
self.defaults.set_change_callback(self.on_defaults_dict_change)
# ###########################################################################################################
# ##################################### FIRST RUN SECTION ###################################################
# ################################ It's done only once after install #####################################
# ###########################################################################################################
if self.defaults["first_run"] is True:
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'minimal'
initial_lay = 'minimal'
layout_field = self.preferencesUiManager.get_form_field("layout")
layout_field.setCurrentIndex(layout_field.findText(initial_lay))
self.ui.set_layout(initial_lay)
# after the first run, this object should be False
self.defaults["first_run"] = False
self.preferencesUiManager.save_defaults(silent=True)
# ###########################################################################################################
# ############################################ Data #########################################################
# ###########################################################################################################
self.recent = []
self.recent_projects = []
self.clipboard = QtWidgets.QApplication.clipboard()
self.project_filename = None
self.toggle_units_ignore = False
# ###########################################################################################################
# ########################################## LOAD LANGUAGES ################################################
# ###########################################################################################################
@@ -2578,7 +2581,7 @@ class App(QtCore.QObject):
self.date = self.date.replace(' ', '_')
filter__ = "HTML File .html (*.html);;TXT File .txt (*.txt);;All Files (*.*)"
path_to_save = self.defaults["global_last_save_folder"] if\
path_to_save = self.defaults["global_last_save_folder"] if \
self.defaults["global_last_save_folder"] is not None else self.data_path
try:
filename, _f = FCFileSaveDialog.get_saved_filename(
@@ -3252,7 +3255,7 @@ class App(QtCore.QObject):
self.prog_grid_lay.addWidget(QtWidgets.QLabel('<b>%s</b>' % _("E-mail")), 0, 2)
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Juan Pablo Caram"), 1, 0)
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Program Author"), 1, 1)
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % _("Program Author")), 1, 1)
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "<>"), 1, 2)
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Denis Hayrullin"), 2, 0)
self.prog_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Kamil Sopko"), 3, 0)
@@ -3348,7 +3351,7 @@ class App(QtCore.QObject):
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Italian"), 4, 0)
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Golfetto Massimiliano"), 4, 1)
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % " "), 4, 2)
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "pcb@golfetto.eu"), 4, 3)
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "<golfetto.pcb@gmail.com>"), 4, 3)
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "German"), 5, 0)
self.translator_grid_lay.addWidget(QtWidgets.QLabel('%s' % "Marius Stanciu (Google-Tr)"), 5, 1)
@@ -3605,6 +3608,7 @@ class App(QtCore.QObject):
# quit app by signalling for self.kill_app() method
# self.close_app_signal.emit()
QtWidgets.qApp.quit()
# QtCore.QCoreApplication.exit()
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
# we use the following command