- 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 - 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) - 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 - 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 2.08.2020

View File

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

View File

@ -2025,16 +2025,16 @@ class CNCObjectUI(ObjectUI):
# self.toolch_ois = OptionalInputSection(self.toolchange_cb, # self.toolch_ois = OptionalInputSection(self.toolchange_cb,
# [self.toolchangelabel, self.toolchange_text, self.tc_variable_combo]) # [self.toolchangelabel, self.toolchange_text, self.tc_variable_combo])
# #
h_lay = QtWidgets.QHBoxLayout() # h_lay = QtWidgets.QHBoxLayout()
h_lay.setAlignment(QtCore.Qt.AlignVCenter) # h_lay.setAlignment(QtCore.Qt.AlignVCenter)
self.custom_box.addLayout(h_lay) # self.custom_box.addLayout(h_lay)
# # Edit GCode Button # Review GCode Button
# self.modify_gcode_button = QtWidgets.QPushButton(_('View CNC Code')) self.review_gcode_button = QtWidgets.QPushButton(_('Review'))
# self.modify_gcode_button.setToolTip( self.review_gcode_button.setToolTip(
# _("Opens TAB to view/modify/print G-Code\n" _("Review CNC Code.")
# "file.") )
# ) self.custom_box.addWidget(self.review_gcode_button)
# Save Button # Save Button
self.export_gcode_button = QtWidgets.QPushButton(_('Save CNC Code')) self.export_gcode_button = QtWidgets.QPushButton(_('Save CNC Code'))
@ -2044,7 +2044,8 @@ class CNCObjectUI(ObjectUI):
"file.") "file.")
) )
h_lay.addWidget(self.export_gcode_button) self.custom_box.addWidget(self.export_gcode_button)
self.custom_box.addStretch()
class ScriptObjectUI(ObjectUI): 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.updateplot_button.clicked.connect(self.on_updateplot_button_click)
self.ui.export_gcode_button.clicked.connect(self.on_exportgcode_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) # 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.gcode_editor_tab.t_frame.show()
self.app.proc_container.view.set_idle() 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')) self.app.inform.emit('[success] %s...' % _('Loaded Machine Code into Code Editor'))