- SolderPaste Tool - fixed not recognizing the default tools
This commit is contained in:
@@ -11,6 +11,8 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
- added an experimental 3D area (archball camera)
|
- added an experimental 3D area (archball camera)
|
||||||
- Drilling Tool - fix a bug introduced in the latter changes; when the Tool is launched and there is no Excellon object loaded then the default_data can't be filled in: solved by using the self.app.options in that case
|
- Drilling Tool - fix a bug introduced in the latter changes; when the Tool is launched and there is no Excellon object loaded then the default_data can't be filled in: solved by using the self.app.options in that case
|
||||||
|
- Drilling Tool - made sure that the preprocessors that are not allowed in this Tool are not loaded in the combobox
|
||||||
|
- SolderPaste Tool - fixed not recognizing the default tools
|
||||||
|
|
||||||
11.12.2020
|
11.12.2020
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
pp_list = []
|
pp_list = []
|
||||||
for name in self.app.preprocessors.keys():
|
for name in self.app.preprocessors.keys():
|
||||||
# the HPGL preprocessor is only for Geometry not for Excellon job therefore don't add it
|
# the HPGL preprocessor is only for Geometry not for Excellon job therefore don't add it
|
||||||
if name == 'hpgl':
|
if name in ['hpgl', 'Paste_1', 'Check_points']:
|
||||||
continue
|
continue
|
||||||
pp_list.append(name)
|
pp_list.append(name)
|
||||||
pp_list.sort()
|
pp_list.sort()
|
||||||
|
|||||||
@@ -5,18 +5,20 @@
|
|||||||
# MIT Licence #
|
# MIT Licence #
|
||||||
# ##########################################################
|
# ##########################################################
|
||||||
|
|
||||||
|
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
from appTool import AppTool
|
from appTool import AppTool
|
||||||
from appCommon.Common import LoudDict
|
from appCommon.Common import LoudDict
|
||||||
from appGUI.GUIElements import FCComboBox, FCEntry, FCTable, FCDoubleSpinner, FCSpinner, FCFileSaveDialog, \
|
from appGUI.GUIElements import FCComboBox, FCEntry, FCTable, FCDoubleSpinner, FCSpinner, FCFileSaveDialog, \
|
||||||
FCInputSpinner
|
FCInputSpinner
|
||||||
from app_Main import log
|
|
||||||
from camlib import distance
|
from camlib import distance
|
||||||
from appEditors.AppTextEditor import AppTextEditor
|
from appEditors.AppTextEditor import AppTextEditor
|
||||||
|
|
||||||
from PyQt5 import QtGui, QtCore, QtWidgets
|
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import re
|
||||||
|
|
||||||
from shapely.geometry import Polygon, LineString
|
from shapely.geometry import Polygon, LineString
|
||||||
from shapely.ops import unary_union
|
from shapely.ops import unary_union
|
||||||
@@ -183,11 +185,15 @@ class SolderPaste(AppTool):
|
|||||||
icon=QtGui.QIcon(self.app.resource_location + "/delete32.png")
|
icon=QtGui.QIcon(self.app.resource_location + "/delete32.png")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# either originally it was a string or not, xy_end will be made string
|
||||||
|
dias_option = self.app.defaults["tools_solderpaste_tools"]
|
||||||
|
dias_option = re.sub('[()\[\]]', '', str(dias_option)) if dias_option else None
|
||||||
try:
|
try:
|
||||||
dias = [float(eval(dia)) for dia in self.app.defaults["tools_solderpaste_tools"].split(",") if dia != '']
|
dias = [float(eval(dia)) for dia in dias_option.split(",") if dia != '']
|
||||||
except Exception:
|
except Exception as err:
|
||||||
log.error("At least one Nozzle tool diameter needed. "
|
self.app.log.debug("SolderPaste.set_tool_ui() -> nozzle dias -> %s" % str(err))
|
||||||
"Verify in Edit -> Preferences -> TOOLS -> Solder Paste Tools.")
|
self.app.log.error("At least one Nozzle tool diameter needed. "
|
||||||
|
"Verify in Edit -> Preferences -> TOOLS -> Solder Paste Tools.")
|
||||||
return
|
return
|
||||||
|
|
||||||
self.tooluid = 0
|
self.tooluid = 0
|
||||||
@@ -208,9 +214,9 @@ class SolderPaste(AppTool):
|
|||||||
|
|
||||||
self.units = self.app.defaults['units'].upper()
|
self.units = self.app.defaults['units'].upper()
|
||||||
|
|
||||||
for name in list(self.app.preprocessors.keys()):
|
for name in self.app.preprocessors.keys():
|
||||||
# populate only with preprocessor files that start with 'Paste_'
|
# populate only with preprocessor files that start with 'Paste_'
|
||||||
if name.partition('_')[0] != 'Paste':
|
if name.partition('_')[0].lower() != 'paste':
|
||||||
continue
|
continue
|
||||||
self.ui.pp_combo.addItem(name)
|
self.ui.pp_combo.addItem(name)
|
||||||
|
|
||||||
@@ -308,7 +314,7 @@ class SolderPaste(AppTool):
|
|||||||
try:
|
try:
|
||||||
tooluid = int(self.ui.tools_table.item(current_row, 2).text())
|
tooluid = int(self.ui.tools_table.item(current_row, 2).text())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("Tool missing. Add a tool in Tool Table. %s" % str(e))
|
self.app.log.debug("Tool missing. Add a tool in Tool Table. %s" % str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
# update the form
|
# update the form
|
||||||
@@ -318,7 +324,7 @@ class SolderPaste(AppTool):
|
|||||||
if int(tooluid_key) == tooluid:
|
if int(tooluid_key) == tooluid:
|
||||||
self.set_form(deepcopy(tooluid_value['data']))
|
self.set_form(deepcopy(tooluid_value['data']))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("ToolSolderPaste ---> update_ui() " + str(e))
|
self.app.log.debug("ToolSolderPaste ---> update_ui() " + str(e))
|
||||||
|
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
@@ -442,7 +448,7 @@ class SolderPaste(AppTool):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if not isinstance(val, dict):
|
if not isinstance(val, dict):
|
||||||
log.debug("ToolSoderPaste.set_form() --> parameter not a dict")
|
self.app.log.debug("ToolSoderPaste.set_form() --> parameter not a dict")
|
||||||
return
|
return
|
||||||
|
|
||||||
for key in self.form_fields:
|
for key in self.form_fields:
|
||||||
@@ -611,7 +617,7 @@ class SolderPaste(AppTool):
|
|||||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Delete failed. Select a tool to delete."))
|
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Delete failed. Select a tool to delete."))
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug(str(e))
|
self.app.log.debug(str(e))
|
||||||
|
|
||||||
self.app.inform.emit('[success] %s' % _("Tools deleted from Tool Table."))
|
self.app.inform.emit('[success] %s' % _("Tools deleted from Tool Table."))
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
@@ -811,7 +817,7 @@ class SolderPaste(AppTool):
|
|||||||
try:
|
try:
|
||||||
geo_obj.tools[tooluid]['solid_geometry'].append(geo)
|
geo_obj.tools[tooluid]['solid_geometry'].append(geo)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('ToolSolderPaste.on_create_geo() --> %s' % str(e))
|
self.app.log.debug('ToolSolderPaste.on_create_geo() --> %s' % str(e))
|
||||||
else:
|
else:
|
||||||
rest_geo.append(g)
|
rest_geo.append(g)
|
||||||
|
|
||||||
@@ -844,7 +850,7 @@ class SolderPaste(AppTool):
|
|||||||
try:
|
try:
|
||||||
app_obj.app_obj.new_object("geometry", name + "_solderpaste", geo_init)
|
app_obj.app_obj.new_object("geometry", name + "_solderpaste", geo_init)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("SolderPaste.on_create_geo() --> %s" % str(e))
|
self.app.log.error("SolderPaste.on_create_geo() --> %s" % str(e))
|
||||||
proc.done()
|
proc.done()
|
||||||
return
|
return
|
||||||
proc.done()
|
proc.done()
|
||||||
@@ -908,7 +914,7 @@ class SolderPaste(AppTool):
|
|||||||
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("SolderPaste.on_create_gcode() --> %s\n" % str(e))
|
self.app.log.debug("SolderPaste.on_create_gcode() --> %s\n" % str(e))
|
||||||
msg = '[ERROR] %s' % _("An internal error has occurred. See shell.\n")
|
msg = '[ERROR] %s' % _("An internal error has occurred. See shell.\n")
|
||||||
msg += 'SolderPaste.on_create_gcode() --> %s' % str(e)
|
msg += 'SolderPaste.on_create_gcode() --> %s' % str(e)
|
||||||
msg += traceback.format_exc()
|
msg += traceback.format_exc()
|
||||||
@@ -950,7 +956,7 @@ class SolderPaste(AppTool):
|
|||||||
res = job_obj.generate_gcode_from_solderpaste_geo(**tooluid_value)
|
res = job_obj.generate_gcode_from_solderpaste_geo(**tooluid_value)
|
||||||
|
|
||||||
if res == 'fail':
|
if res == 'fail':
|
||||||
log.debug("GeometryObject.mtool_gen_cncjob() --> generate_from_geometry2() failed")
|
self.app.log.debug("GeometryObject.mtool_gen_cncjob() --> generate_from_geometry2() failed")
|
||||||
return 'fail'
|
return 'fail'
|
||||||
else:
|
else:
|
||||||
tool_cnc_dict['gcode'] = res
|
tool_cnc_dict['gcode'] = res
|
||||||
@@ -1037,7 +1043,7 @@ class SolderPaste(AppTool):
|
|||||||
try:
|
try:
|
||||||
lines = StringIO(gcode)
|
lines = StringIO(gcode)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("ToolSolderpaste.on_view_gcode() --> %s" % str(e))
|
self.app.log.debug("ToolSolderpaste.on_view_gcode() --> %s" % str(e))
|
||||||
self.app.inform.emit('[ERROR_NOTCL] %s...' % _("No Gcode in the object"))
|
self.app.inform.emit('[ERROR_NOTCL] %s...' % _("No Gcode in the object"))
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1047,7 +1053,7 @@ class SolderPaste(AppTool):
|
|||||||
# self.text_editor_tab.code_editor.append(proc_line)
|
# self.text_editor_tab.code_editor.append(proc_line)
|
||||||
self.text_editor_tab.load_text(lines, move_to_start=True)
|
self.text_editor_tab.load_text(lines, move_to_start=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('ToolSolderPaste.on_view_gcode() -->%s' % str(e))
|
self.app.log.debug('ToolSolderPaste.on_view_gcode() -->%s' % str(e))
|
||||||
self.app.inform.emit('[ERROR] %s --> %s' % ('ToolSolderPaste.on_view_gcode()', str(e)))
|
self.app.inform.emit('[ERROR] %s --> %s' % ('ToolSolderPaste.on_view_gcode()', str(e)))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user