Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue With Widget Player Updating Text Widget Color #1511

Open
seanirby opened this issue Apr 6, 2020 · 4 comments
Open

Issue With Widget Player Updating Text Widget Color #1511

seanirby opened this issue Apr 6, 2020 · 4 comments

Comments

@seanirby
Copy link
Member

seanirby commented Apr 6, 2020

I've got a collection of text widgets on my main slide[0] that represent the available game modes(songs) that can be selected. Only one can be selected at a time, and I want the currently selected mode to show up as a different color on the display. To do this I'm using a widget_player[1] that responds to events that get fired in the mode code[2]

I've verified that all the correct events are getting posted but for some reason the text color in the display never updates. Mind taking a look to see if you can reproduce? I've tried this on both the release and latest dev code.

Repro steps:

  1. Copy my game code:
    git clone https://github.com/seanirby/G1Pinball

  2. Navigate to the machine and run mpf both -xt

  3. Start mpf monitor in another process mpf monitor

  4. Start a game by spoofing events with some keypresses:

  • Press 't' to put a ball in the trough
  • Press 's' to start a game
  • Press 't' to release a ball into the shooter lane
  • Press and hold 'p' for a second to simulate a plunge
  • Press 'r' to activate the playfield
  1. So now a game has started, and for repro purposes its been set up so a mode is already qualified and selected. The mode 'Girl U Want' is selected by default and it should show up as white in the display because the event song_select_2_status_selected was posted. You can use the monitor playfield to hit the left and right switches on the center bash target to change the selected mode but this doesn't have any effect on the display either.

[0] - https://github.com/seanirby/G1Pinball/blob/master/modes/base/config/base.yaml#L40-L45
[1] - https://github.com/seanirby/G1Pinball/blob/master/modes/song_select/config/widgets.yaml
[2] - https://github.com/seanirby/G1Pinball/blob/master/modes/song_select/code/song_select.py#L93-L108

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Apr 6, 2020

Hi Sean,

thanks for the nice reproduction setup. Worked flawless for me. The issue here is a bit tricky: Slides and widgets are scoped per context (i.e. a mode or inside a show). In this case the mode "song_select" tries to update the widget "song_select.song_select_3_song_widget" but you actually want "base.song_select_3_song_widget" (those are the internal names of the widgets). I see that this i non-obvious but it has technical reasons. For instance we want to remove all widgets belonging to a mode when a mode ends and similar things. The fix your your issue is to move the widget player from "song_select" to "base". With that change it works fine for me. Tough the contrast of white vs gray is not very strong - I suggest a different color :-).

Jan

@seanirby
Copy link
Member Author

seanirby commented Apr 6, 2020

That makes sense. Thanks for trying it out and the quick response! Looks like moving the widget player to the base config does not work for me. What system are you on? I've been trying this out on Windows 10 but I might use this opportunity to set up a linux environment for testing.

@seanirby
Copy link
Member Author

seanirby commented Apr 6, 2020

OK I see now. The difference in color is very faint but it's there. This threw me off because I've set text to white before and it has shown up much bolder than it is here.

It looks some styles are maybe getting overwritten when calling my original update action.. If I specify the opacity and z order in the update action it looks more like how I'd expect:

  song_select_2_status_selected:
    song_select_2_song_widget:
      action: update
      widget_settings:
        color: white
        opacity: 100
        z: 100

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Apr 12, 2020

So the issue is that action: update resets settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants