- GCode Editor - modified the UI

This commit is contained in:
Marius Stanciu 2020-08-03 23:20:41 +03:00
parent b7630f1334
commit eb28d28ea2
4 changed files with 36 additions and 33 deletions

View File

@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta
- GCode Editor - GCode tool selection when clicking on tool in Tools table is working. The only issue is that the first tool gcode includes the start gcode which confuse the algorithm
- GCode Editor - can not delete objects while in the Editor; can not close the Code Editor Tab except on Editor exit; activated the shortcut keys (for now only CTRL+S is working)
- added a way to remember the old state of Tools toolbar before and after entering an Editor
- GCode Editor - modified the UI
2.08.2020

View File

@ -709,50 +709,48 @@ class AppGCodeEditorUI:
self.edit_box.addWidget(separator_line)
# Prepend text to GCode
prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to CNC Code'))
prependlabel = QtWidgets.QLabel('%s 1:' % _('CNC Code Snippet'))
prependlabel.setToolTip(
_("Type here any G-Code commands you would\n"
"like to add at the beginning of the G-Code file.")
_("Code snippet defined in Preferences.")
)
self.edit_box.addWidget(prependlabel)
self.prepend_text = FCTextArea()
self.prepend_text.setPlaceholderText(
_("Type here any G-Code commands you would\n"
"like to add at the beginning of the G-Code file.")
"like to insert at the cursor location.")
)
self.edit_box.addWidget(self.prepend_text)
# Insert Button
self.update_gcode_button = FCButton(_('Insert Code'))
# self.update_gcode_button.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png'))
self.update_gcode_button.setToolTip(
_("Insert the code above at the cursor location.")
)
self.edit_box.addWidget(self.update_gcode_button)
# Append text to GCode
appendlabel = QtWidgets.QLabel('%s:' % _('Append to CNC Code'))
appendlabel = QtWidgets.QLabel('%s 2:' % _('CNC Code Snippet'))
appendlabel.setToolTip(
_("Type here any G-Code commands you would\n"
"like to append to the generated file.\n"
"I.e.: M2 (End of program)")
_("Code snippet defined in Preferences.")
)
self.edit_box.addWidget(appendlabel)
self.append_text = FCTextArea()
self.append_text.setPlaceholderText(
_("Type here any G-Code commands you would\n"
"like to append to the generated file.\n"
"I.e.: M2 (End of program)")
"like to insert at the cursor location.")
)
self.edit_box.addWidget(self.append_text)
h_lay = QtWidgets.QHBoxLayout()
h_lay.setAlignment(QtCore.Qt.AlignVCenter)
self.edit_box.addLayout(h_lay)
# GO Button
self.update_gcode_button = FCButton(_('Update Code'))
# Insert Button
self.update_gcode_sec_button = FCButton(_('Insert Code'))
# self.update_gcode_button.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png'))
self.update_gcode_button.setToolTip(
_("Update the Gcode in the Editor with the values\n"
"in the 'Prepend' and 'Append' text boxes.")
self.update_gcode_sec_button.setToolTip(
_("Insert the code above at the cursor location.")
)
h_lay.addWidget(self.update_gcode_button)
self.edit_box.addWidget(self.update_gcode_sec_button)
layout.addStretch()

View File

@ -2025,16 +2025,16 @@ class CNCObjectUI(ObjectUI):
# self.toolch_ois = OptionalInputSection(self.toolchange_cb,
# [self.toolchangelabel, self.toolchange_text, self.tc_variable_combo])
#
h_lay = QtWidgets.QHBoxLayout()
h_lay.setAlignment(QtCore.Qt.AlignVCenter)
self.custom_box.addLayout(h_lay)
# 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.")
# )
# Review GCode Button
self.review_gcode_button = QtWidgets.QPushButton(_('Review'))
self.review_gcode_button.setToolTip(
_("Review CNC Code.")
)
self.custom_box.addWidget(self.review_gcode_button)
# Save Button
self.export_gcode_button = QtWidgets.QPushButton(_('Save CNC Code'))
@ -2044,7 +2044,8 @@ class CNCObjectUI(ObjectUI):
"file.")
)
h_lay.addWidget(self.export_gcode_button)
self.custom_box.addWidget(self.export_gcode_button)
self.custom_box.addStretch()
class ScriptObjectUI(ObjectUI):

View File

@ -451,7 +451,8 @@ 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.editor_button.clicked.connect(self.on_edit_code_click)
self.ui.review_gcode_button.clicked.connect(self.on_edit_code_click)
self.ui.editor_button.clicked.connect(lambda: self.app.object2editor())
# self.ui.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
@ -623,7 +624,9 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.gcode_editor_tab.t_frame.show()
self.app.proc_container.view.set_idle()
self.gcode_editor_tab.buttonSave.clicked.connect(self.on_update_source_file)
self.gcode_editor_tab.buttonSave.hide()
self.gcode_editor_tab.buttonOpen.hide()
self.gcode_editor_tab.code_editor.setReadOnly(True)
self.app.inform.emit('[success] %s...' % _('Loaded Machine Code into Code Editor'))