()
| 92 | |
| 93 | # The advance function will be called every 50ms, to move to the next action |
| 94 | def advance(): |
| 95 | global out, window, curact, actions, loopcount |
| 96 | |
| 97 | # Move to the current action |
| 98 | controller.SetFrameEvent(curact.eventId, False) |
| 99 | |
| 100 | # Initialise a default TextureDisplay object |
| 101 | disp = rd.TextureDisplay() |
| 102 | |
| 103 | # Set the first colour output as the texture to display |
| 104 | disp.resourceId = curact.outputs[0] |
| 105 | |
| 106 | if disp.resourceId != rd.ResourceId.Null(): |
| 107 | # Get the details of this texture |
| 108 | texDetails = getTexture(disp.resourceId) |
| 109 | |
| 110 | # Calculate the scale required in width and height |
| 111 | widthScale = window.winfo_width() / texDetails.width |
| 112 | heightScale = window.winfo_height() / texDetails.height |
| 113 | |
| 114 | # Use the lower scale to fit the texture on the window |
| 115 | disp.scale = min(widthScale, heightScale) |
| 116 | |
| 117 | # Update the texture display |
| 118 | out.SetTextureDisplay(disp) |
| 119 | |
| 120 | # Set the next action |
| 121 | curact = curact.next |
| 122 | |
| 123 | # If we have no next action, start again from the first |
| 124 | if curact is None: |
| 125 | loopcount = loopcount + 1 |
| 126 | curact = actions[0] |
| 127 | |
| 128 | # after 3 loops, quit |
| 129 | if loopcount == 3: |
| 130 | window.quit() |
| 131 | else: |
| 132 | window.after(50, advance) |
| 133 | |
| 134 | # Start the callbacks |
| 135 | advance() |
no test coverage detected