- Serialized the source_file of the Objects so it is saved in the FlatCAM project and restored.

- if there is a single tool in the tool list (Geometry , Excellon) and the user click the Generate GCode, use that tool even if it is not selected
This commit is contained in:
Marius Stanciu 2019-02-16 21:03:27 +02:00 committed by Marius S
parent 326599e4a3
commit 941cec30ae
4 changed files with 53 additions and 25 deletions

View File

@ -5253,15 +5253,15 @@ class App(QtCore.QObject):
except IOError:
exists = False
msg = "Project file exists. Overwrite?"
if exists:
msgbox = QtWidgets.QMessageBox()
msgbox.setInformativeText(msg)
msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel |QtWidgets.QMessageBox.Ok)
msgbox.setDefaultButton(QtWidgets.QMessageBox.Cancel)
result = msgbox.exec_()
if result ==QtWidgets.QMessageBox.Cancel:
return
# msg = "Project file exists. Overwrite?"
# if exists:
# msgbox = QtWidgets.QMessageBox()
# msgbox.setInformativeText(msg)
# msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel |QtWidgets.QMessageBox.Ok)
# msgbox.setDefaultButton(QtWidgets.QMessageBox.Cancel)
# result = msgbox.exec_()
# if result ==QtWidgets.QMessageBox.Cancel:
# return
if thread is True:
self.worker_task.emit({'fcn': self.save_project,

View File

@ -413,11 +413,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
# type of isolation: 0 = exteriors, 1 = interiors, 2 = complete isolation (both interiors and exteriors)
self.iso_type = 2
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
self.ser_attrs += ['options', 'kind']
self.multigeo = False
self.apertures_row = 0
@ -434,6 +429,11 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
# self.ui.generate_bb_button.clicked.connect(self.on_generatebb_button_click)
# self.ui.generate_noncopper_button.clicked.connect(self.on_generatenoncopper_button_click)
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
self.ser_attrs += ['options', 'kind']
def set_ui(self, ui):
"""
Maps options with GUI inputs.
@ -1079,11 +1079,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
# dict to hold the tool number as key and tool offset as value
self.tool_offset ={}
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
self.ser_attrs += ['options', 'kind']
# variable to store the total amount of drills per job
self.tot_drill_cnt = 0
self.tool_row = 0
@ -1100,6 +1095,11 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
self.multigeo = False
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
self.ser_attrs += ['options', 'kind']
@staticmethod
def merge(exc_list, exc_final):
"""
@ -1995,8 +1995,14 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
tools = self.get_selected_tools_list()
if len(tools) == 0:
self.app.inform.emit("[ERROR_NOTCL]Please select one or more tools from the list and try again.")
return
# if there is a single tool in the table (remember that the last 2 rows are for totals and do not count in
# tool number) it means that there are 3 rows (1 tool and 2 totals).
# in this case regardless of the selection status of that tool, use it.
if self.ui.tools_table.rowCount() == 3:
tools.append(self.ui.tools_table.item(0, 0).text())
else:
self.app.inform.emit("[ERROR_NOTCL]Please select one or more tools from the list and try again.")
return
xmin = self.options['xmin']
ymin = self.options['ymin']
@ -3550,6 +3556,9 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.app.report_usage("geometry_on_generatecnc_button")
self.read_form()
self.sel_tools = {}
# test to see if we have tools available in the tool table
if self.ui.geo_tools_table.selectedItems():
for x in self.ui.geo_tools_table.selectedItems():
@ -3571,8 +3580,19 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
tooluid: copy.deepcopy(tooluid_value)
})
self.mtool_gen_cncjob()
self.ui.geo_tools_table.clearSelection()
elif self.ui.geo_tools_table.rowCount() == 1:
tooluid = int(self.ui.geo_tools_table.item(0, 5).text())
for tooluid_key, tooluid_value in self.tools.items():
if int(tooluid_key) == tooluid:
self.sel_tools.update({
tooluid: copy.deepcopy(tooluid_value)
})
self.mtool_gen_cncjob()
self.ui.geo_tools_table.clearSelection()
else:
self.app.inform.emit("[ERROR_NOTCL] Failed. No tool selected in the tool table ...")

View File

@ -12,7 +12,10 @@ CAD program, and create G-Code for Isolation routing.
17.02.2019
- changed some status bar messages
- New feature: added the capability to view the source code of the Gerber/Excellon file that was loaded into the app. The file is also stored as an object attribute for later use. THe view option is in the project context menu and in Menu -> Options -> View Source
- New feature: added the capability to view the source code of the Gerber/Excellon file that was loaded into the app. The file is also stored as an object attribute for later use. The view option is in the project context menu and in Menu -> Options -> View Source
- Serialized the source_file of the Objects so it is saved in the FlatCAM project and restored.
- if there is a single tool in the tool list (Geometry , Excellon) and the user click the Generate GCode, use that tool even if it is not selected
-
16.02.2019

View File

@ -1913,11 +1913,13 @@ class Gerber (Geometry):
# Aperture Macros
self.aperture_macros = {}
self.source_file = ''
# Attributes to be included in serialization
# Always append to it because it carries contents
# from Geometry.
self.ser_attrs += ['int_digits', 'frac_digits', 'apertures',
'aperture_macros', 'solid_geometry']
'aperture_macros', 'solid_geometry', 'source_file']
#### Parser patterns ####
# FS - Format Specification
@ -3295,6 +3297,8 @@ class Excellon(Geometry):
# self.slots (list) to store the slots; each is a dictionary
self.slots = []
self.source_file = ''
# it serve to flag if a start routing or a stop routing was encountered
# if a stop is encounter and this flag is still 0 (so there is no stop for a previous start) issue error
self.routing_flag = 1
@ -3325,7 +3329,8 @@ class Excellon(Geometry):
# Always append to it because it carries contents
# from Geometry.
self.ser_attrs += ['tools', 'drills', 'zeros', 'excellon_format_upper_mm', 'excellon_format_lower_mm',
'excellon_format_upper_in', 'excellon_format_lower_in', 'excellon_units', 'slots']
'excellon_format_upper_in', 'excellon_format_lower_in', 'excellon_units', 'slots',
'source_file']
#### Patterns ####
# Regex basics: