Example #1
0
    def __init__(self, boy, *args, **kwargs):
        super(BaseModule, self).__init__()

        if not hasattr(self, 'GPIO_LED_ID'):
            self.gpio_led_id = None

        if config.gpioAvailable() and self.gpio_led_id:
            self.led = LED(self.gpio_led_id)
            self.led.on()
        else:
            self.led = None

        self.pypboy = boy
        self.position = (0, 40)

        self.footer = pypboy.ui.Footer()
        self.footer.menu = []
        for mod in self.submodules:
            self.footer.menu.append(mod.label)
        self.footer.selected = self.footer.menu[0]
        self.footer.position = (0, user_config['video']['height'].get() - 53
                                )  # 80
        self.add(self.footer)

        self.current_module = 0
        self.switch_submodule(self.current_module)

        self.action_handlers = {
            "pause": self.handle_pause,
            "resume": self.handle_resume
        }
        if user_config['audio']['enabled'].get():
            self.module_change_sfx = pygame.mixer.Sound(
                'sounds/module_change.ogg')
Example #2
0
    def __init__(self, *args, **kwargs):
        if hasattr(config, 'OUTPUT_WIDTH') and hasattr(config,
                                                       'OUTPUT_HEIGHT'):
            self.rescale = True
        super(Pypboy, self).__init__(*args, **kwargs)
        self.init_children()
        self.init_modules()

        self.gpio_buttons = {}
        self.rotary_control = None
        self.rotary_mode = 0
        if config.gpioAvailable():
            self.init_gpio_controls()
Example #3
0
import pygame
import game
import pypboy.ui
import config
from config import user_config

if config.gpioAvailable():
    from gpiozero import LED


class BaseModule(game.EntityGroup):

    submodules = []

    def __init__(self, boy, *args, **kwargs):
        super(BaseModule, self).__init__()

        if not hasattr(self, 'GPIO_LED_ID'):
            self.gpio_led_id = None

        if config.gpioAvailable() and self.gpio_led_id:
            self.led = LED(self.gpio_led_id)
            self.led.on()
        else:
            self.led = None

        self.pypboy = boy
        self.position = (0, 40)

        self.footer = pypboy.ui.Footer()
        self.footer.menu = []