- fixed a bug in SolderPaste Tool that did not allow to view the GCode
This commit is contained in:
parent
a0e142f6e9
commit
d2d5371148
|
@ -5644,6 +5644,8 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
|
|
||||||
FlatCAMApp.App.log.debug("Creating CNCJob object...")
|
FlatCAMApp.App.log.debug("Creating CNCJob object...")
|
||||||
|
|
||||||
|
self.decimals = 4
|
||||||
|
|
||||||
CNCjob.__init__(self, units=units, kind=kind, z_move=z_move,
|
CNCjob.__init__(self, units=units, kind=kind, z_move=z_move,
|
||||||
feedrate=feedrate, feedrate_rapid=feedrate_rapid, z_cut=z_cut, tooldia=tooldia,
|
feedrate=feedrate, feedrate_rapid=feedrate_rapid, z_cut=z_cut, tooldia=tooldia,
|
||||||
spindlespeed=spindlespeed, steps_per_circle=int(self.app.defaults["cncjob_steps_per_circle"]))
|
spindlespeed=spindlespeed, steps_per_circle=int(self.app.defaults["cncjob_steps_per_circle"]))
|
||||||
|
@ -5735,13 +5737,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
# from predecessors.
|
# from predecessors.
|
||||||
self.ser_attrs += ['options', 'kind', 'cnc_tools', 'multitool']
|
self.ser_attrs += ['options', 'kind', 'cnc_tools', 'multitool']
|
||||||
|
|
||||||
self.decimals = 4
|
|
||||||
|
|
||||||
if self.app.is_legacy is False:
|
if self.app.is_legacy is False:
|
||||||
self.text_col = self.app.plotcanvas.new_text_collection()
|
self.text_col = self.app.plotcanvas.new_text_collection()
|
||||||
self.text_col.enabled = True
|
self.text_col.enabled = True
|
||||||
self.annotation = self.app.plotcanvas.new_text_group(collection=self.text_col)
|
self.annotation = self.app.plotcanvas.new_text_group(collection=self.text_col)
|
||||||
|
|
||||||
|
self.gcode_editor_tab = None
|
||||||
|
|
||||||
def build_ui(self):
|
def build_ui(self):
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
30.10.2019
|
30.10.2019
|
||||||
|
|
||||||
- converted SolderPaste Tool to usage of SpinBoxes; changed the SolderPaste Tool UI in Preferences too
|
- converted SolderPaste Tool to usage of SpinBoxes; changed the SolderPaste Tool UI in Preferences too
|
||||||
|
- fixed a bug in SolderPaste Tool that did not allow to view the GCode
|
||||||
|
|
||||||
29.10.2019
|
29.10.2019
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ from flatcamGUI.GUIElements import FCComboBox, FCEntry, FCTable, FCInputDialog,
|
||||||
from FlatCAMApp import log
|
from FlatCAMApp import log
|
||||||
from camlib import distance
|
from camlib import distance
|
||||||
from FlatCAMObj import FlatCAMCNCjob
|
from FlatCAMObj import FlatCAMCNCjob
|
||||||
|
from flatcamEditors.FlatCAMTextEditor import TextEditor
|
||||||
|
|
||||||
from PyQt5 import QtGui, QtCore, QtWidgets
|
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
|
@ -37,6 +38,8 @@ class SolderPaste(FlatCAMTool):
|
||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
FlatCAMTool.__init__(self, app)
|
FlatCAMTool.__init__(self, app)
|
||||||
|
|
||||||
|
# Number of decimals to be used for tools/nozzles in this FlatCAM Tool
|
||||||
self.decimals = 4
|
self.decimals = 4
|
||||||
|
|
||||||
# ## Title
|
# ## Title
|
||||||
|
@ -451,8 +454,7 @@ class SolderPaste(FlatCAMTool):
|
||||||
self.units = ''
|
self.units = ''
|
||||||
self.name = ""
|
self.name = ""
|
||||||
|
|
||||||
# Number of decimals to be used for tools/nozzles in this FlatCAM Tool
|
self.text_editor_tab = None
|
||||||
self.decimals = 4
|
|
||||||
|
|
||||||
# this will be used in the combobox context menu, for delete entry
|
# this will be used in the combobox context menu, for delete entry
|
||||||
self.obj_to_be_deleted_name = ''
|
self.obj_to_be_deleted_name = ''
|
||||||
|
@ -1285,9 +1287,9 @@ class SolderPaste(FlatCAMTool):
|
||||||
xmax = obj.options['xmax']
|
xmax = obj.options['xmax']
|
||||||
ymax = obj.options['ymax']
|
ymax = obj.options['ymax']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("FlatCAMObj.FlatCAMGeometry.mtool_gen_cncjob() --> %s\n" % str(e))
|
log.debug("SolderPaste.on_create_gcode() --> %s\n" % str(e))
|
||||||
msg = '[ERROR] %s' % _("An internal error has ocurred. See shell.\n")
|
msg = '[ERROR] %s' % _("An internal error has ocurred. See shell.\n")
|
||||||
msg += 'FlatCAMObj.FlatCAMGeometry.mtool_gen_cncjob() --> %s' % str(e)
|
msg += 'SolderPaste.on_create_gcode() --> %s' % str(e)
|
||||||
msg += traceback.format_exc()
|
msg += traceback.format_exc()
|
||||||
self.app.inform.emit(msg)
|
self.app.inform.emit(msg)
|
||||||
return
|
return
|
||||||
|
@ -1375,14 +1377,14 @@ class SolderPaste(FlatCAMTool):
|
||||||
"""
|
"""
|
||||||
time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now())
|
time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now())
|
||||||
|
|
||||||
# add the tab if it was closed
|
self.text_editor_tab = TextEditor(app=self.app)
|
||||||
self.app.ui.plot_tab_area.addTab(self.app.ui.text_editor_tab, _("Code Editor"))
|
|
||||||
|
|
||||||
# first clear previous text in text editor (if any)
|
# add the tab if it was closed
|
||||||
self.app.ui.code_editor.clear()
|
self.app.ui.plot_tab_area.addTab(self.text_editor_tab, _("SP GCode Editor"))
|
||||||
|
self.text_editor_tab.setObjectName('solderpaste_gcode_editor_tab')
|
||||||
|
|
||||||
# Switch plot_area to CNCJob tab
|
# Switch plot_area to CNCJob tab
|
||||||
self.app.ui.plot_tab_area.setCurrentWidget(self.app.ui.text_editor_tab)
|
self.app.ui.plot_tab_area.setCurrentWidget(self.text_editor_tab)
|
||||||
|
|
||||||
name = self.cnc_obj_combo.currentText()
|
name = self.cnc_obj_combo.currentText()
|
||||||
obj = self.app.collection.get_by_name(name)
|
obj = self.app.collection.get_by_name(name)
|
||||||
|
@ -1426,17 +1428,17 @@ class SolderPaste(FlatCAMTool):
|
||||||
try:
|
try:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
proc_line = str(line).strip('\n')
|
proc_line = str(line).strip('\n')
|
||||||
self.app.ui.code_editor.append(proc_line)
|
self.text_editor_tab.code_editor.append(proc_line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('ToolSolderPaste.on_view_gcode() -->%s' % str(e))
|
log.debug('ToolSolderPaste.on_view_gcode() -->%s' % str(e))
|
||||||
self.app.inform.emit('[ERROR] %s --> %s' %
|
self.app.inform.emit('[ERROR] %s --> %s' %
|
||||||
('ToolSolderPaste.on_view_gcode()', str(e)))
|
('ToolSolderPaste.on_view_gcode()', str(e)))
|
||||||
return
|
return
|
||||||
|
|
||||||
self.app.ui.code_editor.moveCursor(QtGui.QTextCursor.Start)
|
self.text_editor_tab.code_editor.moveCursor(QtGui.QTextCursor.Start)
|
||||||
|
|
||||||
self.app.handleTextChanged()
|
self.text_editor_tab.handleTextChanged()
|
||||||
self.app.ui.show()
|
# self.app.ui.show()
|
||||||
|
|
||||||
def on_save_gcode(self):
|
def on_save_gcode(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue