Merged in marius_stanciu/flatcam_beta/Beta (pull request #293)

Beta - NCC Tool MAY NOT work
This commit is contained in:
Marius Stanciu 2020-01-08 22:10:42 +00:00
commit 5a2ae4877c
16 changed files with 1386 additions and 765 deletions

View File

@ -1631,7 +1631,7 @@ class App(QtCore.QObject):
self.toggle_units_ignore = False
# #############################################################################
# ########################## LOAD POSTPROCESSORS ##############################
# ########################## LOAD PREPROCESSORS ###############################
# #############################################################################
# a dictionary that have as keys the name of the preprocessor files and the value is the class from
@ -1846,7 +1846,7 @@ class App(QtCore.QObject):
# signal to be called when the app is quiting
self.app_quit.connect(self.quit_application, type=Qt.QueuedConnection)
self.message.connect(self.message_dialog)
self.progress.connect(self.set_progress_bar)
# self.progress.connect(self.set_progress_bar)
# signals that are emitted when object state changes
self.object_created.connect(self.on_object_created)
@ -2464,7 +2464,10 @@ class App(QtCore.QObject):
self.fiducial_tool = None
# always install tools only after the shell is initialized because the self.inform.emit() depends on shell
self.install_tools()
try:
self.install_tools()
except AttributeError:
pass
# ##################################################################################
# ########################### SETUP RECENT ITEMS ###################################
@ -2628,7 +2631,10 @@ class App(QtCore.QObject):
# Storage for shapes, storage that can be used by FlatCAm tools for utility geometry
# VisPy visuals
if self.is_legacy is False:
self.tool_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
try:
self.tool_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
except AttributeError:
self.tool_shapes = None
else:
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
self.tool_shapes = ShapeCollectionLegacy(obj=self, app=self, name="tool")
@ -2639,9 +2645,20 @@ class App(QtCore.QObject):
# watch out for the position of the editors instantiation ... if it is done before a save of the default values
# at the first launch of the App , the editors will not be functional.
self.geo_editor = FlatCAMGeoEditor(self, disabled=True)
self.exc_editor = FlatCAMExcEditor(self)
self.grb_editor = FlatCAMGrbEditor(self)
try:
self.geo_editor = FlatCAMGeoEditor(self, disabled=True)
except AttributeError:
pass
try:
self.exc_editor = FlatCAMExcEditor(self)
except AttributeError:
pass
try:
self.grb_editor = FlatCAMGrbEditor(self)
except AttributeError:
pass
self.log.debug("Finished adding FlatCAM Editor's.")
self.set_ui_title(name=_("New Project - Not saved"))
@ -3136,7 +3153,11 @@ class App(QtCore.QObject):
self.ui.menutoolshell.triggered.connect(self.on_toggle_shell)
# third install all of them
self.install_tools()
try:
self.install_tools()
except AttributeError:
pass
self.log.debug("Tools are initialized.")
# def parse_system_fonts(self):
@ -6625,7 +6646,7 @@ class App(QtCore.QObject):
self.plotcanvas.draw_workspace(workspace_size=self.defaults['global_workspaceT'])
def on_workspace(self):
if self.ui.general_defaults_form.general_gui_group.workspace_cb.get_value():
if self.ui.general_defaults_form.general_app_set_group.workspace_cb.get_value():
self.plotcanvas.draw_workspace(workspace_size=self.defaults['global_workspaceT'])
else:
self.plotcanvas.delete_workspace()
@ -6633,13 +6654,13 @@ class App(QtCore.QObject):
# self.save_defaults(silent=True)
def on_workspace_toggle(self):
state = False if self.ui.general_defaults_form.general_gui_group.workspace_cb.get_value() else True
state = False if self.ui.general_defaults_form.general_app_set_group.workspace_cb.get_value() else True
try:
self.ui.general_defaults_form.general_gui_group.workspace_cb.stateChanged.disconnect(self.on_workspace)
self.ui.general_defaults_form.general_app_set_group.workspace_cb.stateChanged.disconnect(self.on_workspace)
except TypeError:
pass
self.ui.general_defaults_form.general_gui_group.workspace_cb.set_value(state)
self.ui.general_defaults_form.general_gui_group.workspace_cb.stateChanged.connect(self.on_workspace)
self.ui.general_defaults_form.general_app_set_group.workspace_cb.set_value(state)
self.ui.general_defaults_form.general_app_set_group.workspace_cb.stateChanged.connect(self.on_workspace)
self.on_workspace()
def on_layout(self, index=None, lay=None):
@ -10874,13 +10895,11 @@ class App(QtCore.QObject):
name = outname or filename.split('/')[-1].split('\\')[-1]
self.new_object(obj_type, name, obj_init, autoselected=False)
self.progress.emit(20)
# Register recent file
self.file_opened.emit("dxf", filename)
# GUI feedback
self.inform.emit('[success] %s: %s' % (_("Opened"), filename))
self.progress.emit(100)
def open_gerber(self, filename, outname=None):
"""
@ -10956,7 +10975,6 @@ class App(QtCore.QObject):
# How the object should be initialized
def obj_init(excellon_obj, app_obj):
# self.progress.emit(20)
try:
ret = excellon_obj.parse_file(filename=filename)
@ -10969,7 +10987,6 @@ class App(QtCore.QObject):
app_obj.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Cannot open file"), filename))
log.debug("Could not open Excellon object.")
self.progress.emit(0) # TODO: self and app_bjj mixed
return "fail"
except Exception:
msg = '[ERROR_NOTCL] %s' % \
@ -11611,6 +11628,11 @@ class App(QtCore.QObject):
}
try:
image_opener = self.image_tool.import_image
except AttributeError:
image_opener = None
openers = {
'gerber': lambda fname: self.worker_task.emit({'fcn': self.open_gerber, 'params': [fname]}),
'excellon': lambda fname: self.worker_task.emit({'fcn': self.open_excellon, 'params': [fname]}),
@ -11621,7 +11643,7 @@ class App(QtCore.QObject):
'project': self.open_project,
'svg': self.import_svg,
'dxf': self.import_dxf,
'image': self.image_tool.import_image,
'image': image_opener,
'pdf': lambda fname: self.worker_task.emit({'fcn': self.pdf_tool.open_pdf, 'params': [fname]})
}
@ -11950,7 +11972,7 @@ class App(QtCore.QObject):
def on_plotcanvas_setup(self, container=None):
"""
This is doing the setup for the plot area (VisPy canvas)
This is doing the setup for the plot area (canvas)
:param container: widget where to install the canvas
:return: None
@ -11961,7 +11983,18 @@ class App(QtCore.QObject):
plot_container = self.ui.right_layout
if self.is_legacy is False:
self.plotcanvas = PlotCanvas(plot_container, self)
try:
self.plotcanvas = PlotCanvas(plot_container, self)
except Exception as er:
msg_txt = traceback.format_exc()
log.debug("App.on_plotcanvas_setup() failed -> %s" % str(er))
log.debug("OpenGL canvas initialization failed with the following error.\n" + msg_txt)
msg = '[ERROR_NOTCL] %s' % _("An internal error has occurred. See shell.\n")
msg += _("OpenGL canvas initialization failed. HW or HW configuration not supported."
"Change the graphic engine to Legacy(2D) in Edit -> Preferences -> General tab.\n\n")
msg += msg_txt
self.inform.emit(msg)
return 'fail'
else:
self.plotcanvas = PlotCanvasLegacy(plot_container, self)
@ -12044,8 +12077,7 @@ class App(QtCore.QObject):
log.debug("App.on_enable_sel_plot()")
object_list = self.collection.get_selected()
self.enable_plots(objects=object_list)
self.inform.emit('[success] %s' %
_("Selected plots enabled..."))
self.inform.emit('[success] %s' % _("Selected plots enabled..."))
def on_disable_sel_plots(self):
log.debug("App.on_disable_sel_plot()")
@ -12053,8 +12085,7 @@ class App(QtCore.QObject):
# self.inform.emit(_("Disabling plots ..."))
object_list = self.collection.get_selected()
self.disable_plots(objects=object_list)
self.inform.emit('[success] %s' %
_("Selected plots disabled..."))
self.inform.emit('[success] %s' % _("Selected plots disabled..."))
def enable_plots(self, objects):
"""
@ -12070,6 +12101,20 @@ class App(QtCore.QObject):
if obj.options['plot'] is False:
obj.options.set_change_callback(lambda x: None)
obj.options['plot'] = True
try:
# only the Gerber obj has on_plot_cb_click() method
obj.ui.plot_cb.stateChanged.disconnect(obj.on_plot_cb_click)
# disable this cb while disconnected,
# in case the operation takes time the user is not allowed to change it
obj.ui.plot_cb.setDisabled(True)
except AttributeError:
pass
obj.set_form_item("plot")
try:
obj.ui.plot_cb.stateChanged.connect(obj.on_plot_cb_click)
obj.ui.plot_cb.setDisabled(False)
except AttributeError:
pass
obj.options.set_change_callback(obj.on_options_change)
def worker_task(objs):
@ -12104,6 +12149,18 @@ class App(QtCore.QObject):
if obj.options['plot'] is True:
obj.options.set_change_callback(lambda x: None)
obj.options['plot'] = False
try:
# only the Gerber obj has on_plot_cb_click() method
obj.ui.plot_cb.stateChanged.disconnect(obj.on_plot_cb_click)
obj.ui.plot_cb.setDisabled(True)
except AttributeError:
pass
obj.set_form_item("plot")
try:
obj.ui.plot_cb.stateChanged.connect(obj.on_plot_cb_click)
obj.ui.plot_cb.setDisabled(False)
except AttributeError:
pass
obj.options.set_change_callback(obj.on_options_change)
try:
@ -12242,7 +12299,7 @@ class App(QtCore.QObject):
try:
self.collection.get_active().read_form()
except Exception as e:
self.log.debug("There was no active object. %s" % str(e))
self.log.debug("save_project() --> There was no active object. Skipping read_form. %s" % str(e))
pass
# Serialize the whole project

View File

@ -1811,7 +1811,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
visibility = kwargs['visible']
with self.app.proc_container.new(_("Plotting Apertures")):
self.app.progress.emit(30)
def job_thread(app_obj):
try:
@ -3080,7 +3079,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
def geo_init(geo_obj, app_obj):
assert isinstance(geo_obj, FlatCAMGeometry), \
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
app_obj.progress.emit(20)
# ## Add properties to the object
@ -3110,7 +3108,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
if use_thread:
def geo_thread(app_obj):
app_obj.new_object("geometry", outname, geo_init, plot=plot)
app_obj.progress.emit(100)
# Create a promise with the new name
self.app.collection.promise(outname)
@ -3173,7 +3170,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
def geo_init(geo_obj, app_obj):
assert isinstance(geo_obj, FlatCAMGeometry), \
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
app_obj.progress.emit(20)
# ## Add properties to the object
@ -3217,7 +3213,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
if use_thread:
def geo_thread(app_obj):
app_obj.new_object("geometry", outname + '_slot', geo_init, plot=plot)
app_obj.progress.emit(100)
# Create a promise with the new name
self.app.collection.promise(outname)
@ -3358,7 +3353,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
def job_thread(app_obj):
with self.app.proc_container.new(_("Generating CNC Code")):
app_obj.new_object("cncjob", job_name, job_init)
app_obj.progress.emit(100)
# Create promise for the new name.
self.app.collection.promise(job_name)
@ -5425,11 +5419,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
# Propagate options
job_obj.options["tooldia"] = tooldia
app_obj.progress.emit(20)
job_obj.coords_decimals = self.app.defaults["cncjob_coords_decimals"]
job_obj.fr_decimals = self.app.defaults["cncjob_fr_decimals"]
app_obj.progress.emit(40)
job_obj.options['type'] = 'Geometry'
job_obj.options['tool_dia'] = tooldia
@ -5459,24 +5450,18 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
pp_geometry_name=ppname_g
)
app_obj.progress.emit(50)
# tell gcode_parse from which point to start drawing the lines depending on what kind of object is the
# source of gcode
job_obj.toolchange_xy_type = "geometry"
job_obj.gcode_parse()
self.app.inform.emit('[success] %s' %
_("Finished G-Code processing..."))
app_obj.progress.emit(80)
self.app.inform.emit('[success] %s' % _("Finished G-Code processing..."))
if use_thread:
# To be run in separate thread
def job_thread(app_obj):
with self.app.proc_container.new(_("Generating CNC Code")):
app_obj.new_object("cncjob", outname, job_init, plot=plot)
app_obj.inform.emit('[success] %s: %s' %
(_("CNCjob created")), outname)
app_obj.progress.emit(100)
app_obj.inform.emit('[success] %s: %s' % (_("CNCjob created")), outname)
# Create a promise with the name
self.app.collection.promise(outname)

View File

@ -9,11 +9,29 @@ CAD program, and create G-Code for Isolation routing.
=================================================
8.01.2019
- working in NCC Tool
- selected rows in the Tools Tables will stay colored in blue after loosing focus instead of the default gray
- in NCC Tool the Tool name in the Parameters section will be the Tool ID in the Tool Table
- added an exception catch in case the plotcanvas init failed for the OpenGL graphic engine and warn user about what happened
7.01.2019
- solved issue #368 - when using the Enable/Disable prj context menu entries the plotted status is not updated in the object properties
- updates in NCC Tool
6.01.2019
- working on new NCC Tool
2.01.2020
- started to rework the NCC Tool GUI in preparation for adding a Tool DB feature
- for auto-completer, now clicking an entry in the completer popup will select that entry and insert it
- made available only for Linux and Windows (not OSX) the starting of the thread that checks if another instance of FlatCAM is already running at the launch of FLatCAM
- modified Toggle Workspace function to work in the new Preferences UI configuration
- cleaned the app from progress signal usage since it is not used anymore
1.01.2020

View File

@ -3305,7 +3305,6 @@ class FlatCAMExcEditor(QtCore.QObject):
# How the object should be initialized
def obj_init(excellon_obj, app_obj):
# self.progress.emit(20)
excellon_obj.drills = deepcopy(new_drills)
excellon_obj.tools = deepcopy(new_tools)
excellon_obj.slots = deepcopy(new_slots)
@ -3335,12 +3334,9 @@ class FlatCAMExcEditor(QtCore.QObject):
use_thread=False)
except Exception as e:
log.error("Error on Edited object creation: %s" % str(e))
self.app.progress.emit(100)
return
self.app.inform.emit('[success] %s' %
_("Excellon editing finished."))
# self.progress.emit(100)
self.app.inform.emit('[success] %s' % _("Excellon editing finished."))
def on_tool_select(self, tool):
"""

View File

@ -1272,8 +1272,6 @@ class TransformEditorTool(FlatCAMTool):
xmaximal = max(xmaxlist)
ymaximal = max(ymaxlist)
self.app.progress.emit(20)
for sel_sha in shape_list:
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
@ -1284,11 +1282,7 @@ class TransformEditorTool(FlatCAMTool):
# self.draw_app.transform_complete.emit()
self.app.inform.emit('[success] %s' %
_("Done. Rotate completed."))
self.app.progress.emit(100)
self.app.inform.emit('[success] %s' % _("Done. Rotate completed."))
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Rotation action was not executed"), str(e)))
return
@ -1329,8 +1323,6 @@ class TransformEditorTool(FlatCAMTool):
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
self.app.progress.emit(20)
# execute mirroring
for sha in shape_list:
if axis is 'X':
@ -1347,8 +1339,6 @@ class TransformEditorTool(FlatCAMTool):
#
# self.draw_app.transform_complete.emit()
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Flip action was not executed"), str(e)))
return
@ -1375,8 +1365,6 @@ class TransformEditorTool(FlatCAMTool):
xminimal = min(xminlist)
yminimal = min(yminlist)
self.app.progress.emit(20)
for sha in shape_list:
if axis is 'X':
sha.skew(num, 0, point=(xminimal, yminimal))
@ -1388,12 +1376,9 @@ class TransformEditorTool(FlatCAMTool):
#
# self.draw_app.transform_complete.emit()
if axis == 'X':
self.app.inform.emit('[success] %s...' %
_('Skew on the X axis done'))
self.app.inform.emit('[success] %s...' % _('Skew on the X axis done'))
else:
self.app.inform.emit('[success] %s...' %
_('Skew on the Y axis done'))
self.app.progress.emit(100)
self.app.inform.emit('[success] %s...' % _('Skew on the Y axis done'))
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Skew action was not executed"), str(e)))
@ -1407,8 +1392,7 @@ class TransformEditorTool(FlatCAMTool):
ymaxlist = []
if not shape_list:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("No shape selected. Please Select a shape to scale!"))
self.app.inform.emit('[WARNING_NOTCL] %s' % _("No shape selected. Please Select a shape to scale!"))
return
else:
with self.app.proc_container.new(_("Applying Scale")):
@ -1427,8 +1411,6 @@ class TransformEditorTool(FlatCAMTool):
xmaximal = max(xmaxlist)
ymaximal = max(ymaxlist)
self.app.progress.emit(20)
if point is None:
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
@ -1445,12 +1427,9 @@ class TransformEditorTool(FlatCAMTool):
# self.draw_app.transform_complete.emit()
if str(axis) == 'X':
self.app.inform.emit('[success] %s...' %
_('Scale on the X axis done'))
self.app.inform.emit('[success] %s...' % _('Scale on the X axis done'))
else:
self.app.inform.emit('[success] %s...' %
_('Scale on the Y axis done'))
self.app.progress.emit(100)
self.app.inform.emit('[success] %s...' % _('Scale on the Y axis done'))
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Scale action was not executed"), str(e)))
return
@ -1467,8 +1446,6 @@ class TransformEditorTool(FlatCAMTool):
else:
with self.app.proc_container.new(_("Applying Offset")):
try:
self.app.progress.emit(20)
for sha in shape_list:
if axis is 'X':
sha.offset((num, 0))
@ -1477,12 +1454,9 @@ class TransformEditorTool(FlatCAMTool):
self.draw_app.replot()
if axis == 'X':
self.app.inform.emit('[success] %s...' %
_('Offset on the X axis done'))
self.app.inform.emit('[success] %s...' % _('Offset on the X axis done'))
else:
self.app.inform.emit('[success] %s...' %
_('Offset on the Y axis done'))
self.app.progress.emit(100)
self.app.inform.emit('[success] %s...' % _('Offset on the Y axis done'))
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Offset action was not executed"), str(e)))

View File

@ -5761,7 +5761,6 @@ class TransformEditorTool(FlatCAMTool):
xmaximal = max(xmaxlist)
ymaximal = max(ymaxlist)
self.app.progress.emit(20)
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
@ -5775,12 +5774,9 @@ class TransformEditorTool(FlatCAMTool):
sel_el['clear'] = affinity.rotate(sel_el['clear'], angle=-num, origin=(px, py))
self.draw_app.plot_all()
self.app.inform.emit('[success] %s' %
_("Done. Rotate completed."))
self.app.progress.emit(100)
self.app.inform.emit('[success] %s' % _("Done. Rotate completed."))
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Rotation action was not executed."), str(e)))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Rotation action was not executed."), str(e)))
return
def on_flip(self, axis):
@ -5827,8 +5823,6 @@ class TransformEditorTool(FlatCAMTool):
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
self.app.progress.emit(20)
# execute mirroring
for sel_el_shape in elem_list:
sel_el = sel_el_shape.geo
@ -5851,8 +5845,6 @@ class TransformEditorTool(FlatCAMTool):
self.app.inform.emit('[success] %s...' %
_('Flip on the X axis done'))
self.draw_app.plot_all()
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Flip action was not executed."), str(e)))
@ -5889,8 +5881,6 @@ class TransformEditorTool(FlatCAMTool):
xminimal = min(xminlist)
yminimal = min(yminlist)
self.app.progress.emit(20)
for sel_el_shape in elem_list:
sel_el = sel_el_shape.geo
if axis is 'X':
@ -5913,8 +5903,6 @@ class TransformEditorTool(FlatCAMTool):
self.app.inform.emit('[success] %s...' % _('Skew on the X axis done'))
else:
self.app.inform.emit('[success] %s...' % _('Skew on the Y axis done'))
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Skew action was not executed."), str(e)))
return
@ -5958,8 +5946,6 @@ class TransformEditorTool(FlatCAMTool):
xmaximal = max(xmaxlist)
ymaximal = max(ymaxlist)
self.app.progress.emit(20)
if point is None:
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)

View File

@ -2221,9 +2221,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.infobar.addWidget(self.units_label)
# disabled
self.progress_bar = QtWidgets.QProgressBar()
self.progress_bar.setMinimum(0)
self.progress_bar.setMaximum(100)
# self.progress_bar = QtWidgets.QProgressBar()
# self.progress_bar.setMinimum(0)
# self.progress_bar.setMaximum(100)
# infobar.addWidget(self.progress_bar)
# ########################################################################
@ -2262,6 +2262,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.grb_editor_cmenu.menuAction().setVisible(False)
self.e_editor_cmenu.menuAction().setVisible(False)
# ########################################################################
# ######################## BUILD PREFERENCES #############################
# ########################################################################
self.general_defaults_form = GeneralPreferencesUI(decimals=self.decimals)
self.gerber_defaults_form = GerberPreferencesUI(decimals=self.decimals)
self.excellon_defaults_form = ExcellonPreferencesUI(decimals=self.decimals)
@ -2358,7 +2362,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
:param event: QT event to filter
:return:
"""
if self.general_defaults_form.general_app_set_group.toggle_tooltips_cb.get_value() is False:
if self.app.defaults["global_toggle_tooltips"] is False:
if event.type() == QtCore.QEvent.ToolTip:
return True
else:

View File

@ -2006,6 +2006,11 @@ class FCTable(QtWidgets.QTableWidget):
def __init__(self, drag_drop=False, protected_rows=None, parent=None):
super(FCTable, self).__init__(parent)
palette = QtGui.QPalette()
palette.setColor(QtGui.QPalette.Inactive, QtGui.QPalette.Highlight,
palette.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight))
self.setPalette(palette)
if drag_drop:
self.setDragEnabled(True)
self.setAcceptDrops(True)

View File

@ -1661,18 +1661,13 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.layout.addWidget(separator_line)
grid1 = QtWidgets.QGridLayout()
self.layout.addLayout(grid1)
grid1.setColumnStretch(0, 0)
grid1.setColumnStretch(1, 1)
grid0.addWidget(separator_line, 31, 0, 1, 2)
self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
self.pdf_param_label.setToolTip(
_("Used when saving text in Code Editor or in FlatCAM Document objects.")
)
grid1.addWidget(self.pdf_param_label, 0, 0, 1, 2)
grid0.addWidget(self.pdf_param_label, 32, 0, 1, 2)
# Top Margin value
self.tmargin_entry = FCDoubleSpinner()
@ -1684,8 +1679,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
_("Distance between text body and the top of the PDF file.")
)
grid1.addWidget(self.tmargin_label, 1, 0)
grid1.addWidget(self.tmargin_entry, 1, 1)
grid0.addWidget(self.tmargin_label, 33, 0)
grid0.addWidget(self.tmargin_entry, 33, 1)
# Bottom Margin value
self.bmargin_entry = FCDoubleSpinner()
@ -1697,8 +1692,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
_("Distance between text body and the bottom of the PDF file.")
)
grid1.addWidget(self.bmargin_label, 2, 0)
grid1.addWidget(self.bmargin_entry, 2, 1)
grid0.addWidget(self.bmargin_label, 34, 0)
grid0.addWidget(self.bmargin_entry, 34, 1)
# Left Margin value
self.lmargin_entry = FCDoubleSpinner()
@ -1710,8 +1705,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
_("Distance between text body and the left of the PDF file.")
)
grid1.addWidget(self.lmargin_label, 3, 0)
grid1.addWidget(self.lmargin_entry, 3, 1)
grid0.addWidget(self.lmargin_label, 35, 0)
grid0.addWidget(self.lmargin_entry, 35, 1)
# Right Margin value
self.rmargin_entry = FCDoubleSpinner()
@ -1723,8 +1718,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
_("Distance between text body and the right of the PDF file.")
)
grid1.addWidget(self.rmargin_label, 4, 0)
grid1.addWidget(self.rmargin_entry, 4, 1)
grid0.addWidget(self.rmargin_label, 36, 0)
grid0.addWidget(self.rmargin_entry, 36, 1)
self.layout.addStretch()

File diff suppressed because it is too large Load Diff

View File

@ -484,11 +484,8 @@ class Panelize(FlatCAMTool):
if panel_obj is not None:
self.app.inform.emit(_("Generating panel ... "))
self.app.progress.emit(0)
def job_init_excellon(obj_fin, app_obj):
currenty = 0.0
self.app.progress.emit(10)
obj_fin.tools = copied_tools
obj_fin.drills = []
obj_fin.slots = []

View File

@ -417,8 +417,6 @@ class PcbWizard(FlatCAMTool):
# How the object should be initialized
def obj_init(excellon_obj, app_obj):
# self.progress.emit(20)
try:
ret = excellon_obj.parse_file(file_obj=excellon_fileobj)
if ret == "fail":
@ -427,10 +425,8 @@ class PcbWizard(FlatCAMTool):
_("This is not Excellon file."))
return "fail"
except IOError:
app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (
_("Cannot parse file"), self.outname))
app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Cannot parse file"), self.outname))
app_obj.log.debug("Could not import Excellon object.")
app_obj.progress.emit(0)
return "fail"
except Exception as e:
app_obj.log.debug("PcbWizard.on_import_excellon().obj_init() %s" % str(e))
@ -443,7 +439,7 @@ class PcbWizard(FlatCAMTool):
if ret == 'fail':
app_obj.log.debug("Could not create geometry for Excellon object.")
return "fail"
app_obj.progress.emit(100)
for tool in excellon_obj.tools:
if excellon_obj.tools[tool]['solid_geometry']:
return

View File

@ -1348,8 +1348,6 @@ class SolderPaste(FlatCAMTool):
job_obj.options['ymax'] = ymax
for tooluid_key, tooluid_value in obj.tools.items():
app_obj.progress.emit(20)
# find the tool_dia associated with the tooluid_key
tool_dia = tooluid_value['tooldia']
tool_cnc_dict = deepcopy(tooluid_value)
@ -1380,8 +1378,6 @@ class SolderPaste(FlatCAMTool):
# tell gcode_parse from which point to start drawing the lines depending on what kind of
# object is the source of gcode
job_obj.toolchange_xy_type = "geometry"
app_obj.progress.emit(80)
job_obj.cnc_tools.update({
tooluid_key: deepcopy(tool_cnc_dict)
})
@ -1394,8 +1390,6 @@ class SolderPaste(FlatCAMTool):
if app_obj.new_object("cncjob", name, job_init) != 'fail':
app_obj.inform.emit('[success] [success] %s: %s' %
(_("ToolSolderPaste CNCjob created"), name))
app_obj.progress.emit(100)
# Create a promise with the name
self.app.collection.promise(name)
# Send to worker

View File

@ -682,8 +682,6 @@ class ToolTransform(FlatCAMTool):
xmaximal = max(xmaxlist)
ymaximal = max(ymaxlist)
self.app.progress.emit(20)
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
for sel_obj in obj_list:
@ -697,8 +695,6 @@ class ToolTransform(FlatCAMTool):
sel_obj.options['rotate'] = num
sel_obj.plot()
self.app.inform.emit('[success] %s...' % _('Rotate done'))
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s %s, %s.' %
(_("Due of"), str(e), _("action was not executed.")))
@ -743,8 +739,6 @@ class ToolTransform(FlatCAMTool):
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
self.app.progress.emit(20)
# execute mirroring
for sel_obj in obj_list:
if isinstance(sel_obj, FlatCAMCNCjob):
@ -768,12 +762,9 @@ class ToolTransform(FlatCAMTool):
sel_obj.options['mirror_x'] = not sel_obj.options['mirror_x']
else:
sel_obj.options['mirror_x'] = True
self.app.inform.emit('[success] %s...' %
_('Flip on the X axis done'))
self.app.inform.emit('[success] %s...' % _('Flip on the X axis done'))
self.app.object_changed.emit(sel_obj)
sel_obj.plot()
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s %s, %s.' %
(_("Due of"), str(e), _("action was not executed.")))
@ -809,8 +800,6 @@ class ToolTransform(FlatCAMTool):
xminimal = min(xminlist)
yminimal = min(yminlist)
self.app.progress.emit(20)
for sel_obj in obj_list:
if isinstance(sel_obj, FlatCAMCNCjob):
self.app.inform.emit(_("CNCJob objects can't be skewed."))
@ -825,10 +814,7 @@ class ToolTransform(FlatCAMTool):
sel_obj.options['skew_y'] = num
self.app.object_changed.emit(sel_obj)
sel_obj.plot()
self.app.inform.emit('[success] %s %s %s...' %
(_('Skew on the'), str(axis), _("axis done")))
self.app.progress.emit(100)
self.app.inform.emit('[success] %s %s %s...' % (_('Skew on the'), str(axis), _("axis done")))
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s %s, %s.' %
(_("Due of"), str(e), _("action was not executed.")))
@ -865,8 +851,6 @@ class ToolTransform(FlatCAMTool):
xmaximal = max(xmaxlist)
ymaximal = max(ymaxlist)
self.app.progress.emit(20)
if point is None:
px = 0.5 * (xminimal + xmaximal)
py = 0.5 * (yminimal + ymaximal)
@ -887,7 +871,6 @@ class ToolTransform(FlatCAMTool):
self.app.inform.emit('[success] %s %s %s...' %
(_('Scale on the'), str(axis), _('axis done')))
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s %s, %s.' %
(_("Due of"), str(e), _("action was not executed.")))
@ -903,8 +886,6 @@ class ToolTransform(FlatCAMTool):
else:
with self.app.proc_container.new(_("Applying Offset")):
try:
self.app.progress.emit(20)
for sel_obj in obj_list:
if isinstance(sel_obj, FlatCAMCNCjob):
self.app.inform.emit(_("CNCJob objects can't be offset."))
@ -922,8 +903,6 @@ class ToolTransform(FlatCAMTool):
self.app.inform.emit('[success] %s %s %s...' %
(_('Offset on the'), str(axis), _('axis done')))
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s %s, %s.' %
(_("Due of"), str(e), _("action was not executed.")))

View File

@ -219,22 +219,22 @@ class TclCommandCopperClear(TclCommand):
# Non-Copper clear all polygons in the non-copper clear object
if 'all' in args and bool(args['all']):
self.app.ncclear_tool.clear_copper(ncc_obj=obj,
select_method='itself',
ncctooldia=tooldia,
overlap=overlap,
order=order,
margin=margin,
has_offset=has_offset,
offset=offset,
method=method,
outname=outname,
connect=connect,
contour=contour,
rest=rest,
tools_storage=ncc_tools,
plot=False,
run_threaded=False)
self.app.ncclear_tool.clear_copper_tcl(ncc_obj=obj,
select_method='itself',
ncctooldia=tooldia,
overlap=overlap,
order=order,
margin=margin,
has_offset=has_offset,
offset=offset,
method=method,
outname=outname,
connect=connect,
contour=contour,
rest=rest,
tools_storage=ncc_tools,
plot=False,
run_threaded=False)
return
# Non-Copper clear all polygons found within the box object from the the non_copper cleared object
@ -252,23 +252,23 @@ class TclCommandCopperClear(TclCommand):
self.raise_tcl_error("%s: %s" % (_("Could not retrieve box object"), name))
return "Could not retrieve object: %s" % name
self.app.ncclear_tool.clear_copper(ncc_obj=obj,
sel_obj=box_obj,
select_method='box',
ncctooldia=tooldia,
overlap=overlap,
order=order,
margin=margin,
has_offset=has_offset,
offset=offset,
method=method,
outname=outname,
connect=connect,
contour=contour,
rest=rest,
tools_storage=ncc_tools,
plot=False,
run_threaded=False)
self.app.ncclear_tool.clear_copper_tcl(ncc_obj=obj,
sel_obj=box_obj,
select_method='box',
ncctooldia=tooldia,
overlap=overlap,
order=order,
margin=margin,
has_offset=has_offset,
offset=offset,
method=method,
outname=outname,
connect=connect,
contour=contour,
rest=rest,
tools_storage=ncc_tools,
plot=False,
run_threaded=False)
return
else:
self.raise_tcl_error("%s:" % _("None of the following args: 'ref', 'all' were found or none was set to 1.\n"

View File

@ -177,11 +177,8 @@ class TclCommandPanelize(TclCommand):
if obj is not None:
self.app.inform.emit("Generating panel ... Please wait.")
self.app.progress.emit(0)
def job_init_excellon(obj_fin, app_obj):
currenty = 0.0
self.app.progress.emit(10)
obj_fin.tools = obj.tools.copy()
obj_fin.drills = []
obj_fin.slots = []
@ -247,7 +244,6 @@ class TclCommandPanelize(TclCommand):
for tool in obj.tools:
obj_fin.tools[tool]['solid_geometry'][:] = []
self.app.progress.emit(0)
for row in range(rows):
currentx = 0.0
@ -271,10 +267,8 @@ class TclCommandPanelize(TclCommand):
currenty += lenghty
if isinstance(obj, FlatCAMExcellon):
self.app.progress.emit(50)
self.app.new_object("excellon", outname, job_init_excellon, plot=False, autoselected=True)
else:
self.app.progress.emit(50)
self.app.new_object("geometry", outname, job_init_geometry, plot=False, autoselected=True)
if threaded is True: