From 7b891900be52156e1f9ac7035a147c61b578bc71 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 15 Jul 2020 03:31:39 +0300 Subject: [PATCH] - added Editor Push buttons in Geometry and CNCJob UI's --- CHANGELOG.md | 2 ++ appEditors/AppExcEditor.py | 1 + appEditors/AppGeoEditor.py | 1 + appEditors/AppGerberEditor.py | 1 + appGUI/ObjectUI.py | 36 +++++++++++++++++++++++++++-------- appObjects/FlatCAMCNCJob.py | 2 +- appObjects/FlatCAMGeometry.py | 2 ++ appTools/ToolDrilling.py | 3 +++ 8 files changed, 39 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05b16ff1..e3d4494b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ CHANGELOG for FlatCAM beta 15.07.2020 - added icons to some of the push buttons +- Tool Drilling - automatically switch to the Selected Tab after job finished +- added Editor Push buttons in Geometry and CNCJob UI's 14.07.2020 diff --git a/appEditors/AppExcEditor.py b/appEditors/AppExcEditor.py index ead97d90..86a3ed47 100644 --- a/appEditors/AppExcEditor.py +++ b/appEditors/AppExcEditor.py @@ -4195,6 +4195,7 @@ class AppExcEditorUI: # Editor self.exit_editor_button = QtWidgets.QPushButton(_('Exit Editor')) + self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) self.exit_editor_button.setToolTip( _("Exit from Editor.") ) diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index ab37dca5..5a0160ef 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -3299,6 +3299,7 @@ class AppGeoEditor(QtCore.QObject): # Editor self.exit_editor_button = QtWidgets.QPushButton(_('Exit Editor')) + self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) self.exit_editor_button.setToolTip( _("Exit from Editor.") ) diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index a1c66aca..93837356 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -2896,6 +2896,7 @@ class AppGerberEditor(QtCore.QObject): # Editor self.exit_editor_button = QtWidgets.QPushButton(_('Exit Editor')) + self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) self.exit_editor_button.setToolTip( _("Exit from Editor.") ) diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index 6feaa0a1..e38f6d45 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -1860,6 +1860,26 @@ class CNCObjectUI(ObjectUI): ) self.custom_box.addWidget(self.updateplot_button) + # Editor + self.editor_button = QtWidgets.QPushButton(_('GCode Editor')) + self.editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/edit_file32.png')) + + self.editor_button.setToolTip( + _("Edit an GCode object.") + ) + self.editor_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.custom_box.addWidget(self.editor_button) + + separator_line = QtWidgets.QFrame() + separator_line.setFrameShape(QtWidgets.QFrame.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.custom_box.addWidget(separator_line) + # #################### # ## Export G-Code ## # #################### @@ -1991,13 +2011,13 @@ class CNCObjectUI(ObjectUI): h_lay = QtWidgets.QHBoxLayout() h_lay.setAlignment(QtCore.Qt.AlignVCenter) self.custom_box.addLayout(h_lay) - - # Edit GCode Button - self.modify_gcode_button = QtWidgets.QPushButton(_('View CNC Code')) - self.modify_gcode_button.setToolTip( - _("Opens TAB to view/modify/print G-Code\n" - "file.") - ) + # + # # Edit GCode Button + # self.modify_gcode_button = QtWidgets.QPushButton(_('View CNC Code')) + # self.modify_gcode_button.setToolTip( + # _("Opens TAB to view/modify/print G-Code\n" + # "file.") + # ) # GO Button self.export_gcode_button = QtWidgets.QPushButton(_('Save CNC Code')) @@ -2006,7 +2026,7 @@ class CNCObjectUI(ObjectUI): "file.") ) - h_lay.addWidget(self.modify_gcode_button) + # h_lay.addWidget(self.modify_gcode_button) h_lay.addWidget(self.export_gcode_button) # self.custom_box.addWidget(self.export_gcode_button) diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index 9e049da3..42940d24 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -436,7 +436,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): self.ui.updateplot_button.clicked.connect(self.on_updateplot_button_click) self.ui.export_gcode_button.clicked.connect(self.on_exportgcode_button_click) - self.ui.modify_gcode_button.clicked.connect(self.on_edit_code_click) + self.ui.editor_button.clicked.connect(self.on_edit_code_click) self.ui.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters) diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index 29fc7668..eb4ca7ac 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -611,6 +611,8 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click) self.ui.multicolored_cb.stateChanged.connect(self.on_multicolored_cb_click) + self.ui.editor_button.clicked.connect(self.app.object2editor) + self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click) self.ui.paint_tool_button.clicked.connect(lambda: self.app.paint_tool.run(toggle=False)) self.ui.generate_ncc_button.clicked.connect(lambda: self.app.ncclear_tool.run(toggle=False)) diff --git a/appTools/ToolDrilling.py b/appTools/ToolDrilling.py index 41662f20..3d430252 100644 --- a/appTools/ToolDrilling.py +++ b/appTools/ToolDrilling.py @@ -1826,6 +1826,9 @@ class ToolDrilling(AppTool, Excellon): with self.app.proc_container.new(_("Generating CNC Code")): a_obj.app_obj.new_object("cncjob", job_name, job_init) + # Switch notebook to Selected page + self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab) + # Create promise for the new name. self.app.collection.promise(job_name)