- 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)
This commit is contained in:
parent
7d47a133f6
commit
ffda89f949
|
@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
|
|||
3.08.2020
|
||||
|
||||
- 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)
|
||||
|
||||
2.08.2020
|
||||
|
||||
|
|
|
@ -65,6 +65,10 @@ class AppGCodeEditor(QtCore.QObject):
|
|||
# add the tab if it was closed
|
||||
self.app.ui.plot_tab_area.addTab(self.ui.gcode_editor_tab, '%s' % _("Code Editor"))
|
||||
self.ui.gcode_editor_tab.setObjectName('gcode_editor_tab')
|
||||
# protect the tab that was just added
|
||||
for idx in range(self.app.ui.plot_tab_area.count()):
|
||||
if self.app.ui.plot_tab_area.widget(idx).objectName() == self.ui.gcode_editor_tab.objectName():
|
||||
self.app.ui.plot_tab_area.protectTab(idx)
|
||||
|
||||
# delete the absolute and relative position and messages in the infobar
|
||||
self.app.ui.position_label.setText("")
|
||||
|
@ -97,6 +101,8 @@ class AppGCodeEditor(QtCore.QObject):
|
|||
self.edited_obj_name = self.gcode_obj.options['name']
|
||||
self.ui.name_entry.set_value(self.edited_obj_name)
|
||||
|
||||
self.activate()
|
||||
|
||||
# #################################################################################
|
||||
# ################### SIGNALS #####################################################
|
||||
# #################################################################################
|
||||
|
@ -578,6 +584,7 @@ class AppGCodeEditor(QtCore.QObject):
|
|||
"""
|
||||
my_gcode = self.ui.gcode_editor_tab.code_editor.toPlainText()
|
||||
self.gcode_obj.source_file = my_gcode
|
||||
self.deactivate()
|
||||
|
||||
self.ui.gcode_editor_tab.buttonSave.setStyleSheet("")
|
||||
self.ui.gcode_editor_tab.buttonSave.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png'))
|
||||
|
@ -602,6 +609,14 @@ class AppGCodeEditor(QtCore.QObject):
|
|||
self.ui.gcode_editor_tab.load_text(self.code_edited, move_to_start=True, clear_text=True)
|
||||
file.close()
|
||||
|
||||
def activate(self):
|
||||
self.editor_active = True
|
||||
self.app.call_source = 'gcode_editor'
|
||||
|
||||
def deactivate(self):
|
||||
self.editor_active = False
|
||||
self.app.call_source = 'app'
|
||||
|
||||
def on_name_activate(self):
|
||||
self.edited_obj_name = self.ui.name_entry.get_value()
|
||||
|
||||
|
|
|
@ -3514,6 +3514,22 @@ class MainGUI(QtWidgets.QMainWindow):
|
|||
else:
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Adding Tool cancelled ..."))
|
||||
return
|
||||
elif self.app.call_source == 'gcode_editor':
|
||||
# CTRL
|
||||
if modifiers == QtCore.Qt.ControlModifier:
|
||||
# save (update) the current geometry and return to the App
|
||||
if key == QtCore.Qt.Key_S or key == 'S':
|
||||
self.app.editor2object()
|
||||
return
|
||||
# SHIFT
|
||||
elif modifiers == QtCore.Qt.ShiftModifier:
|
||||
pass
|
||||
# ALT
|
||||
elif modifiers == QtCore.Qt.AltModifier:
|
||||
pass
|
||||
# NO MODIFIER
|
||||
elif modifiers == QtCore.Qt.NoModifier:
|
||||
pass
|
||||
elif self.app.call_source == 'measurement':
|
||||
if modifiers == QtCore.Qt.ControlModifier:
|
||||
pass
|
||||
|
|
|
@ -2416,6 +2416,7 @@ class App(QtCore.QObject):
|
|||
self.exc_editor.deactivate()
|
||||
edited_obj.build_ui()
|
||||
elif edited_obj.kind == 'cncjob':
|
||||
self.gcode_editor.deactivate()
|
||||
edited_obj.build_ui()
|
||||
|
||||
# close the open tab
|
||||
|
@ -4533,7 +4534,7 @@ class App(QtCore.QObject):
|
|||
# Make sure that the deletion will happen only after the Editor is no longer active otherwise we might delete
|
||||
# a geometry object before we update it.
|
||||
if self.geo_editor.editor_active is False and self.exc_editor.editor_active is False \
|
||||
and self.grb_editor.editor_active is False:
|
||||
and self.grb_editor.editor_active is False and self.gcode_editor.editor_active is False:
|
||||
if self.defaults["global_delete_confirmation"] is True and force_deletion is False:
|
||||
msgbox = QtWidgets.QMessageBox()
|
||||
msgbox.setWindowTitle(_("Delete objects"))
|
||||
|
|
Loading…
Reference in New Issue