|
|
@@ -1358,12 +1358,16 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
:param rest: True if to use rest-machining
|
|
|
:param tools_storage: whether to use the current tools_storage self.ncc_tools or a different one.
|
|
|
Usage of the different one is related to when this function is called from a TcL command.
|
|
|
+ :param plot: if True after the job is finished the result will be plotted, else it will not.
|
|
|
:param run_threaded: If True the method will be run in a threaded way suitable for GUI usage; if False it will
|
|
|
run non-threaded for TclShell usage
|
|
|
:return:
|
|
|
"""
|
|
|
-
|
|
|
- proc = self.app.proc_container.new(_("Non-Copper clearing ..."))
|
|
|
+ if run_threaded:
|
|
|
+ proc = self.app.proc_container.new(_("Non-Copper clearing ..."))
|
|
|
+ else:
|
|
|
+ self.app.proc_container.view.set_busy(_("Non-Copper clearing ..."))
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
|
|
|
# #####################################################################
|
|
|
# ####### Read the parameters #########################################
|
|
|
@@ -1526,6 +1530,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
assert isinstance(geo_obj, FlatCAMGeometry), \
|
|
|
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
|
|
|
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ if not run_threaded:
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
log.debug("NCC Tool. Normal copper clearing task started.")
|
|
|
self.app.inform.emit(_("NCC Tool. Finished non-copper polygons. Normal copper clearing task started."))
|
|
|
|
|
|
@@ -1604,6 +1612,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
else:
|
|
|
try:
|
|
|
for geo_elem in isolated_geo:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
if self.app.abort_flag:
|
|
|
# graceful abort requested by the user
|
|
|
raise FlatCAMApp.GracefulException
|
|
|
@@ -1709,6 +1720,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
# graceful abort requested by the user
|
|
|
raise FlatCAMApp.GracefulException
|
|
|
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
app_obj.inform.emit(
|
|
|
'[success] %s %s%s %s' % (_('NCC Tool clearing with tool diameter = '),
|
|
|
str(tool),
|
|
|
@@ -1743,6 +1757,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
if len(area.geoms) > 0:
|
|
|
pol_nr = 0
|
|
|
for p in area.geoms:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
if self.app.abort_flag:
|
|
|
# graceful abort requested by the user
|
|
|
raise FlatCAMApp.GracefulException
|
|
|
@@ -1879,6 +1896,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
log.debug("NCC Tool. Rest machining copper clearing task started.")
|
|
|
app_obj.inform.emit('_(NCC Tool. Rest machining copper clearing task started.')
|
|
|
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ if not run_threaded:
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
# a flag to signal that the isolation is broken by the bounding box in 'area' and 'box' cases
|
|
|
# will store the number of tools for which the isolation is broken
|
|
|
warning_flag = 0
|
|
|
@@ -1934,6 +1955,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
else:
|
|
|
try:
|
|
|
for geo_elem in isolated_geo:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
if self.app.abort_flag:
|
|
|
# graceful abort requested by the user
|
|
|
raise FlatCAMApp.GracefulException
|
|
|
@@ -2062,6 +2086,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
|
|
|
# Area to clear
|
|
|
for poly in cleared_by_last_tool:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
if self.app.abort_flag:
|
|
|
# graceful abort requested by the user
|
|
|
raise FlatCAMApp.GracefulException
|
|
|
@@ -2098,6 +2125,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
raise FlatCAMApp.GracefulException
|
|
|
|
|
|
if p is not None:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
if isinstance(p, Polygon):
|
|
|
try:
|
|
|
if ncc_method == 'standard':
|
|
|
@@ -2124,6 +2154,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
elif isinstance(p, MultiPolygon):
|
|
|
for poly in p:
|
|
|
if poly is not None:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
try:
|
|
|
if ncc_method == 'standard':
|
|
|
cp = self.clear_polygon(poly, tool_used,
|
|
|
@@ -2235,13 +2268,19 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
else:
|
|
|
app_obj.new_object("geometry", name, gen_clear_area, plot=plot)
|
|
|
except FlatCAMApp.GracefulException:
|
|
|
- proc.done()
|
|
|
+ if run_threaded:
|
|
|
+ proc.done()
|
|
|
return
|
|
|
except Exception as e:
|
|
|
- proc.done()
|
|
|
+ if run_threaded:
|
|
|
+ proc.done()
|
|
|
traceback.print_stack()
|
|
|
return
|
|
|
- proc.done()
|
|
|
+ if run_threaded:
|
|
|
+ proc.done()
|
|
|
+ else:
|
|
|
+ app_obj.proc_container.view.set_idle()
|
|
|
+
|
|
|
# focus on Selected Tab
|
|
|
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
|
|
|
|
|
|
@@ -2630,6 +2669,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|
|
except Exception as e:
|
|
|
try:
|
|
|
for el in target:
|
|
|
+ # provide the app with a way to process the GUI events when in a blocking loop
|
|
|
+ QtWidgets.QApplication.processEvents()
|
|
|
+
|
|
|
if self.app.abort_flag:
|
|
|
# graceful abort requested by the user
|
|
|
raise FlatCAMApp.GracefulException
|