- trying to optimize Gerber Editor selection with the mouse
- optimized some of the strings
This commit is contained in:
@@ -416,7 +416,7 @@ class ToolCorners(AppTool):
|
||||
|
||||
def replot(self, obj, run_thread=True):
|
||||
def worker_task():
|
||||
with self.app.proc_container.new('%s...' % _("Plotting")):
|
||||
with self.app.proc_container.new('%s ...' % _("Plotting")):
|
||||
obj.plot()
|
||||
self.app.app_obj.object_plotted.emit(obj)
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ class ToolFiducials(AppTool):
|
||||
|
||||
def replot(self, obj, run_thread=True):
|
||||
def worker_task():
|
||||
with self.app.proc_container.new('%s...' % _("Plotting")):
|
||||
with self.app.proc_container.new('%s ...' % _("Plotting")):
|
||||
obj.plot()
|
||||
self.app.app_obj.object_plotted.emit(obj)
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ class ToolImage(AppTool):
|
||||
geo_obj.import_image(filename, units=units, dpi=dpi, mode=mode, mask=mask)
|
||||
geo_obj.multigeo = False
|
||||
|
||||
with self.app.proc_container.new(_("Importing Image")):
|
||||
with self.app.proc_container.new('%s ...' % _("Importing")):
|
||||
|
||||
# Object name
|
||||
name = outname or filename.split('/')[-1].split('\\')[-1]
|
||||
|
||||
@@ -927,7 +927,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
return
|
||||
|
||||
def job_thread(app_obj, is_display):
|
||||
with self.app.proc_container.new(_("Working...")):
|
||||
with self.app.proc_container.new(_("Working ...")):
|
||||
try:
|
||||
old_disp_number = 0
|
||||
pol_nr = 0
|
||||
@@ -1387,7 +1387,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
self.find_safe_tooldia_worker(is_displayed=False)
|
||||
|
||||
def worker_task(iso_obj):
|
||||
with self.app.proc_container.new(_("Isolating...")):
|
||||
with self.app.proc_container.new(_("Isolating ...")):
|
||||
self.isolate_handler(iso_obj)
|
||||
|
||||
self.app.worker_task.emit({'fcn': worker_task, 'params': [self.grb_obj]})
|
||||
|
||||
@@ -160,7 +160,7 @@ class ToolMove(AppTool):
|
||||
if obj.options['plot'] and obj.visible is True]
|
||||
|
||||
def job_move(app_obj):
|
||||
with self.app.proc_container.new(_("Moving...")):
|
||||
with self.app.proc_container.new(_("Moving ...")):
|
||||
|
||||
if not obj_list:
|
||||
app_obj.app.inform.emit('[WARNING_NOTCL] %s' % _("No object(s) selected."))
|
||||
@@ -226,7 +226,7 @@ class ToolMove(AppTool):
|
||||
def replot(self, obj_list):
|
||||
|
||||
def worker_task():
|
||||
with self.app.proc_container.new('%s...' % _("Plotting")):
|
||||
with self.app.proc_container.new('%s ...' % _("Plotting")):
|
||||
for sel_obj in obj_list:
|
||||
sel_obj.plot()
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ class ToolOptimal(AppTool):
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Only Gerber objects can be evaluated."))
|
||||
return
|
||||
|
||||
proc = self.app.proc_container.new(_("Working..."))
|
||||
proc = self.app.proc_container.new(_("Working ..."))
|
||||
|
||||
def job_thread(app_obj):
|
||||
app_obj.inform.emit(_("Optimal Tool. Started to search for the minimum distance between copper features."))
|
||||
|
||||
@@ -120,7 +120,7 @@ class ToolPDF(AppTool):
|
||||
# graceful abort requested by the user
|
||||
raise grace
|
||||
|
||||
with self.app.proc_container.new(_("Parsing PDF file ...")):
|
||||
with self.app.proc_container.new(_("Parsing ...")):
|
||||
with open(filename, "rb") as f:
|
||||
pdf = f.read()
|
||||
|
||||
|
||||
@@ -2193,7 +2193,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
# Promise object with the new name
|
||||
self.app.collection.promise(name)
|
||||
|
||||
proc = self.app.proc_container.new(_("Painting..."))
|
||||
proc = self.app.proc_container.new(_("Painting ..."))
|
||||
|
||||
if run_threaded:
|
||||
# Background
|
||||
|
||||
@@ -610,7 +610,7 @@ class Panelize(AppTool):
|
||||
"Final panel has {col} columns and {row} rows").format(
|
||||
text='[WARNING] ', col=columns, row=rows))
|
||||
|
||||
proc = self.app.proc_container.new(_("Working..."))
|
||||
proc = self.app.proc_container.new(_("Working ..."))
|
||||
|
||||
def job_thread(app_obj):
|
||||
try:
|
||||
|
||||
@@ -333,7 +333,7 @@ class PcbWizard(AppTool):
|
||||
|
||||
if excellon_fileobj is not None and excellon_fileobj != '':
|
||||
if self.process_finished:
|
||||
with self.app.proc_container.new(_("Importing Excellon.")):
|
||||
with self.app.proc_container.new('%s ...' % _("Importing")):
|
||||
|
||||
# Object name
|
||||
name = self.outname
|
||||
|
||||
@@ -192,7 +192,7 @@ class Properties(AppTool):
|
||||
self.treeWidget.addChild(obj_name, [obj.options['name']])
|
||||
|
||||
def job_thread(obj_prop):
|
||||
self.app.proc_container.new(_("Calculating dimensions ... Please wait."))
|
||||
self.app.proc_container.new(_("Working ..."))
|
||||
|
||||
length = 0.0
|
||||
width = 0.0
|
||||
|
||||
@@ -163,47 +163,47 @@ class QRCode(AppTool):
|
||||
self.mr = self.app.plotcanvas.graph_event_connect('mouse_release', self.on_mouse_release)
|
||||
self.kr = self.app.plotcanvas.graph_event_connect('key_release', self.on_key_release)
|
||||
|
||||
self.proc = self.app.proc_container.new('%s...' % _("Generating QRCode geometry"))
|
||||
|
||||
def job_thread_qr(app_obj):
|
||||
error_code = {
|
||||
'L': qrcode.constants.ERROR_CORRECT_L,
|
||||
'M': qrcode.constants.ERROR_CORRECT_M,
|
||||
'Q': qrcode.constants.ERROR_CORRECT_Q,
|
||||
'H': qrcode.constants.ERROR_CORRECT_H
|
||||
}[self.ui.error_radio.get_value()]
|
||||
with self.app.proc_container.new('%s' % _("Working ...")) as self.proc:
|
||||
|
||||
qr = qrcode.QRCode(
|
||||
version=self.ui.version_entry.get_value(),
|
||||
error_correction=error_code,
|
||||
box_size=self.ui.bsize_entry.get_value(),
|
||||
border=self.ui.border_size_entry.get_value(),
|
||||
image_factory=qrcode.image.svg.SvgFragmentImage
|
||||
)
|
||||
qr.add_data(text_data)
|
||||
qr.make()
|
||||
error_code = {
|
||||
'L': qrcode.constants.ERROR_CORRECT_L,
|
||||
'M': qrcode.constants.ERROR_CORRECT_M,
|
||||
'Q': qrcode.constants.ERROR_CORRECT_Q,
|
||||
'H': qrcode.constants.ERROR_CORRECT_H
|
||||
}[self.ui.error_radio.get_value()]
|
||||
|
||||
svg_file = BytesIO()
|
||||
img = qr.make_image()
|
||||
img.save(svg_file)
|
||||
qr = qrcode.QRCode(
|
||||
version=self.ui.version_entry.get_value(),
|
||||
error_correction=error_code,
|
||||
box_size=self.ui.bsize_entry.get_value(),
|
||||
border=self.ui.border_size_entry.get_value(),
|
||||
image_factory=qrcode.image.svg.SvgFragmentImage
|
||||
)
|
||||
qr.add_data(text_data)
|
||||
qr.make()
|
||||
|
||||
svg_text = StringIO(svg_file.getvalue().decode('UTF-8'))
|
||||
svg_geometry = self.convert_svg_to_geo(svg_text, units=self.units)
|
||||
self.qrcode_geometry = deepcopy(svg_geometry)
|
||||
svg_file = BytesIO()
|
||||
img = qr.make_image()
|
||||
img.save(svg_file)
|
||||
|
||||
svg_geometry = unary_union(svg_geometry).buffer(0.0000001).buffer(-0.0000001)
|
||||
self.qrcode_utility_geometry = svg_geometry
|
||||
svg_text = StringIO(svg_file.getvalue().decode('UTF-8'))
|
||||
svg_geometry = self.convert_svg_to_geo(svg_text, units=self.units)
|
||||
self.qrcode_geometry = deepcopy(svg_geometry)
|
||||
|
||||
# make a bounding box of the QRCode geometry to help drawing the utility geometry in case it is too
|
||||
# complicated
|
||||
try:
|
||||
a, b, c, d = self.qrcode_utility_geometry.bounds
|
||||
self.box_poly = box(minx=a, miny=b, maxx=c, maxy=d)
|
||||
except Exception as ee:
|
||||
log.debug("QRCode.make() bounds error --> %s" % str(ee))
|
||||
svg_geometry = unary_union(svg_geometry).buffer(0.0000001).buffer(-0.0000001)
|
||||
self.qrcode_utility_geometry = svg_geometry
|
||||
|
||||
app_obj.call_source = 'qrcode_tool'
|
||||
app_obj.inform.emit(_("Click on the Destination point ..."))
|
||||
# make a bounding box of the QRCode geometry to help drawing the utility geometry in case it is too
|
||||
# complicated
|
||||
try:
|
||||
a, b, c, d = self.qrcode_utility_geometry.bounds
|
||||
self.box_poly = box(minx=a, miny=b, maxx=c, maxy=d)
|
||||
except Exception as ee:
|
||||
log.debug("QRCode.make() bounds error --> %s" % str(ee))
|
||||
|
||||
app_obj.call_source = 'qrcode_tool'
|
||||
app_obj.inform.emit(_("Click on the Destination point ..."))
|
||||
|
||||
self.app.worker_task.emit({'fcn': job_thread_qr, 'params': [self.app]})
|
||||
|
||||
@@ -463,7 +463,7 @@ class QRCode(AppTool):
|
||||
|
||||
def replot(self, obj):
|
||||
def worker_task():
|
||||
with self.app.proc_container.new('%s...' % _("Plotting")):
|
||||
with self.app.proc_container.new('%s ...' % _("Plotting")):
|
||||
obj.plot()
|
||||
|
||||
self.app.worker_task.emit({'fcn': worker_task, 'params': []})
|
||||
|
||||
@@ -667,7 +667,7 @@ class SolderPaste(AppTool):
|
||||
:param use_thread: use thread, True or False
|
||||
:return: a Geometry type object
|
||||
"""
|
||||
proc = self.app.proc_container.new(_("Creating Solder Paste dispensing geometry."))
|
||||
proc = self.app.proc_container.new(_("Working ..."))
|
||||
obj = work_object
|
||||
|
||||
# Sort tools in descending order
|
||||
@@ -956,7 +956,7 @@ class SolderPaste(AppTool):
|
||||
if use_thread:
|
||||
# To be run in separate thread
|
||||
def job_thread(app_obj):
|
||||
with self.app.proc_container.new("Generating CNC Code"):
|
||||
with self.app.proc_container.new('%s' % _("Working ...")):
|
||||
if app_obj.app_obj.new_object("cncjob", name, job_init) != 'fail':
|
||||
app_obj.inform.emit('[success] [success] %s: %s' %
|
||||
(_("ToolSolderPaste CNCjob created"), name))
|
||||
|
||||
@@ -194,35 +194,36 @@ class ToolSub(AppTool):
|
||||
self.new_apertures[apid][key] = self.target_grb_obj.apertures[apid][key]
|
||||
|
||||
def worker_job(app_obj):
|
||||
# SUBTRACTOR geometry (always the same)
|
||||
sub_geometry = {'solid': [], 'clear': []}
|
||||
# iterate over SUBTRACTOR geometry and load it in the sub_geometry dict
|
||||
for s_apid in app_obj.sub_grb_obj.apertures:
|
||||
for s_el in app_obj.sub_grb_obj.apertures[s_apid]['geometry']:
|
||||
if "solid" in s_el:
|
||||
sub_geometry['solid'].append(s_el["solid"])
|
||||
if "clear" in s_el:
|
||||
sub_geometry['clear'].append(s_el["clear"])
|
||||
with app_obj.app.proc_container.new('%s' % _("Working ...")):
|
||||
# SUBTRACTOR geometry (always the same)
|
||||
sub_geometry = {'solid': [], 'clear': []}
|
||||
# iterate over SUBTRACTOR geometry and load it in the sub_geometry dict
|
||||
for s_apid in app_obj.sub_grb_obj.apertures:
|
||||
for s_el in app_obj.sub_grb_obj.apertures[s_apid]['geometry']:
|
||||
if "solid" in s_el:
|
||||
sub_geometry['solid'].append(s_el["solid"])
|
||||
if "clear" in s_el:
|
||||
sub_geometry['clear'].append(s_el["clear"])
|
||||
|
||||
for ap_id in app_obj.target_grb_obj.apertures:
|
||||
# TARGET geometry
|
||||
target_geo = [geo for geo in app_obj.target_grb_obj.apertures[ap_id]['geometry']]
|
||||
for ap_id in app_obj.target_grb_obj.apertures:
|
||||
# TARGET geometry
|
||||
target_geo = [geo for geo in app_obj.target_grb_obj.apertures[ap_id]['geometry']]
|
||||
|
||||
# send the job to the multiprocessing JOB
|
||||
app_obj.results.append(
|
||||
app_obj.pool.apply_async(app_obj.aperture_intersection, args=(ap_id, target_geo, sub_geometry))
|
||||
)
|
||||
# send the job to the multiprocessing JOB
|
||||
app_obj.results.append(
|
||||
app_obj.pool.apply_async(app_obj.aperture_intersection, args=(ap_id, target_geo, sub_geometry))
|
||||
)
|
||||
|
||||
output = []
|
||||
for p in app_obj.results:
|
||||
res = p.get()
|
||||
output.append(res)
|
||||
app_obj.app.inform.emit('%s: %s...' % (_("Finished parsing geometry for aperture"), str(res[0])))
|
||||
output = []
|
||||
for p in app_obj.results:
|
||||
res = p.get()
|
||||
output.append(res)
|
||||
app_obj.app.inform.emit('%s: %s...' % (_("Finished parsing geometry for aperture"), str(res[0])))
|
||||
|
||||
app_obj.app.inform.emit("%s" % _("Subtraction aperture processing finished."))
|
||||
app_obj.app.inform.emit("%s" % _("Subtraction aperture processing finished."))
|
||||
|
||||
outname = app_obj.ui.target_gerber_combo.currentText() + '_sub'
|
||||
app_obj.aperture_processing_finished.emit(outname, output)
|
||||
outname = app_obj.ui.target_gerber_combo.currentText() + '_sub'
|
||||
app_obj.aperture_processing_finished.emit(outname, output)
|
||||
|
||||
self.app.worker_task.emit({'fcn': worker_job, 'params': [self]})
|
||||
|
||||
@@ -349,7 +350,7 @@ class ToolSub(AppTool):
|
||||
grb_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
|
||||
local_use=grb_obj, use_thread=False)
|
||||
|
||||
with self.app.proc_container.new(_("Generating new object ...")):
|
||||
with self.app.proc_container.new(_("New object ...")):
|
||||
ret = self.app.app_obj.new_object('gerber', outname, obj_init, autoselected=False)
|
||||
if ret == 'fail':
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _('Generating new object failed.'))
|
||||
@@ -543,7 +544,7 @@ class ToolSub(AppTool):
|
||||
app_obj.log.debug("ToolSub.new_geo_object() --> %s" % str(e))
|
||||
geo_obj.multigeo = False
|
||||
|
||||
with self.app.proc_container.new(_("Generating new object ...")):
|
||||
with self.app.proc_container.new(_("New object ...")):
|
||||
ret = self.app.app_obj.new_object('geometry', outname, obj_init, autoselected=False)
|
||||
if ret == 'fail':
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _('Generating new object failed.'))
|
||||
|
||||
Reference in New Issue
Block a user