def __init__(self, parent):
     super().__init__(
         parent,
         [
             Image("launcher:/data/windowed_16.png"),
             Image("launcher:/data/fullscreen_16.png"),
         ],
     )
     self.set_tooltip(self.tooltip_text)
     self.set_min_width(40)
 def __init__(self, parent):
     self.active_icon = 1
     super().__init__(parent, [])
     self.add_item(gettext("Unrated"), Image("launcher:res/16/bullet.png"))
     self.add_item(gettext("Best Variant"),
                   Image("launcher:res/16/rating_fav_2.png"))
     self.add_item(gettext("Good Variant"),
                   Image("launcher:res/16/thumb_up_2.png"))
     self.add_item(gettext("Bad Variant"),
                   Image("launcher:res/16/thumb_down_2.png"))
     ConfigBehavior(self, ["variant_rating", "variant_uuid"])
 def __init__(self, parent):
     super().__init__(
         parent,
         [
             Image("launcher:/data/16x16/monitor_left.png"),
             Image("launcher:/data/16x16/monitor_middle_left.png"),
             Image("launcher:/data/16x16/monitor_middle_right.png"),
             Image("launcher:/data/16x16/monitor_right.png"),
         ],
     )
     self.set_tooltip(self.tooltip_text)
     self.set_min_width(40)
Exemplo n.º 4
0
 def __init__(self, parent):
     self.active_icon = 1
     super().__init__(parent, [], cursor_keys=False)
     with self.changed.inhibit:
         self.add_item(gettext("Rate Variant"),
                       Image("launcher:res/16/bullet.png"))
         self.add_item(gettext("Best Variant"),
                       Image("launcher:res/16/rating_fav_2.png"))
         self.add_item(gettext("Good Variant"),
                       Image("launcher:res/16/thumb_up_2.png"))
         self.add_item(gettext("Bad Variant"),
                       Image("launcher:res/16/thumb_down_2.png"))
     ConfigBehavior(self, ["variant_rating", "variant_uuid"])
Exemplo n.º 5
0
    def __init__(self, parent):
        StatusElement.__init__(self, parent)
        # self.set_min_width(140)
        # self.layout = HorizontalLayout()
        self.protection_icon = Image("launcher:res/16x16/lock.png")
        # self.unknown_icon = self.icon.grey_scale()
        self.disabled_icon = Image("launcher:res/16x16/lock_open_green.png")
        # self.disabled_icon = self.disabled_icon.grey_scale()
        self.icon = self.protection_icon

        self.na_text = " "
        self.protection = ""
        self.text = self.na_text
        self.active = False

        LauncherConfig.add_listener(self)
        self.on_config("protection", LauncherConfig.get("protection"))
Exemplo n.º 6
0
 def __init__(self, parent, icon=None):
     if icon is not None:
         self.icon = icon
     else:
         self.icon = Image("launcher:res/16/world.png")
     Panel.__init__(self, parent, paintable=True)
     # self.set_tooltip(tooltip)
     LauncherConfig.add_listener(self)
     self.on_config("variant_rating", "")
Exemplo n.º 7
0
    def __init__(self, parent):
        StatusElement.__init__(self, parent)
        # self.set_min_width(140)
        self.layout = HorizontalLayout()
        self.icon = Image("launcher:res/16x16/world_link.png")
        self.right_icon = Image("launcher:res/16x16/drop_down_arrow.png")
        self.right_icon_disabled = Image(
            "launcher:res/16x16/drop_down_arrow_disabled.png")
        # self.inactive_icon = self.active_icon.grey_scale()

        self.text = gettext("Web Links")

        LauncherConfig.add_listener(self)
        self.on_config("protection", LauncherConfig.get("protection"))

        self.have = set()
        for key in url_keys:
            self.on_config(key, LauncherConfig.get(key))
Exemplo n.º 8
0
    def __init__(self, parent):
        Panel.__init__(self, parent, paintable=True)
        self.set_min_height(29)
        # self.set_background_color(Color(0xd8, 0xd8, 0xd8))
        self.layout = VerticalLayout()
        self.hori_layout = HorizontalLayout()
        if Skin.fws():
            self.top_border_size = 2
        else:
            self.top_border_size = 1
        self.layout.add(self.hori_layout,
                        fill=True,
                        expand=True,
                        margin_top=self.top_border_size)

        element = ProtectionElement(self)
        self.hori_layout.add(element, fill=True)

        element = WarningsElement(self)
        self.hori_layout.add(element, fill=True, expand=True)
        self.hori_layout.add_spacer(16)

        for language, icon_name in reversed([
            ("en", "flag-gb"),
            ("de", "flag-de"),
            ("fr", "flag-fr"),
            ("es", "flag-es"),
            ("it", "flag-it"),
            ("ja", "flag-jp"),
                # ("", "flag-unknown"),
        ]):
            icon = Image("workspace:res/16/" + icon_name + ".png")
            element = LanguageElement(self, language, icon)
            self.hori_layout.add(element, fill=True)
        self.hori_layout.add_spacer(16)

        element = PlayersElement(self)
        self.hori_layout.add(element, fill=True)

        # for config_key, icon_name in [
        #     ("database_url", "database_url_16"),
        #     ("hol_url", "hol_url_16"),
        #     ("lemonamiga_url", "lemon_url_16"),
        #     ("mobygames_url", "mobygames_url_16"),
        #     ("wikipedia_url", "wikipedia_url_16"),
        # ]:
        #     icon = Image("launcher:res/" + icon_name + ".png")
        #     element = LinkButtonElement(self, config_key, icon)
        #     self.hori_layout.add(element)

        element = WebLinkElement(self)
        self.hori_layout.add(element, fill=True)

        # this listener is added after all status bar children have
        # added their listeners, this is important for re-layout...
        LauncherConfig.add_listener(self)
Exemplo n.º 9
0
 def __init__(self, parent, icon=None):
     if icon is not None:
         self.icon = icon
     else:
         self.icon = Image("launcher:/data/16x16/world.png")
     Panel.__init__(self, parent, paintable=True)
     # self.set_tooltip(tooltip)
     config = get_config(self)
     config.add_listener(self)
     self.on_config("variant_uuid", "")
Exemplo n.º 10
0
    def __init__(self, parent):
        StatusElement.__init__(self, parent)
        self.icon = Image("launcher:res/16x16/user.png")
        self.text = gettext("N/A")
        self.active = False

        self.players = ""

        LauncherConfig.add_listener(self)
        self.on_config("players", LauncherConfig.get("players"))
 def __init__(self, parent):
     super().__init__(
         parent,
         [
             Image(
                 "launcher:/data/icons/audio-volume-high_16/audio-volume-high.png"
             ),
             Image(
                 "launcher:/data/icons/audio-volume-medium_16/audio-volume-medium.png"
             ),
             Image(
                 "launcher:/data/icons/audio-volume-low_16/audio-volume-low.png"
             ),
             Image(
                 "launcher:/data/icons/audio-volume-muted_16/audio-volume-muted.png"
             ),
         ],
     )
     self.set_tooltip(self.tooltip_text)
     self.set_min_width(40)
Exemplo n.º 12
0
    def _add_page(self, book, instance, icon_name, title, tooltip):
        book.add_page(instance)
        if icon_name:
            icon = Image("launcher:/data/{0}.png".format(icon_name))
        else:
            icon = None

        def function():
            book.set_page(instance)

        if icon:
            self.add_tab(function, icon, title, tooltip)
        return instance
Exemplo n.º 13
0
    def __init__(self, parent):
        self.active_icon = 1
        super().__init__(parent, [], cursor_keys=False)
        with self.changed.inhibit:
            self.add_item(
                # gettext("Rate Variant"),
                # gettext("Rate"),
                "",
                Image("launcher:/data/16x16/bullet.png"),
            )
            self.add_item(
                # gettext("Best Variant"),
                gettext("Best"),
                Image("launcher:/data/16x16/rating_fav_2.png"),
            )
            self.add_item(
                # gettext("Good Variant"),
                gettext("Good"),
                Image("launcher:/data/16x16/thumb_up_2.png"),
            )
            self.add_item(
                # gettext("Bad Variant"),
                gettext("Bad"),
                Image("launcher:/data/16x16/thumb_down_2.png"),
            )
        self.set_tooltip(gettext("Rate variant"))
        # FIXME
        # ConfigBehavior(self, ["variant_uuid"])
        # SettingsBehavior(self, ["__variant_rating"])

        ConfigDispatch(
            self,
            {
                VARIANT_RATING__: self.on_variant_rating_config,
                VARIANT_UUID__: self.on_variant_uuid_config,
            },
        )
    def __init__(self, parent):
        super().__init__(parent)
        self.set_min_height(10 + 150 + 10)
        # self.image_loader = ImageLoader()
        # default_image = Image("launcher:/data/screenshot.png")
        # default_image.resize(SCREEN_SIZE)
        default_image = None
        overlay_image = Image("launcher:/data/screenshot_overlay.png")
        image_loader = get_window(self).image_loader

        self.screenshotpanels = []
        x = 20
        y = 10
        for i in range(6):
            panel = ScreenshotPanel(self, i, image_loader, default_image,
                                    overlay_image)
            panel.set_position((x, y))
            self.screenshotpanels.append(panel)
            x += panel.width() + 20
 def get_item_icon(self, index):
     item = self.items[index]
     platform_id = (item[str("platform")] or "").lower()
     if item[str("have")] == 1:
         return self.manual_download_icon
     elif item[str("have")] == 0:
         return self.blank_icon
     elif item[str("have")] == 2:
         return self.auto_download_icon
     elif item[str("have")] == 4:
         if platform_id not in self.platform_icons:
             try:
                 icon = Image(
                     "launcher:/data/16x16/{0}.png".format(platform_id))
             except Exception:
                 icon = self.game_icon
             self.platform_icons[platform_id] = icon
         return self.platform_icons[platform_id]
     else:
         return self.config_icon
Exemplo n.º 16
0
 def __init__(self, parent, name):
     image = Image("launcher:res/" + name)
     ImageButton.__init__(self, parent, image)
     self.set_min_width(self.BUTTON_WIDTH)
Exemplo n.º 17
0
    def _missing_icon(self):
        from fsui.qt import QImage, QSize

        return Image(qimage=QImage(QSize(1, 1), QImage.Format_RGBA8888))
Exemplo n.º 18
0
    def __init__(self, parent):
        StatusElement.__init__(self, parent)
        self.error_icon = Image("launcher:res/16x16/error.png")
        self.warning_icon = Image("launcher:res/16x16/warning_3.png")
        self.notice_icon = Image("launcher:res/16x16/information.png")
        self.icons = [self.error_icon, self.warning_icon, self.notice_icon]
        self.coordinates = []
        self.warnings = []
        self.game_notice = ""
        self.variant_notice = ""
        self.variant_warning = ""
        self.variant_error = ""
        self.joy_emu_conflict = ""
        self.using_joy_emu = False
        self.kickstart_file = ""
        self.x_kickstart_file_sha1 = ""
        self.update_available = ""
        self.__error = ""
        self.x_missing_files = ""
        self.download_page = ""
        self.download_file = ""
        self.platform = ""
        self.amiga_model = ""
        self.amiga_model_calculated = ""
        self.chip_memory = ""
        self.chip_memory_calculated = 0
        self.outdated_plugins = []
        self.custom_config = set()
        self.custom_uae_config = set()
        self.settings_config_keys = set()

        plugin_manager = PluginManager.instance()
        for plugin in plugin_manager.plugins():
            if plugin.outdated:
                self.outdated_plugins.append(plugin.name)

        ConfigBehavior(
            self,
            [
                "x_game_notice",
                "x_variant_notice",
                "x_variant_warning",
                "x_variant_error",
                "x_joy_emu_conflict",
                "amiga_model",
                "x_kickstart_file_sha1",
                "kickstart_file",
                "download_page",
                "download_file",
                "x_missing_files",
                "__error",
                "chip_memory",
                "jit_compiler",
                "platform",
            ],
        )
        SettingsBehavior(self, ["__update_available"])

        LauncherConfig.add_listener(self)
        for key in JOYSTICK_KEYS:
            self.on_config(key, LauncherConfig.get(key))
        for key in LauncherConfig.keys():
            if LauncherConfig.is_custom_uae_option(key):
                self.on_config(key, LauncherConfig.get(key))
            elif LauncherConfig.is_custom_option(key):
                self.on_config(key, LauncherConfig.get(key))

        LauncherSettings.add_listener(self)
        for key in LauncherSettings.keys():
            if LauncherConfig.is_config_only_option(key):
                self.on_setting(key, LauncherSettings.get(key))
    def __init__(self, parent):
        VerticalItemView.__init__(self, parent, border=False)
        self.items = []
        self.game_icon = Image("launcher:/data/16x16/controller.png")
        self.config_icon = Image("launcher:/data/fsuae_config_16.png")
        LauncherSettings.add_listener(self)
        self.update_search()

        self.manual_download_icon = Image(
            "launcher:/data/16x16/arrow_down_yellow.png")
        self.auto_download_icon = Image(
            "launcher:/data/16x16/arrow_down_green.png")
        self.blank_icon = Image("launcher:/data/16x16/blank.png")
        self.missing_color = Color(0xA8, 0xA8, 0xA8)
        self.unpublished_color = Color(0xCC, 0x00, 0x00)

        self.platform_icons = {}

        self.set_background_color(Color(0x999999))
        self.set_font(Font("Saira Condensed", 17, weight=500))

        self.set_row_height(32)
        get_window(self).activated.connect(self.__on_activated)
        get_window(self).deactivated.connect(self.__on_deactivated)

        self._qwidget.verticalScrollBar().setStyleSheet(f"""
            QScrollBar:vertical {{
                border: 0px;
                /*
                background: #32CC99;
                */
                /*
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #888888, stop: 1 #909090);
                */
                /*
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #848484, stop: 0.0625 #8A8A8A stop: 1 #909090);
                */
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #858585, stop: {1 / (16 - 1)} #8A8A8A stop: 1 #909090);
                width: 16px;
                margin: 0 0 0 0;
            }}
            QScrollBar::handle:vertical {{
                /*
                background: #9d9d9d;
                */
                background: #999999;
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #AAAAAA stop: 1 #999999);
                min-height: 60px;
            }}
            
            QScrollBar::handle:vertical:hover {{
                background: #AAAAAA;   
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #B2B2B2 stop: 1 #A0A0A0);
            }}

            QScrollBar::handle:vertical:pressed {{
                background: #777777;
            }}

            QScrollBar::add-line:vertical {{
                border: none;
                background: none;
                width: 0;
                height: 0;
            }}

            QScrollBar::sub-line:vertical {{
                border: none;
                background: none;
                width: 0;
                height: 0;
            }}
            """)
Exemplo n.º 20
0
    def add_launcher_icon(self, path):
        print("add_launcher_icon", path)

        label = self._label_for_path(path)
        # label = shell_basename(path)
        # if label.endswith(":"):
        #     # Hack for volumes
        #     label = label[:-1]
        # wsopen = path

        # FIXME: Get proper data file path
        # icon_dir = os.path.join(
        #     Application.executable_dir(),
        #     "data",
        #     "Icons",
        #     shell_dirname(path).replace(":", "/"),
        # )
        # print(icon_dir, label)

        icon_dir = os.path.join(
            "Icons",
            shell_dirname(path).replace(":", "/"),
        )
        normal_image = Image(
            ApplicationData.path_or_stream(
                os.path.join(icon_dir, label + ".png")))
        selected_image = Image(
            ApplicationData.path_or_stream(
                os.path.join(icon_dir, label + "_Selected.png")))

        # # FIXME
        # icon = Image(
        #     os.path.join("data", "Icons")
        #     os.path.expanduser(
        #         "~/openretro/icons/Prefs/" + label + "_Normal.png"
        #     )
        # )
        # try:
        #     # icon = Image(
        #     #     os.path.expanduser("~/openretro/icons/Prefs/" + label + "/" + label + "_Normal.png")
        #     # )
        #     icon = Image(
        #         os.path.expanduser(
        #             "~/openretro/icons/Prefs/" + label + "_Normal.png"
        #         )
        #     )
        # except Exception:
        #     icon = Image(
        #         os.path.expanduser("~/openretro/icons/Prefs/Help_Normal.png")
        #     )

        # try:
        #     # selected_icon = Image(
        #     #     os.path.expanduser("~/openretro/icons/Prefs/" + label + "/" + label + "_Selected.png")
        #     # )
        #     selected_icon = Image(
        #         os.path.expanduser(
        #             "~/openretro/icons/Prefs/" + label + "_Selected.png"
        #         )
        #     )
        # except Exception:
        #     selected_icon = Image(
        #         os.path.expanduser("~/openretro/icons/Prefs/Help_Selected.png")
        #     )

        # try:
        #     selected_icon = Image(
        #         os.path.expanduser("~/openretro/icons/Prefs/" + label + "/" + label + "_Selected.png")
        #     )
        # except Exception:
        #     try:
        #         selected_icon = Image(
        #             os.path.expanduser(
        #                 "~/openretro/icons/Prefs/" + label + "_Selected.png"
        #             )
        #         )
        #     except Exception:
        #         selected_icon = None
        #         selected_icon = icon.copy()
        #         selected_icon.invert()
        self._add_icon(path, normal_image, selected_image, label=label)
    def __init__(self, parent):
        ItemChoice.__init__(self, parent)

        self.parent_uuid = ""
        self.items = []  # type: list [dict]
        # self.last_variants = LastVariants()

        self.missing_color = Color(0xA8, 0xA8, 0xA8)
        self.icon = Image("launcher:/data/fsuae_config_16.png")
        self.adf_icon = Image("launcher:/data/adf_game_16.png")
        self.ipf_icon = Image("launcher:/data/ipf_game_16.png")
        self.cd_icon = Image("launcher:/data/cd_game_16.png")
        self.hd_icon = Image("launcher:/data/hd_game_16.png")
        # self.missing_icon = Image(
        #     "launcher:/data/missing_game_16.png")
        self.missing_icon = Image("launcher:/data/16x16/delete_grey.png")
        self.blank_icon = Image("launcher:/data/16x16/blank.png")
        self.bullet_icon = Image("launcher:/data/16x16/bullet.png")
        self.manual_download_icon = Image(
            "launcher:/data/16x16/arrow_down_yellow.png")
        self.auto_download_icon = Image(
            "launcher:/data/16x16/arrow_down_green.png")
        self.up_icon = Image("launcher:/data/16x16/thumb_up_mod.png")
        self.down_icon = Image("launcher:/data/16x16/thumb_down_mod.png")
        self.fav_icon = Image("launcher:/data/rating_fav_16.png")

        # LauncherSettings.add_listener(self)
        # self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid"))

        ConfigDispatch(
            self,
            {
                PARENT_UUID: self.__on_parent_uuid_config,
                VARIANT_RATING__: self.on_variant_rating_config,
            },
        )
Exemplo n.º 22
0
 def set_icon_name(self, name):
     image = Image("launcher:res/" + name)
     self.set_image(image)
Exemplo n.º 23
0
 def __init__(self, parent):
     icon = Image("launcher:res/16x16/pencil.png")
     WebButton.__init__(self, parent, icon)