def load_game_variant(self, variant_uuid):
        # game_database = fsgs.get_game_database()
        # values = game_database.get_game_values_for_uuid(variant_uuid)

        from .Database import Database
        database = Database.instance()
        try:
            database_name = database.find_game_database_for_game_variant(
                variant_uuid)
        except LookupError:
            return False

        values = self.game.set_from_variant_uuid(database_name, variant_uuid)
        if not values:
            return False

        # print("")
        # for key in sorted(values.keys()):
        #     print(" * {0} = {1}".format(key, values[key]))
        # print("")

        from fsgs.platform import PlatformHandler
        platform_handler = PlatformHandler.create(self.game.platform.id)
        loader = platform_handler.get_loader(self)
        self.config.load(loader.load_values(values))
        return True
Esempio n. 2
0
    def create_context(self):
        item = self.items[0]
        variant_uuid = item.configurations[0][0]
        database_name = item.configurations[0][2]
        print("\nitem:\n", item.configurations)
        print("\nitem[0]:\n", item.configurations[0])
        print("\n\nvariant_uuid =", variant_uuid, "\n\n")

        # print("\n\ncreate_context")
        # print("configurations: ", item.configurations)
        # configs = sort_configurations(item.configurations)

        # configs = item.configurations
        # config = configs[0]
        # self.context = GameContext.create_for_game(
        #     item.platform, item.name, config)

        values = fsgs.game.set_from_variant_uuid(database_name, variant_uuid)

        # print("")
        # for key in sorted(values.keys()):
        #     print(" * {0} = {1}".format(key, values[key]))
        # print("")

        self.platform_handler = PlatformHandler.create(fsgs.game.platform.id)
        loader = self.platform_handler.get_loader(fsgs)
        fsgs.config.load(loader.load_values(values))
Esempio n. 3
0
    def load_game_variant(self, variant_uuid):
        # game_database = fsgs.get_game_database()
        # values = game_database.get_game_values_for_uuid(variant_uuid)

        from .Database import Database
        database = Database.instance()
        try:
            database_name = database.find_game_database_for_game_variant(
                variant_uuid)
        except LookupError:
            return False

        values = self.game.set_from_variant_uuid(database_name, variant_uuid)
        if not values:
            return False

        # print("")
        # for key in sorted(values.keys()):
        #     print(" * {0} = {1}".format(key, values[key]))
        # print("")

        from fsgs.platform import PlatformHandler
        platform_handler = PlatformHandler.create(self.game.platform.id)
        loader = platform_handler.get_loader(self)
        self.config.load(loader.load_values(values))
        return True
 def get_item_text(self, index):
     item = self.items[index]
     name = item[str("name")]
     platform = item[str("platform")] or ""
     if "[" in name:
         name, extra = name.split("[", 1)
         name = name.strip()
         extra = " \u00b7 " + extra.strip(" ]")
     else:
         extra = ""
     if fsui.toolkit == 'wx':
         sep = "\n"
     else:
         sep = " \u00b7 "
         name = name.replace("\n", " \u00b7 ")
     if platform == "Amiga":
         platform = ""
     elif platform:
         platform = sep + PlatformHandler.get_platform_name(platform)
         # if not extra:
         #     sep = ""
         # return "{0}{1}{2}{3}".format(name, sep, extra, "")
     # else:
     text = "{0}{1}{2}".format(name, extra, platform) or "Missing Name"
     return text
Esempio n. 5
0
    def create_context(self):
        item = self.items[0]
        variant_uuid = item.configurations[0][0]
        database_name = item.configurations[0][2]
        print("\nitem:\n", item.configurations)
        print("\nitem[0]:\n", item.configurations[0])
        print("\n\nvariant_uuid =", variant_uuid, "\n\n")

        # print("\n\ncreate_context")
        # print("configurations: ", item.configurations)
        # configs = sort_configurations(item.configurations)

        # configs = item.configurations
        # config = configs[0]
        # self.context = GameContext.create_for_game(
        #     item.platform, item.name, config)

        values = fsgs.game.set_from_variant_uuid(database_name, variant_uuid)

        # print("")
        # for key in sorted(values.keys()):
        #     print(" * {0} = {1}".format(key, values[key]))
        # print("")

        self.platform_handler = PlatformHandler.create(fsgs.game.platform.id)
        loader = self.platform_handler.get_loader(fsgs)
        fsgs.config.load(loader.load_values(values))
 def get_item_text(self, index):
     item = self.items[index]
     name = item[str("name")]
     platform = item[str("platform")] or ""
     if "[" in name:
         name, extra = name.split("[", 1)
         name = name.strip()
         extra = " \u00b7 " + extra.strip(" ]")
     else:
         extra = ""
     if fsui.toolkit == "wx":
         sep = "\n"
     else:
         sep = " \u00b7 "
         name = name.replace("\n", " \u00b7 ")
     if platform == "Amiga" and not openretro:
         platform = ""
     elif platform:
         platform = sep + PlatformHandler.get_platform_name(platform)
         # if not extra:
         #     sep = ""
         # return "{0}{1}{2}{3}".format(name, sep, extra, "")
     # else:
     text = "{0}{1}{2}".format(name, extra, platform) or "Missing Name"
     return text
Esempio n. 7
0
def show():
    global current_menu

    # fade_from is used on init_display, so we initialize this
    # color here. Set alpha to 2.0 to force 1 second of solid
    # color in combination with 2 sec. animation below
    if False and windows and not Settings.fullscreen_menu:
        State.get().fade_from = (1.0, 1.0, 1.0, 2.0)
        State.get().fade_to = (1.0, 1.0, 1.0, 0.0)
    else:
        State.get().fade_from = (0.0, 0.0, 0.0, 2.0)
        State.get().fade_to = (0.0, 0.0, 0.0, 0.0)
    init_display()
    if LIGHTING:
        init_lighting()
    init_textures()
    init_fonts()

    if USE_MENU_TRANSITIONS:
        compile_programs()

    InputHandler.open()

    on_resize((Render.get().display_width, Render.get().display_height))
    image_loader = ImageLoader.get()
    image_loader.start()
    new_menu = create_main_menu()
    State.get().history.append(new_menu)

    for platform_id in PlatformHandler.get_platform_ids():
        if "--" + platform_id in sys.argv:
            platform_menu = ItemMenu()
            platform_menu.parent_menu = new_menu

            platform_item = PlatformItem(platform_id)
            platform_menu.items.append(platform_item)
            # platform_menu.set_selected_index(0, immediate=True)

            new_menu = platform_item.activate(platform_menu)
            print(new_menu)
            State.get().history.append(new_menu)
            break

    set_current_menu(new_menu)
    if len(new_menu) == 1:
        # only n/a item showing, possibly
        if len(AllMenuItem().activate(None)) == 0:
            # no games, initiate game scan
            rescan_games()

    State.get().fade_start = get_current_time()
    State.get().fade_end = get_current_time() + 2.000

    # # make a timer so that update events are sent to modules at least once
    # # every second
    # pygame.time.set_timer(IDLE_EVENT, 1000)

    State.get().start_time = get_current_time()
Esempio n. 8
0
    def start_local_game_other(cls):
        if True:
            platform_id = LauncherConfig.get(Option.PLATFORM).lower()
            platform_handler = PlatformHandler.create(platform_id)
        else:
            database_name = LauncherConfig.get("__database")
            variant_uuid = LauncherConfig.get("variant_uuid")
            assert variant_uuid
            fsgs.game.set_from_variant_uuid(database_name, variant_uuid)
            platform_handler = PlatformHandler.create(fsgs.game.platform.id)

        runner = platform_handler.get_runner(fsgs)
        task = RunnerTask(runner)
        from .ui.launcherwindow import LauncherWindow
        dialog = LaunchDialog(LauncherWindow.current(),
                              gettext("Launching Game"), task)
        dialog.show()
        LauncherConfig.set("__running", "1")
        task.start()
Esempio n. 9
0
    def start(self):
        assert self.thread is None

        platform_handler = PlatformHandler.create(self.fsgs.game.platform.id)
        self.runner = platform_handler.get_runner(self.fsgs)

        device_helper = EnumerateHelper()
        device_helper.default_port_selection(self.runner.ports)

        self.thread = threading.Thread(target=self._thread)
        self.thread.start()
Esempio n. 10
0
    def start_local_game_other(cls):
        if True:
            platform_id = LauncherConfig.get(Option.PLATFORM).lower()
            platform_handler = PlatformHandler.create(platform_id)
        else:
            database_name = LauncherConfig.get("__database")
            variant_uuid = LauncherConfig.get("variant_uuid")
            assert variant_uuid
            fsgs.game.set_from_variant_uuid(database_name, variant_uuid)
            platform_handler = PlatformHandler.create(fsgs.game.platform.id)

        runner = platform_handler.get_runner(fsgs)
        task = RunnerTask(runner)
        from .ui.launcherwindow import LauncherWindow

        dialog = LaunchDialog(
            LauncherWindow.current(), gettext("Launching Game"), task
        )
        dialog.show()
        LauncherConfig.set("__running", "1")
        task.start()
Esempio n. 11
0
def render_bottom_bar_text(item):
    strength = 0.9
    x = 544
    y = 290

    title = item.title.upper()
    if title:
        Render.get().text(title, Font.title_font, x, y, 1920 - x - 170,
                          shadow=True, color=(1.0, 1.0, 1.0, 1.0 * strength))

    year_text = str(getattr(State.get().current_menu.selected_item,
                            "year", "") or "").upper()
    if year_text:
        tw, th = Render.get().measure_text(year_text, Font.title_font)
        Render.get().text(year_text, Font.title_font, 1920 - 30 - tw, y, 0,
                          shadow=True, color=(1.0, 1.0, 1.0, 1.0 * strength))

    color = (0x6e / 0xff, 0x8b / 0xff, 0x96 / 0xff, 1.0)
    y = 258
    text_str = ""
    companies = set()
    publisher_text = (getattr(State.get().current_menu.selected_item,
                              "publisher", "") or "").upper()
    for text in publisher_text.split("/"):
        text = text.strip()
        if text:
            if text not in companies:
                text_str = text_str + u" \u00b7 " + text
                companies.add(text)
    developer_text = (getattr(State.get().current_menu.selected_item,
                              "developer", "") or "").upper()
    for text in developer_text.split("/"):
        text = text.strip()
        if text:
            if text not in companies:
                text_str = text_str + u" \u00b7 " + text
                companies.add(text)
    if len(text_str) > 3:
        text_str = text_str[3:]  # remove initial middle dot
        Render.get().text(text_str, Font.subtitle_font, x, y, 0,
                          shadow=True, color=color)

    platform_str = str(
        getattr(State.get().current_menu.selected_item, "platform", "") or "")
    if platform_str:
        platform_str = PlatformHandler.get_platform_name(platform_str).upper()
    if len(platform_str) >= 3:
        tw, th = Render.get().measure_text(platform_str, Font.subtitle_font)
        Render.get().text(platform_str, Font.subtitle_font, 1920 - 30 - tw, y,
                          0,
                          shadow=True, color=color)
    return
Esempio n. 12
0
    def run_game(self):
        from fsgs.platform import PlatformHandler
        platform_handler = PlatformHandler.create(self.game.platform.id)
        runner = platform_handler.get_runner(self)

        from fsgs.input.enumeratehelper import EnumerateHelper
        device_helper = EnumerateHelper()
        device_helper.default_port_selection(runner.ports, runner.options)

        runner.prepare()
        process = runner.run()
        process.wait()
        runner.finish()
    def run_game(self):
        from fsgs.platform import PlatformHandler
        platform_handler = PlatformHandler.create(self.game.platform.id)
        runner = platform_handler.get_runner(self)

        from fsgs.input.enumeratehelper import EnumerateHelper
        device_helper = EnumerateHelper()
        device_helper.default_port_selection(runner.ports)

        runner.prepare()
        process = runner.run()
        process.wait()
        runner.finish()
Esempio n. 14
0
    def load_values(cls, values, uuid=""):
        # print("loading config values", values)
        platform_id = values.get("platform", "").lower()

        if platform_id in ["amiga", "cdtv", "cd32"]:
            value_config_loader = ValueConfigLoader(uuid=uuid)
            value_config_loader.load_values(values)
            config = value_config_loader.get_config()
            cls.load(config)
            values["__config_name"] = config.get("__config_name")
        else:
            print("Warning: Non-Amiga game loaded")
            platform_handler = PlatformHandler.create(platform_id)
            loader = platform_handler.get_loader(fsgs)
            fsgs.config.load(loader.load_values(values))
        cls.post_load_values(values)
Esempio n. 15
0
    def load_values(cls, values, uuid=""):
        print("loading config values", values)
        platform_id = values.get("platform", "").lower()

        if platform_id in ["amiga", "cdtv", "cd32"]:
            value_config_loader = ValueConfigLoader(uuid=uuid)
            value_config_loader.load_values(values)
            config = value_config_loader.get_config()
            cls.load(config)
            values["__config_name"] = config.get("__config_name")
        else:
            print("Warning: Non-Amiga game loaded")
            platform_handler = PlatformHandler.create(platform_id)
            loader = platform_handler.get_loader(fsgs)
            fsgs.config.load(loader.load_values(values))
        cls.post_load_values(values)
Esempio n. 16
0
    def get_platform_name(self):
        # FIXME: UNUSED? REMOVE?
        p = self.options[Option.PLATFORM].lower()
        # if p == "atari-7800":
        #     return "Atari 7800"
        # if p == "amiga":
        #     return "Amiga"
        # if p == "cdtv":
        #     return "CDTV"
        # if p == "cd32":
        #     return "CD32"
        # fsgs.platform.
        # return p
        from fsgs.platform import PlatformHandler

        return PlatformHandler.get_platform_name(p)
    def load_values(cls, values, uuid=""):
        print("loading config values", values)
        platform_id = values.get("platform", "").lower()

        if platform_id in ["amiga", "cdtv", "cd32"]:
            value_config_loader = ValueConfigLoader(uuid=uuid)
            value_config_loader.load_values(values)
            config = value_config_loader.get_config()
            cls.load(config)
            config_name = config.get("__config_name", "")

        else:
            print("Warning: Non-Amiga game loaded")
            platform_handler = PlatformHandler.create(platform_id)
            loader = platform_handler.get_loader(fsgs)
            fsgs.config.load(loader.load_values(values))
            config_name = "{0} ({1})".format(values.get("game_name"),
                                             values.get("platform_name"))

        LauncherSettings.set("config_path", "")

        # print("config is", config)
        # config["x_config_uuid"] = uuid

        if config_name:
            config_name = cls.create_fs_name(config_name)
        # else:
        #     config_name, ext = os.path.splitext(os.path.basename(path))

        if "(" in config_name:
            config_base = config_name.split("(")[0].strip()
        else:
            config_base = config_name
        # game = name

        # if not Config.get("title"):
        #     Config.set("title", config_base)

        LauncherSettings.set("config_base", config_base)
        LauncherSettings.set("config_name", config_name)
        LauncherSettings.set("config_xml_path", "")
        # Settings.set("config_changed", "0")
        cls.set("__changed", "0")
    def load_values(cls, values, uuid=""):
        print("loading config values", values)
        platform_id = values.get("platform", "").lower()

        if platform_id in ["amiga", "cdtv", "cd32"]:
            value_config_loader = ValueConfigLoader(uuid=uuid)
            value_config_loader.load_values(values)
            config = value_config_loader.get_config()
            cls.load(config)
            config_name = config.get("__config_name", "")

        else:
            print("Warning: Non-Amiga game loaded")
            platform_handler = PlatformHandler.create(platform_id)
            loader = platform_handler.get_loader(fsgs)
            fsgs.config.load(loader.load_values(values))
            config_name = "{0} ({1})".format(
                values.get("game_name"), values.get("platform_name"))

        LauncherSettings.set("config_path", "")

        # print("config is", config)
        # config["x_config_uuid"] = uuid

        if config_name:
            config_name = cls.create_fs_name(config_name)
        # else:
        #     config_name, ext = os.path.splitext(os.path.basename(path))

        if "(" in config_name:
            config_base = config_name.split("(")[0].strip()
        else:
            config_base = config_name
        # game = name

        # if not Config.get("title"):
        #     Config.set("title", config_base)

        LauncherSettings.set("config_base", config_base)
        LauncherSettings.set("config_name", config_name)
        LauncherSettings.set("config_xml_path", "")
        # Settings.set("config_changed", "0")
        cls.set("__changed", "0")
Esempio n. 19
0
 def __init__(self):
     PlatformHandler.__init__(self)
 def name(self):
     from .platform import PlatformHandler
     return PlatformHandler.get_platform_name(self._id)
Esempio n. 21
0
    def __init__(self, platform):
        AutoExpandItem.__init__(self)
        self._platform = platform
        # using self.platform for "description"

        # self.sort_title = ""
        # try:
        #    self.title, self.subtitle, self.sort_title = {
        #        "Amiga": (
        #            "Amiga",
        #            "Commodore Amiga",
        #            "Commodore 2"),
        #        "amstrad-cpc": (
        #            "Amstrad CPC",
        #            "Color Personal Computer",
        #            ""),
        #        "apple-II": (
        #            "Apple II",
        #            "II/Plus/e/c",
        #            ""),
        #        "arcade": (
        #            "Arcade Video Games",
        #            "Multiple Arcade Machines",
        #            ""),
        #        "atari-2600": (
        #            "Atari 2600",
        #            "Video Computer System",
        #            "Atari 1"),
        #        "atari-8-bit": (
        #            "Atari 8-Bit",
        #            "Atari 400/800/XL/XE",
        #            "Atari 2"),
        #        "atari-5200": (
        #            "Atari 5200",
        #            "Atari 5200 SuperSystem",
        #            "Atari 3"),
        #        "atari-7800": (
        #            "Atari 7800",
        #            "Atari 7800 ProSystem",
        #            "Atari 4"),
        #        "atari-st": (
        #            "Atari ST",
        #            "Atari ST/STE",
        #            "Atari 5"),
        #        "bbc-micro": (
        #            "BBC Micro",
        #            "Acorn BCC Micro",
        #            ""),
        #        "commodore-64": (
        #            "Commodore 64",
        #            "",
        #            "Commodore 1"),
        #        "game-boy": (
        #            "Game Boy",
        #            "",
        #            "Nintendo 2"),
        #        "game-boy-color": (
        #            "Game Boy Color",
        #            "",
        #            "Nintendo 5"),
        #        "game-boy-advance": (
        #            "Game Boy Advance",
        #            "",
        #            "Nintendo 6"),
        #        "game-cube": (
        #            "GameCube",
        #            "Nintendo GameCube",
        #            "Nintendo 7"),
        #        "game-gear": (
        #            "Game Gear",
        #            "Sega Game Gear",
        #            "Sega 3"),
        #        "lynx": (
        #            "Atari Lynx",
        #            "",
        #            "Atari 6"),
        #        "nintendo": (
        #            "Nintendo",
        #            "",
        #            "Nintendo 1"),
        #        "nintendo-64": (
        #            "Nintendo 64",
        #            "",
        #            "Nintendo 4"),
        #        "DOS": (
        #            "DOS",
        #            "IBM PC Compatible",
        #            "PC 1"),
        #        "master-system": (
        #            "Master System",
        #            "Sega Master System / Mark III",
        #            "Sega 1"),
        #        "mega-drive": (
        #            "Mega Drive",
        #            "Sega Mega Drive / Genesis",
        #            "Sega 2"),
        #        "playstation": (
        #            "PlayStation",
        #            "Sony PlayStation",
        #            ""),
        #        "playstation-2": (
        #            "PlayStation 2",
        #            "Sony PlayStation 2",
        #            ""),
        #        "super-nintendo": (
        #            "Super Nintendo",
        #            "Entertainment System",
        #            "Nintendo 3"),
        #        "turbografx-16": (
        #            "TurboGrafx-16",
        #            "Entertainment SuperSystem",
        #            ""),
        #        "wii": (
        #            "Wii",
        #            "Nintendo Wii",
        #            "Nintendo 8"),
        #        "windows": (
        #            "Windows",
        #            "IBM PC Compatible",
        #            "PC 2"),
        #        "zx-spectrum": (
        #            "ZX Spectrum",
        #            "Sinclair ZX Spectrum",
        #            ""),
        #    }[platform]
        # except KeyError:
        #    self.title = platform
        self.platform = platform
        self.path_title = platform

        self.title = PlatformHandler.get_platform_name(platform)
        self.path_title = self.title

        # self.title = ""
        # self.title = "CHOOSE PLATFORM: " + self.title
        # self.subtitle = ""
        self.subtitle = "CHOOSE PLATFORM"

        # if not self.sort_title:
        #     self.sort_title = self.title

        # FIXME: for now, test using just title as sort title
        self.sort_title = self.title
Esempio n. 22
0
    def __init__(self, platform):
        AutoExpandItem.__init__(self)
        self._platform = platform
        # using self.platform for "description"

        # self.sort_title = ""
        # try:
        #    self.title, self.subtitle, self.sort_title = {
        #        "Amiga": (
        #            "Amiga",
        #            "Commodore Amiga",
        #            "Commodore 2"),
        #        "amstrad-cpc": (
        #            "Amstrad CPC",
        #            "Color Personal Computer",
        #            ""),
        #        "apple-II": (
        #            "Apple II",
        #            "II/Plus/e/c",
        #            ""),
        #        "arcade": (
        #            "Arcade Video Games",
        #            "Multiple Arcade Machines",
        #            ""),
        #        "atari-2600": (
        #            "Atari 2600",
        #            "Video Computer System",
        #            "Atari 1"),
        #        "atari-8-bit": (
        #            "Atari 8-Bit",
        #            "Atari 400/800/XL/XE",
        #            "Atari 2"),
        #        "atari-5200": (
        #            "Atari 5200",
        #            "Atari 5200 SuperSystem",
        #            "Atari 3"),
        #        "atari-7800": (
        #            "Atari 7800",
        #            "Atari 7800 ProSystem",
        #            "Atari 4"),
        #        "atari-st": (
        #            "Atari ST",
        #            "Atari ST/STE",
        #            "Atari 5"),
        #        "bbc-micro": (
        #            "BBC Micro",
        #            "Acorn BCC Micro",
        #            ""),
        #        "commodore-64": (
        #            "Commodore 64",
        #            "",
        #            "Commodore 1"),
        #        "game-boy": (
        #            "Game Boy",
        #            "",
        #            "Nintendo 2"),
        #        "game-boy-color": (
        #            "Game Boy Color",
        #            "",
        #            "Nintendo 5"),
        #        "game-boy-advance": (
        #            "Game Boy Advance",
        #            "",
        #            "Nintendo 6"),
        #        "game-cube": (
        #            "GameCube",
        #            "Nintendo GameCube",
        #            "Nintendo 7"),
        #        "game-gear": (
        #            "Game Gear",
        #            "Sega Game Gear",
        #            "Sega 3"),
        #        "lynx": (
        #            "Atari Lynx",
        #            "",
        #            "Atari 6"),
        #        "nintendo": (
        #            "Nintendo",
        #            "",
        #            "Nintendo 1"),
        #        "nintendo-64": (
        #            "Nintendo 64",
        #            "",
        #            "Nintendo 4"),
        #        "DOS": (
        #            "DOS",
        #            "IBM PC Compatible",
        #            "PC 1"),
        #        "master-system": (
        #            "Master System",
        #            "Sega Master System / Mark III",
        #            "Sega 1"),
        #        "mega-drive": (
        #            "Mega Drive",
        #            "Sega Mega Drive / Genesis",
        #            "Sega 2"),
        #        "playstation": (
        #            "PlayStation",
        #            "Sony PlayStation",
        #            ""),
        #        "playstation-2": (
        #            "PlayStation 2",
        #            "Sony PlayStation 2",
        #            ""),
        #        "super-nintendo": (
        #            "Super Nintendo",
        #            "Entertainment System",
        #            "Nintendo 3"),
        #        "turbografx-16": (
        #            "TurboGrafx-16",
        #            "Entertainment SuperSystem",
        #            ""),
        #        "wii": (
        #            "Wii",
        #            "Nintendo Wii",
        #            "Nintendo 8"),
        #        "windows": (
        #            "Windows",
        #            "IBM PC Compatible",
        #            "PC 2"),
        #        "zx-spectrum": (
        #            "ZX Spectrum",
        #            "Sinclair ZX Spectrum",
        #            ""),
        #    }[platform]
        # except KeyError:
        #    self.title = platform
        self.platform = platform
        self.path_title = platform

        self.title = PlatformHandler.get_platform_name(platform)
        self.path_title = self.title

        # self.title = ""
        # self.title = "CHOOSE PLATFORM: " + self.title
        # self.subtitle = ""
        self.subtitle = "CHOOSE PLATFORM"

        # if not self.sort_title:
        #     self.sort_title = self.title

        # FIXME: for now, test using just title as sort title
        self.sort_title = self.title
Esempio n. 23
0
 def __init__(self):
     PlatformHandler.__init__(self)
Esempio n. 24
0
def render_bottom_bar_text(item):
    strength = 0.9
    x = 544
    y = 290

    title = item.title.upper()
    title = title.strip()
    if "[" in title:
        title, subtitle = title.rsplit("[", 1)
        title = title.strip()
        subtitle = subtitle.strip()
        if subtitle.endswith("]"):
            subtitle = subtitle[:-1]
    else:
        subtitle = ""
    if title:
        Render.get().text(title,
                          Font.title_font,
                          x,
                          y,
                          1920 - x - 170,
                          shadow=True,
                          color=(1.0, 1.0, 1.0, 1.0 * strength))
        if subtitle:
            color = (0x6e / 0xff, 0x8b / 0xff, 0x96 / 0xff, 0.75)
            tw, th = Render.get().measure_text(title, Font.title_font)
            Render.get().text(subtitle,
                              Font.title_font,
                              x + tw + 20,
                              y,
                              1920 - x - 170,
                              shadow=True,
                              color=color)

    color = (0xc4 / 0xff, 0xd7 / 0xff, 0xde / 0xff, 1.0)
    year_text = str(
        getattr(State.get().current_menu.selected_item, "year", "")
        or "").upper()
    if year_text:
        tw, th = Render.get().measure_text(year_text, Font.title_font)
        Render.get().text(year_text,
                          Font.title_font,
                          1920 - 30 - tw,
                          y,
                          0,
                          shadow=True,
                          color=color)
    color = (0x6e / 0xff, 0x8b / 0xff, 0x96 / 0xff, 1.0)
    y = 258
    text_str = ""
    companies = set()
    publisher_text = (getattr(State.get().current_menu.selected_item,
                              "publisher", "") or "").upper()
    for text in publisher_text.split("/"):
        text = text.strip()
        if text:
            if text not in companies:
                text_str = text_str + u" \u00b7 " + text
                companies.add(text)
    developer_text = (getattr(State.get().current_menu.selected_item,
                              "developer", "") or "").upper()
    for text in developer_text.split("/"):
        text = text.strip()
        if text:
            if text not in companies:
                text_str = text_str + u" \u00b7 " + text
                companies.add(text)
    if len(text_str) > 3:
        text_str = text_str[3:]  # remove initial middle dot
        tw, th = Render.get().measure_text(text_str, Font.subtitle_font)
        Render.get().text(text_str,
                          Font.subtitle_font,
                          1920 - 30 - tw,
                          y,
                          0,
                          shadow=True,
                          color=color)

    platform_str = str(
        getattr(State.get().current_menu.selected_item, "platform", "") or "")
    if platform_str:
        platform_str = PlatformHandler.get_platform_name(platform_str).upper()
    if len(platform_str) >= 3:
        # tw, th = Render.get().measure_text(platform_str, Font.subtitle_font)
        Render.get().text(platform_str,
                          Font.subtitle_font,
                          x,
                          y,
                          0,
                          shadow=True,
                          color=color)
    return
Esempio n. 25
0
def render_bottom_bar_text(item):
    strength = 0.9
    x = 544
    y = 290

    title = item.title.upper()
    title = title.strip()
    if "[" in title:
        title, subtitle = title.rsplit("[", 1)
        title = title.strip()
        subtitle = subtitle.strip()
        if subtitle.endswith("]"):
            subtitle = subtitle[:-1]
    else:
        subtitle = ""
    if title:
        Render.get().text(
            title,
            Font.title_font,
            x,
            y,
            1920 - x - 170,
            shadow=True,
            color=(1.0, 1.0, 1.0, 1.0 * strength),
        )
        if subtitle:
            color = (0x6E / 0xFF, 0x8B / 0xFF, 0x96 / 0xFF, 0.75)
            tw, th = Render.get().measure_text(title, Font.title_font)
            Render.get().text(
                subtitle,
                Font.title_font,
                x + tw + 20,
                y,
                1920 - x - 170,
                shadow=True,
                color=color,
            )

    color = (0xC4 / 0xFF, 0xD7 / 0xFF, 0xDE / 0xFF, 1.0)
    year_text = str(
        getattr(State.get().current_menu.selected_item, "year", "") or ""
    ).upper()
    if year_text:
        tw, th = Render.get().measure_text(year_text, Font.title_font)
        Render.get().text(
            year_text,
            Font.title_font,
            1920 - 30 - tw,
            y,
            0,
            shadow=True,
            color=color,
        )
    color = (0x6E / 0xFF, 0x8B / 0xFF, 0x96 / 0xFF, 1.0)
    y = 258
    text_str = ""
    companies = set()
    publisher_text = (
        getattr(State.get().current_menu.selected_item, "publisher", "") or ""
    ).upper()
    for text in publisher_text.split("/"):
        text = text.strip()
        if text:
            if text not in companies:
                text_str = text_str + u" \u00b7 " + text
                companies.add(text)
    developer_text = (
        getattr(State.get().current_menu.selected_item, "developer", "") or ""
    ).upper()
    for text in developer_text.split("/"):
        text = text.strip()
        if text:
            if text not in companies:
                text_str = text_str + u" \u00b7 " + text
                companies.add(text)
    if len(text_str) > 3:
        text_str = text_str[3:]  # remove initial middle dot
        tw, th = Render.get().measure_text(text_str, Font.subtitle_font)
        Render.get().text(
            text_str,
            Font.subtitle_font,
            1920 - 30 - tw,
            y,
            0,
            shadow=True,
            color=color,
        )

    platform_str = str(
        getattr(State.get().current_menu.selected_item, "platform", "") or ""
    )
    if platform_str:
        platform_str = PlatformHandler.get_platform_name(platform_str).upper()
    if len(platform_str) >= 3:
        # tw, th = Render.get().measure_text(platform_str, Font.subtitle_font)
        Render.get().text(
            platform_str, Font.subtitle_font, x, y, 0, shadow=True, color=color
        )
    return
Esempio n. 26
0
 def name(self):
     from .platform import PlatformHandler
     return PlatformHandler.get_platform_name(self._id)