Merge branch 'Beta'

This commit is contained in:
David Robertson
2020-05-03 01:53:27 +01:00
52 changed files with 58356 additions and 48641 deletions

View File

@@ -2366,7 +2366,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# ########################################################################
# ######################## BUILD PREFERENCES #############################
# ########################################################################
self.general_defaults_form = GeneralPreferencesUI(decimals=self.decimals)
self.gerber_defaults_form = GerberPreferencesUI(decimals=self.decimals)
self.excellon_defaults_form = ExcellonPreferencesUI(decimals=self.decimals)
@@ -2381,7 +2380,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# ########################################################################
# ################## RESTORE THE TOOLBAR STATE from file #################
# ########################################################################
flat_settings = QSettings("Open Source", "FlatCAM")
if flat_settings.contains("saved_gui_state"):
saved_gui_state = flat_settings.value('saved_gui_state')
@@ -2439,15 +2437,42 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
del qsettings
self.lock_toolbar(lock=lock_state)
self.on_grid_snap_triggered(state=True)
self.lock_action.triggered[bool].connect(self.lock_toolbar)
self.pref_open_button.clicked.connect(self.on_preferences_open_folder)
self.clear_btn.clicked.connect(self.on_gui_clear)
self.grid_snap_btn.triggered.connect(self.on_grid_snap_triggered)
self.snap_infobar_label.clicked.connect(self.on_grid_icon_snap_clicked)
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def on_grid_snap_triggered(self, state):
"""
:param state: A parameter with the state of the grid, boolean
:return:
"""
if state:
self.snap_infobar_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/snap_filled_16.png'))
else:
self.snap_infobar_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/snap_16.png'))
self.snap_infobar_label.clicked_state = state
def on_grid_icon_snap_clicked(self):
"""
Slot called by clicking a GUI element, in this case a FCLabel
:return:
"""
if isinstance(self.sender(), FCLabel):
self.grid_snap_btn.trigger()
def eventFilter(self, obj, event):
"""
Filter the ToolTips display based on a Preferences setting
@@ -3207,7 +3232,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
else:
self.app.collection.set_active(names_list[active_index-1])
# Select the object in the Tree bellow the current one
# Select the object in the Tree below the current one
if key == QtCore.Qt.Key_Down:
# make sure it works only for the Project Tab who is an instance of KeySensitiveListView
focused_wdg = QtWidgets.QApplication.focusWidget()
@@ -3811,10 +3836,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.grb_editor.select_tool('track')
return
# Zoom Fit
# Zoom fit
if key == QtCore.Qt.Key_V or key == 'V':
self.app.grb_editor.launched_from_shortcuts = True
self.app.on_zoom_fit(None)
self.app.grb_editor.on_zoom_fit()
return
# Show Shortcut list

View File

@@ -45,7 +45,7 @@ class PreferencesUIManager:
# if Preferences are changed in the Edit -> Preferences tab the value will be set to True
self.preferences_changed_flag = False
# when adding entries here read the comments in the method found bellow named:
# when adding entries here read the comments in the method found below named:
# def new_object(self, kind, name, initialize, active=True, fit=True, plot=True)
self.defaults_form_fields = {
# General App

View File

@@ -374,10 +374,25 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.splash_cb.stateChanged.connect(self.on_splash_changed)
# Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
self.shell_startup_cb.clicked.connect(self.on_toggle_shell_from_settings)
self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
def on_toggle_shell_from_settings(self, state):
"""
Toggle shell: if is visible close it, if it is closed then open it
:return: None
"""
self.app.defaults.report_usage("on_toggle_shell_from_settings()")
if state is True:
if not self.app.ui.shell_dock.isVisible():
self.app.ui.shell_dock.show()
else:
if self.app.ui.shell_dock.isVisible():
self.app.ui.shell_dock.hide()
@staticmethod
def on_splash_changed(state):
qsettings = QSettings("Open Source", "FlatCAM")

View File

@@ -377,7 +377,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI2):
self.app.connect_toolbar_signals()
self.app.ui.grid_snap_btn.setChecked(True)
self.app.on_grid_snap_triggered(state=True)
self.app.ui.on_grid_snap_triggered(state=True)
self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))