Draft: Simplify using getattr instead of hasattr
Using the default argument supported by getattr makes this code a bit simpler and probably (ever so slightly) faster. See https://forum.freecadweb.org/viewtopic.php?f=10&t=58611 for previous discussion. This is not an exhaustive change, these are just a few I encounted while working with the code.
This commit is contained in:
@@ -184,9 +184,8 @@ class Shape2DView(DraftObject):
|
||||
return nedges
|
||||
|
||||
def execute(self,obj):
|
||||
if hasattr(obj,"AutoUpdate"):
|
||||
if not obj.AutoUpdate:
|
||||
return True
|
||||
if not getattr(obj,"AutoUpdate", True):
|
||||
return True
|
||||
import Part, DraftGeomUtils
|
||||
obj.positionBySupport()
|
||||
pl = obj.Placement
|
||||
@@ -215,7 +214,7 @@ class Shape2DView(DraftObject):
|
||||
if getattr(obj,"VisibleOnly",True):
|
||||
objs = gui_utils.remove_hidden(objs)
|
||||
shapes = []
|
||||
if hasattr(obj,"FuseArch") and obj.FuseArch:
|
||||
if getattr(obj,"FuseArch", False):
|
||||
shtypes = {}
|
||||
for o in objs:
|
||||
if utils.get_type(o) in ["Wall","Structure"]:
|
||||
|
||||
Reference in New Issue
Block a user