Skip to content

Commit

Permalink
MNT: single call to runJavaScript('tourxml;')
Browse files Browse the repository at this point in the history
  • Loading branch information
dhomeier committed May 20, 2022
1 parent 7783e4a commit 5774409
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions glue_wwt/viewer/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,14 @@ def activate(self):

self.viewer._wwt.widget.page.runJavaScript(SAVE_TOUR_CODE)

start = time.time()
tourxml = None
while time.time() - start < 10:
time.sleep(0.1)
app.processEvents()
tourxml = self.viewer._wwt.widget.page.runJavaScript('tourxml;')
if tourxml:
break
time.sleep(1)
app.processEvents()
time.sleep(1)
tourxml = self.viewer._wwt.widget.page.runJavaScript('tourxml;')

if not tourxml:
raise Exception("Failed to save tour")
raise ChildProcessError(f"Failed to save tour: {tourxml}")

# Patch the altUnit so that it is correct for the Windows client (since
# the web client currently has other bugs with relation to loading tours).
Expand Down

0 comments on commit 5774409

Please sign in to comment.