- fixed GCode Editor such that selection of the only tool present when the GCode ie generated without Toolchange event will select all the actual working GCode
This commit is contained in:
@@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
- working on the Follow Tool and Milling Tool
|
- working on the Follow Tool and Milling Tool
|
||||||
- working on the Isolation Tool and Milling Tool
|
- working on the Isolation Tool and Milling Tool
|
||||||
|
- fixed GCode Editor such that selection of the only tool present when the GCode ie generated without Toolchange event will select all the actual working GCode
|
||||||
|
|
||||||
12.01.2021
|
12.01.2021
|
||||||
|
|
||||||
|
|||||||
@@ -452,9 +452,7 @@ class AppGCodeEditor(QtCore.QObject):
|
|||||||
|
|
||||||
# first I search for the tool
|
# first I search for the tool
|
||||||
found_tool = self.edit_area.find('T%d' % tool_no, flags)
|
found_tool = self.edit_area.find('T%d' % tool_no, flags)
|
||||||
if found_tool is False:
|
if found_tool is True:
|
||||||
continue
|
|
||||||
|
|
||||||
# once the tool found then I set the text Cursor position to the tool Tx position
|
# once the tool found then I set the text Cursor position to the tool Tx position
|
||||||
my_text_cursor = self.edit_area.textCursor()
|
my_text_cursor = self.edit_area.textCursor()
|
||||||
tool_pos = my_text_cursor.selectionStart()
|
tool_pos = my_text_cursor.selectionStart()
|
||||||
@@ -517,6 +515,23 @@ class AppGCodeEditor(QtCore.QObject):
|
|||||||
tool_selection.cursor = self.edit_area.textCursor()
|
tool_selection.cursor = self.edit_area.textCursor()
|
||||||
tool_selection.format.setFontUnderline(True)
|
tool_selection.format.setFontUnderline(True)
|
||||||
sel_list.append(tool_selection)
|
sel_list.append(tool_selection)
|
||||||
|
else:
|
||||||
|
# no Toolchange event
|
||||||
|
f = self.edit_area.find(str(text_list[0]), flags)
|
||||||
|
if f is False:
|
||||||
|
# maybe the text start is deleted in editing
|
||||||
|
continue
|
||||||
|
# once the tool found then I set the text Cursor position to the start of the only tool used
|
||||||
|
my_text_cursor = self.edit_area.textCursor()
|
||||||
|
start_sel = my_text_cursor.selectionStart()
|
||||||
|
|
||||||
|
self.edit_area.moveCursor(QtGui.QTextCursor.End)
|
||||||
|
my_text_cursor = self.edit_area.textCursor()
|
||||||
|
end_sel = my_text_cursor.selectionEnd()
|
||||||
|
|
||||||
|
my_text_cursor.setPosition(start_sel)
|
||||||
|
my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.KeepAnchor)
|
||||||
|
self.edit_area.setTextCursor(my_text_cursor)
|
||||||
|
|
||||||
self.edit_area.setExtraSelections(sel_list)
|
self.edit_area.setExtraSelections(sel_list)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user