Ejemplo n.º 1
0
    def __init__(self, parent, index):
        self.index = index
        if index:
            self.key = Option.SECONDARY_JOYSTICK
        else:
            self.key = Option.PRIMARY_JOYSTICK

        fsui.Group.__init__(self, parent)
        self.layout = fsui.HorizontalLayout()

        devices = ["", get_keyboard_title()]
        # for i, name in enumerate(DeviceManager.get_joystick_names()):
        #     devices.append(name)
        for device_name in DeviceManager.get_joystick_names():
            if DeviceManager.is_joystick(device_name):
                devices.append(device_name)

        self.device_choice = fsui.ComboBox(self, devices)

        self.layout.add(self.device_choice, expand=True)

        # Config.add_listener(self)

        self.initialize_from_settings()
        self.set_settings_handlers()
Ejemplo n.º 2
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("joystick-settings", "pkg:workspace")
        # gettext("Joystick Settings")
        title = gettext("Controllers")
        subtitle = gettext(
            "Configure joysticks and set preferred joystick " "devices"
        )
        self.add_header(icon, title, subtitle)

        label = fsui.Label(
            self, gettext("Double-click a controller to configure it:")
        )
        self.layout.add(label, margin_bottom=10)

        self.list_view = fsui.ListView(self)
        self.list_view.set_min_height(140)
        self.list_view.item_activated.connect(self.on_joystick_activated)
        image = fsui.Image("workspace:res/16x16/gamepad.png")
        for device_name in DeviceManager.get_joystick_names():
            if DeviceManager.is_joystick(device_name):
                self.list_view.add_item(device_name, icon=image)
        self.layout.add(self.list_view, fill=True, expand=True)

        self.layout.add_spacer(20)
        self.pref_group = PreferredJoysticksGroup(self)
        self.layout.add(self.pref_group, fill=True)

        # For reset to defaults function
        self.options_on_page.add(Option.PRIMARY_JOYSTICK)
        self.options_on_page.add(Option.SECONDARY_JOYSTICK)