Skip to content

Commit 7482da6

Browse files
committed
always run setup() even if no draw() is defined
1 parent c3dd162 commit 7482da6

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

plotdevice/gui/document.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ def runScript(self):
363363
if self.vm.vars:
364364
self.dashboardController.buildInterface(self.vm.vars)
365365

366+
# Run the setup routine (if it exists)
367+
if success:
368+
success = self.invoke("setup")
369+
366370
if not success or not self.vm.animated:
367371
# halt the progress indicator if we crashed (or if we succeeded in a non-anim)
368372
self.statusView.endRun()
@@ -376,10 +380,6 @@ def runScript(self):
376380

377381
# Check whether we are dealing with animation
378382
if self.vm.animated:
379-
380-
# Run setup routine
381-
self.invoke("setup")
382-
383383
if not self.vm.crashed:
384384
# calling speed(0) just draws the first frame, so bail out before repeating
385385
if self.vm.speed<=0:
@@ -392,7 +392,6 @@ def runScript(self):
392392
# Start the timer
393393
self.animationTimer = set_timeout(self, 'step', 1.0/self.vm.speed, repeat=True)
394394

395-
396395
def step(self):
397396
"""Keep calling the script's draw method until an error occurs or the animation complete."""
398397
ok = self.invoke("draw")

0 commit comments

Comments
 (0)