- minor PEP corrections

This commit is contained in:
Marius Stanciu
2020-10-31 18:46:20 +02:00
committed by Marius Stanciu
parent ffe4f0d641
commit e71a48ff5c
6 changed files with 52 additions and 68 deletions

View File

@@ -2046,7 +2046,8 @@ class AppExcEditor(QtCore.QObject):
try:
if dia is None or dia is False:
# deleted_tool_dia = float(self.e_ui.tools_table_exc.item(self.e_ui.tools_table_exc.currentRow(), 1).text())
# deleted_tool_dia = float(
# self.e_ui.tools_table_exc.item(self.e_ui.tools_table_exc.currentRow(), 1).text())
for index in self.e_ui.tools_table_exc.selectionModel().selectedRows():
row = index.row()
deleted_tool_dia_list.append(float(self.e_ui.tools_table_exc.item(row, 1).text()))
@@ -2803,11 +2804,7 @@ class AppExcEditor(QtCore.QObject):
def update_options(obj):
try:
if not obj.options:
obj.options = {}
obj.options['xmin'] = 0
obj.options['ymin'] = 0
obj.options['xmax'] = 0
obj.options['ymax'] = 0
obj.options = {'xmin': 0, 'ymin': 0, 'xmax': 0, 'ymax': 0}
return True
else:
return False
@@ -3229,7 +3226,8 @@ class AppExcEditor(QtCore.QObject):
# if the row to be selected is not already in the selected rows then select it
# otherwise don't do it as it seems that we have a toggle effect
if row_to_sel not in set(index.row() for index in self.e_ui.tools_table_exc.selectedIndexes()):
if row_to_sel not in set(
index.row() for index in self.e_ui.tools_table_exc.selectedIndexes()):
self.e_ui.tools_table_exc.selectRow(row_to_sel)
self.last_tool_selected = int(key_tool_nr)

View File

@@ -1266,7 +1266,7 @@ class TransformEditorTool(AppTool):
"""
Rotate geometry
:param num: Rotate with a known angle value, val
:param val: Rotate with a known angle value, val
:param point: Reference point for rotation: tuple
:return:
"""
@@ -1326,6 +1326,7 @@ class TransformEditorTool(AppTool):
"""
Skew geometry
:param point:
:param axis: Axis on which to deform, skew
:param xval: Skew value on X axis
:param yval: Skew value on Y axis
@@ -1888,7 +1889,8 @@ class DrawTool(object):
def utility_geometry(self, data=None):
return None
def bounds(self, obj):
@staticmethod
def bounds(obj):
def bounds_rec(o):
if type(o) is list:
minx = np.Inf
@@ -3688,7 +3690,6 @@ class AppGeoEditor(QtCore.QObject):
self.clear()
self.app.ui.geo_edit_toolbar.setDisabled(True)
settings = QSettings("Open Source", "FlatCAM")
self.app.ui.corner_snap_btn.setVisible(False)
self.app.ui.snap_magnet.setVisible(False)

View File

@@ -815,9 +815,7 @@ class FCPoligonize(FCShapeTool):
except KeyError:
self.draw_app.on_aperture_add(apcode='0')
current_storage = self.draw_app.storage_dict['0']['geometry']
new_el = {}
new_el['solid'] = geo
new_el['follow'] = geo.exterior
new_el = {'solid': geo, 'follow': geo.exterior}
self.draw_app.on_grb_shape_complete(current_storage, specific_shape=DrawToolShape(deepcopy(new_el)))
else:
# clean-up the geo
@@ -830,9 +828,7 @@ class FCPoligonize(FCShapeTool):
self.draw_app.on_aperture_add(apcode='0')
current_storage = self.draw_app.storage_dict['0']['geometry']
new_el = {}
new_el['solid'] = fused_geo
new_el['follow'] = fused_geo.exterior
new_el = {'solid': fused_geo, 'follow': fused_geo.exterior}
self.draw_app.on_grb_shape_complete(current_storage, specific_shape=DrawToolShape(deepcopy(new_el)))
self.draw_app.delete_selected()
@@ -840,8 +836,7 @@ class FCPoligonize(FCShapeTool):
self.draw_app.in_action = False
self.complete = True
self.draw_app.app.inform.emit('[success] %s' %
_("Done. Poligonize completed."))
self.draw_app.app.inform.emit('[success] %s' % _("Done. Poligonize completed."))
# MS: always return to the Select Tool if modifier key is not pressed
# else return to the current tool
@@ -1052,12 +1047,11 @@ class FCRegion(FCShapeTool):
self.temp_points.append(self.inter_point)
self.temp_points.append(data)
new_geo_el = {}
new_geo_el['solid'] = LinearRing(self.temp_points).buffer(self.buf_val,
resolution=int(self.steps_per_circle / 4),
join_style=1)
new_geo_el['follow'] = LinearRing(self.temp_points)
new_geo_el = {
'solid': LinearRing(self.temp_points).buffer(self.buf_val,
resolution=int(self.steps_per_circle / 4),
join_style=1),
'follow': LinearRing(self.temp_points)}
return DrawToolUtilityShape(new_geo_el)
@@ -1073,12 +1067,11 @@ class FCRegion(FCShapeTool):
else:
self.draw_app.last_aperture_selected = '0'
new_geo_el = {}
new_geo_el['solid'] = Polygon(self.points).buffer(self.buf_val,
resolution=int(self.steps_per_circle / 4),
join_style=2)
new_geo_el['follow'] = Polygon(self.points).exterior
new_geo_el = {
'solid': Polygon(self.points).buffer(self.buf_val,
resolution=int(self.steps_per_circle / 4),
join_style=2), 'follow': Polygon(self.points).exterior
}
self.geometry = DrawToolShape(new_geo_el)
self.draw_app.in_action = False
@@ -2106,8 +2099,7 @@ class FCApertureMove(FCShapeTool):
geo_list.append(deepcopy(new_geo_el))
return DrawToolUtilityShape(geo_list)
else:
ss_el = {}
ss_el['solid'] = affinity.translate(self.selection_shape, xoff=dx, yoff=dy)
ss_el = {'solid': affinity.translate(self.selection_shape, xoff=dx, yoff=dy)}
return DrawToolUtilityShape(ss_el)
@@ -3971,7 +3963,6 @@ class AppGerberEditor(QtCore.QObject):
else:
self.conversion_factor = 0.0393700787401575
# Hide original geometry
orig_grb_obj.visible = False
@@ -4237,11 +4228,7 @@ class AppGerberEditor(QtCore.QObject):
def update_options(obj):
try:
if not obj.options:
obj.options = {}
obj.options['xmin'] = 0
obj.options['ymin'] = 0
obj.options['xmax'] = 0
obj.options['ymax'] = 0
obj.options = {'xmin': 0, 'ymin': 0, 'xmax': 0, 'ymax': 0}
return True
else:
return False
@@ -5960,7 +5947,7 @@ class TransformEditorTool(AppTool):
"""
Rotate geometry
:param num: Rotate with a known angle value, val
:param val: Rotate with a known angle value, val
:param point: Reference point for rotation: tuple
:return:
"""
@@ -5969,7 +5956,7 @@ class TransformEditorTool(AppTool):
px, py = point
if not elem_list:
self.app.inform.emit('[WARNING_NOTCL] %s' %_("No shape selected."))
self.app.inform.emit('[WARNING_NOTCL] %s' % _("No shape selected."))
return
with self.app.proc_container.new(_("Appying Rotate")):
@@ -6297,6 +6284,7 @@ class TransformEditorTool(AppTool):
return bounds_rec(shapelist)
def get_shapely_list_bounds(geometry_list):
xmin = np.Inf
ymin = np.Inf