Example #1
0
 def _load_clock(self) -> ClockBase:  # pragma: no cover
     """Load clock and loop."""
     clock = ClockBase(self)
     clock.loop.set_exception_handler(self._exception_handler)
     return clock
Example #2
0
    def __init__(self, mpf_path, machine_path, args, **kwargs):

        super().__init__(**kwargs)

        self.config_validator = ConfigValidator(self)
        self.mpf_config_processor = MpfConfigProcessor()
        files = [
            os.path.join(mpfmc.__path__[0],
                         'tools/interactive_mc/imcconfig.yaml')
        ]
        self.machine_config = self.mpf_config_processor.load_config_files_with_cache(
            files, "machine")
        self.machine_config['mpf'] = dict()
        self.machine_config['mpf']['allow_invalid_config_sections'] = True
        self.config = self.machine_config
        self._initialized = False
        self.options = dict(bcp=True)
        self.clock = ClockBase(self)

        self.events = EventManager(self)
        self.mode_controller = ModeController(self)
        self.bcp = Bcp(self)
        self.slide_player = MpfSlidePlayer(self)
        self.slide_player.instances['imc'] = dict()

        self.events.post("init_phase_1")
        self.events.process_event_queue()
        self.events.post("init_phase_2")
        self.events.process_event_queue()
        self.events.post("init_phase_3")
        self.events.process_event_queue()
        self.events.post("init_phase_4")
        self.events.process_event_queue()
        self.events.post("init_phase_5")

        self.sm = ScreenManager()
        self.slide_screen = Screen(name="Slide Player")
        self.widget_screen = Screen(name="Widget Player")
        self.sm.add_widget(self.slide_screen)
        self.sm.add_widget(self.widget_screen)
        self.slide_player_code = YamlCodeInput(lexer=YamlLexer(), tab_width=4)
        self.slide_player_code.bind(on_triple_tap=self.send_slide_to_mc)

        self.slide_player_code.text = '''my_test_slide:
    widgets:
      - type: text
        text: iMC
        color: red
      - type: line
        points: 1, 1, 1, 32, 128, 32, 128, 1, 1, 1
        color: lime
      - type: rectangle
        width: 50
        height: 20
        color: yellow
'''

        self.send_button = Button(text='Send',
                                  size=(150, 60),
                                  size_hint=(None, None),
                                  background_normal='',
                                  background_color=(0, .6, 0, 1),
                                  pos=(0, 1),
                                  pos_hint={
                                      'top': 0.1,
                                      'right': 0.95
                                  })

        self.send_button.bind(on_press=self.send_slide_to_mc)

        self.slide_screen.add_widget(self.slide_player_code)
        self.slide_screen.add_widget(self.send_button)

        self.slide_player.register_player_events(dict())