- GCode Editor - working on GCode tool selection - not OK

This commit is contained in:
Marius Stanciu 2020-08-02 22:25:48 +03:00
parent 44411cdc82
commit f557eeb98d
2 changed files with 19 additions and 3 deletions

View File

@ -13,6 +13,7 @@ CHANGELOG for FlatCAM beta
- cleanup of the CNCJob UI; added a checkbox to signal if any append/prepend gcode was set in Preferences (unchecking it will override and disable the usage of the append/prepend GCode)
- the start Gcode is now stored in the CNCJob object attribute gc_start
- GCode Editor - finished adding the ability to select a row in the Tools table and select the related GCode
- GCode Editor - working on GCode tool selection - not OK
1.08.2020

View File

@ -407,8 +407,9 @@ class AppGCodeEditor(QtCore.QObject):
for row in sel_rows:
# those are special rows treated before so we except them
if row not in [0, 1, 2]:
tool_no = int(t_table.item(row, 0).text())
if self.gcode_obj.cnc_tools:
tool_no = int(t_table.item(row, 0).text())
text_to_be_found = self.gcode_obj.cnc_tools[tool_no]['gcode']
elif self.gcode_obj.exc_cnc_tools:
tool_dia = float(t_table.item(row, 1).text())
@ -418,14 +419,28 @@ class AppGCodeEditor(QtCore.QObject):
text_list = [x for x in text_to_be_found.split("\n") if x != '']
self.edit_area.find(str(text_list[0]), flags)
# self.edit_area.find(str(text_list[0]), flags)
# my_text_cursor = self.edit_area.textCursor()
# start_sel = my_text_cursor.selectionStart()
found_tool = self.edit_area.find('T%d' % tool_no, flags)
if found_tool is False:
return
my_text_cursor = self.edit_area.textCursor()
tool_pos = my_text_cursor.selectionStart()
my_text_cursor.setPosition(tool_pos)
f = self.edit_area.find(str(text_list[0]), flags)
if f is False:
return
my_text_cursor = self.edit_area.textCursor()
start_sel = my_text_cursor.selectionStart()
end_sel = 0
while True:
f = self.edit_area.find(str(text_list[-1]), flags)
if f is False:
m6 = self.edit_area.find('M6', flags)
if f is False or m6:
break
my_text_cursor = self.edit_area.textCursor()
end_sel = my_text_cursor.selectionEnd()