- Milling Tool - working on the data structure - wip

This commit is contained in:
Marius Stanciu
2020-12-06 21:27:26 +02:00
committed by Marius Stanciu
parent d46e2b5703
commit ef11bced6d

View File

@@ -1355,7 +1355,7 @@ class ToolMilling(AppTool, Excellon):
""" """
Will update the GUI with data from the "storage" in this case the dict self.tools Will update the GUI with data from the "storage" in this case the dict self.tools
:param dict_storage: A dictionary holding the data relevant for gnerating Gcode from Excellon :param dict_storage: A dictionary holding the data relevant for generating Gcode
:type dict_storage: dict :type dict_storage: dict
:return: None :return: None
:rtype: :rtype:
@@ -1415,6 +1415,10 @@ class ToolMilling(AppTool, Excellon):
t_table = self.ui.tools_table t_table = self.ui.tools_table
self.current_row = t_table.currentRow() self.current_row = t_table.currentRow()
# those are the general parameters that are common to all tools
general_parameters = ["toolchange", "toolchangez", "endxy", "endz", "ppname_g", "area_exclusion",
"area_shape", "area_strategy", "area_overz"]
# update the tool specific parameters # update the tool specific parameters
rows = sorted(set(index.row() for index in used_tools_table.selectedIndexes())) rows = sorted(set(index.row() for index in used_tools_table.selectedIndexes()))
for row in rows: for row in rows:
@@ -1425,18 +1429,21 @@ class ToolMilling(AppTool, Excellon):
for tooluid_key, tooluid_val in self.target_obj.tools.items(): for tooluid_key, tooluid_val in self.target_obj.tools.items():
if int(tooluid_key) == tooluid_item: if int(tooluid_key) == tooluid_item:
for form_key, form_val in self.form_fields.items(): for form_key, form_val in self.form_fields.items():
if form_key in general_parameters:
continue
try: try:
# widgets in the tools table # widgets in the tools table
if form_key == 'tool_type': if form_key == 'tool_type':
form_val = self.ui.geo_tools_table.cellWidget(self.current_row, 2) tt_wdg = self.ui.geo_tools_table.cellWidget(self.current_row, 2)
self.target_obj.tools[tooluid_key]['data'][form_key] = tt_wdg.get_value()
self.target_obj.tools[tooluid_key]['data'][form_key] = form_val.get_value() else:
self.target_obj.tools[tooluid_key]['data'][form_key] = form_val.get_value()
except Exception as e: except Exception as e:
self.app.log.debug("ToolMilling.form_to_storage() --> %s" % str(e)) self.app.log.debug("ToolMilling.form_to_storage() --> %s" % str(e))
# update the general parameters in all tools # update the general parameters in all tools
for general_option in ["toolchange", "toolchangez", "endxy", "endz", "ppname_g", "area_exclusion", for general_option in general_parameters:
"area_shape", "area_strategy", "area_overz"]:
new_opt_val = self.form_fields[general_option].get_value() new_opt_val = self.form_fields[general_option].get_value()
for tool in self.target_obj.tools: for tool in self.target_obj.tools:
try: try: