Skip to content

Commit

Permalink
fix: should wait template in paddock scene
Browse files Browse the repository at this point in the history
  • Loading branch information
NateScarlet committed Sep 9, 2021
1 parent 0dc8cc0 commit cd10e97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion auto_derby/scenes/paddock.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def choose_runing_style(self, style: RuningStyle):
RuningStyle.MIDDLE: rp.vector2((160, 500), 466),
RuningStyle.LAST: rp.vector2((60, 500), 466),
}[style]
action.tap_image(templates.RACE_RUNNING_STYLE_CHANGE_BUTTON)
action.wait_tap_image(templates.RACE_RUNNING_STYLE_CHANGE_BUTTON)
_, pos = action.wait_image(templates.RACE_CONFIRM_BUTTON)
time.sleep(0.5)
action.tap(button_pos)
Expand Down

5 comments on commit cd10e97

@CNA-Bld
Copy link
Contributor

@CNA-Bld CNA-Bld commented on cd10e97 Sep 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is not required either as _enter() already waited for it... But no harm either ¯_(ツ)_/¯

@NateScarlet
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_enter is not called by choose_running_style, this two method has no guaranteed order

@CNA-Bld
Copy link
Contributor

@CNA-Bld CNA-Bld commented on cd10e97 Sep 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait what does

scene = PaddockScene.enter(ctx)
do then? I am not seeing async operations around this?

@NateScarlet
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a public method, not only for one specific line.

  1. _enter will not be called if ctx.scene.name() == "paddock"
  2. user may paused script between _enter and choose_running_style and forgot to close the menu

@CNA-Bld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK thanks.

I don't think 1) will ever happen, and 2) is some sort of racing between the user and the script which is impossible to fix anyway. But yes this is an improvement.

Please sign in to comment.