- more PEP8 cleanup

This commit is contained in:
Marius Stanciu 2019-05-30 21:15:09 +03:00
parent 8ee516ec14
commit b7023d8ef6
3 changed files with 18 additions and 24 deletions

View File

@ -3036,6 +3036,9 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.old_pp_state = ''
self.old_toolchangeg_state = ''
# store here the default data for Geometry Data
self.default_data = {}
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
@ -3394,11 +3397,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
try:
# works for CheckBoxes
self.ui.grid3.itemAt(i).widget().stateChanged.connect(self.gui_form_to_storage)
except:
except Exception as e:
# works for ComboBoxes
try:
self.ui.grid3.itemAt(i).widget().currentIndexChanged.connect(self.gui_form_to_storage)
except:
except Exception as e2:
# works for Entry
try:
self.ui.grid3.itemAt(i).widget().editingFinished.connect(self.gui_form_to_storage)
@ -3495,13 +3498,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
def on_tool_add(self, dia=None):
self.ui_disconnect()
last_offset = None
last_offset_value = None
last_type = None
last_tool_type = None
last_data = None
last_solid_geometry = []
# if a Tool diameter entered is a char instead a number the final message of Tool adding is changed
# because the Default value for Tool is used.
change_message = False
@ -3550,7 +3546,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.tools.update({
self.tooluid: {
'tooldia': tooldia,
'offset': ('Path'),
'offset': 'Path',
'offset_value': 0.0,
'type': _('Rough'),
'tool_type': 'C1',
@ -3559,7 +3555,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
}
})
else:
# print("LAST", self.tools[maxuid])
last_data = self.tools[max_uid]['data']
last_offset = self.tools[max_uid]['offset']
last_offset_value = self.tools[max_uid]['offset_value']
@ -3583,7 +3578,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
'solid_geometry': deepcopy(last_solid_geometry)
}
})
# print("CURRENT", self.tools[-1])
self.ui.tool_offset_entry.hide()
self.ui.tool_offset_lbl.hide()

View File

@ -20,9 +20,9 @@ from PyQt5.QtCore import Qt
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@ -526,8 +526,8 @@ class ObjectCollection(QtCore.QAbstractItemModel):
ymin = min([ymin, gymin])
xmax = max([xmax, gxmax])
ymax = max([ymax, gymax])
except:
FlatCAMApp.App.log.warning("DEV WARNING: Tried to get bounds of empty geometry.")
except Exception as e:
FlatCAMApp.App.log.warning("DEV WARNING: Tried to get bounds of empty geometry. %s" % str(e))
return [xmin, ymin, xmax, ymax]
@ -537,12 +537,12 @@ class ObjectCollection(QtCore.QAbstractItemModel):
:param name: The name of the object.
:type name: str
:param isCaseSensitive: whether searching of the object is done by name where the name is case sensitive
:return: The requested object or None if no such object.
:rtype: FlatCAMObj or None
"""
FlatCAMApp.App.log.debug(str(inspect.stack()[1][3]) + "--> OC.get_by_name()")
if isCaseSensitive is None or isCaseSensitive is True:
for obj in self.get_list():
if obj.options['name'] == name:
@ -570,10 +570,9 @@ class ObjectCollection(QtCore.QAbstractItemModel):
self.app.myKeywords.remove(name)
self.app.shell._edit.set_model_data(self.app.myKeywords)
self.app.ui.code_editor.set_model_data(self.app.myKeywords)
except:
except Exception as e:
log.debug(
"delete_active() --> Could not remove the old object name from auto-completer model list")
"delete_active() --> Could not remove the old object name from auto-completer model list. %s" % str(e))
self.beginRemoveRows(self.index(group.row(), 0, QtCore.QModelIndex()), active.row(), active.row())
@ -650,12 +649,12 @@ class ObjectCollection(QtCore.QAbstractItemModel):
:return: List of objects
"""
l = self.get_list()
obj_list = self.get_list()
for sel in self.get_selected():
l.remove(sel)
obj_list.remove(sel)
return l
return obj_list
def set_active(self, name):
"""
@ -732,8 +731,8 @@ class ObjectCollection(QtCore.QAbstractItemModel):
self.app.inform.emit('')
try:
self.app.ui.selected_scroll_area.takeWidget()
except:
FlatCAMApp.App.log.debug("Nothing to remove")
except Exception as e:
FlatCAMApp.App.log.debug("Nothing to remove. %s" % str(e))
self.app.setup_component_editor()
return

View File

@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing.
- solved issue #292 where a new geometry renamed with many underscores failed to store the name in a saved project
- the name for the saved projects are updated to the current time and not to the time of the app startup
- some PEP8 changes related to comments starting with only one '#' symbol
- more PEP8 cleanup
24.05.2019