|
|
|
@ -641,6 +641,44 @@ class TechDrawExtensions:
|
|
|
|
|
callback() |
|
|
|
|
QTimer.singleShot(10, restoreKeepUpdated) |
|
|
|
|
|
|
|
|
|
def refreshOverlays(self, page, callback = None): |
|
|
|
|
if page.KeepUpdated: |
|
|
|
|
callback() |
|
|
|
|
else: |
|
|
|
|
page.KeepUpdated = True |
|
|
|
|
def restoreKeepUpdated(): |
|
|
|
|
for view in page.Views: |
|
|
|
|
if view.TypeId == 'TechDraw::DrawViewPart': |
|
|
|
|
if view.Name.endswith('_overlay'): |
|
|
|
|
view.touch() |
|
|
|
|
view.recompute() |
|
|
|
|
for sub_view in page.Views: |
|
|
|
|
try: |
|
|
|
|
if sub_view.SourceView == view: |
|
|
|
|
sub_view.recompute() |
|
|
|
|
except: |
|
|
|
|
pass |
|
|
|
|
page.KeepUpdated = False |
|
|
|
|
|
|
|
|
|
for view in page.Views: |
|
|
|
|
if view.TypeId == 'TechDraw::DrawViewBalloon': |
|
|
|
|
if view.ViewObject.Visibility: |
|
|
|
|
# workaround for a TechDraw bug: sometimes the balloon should be visible but doesn't appear, showing it again fixes the issue |
|
|
|
|
view.ViewObject.Visibility = False |
|
|
|
|
def makeRedrawCallback(view): |
|
|
|
|
def redrawBalloon(): |
|
|
|
|
view.ViewObject.Visibility = True |
|
|
|
|
return redrawBalloon |
|
|
|
|
QTimer.singleShot(0, makeRedrawCallback(view)) |
|
|
|
|
else: |
|
|
|
|
# workaround for a TechDraw bug: sometimes the balloon text is visible even if the balloon is hidden, hiding it again fixes the issue |
|
|
|
|
view.ViewObject.Visibility = True |
|
|
|
|
view.ViewObject.Visibility = False |
|
|
|
|
|
|
|
|
|
if callback is not None: |
|
|
|
|
callback() |
|
|
|
|
QTimer.singleShot(10, restoreKeepUpdated) |
|
|
|
|
|
|
|
|
|
def getSourceView(self, view): |
|
|
|
|
if view.Name.endswith('_overlay'): |
|
|
|
|
view = view.Document.getObject(view.Name[0:-8]) |
|
|
|
|