Update attributeManager.py

This commit is contained in:
chrys87 2018-05-29 10:54:22 +02:00 committed by GitHub
parent 3bffb8b80c
commit fc3b7956a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,23 +103,18 @@ class attributeManager():
'default' # fontfamily 'default' # fontfamily
)) #end attribute )) #end attribute
def isDefaultAttribute(self,attribute): def isDefaultAttribute(self,attribute):
useAttribute = None return attribute in self.defaultAttributes
if not attribute:
useAttribute = self.currAttributes
else:
useAttribute = attribute
return useAttribute in self.defaultAttributes
def hasAttributes(self, cursor, update=True): def hasAttributes(self, cursor, update=True):
if not cursor: if not cursor:
return False return False
cursorPos = cursor.copy() cursorPos = cursor.copy()
try: try:
attributes = self.getAttributeByXY( cursorPos['x'], cursorPos['y']) attribute = self.getAttributeByXY( cursorPos['x'], cursorPos['y'])
if self.isDefaultAttribute(attributes): if self.isDefaultAttribute(attribute):
return False return False
if update: if update:
self.setLastCursorAttribute(attributes) self.setLastCursorAttribute(attribute)
if not self.isLastCursorAttributeChange(): if not self.isLastCursorAttributeChange():
return False return False
except Exception as e: except Exception as e: