Do not break lines on empty callbacks

Boxes.cc() did move the coordinate system arround even if the callback is
None. This breaks the continuity of the border. If there is callback the
line is still broken.
This commit is contained in:
Florian Festi 2016-10-25 19:31:15 +02:00
parent 33d11487de
commit 44b55029a0
1 changed files with 13 additions and 16 deletions

View File

@ -430,26 +430,23 @@ class Boxes:
"""
if y is None:
y = self.burn
self.ctx.save()
self.moveTo(x, y)
if callable(callback):
if hasattr(callback, '__getitem__'):
try:
callback = callback[number]
number = None
except (KeyError, IndexError):
pass
if callback and callable(callback):
self.ctx.save()
self.moveTo(x, y)
if number is None:
callback()
else:
callback(number)
elif hasattr(callback, '__getitem__'):
try:
callback = callback[number]
if callable(callback):
callback()
except (KeyError, IndexError):
pass
except:
self.ctx.restore()
raise
self.ctx.restore()
self.ctx.restore()
self.ctx.move_to(0, 0)
def getEntry(self, param, idx):
"""