- added some icons in the Code Editor

- replaced some icons in the app
- in Code Editor, when changing text, the Save Code button will change color (text and icon) to red and after save it will revert the color to the default one
- in Code Editor some methods rework
This commit is contained in:
Marius Stanciu
2020-07-18 00:26:03 +03:00
committed by Marius
parent 1b15d2a2c1
commit 8409c74e23
29 changed files with 61 additions and 61 deletions

View File

@@ -579,10 +579,6 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.app.ui.position_label.setText("")
self.app.ui.rel_position_label.setText("")
# first clear previous text in text editor (if any)
self.gcode_editor_tab.code_editor.clear()
self.gcode_editor_tab.code_editor.setReadOnly(False)
self.gcode_editor_tab.code_editor.completer_enable = False
self.gcode_editor_tab.buttonRun.hide()
@@ -592,20 +588,12 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.gcode_editor_tab.t_frame.hide()
# then append the text from GCode to the text editor
try:
self.gcode_editor_tab.code_editor.setPlainText(self.app.gcode_edited.getvalue())
# for line in self.app.gcode_edited:
# QtWidgets.QApplication.processEvents()
#
# proc_line = str(line).strip('\n')
# self.gcode_editor_tab.code_editor.append(proc_line)
self.gcode_editor_tab.load_text(self.app.gcode_edited.getvalue(), move_to_start=True, clear_text=True)
except Exception as e:
log.debug('FlatCAMCNNJob.on_edit_code_click() -->%s' % str(e))
self.app.inform.emit('[ERROR] %s %s' % ('FlatCAMCNNJob.on_edit_code_click() -->', str(e)))
return
self.gcode_editor_tab.code_editor.moveCursor(QtGui.QTextCursor.Start)
self.gcode_editor_tab.handleTextChanged()
self.gcode_editor_tab.t_frame.show()
self.app.proc_container.view.set_idle()

View File

@@ -84,10 +84,6 @@ class DocumentObject(FlatCAMObj):
self.document_editor_tab.code_editor.setStyleSheet(stylesheet)
# first clear previous text in text editor (if any)
self.document_editor_tab.code_editor.clear()
self.document_editor_tab.code_editor.setReadOnly(self._read_only)
self.document_editor_tab.buttonRun.hide()
self.ui.autocomplete_cb.set_value(self.app.defaults['document_autocompleter'])
@@ -138,14 +134,16 @@ class DocumentObject(FlatCAMObj):
self.ui.font_size_cb.setCurrentIndex(int(self.app.defaults['document_font_size']))
self.document_editor_tab.handleTextChanged()
# self.document_editor_tab.handleTextChanged()
self.ser_attrs = ['options', 'kind', 'source_file']
if Qt.mightBeRichText(self.source_file):
self.document_editor_tab.code_editor.setHtml(self.source_file)
# self.document_editor_tab.code_editor.setHtml(self.source_file)
self.document_editor_tab.load_text(self.source_file, move_to_start=True, clear_text=True, as_html=True)
else:
for line in self.source_file.splitlines():
self.document_editor_tab.code_editor.append(line)
# for line in self.source_file.splitlines():
# self.document_editor_tab.code_editor.append(line)
self.document_editor_tab.load_text(self.source_file, move_to_start=True, clear_text=True, as_html=False)
self.build_ui()

View File

@@ -135,14 +135,11 @@ class ScriptObject(FlatCAMObj):
self.script_editor_tab.t_frame.hide()
try:
self.script_editor_tab.code_editor.setPlainText(self.source_file)
# for line in self.source_file.splitlines():
# QtWidgets.QApplication.processEvents()
# self.script_editor_tab.code_editor.append(line)
# self.script_editor_tab.code_editor.setPlainText(self.source_file)
self.script_editor_tab.load_text(self.source_file, move_to_end=True)
except Exception as e:
log.debug("ScriptObject.set_ui() --> %s" % str(e))
self.script_editor_tab.code_editor.moveCursor(QtGui.QTextCursor.End)
self.script_editor_tab.t_frame.show()
self.app.proc_container.view.set_idle()