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

Look into supporting the Kivy Inspector #401

Open
seanirby opened this issue Apr 20, 2020 · 3 comments
Open

Look into supporting the Kivy Inspector #401

seanirby opened this issue Apr 20, 2020 · 3 comments

Comments

@seanirby
Copy link
Member

seanirby commented Apr 20, 2020

Kivy has an inspector that may be worth including in mpf-mc. I followed their example here and was able to get it somewhat working but it looks like it only picks up children in the widget tree down to the DisplayOutput. I wonder if we're doing something in DisplayOutput that prevents it from recognizing the widgets it contains.

If you'd like to try it out you can update MpfMc.displays_initialized to the following:

    def displays_initialized(self, *args):
        del args
        self.validate_machine_config_section('window')
        from mpfmc.uix.window import Window
        Window.initialize(self)
        ### add these lines
        from kivy.core.window import Window as KivyWindow
        from kivy.modules import inspector
        inspector.create_inspector(KivyWindow, self)
        self.events.post('displays_initialized')

Once your game is running you can press Ctrl-E to toggle the inspector.

Example
https://ibb.co/T4Shjjy

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Apr 20, 2020

Wow that is cool. We probably do something different. I guess this is worth exploring.

Jan

@seanirby
Copy link
Member Author

So the issue is that Kivy's inspector is looking for a list of children on each widget in the widget tree. DisplayOutput explicity doesn't add children.

I put together a proof of concept here by updating the DisplayOutput class to manage its own children list. It works but I'm not sure if this is safe to do. If you want to try it out I've got the changes on this branch:
https://github.com/seanirby/mpf-mc/tree/kivy-inspector

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Apr 21, 2020

The reason for that is that a display can be attached to multiple display widgets. That is a concept which is missing in kivy. However, I don't think this would hurt. I will try that in my machine later as I use that feature

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

No branches or pull requests

2 participants