Ejemplo n.º 1
0
    def get_lutris_links(self):
        box = Gtk.VBox(spacing=6, visible=True)

        donate_button = get_link_button("Support Lutris!")
        donate_button.connect("clicked", lambda *x: open_uri(LINKS["donate"]))
        box.add(donate_button)

        help_label = Gtk.Label(visible=True)
        help_label.set_markup("<b>Help:</b>")
        help_label.set_alignment(0, 0.5)
        help_label.set_margin_top(136)
        box.add(help_label)

        help_box = Gtk.Box(spacing=6, visible=True)
        forums_button = get_link_button("Forums")
        forums_button.set_size_request(-1, -1)
        forums_button.connect("clicked", lambda *x: open_uri(LINKS["forums"]))
        help_box.add(forums_button)
        irc_button = get_link_button("IRC")
        irc_button.set_size_request(-1, -1)
        irc_button.connect("clicked", lambda *x: open_uri(LINKS["irc"]))
        help_box.add(irc_button)
        discord_button = get_link_button("Discord")
        discord_button.set_size_request(-1, -1)
        discord_button.connect("clicked", lambda *x: open_uri(LINKS["discord"]))
        help_box.add(discord_button)
        box.add(help_box)
        return box
Ejemplo n.º 2
0
    def get_lutris_links(self):
        box = Gtk.VBox(spacing=6, visible=True)

        donate_button = get_link_button(_("Support Lutris!"))
        donate_button.connect("clicked", lambda *x: open_uri(LINKS["donate"]))
        box.add(donate_button)

        help_label = Gtk.Label(visible=True)
        help_label.set_markup(_("<b>Help:</b>"))
        help_label.set_alignment(0, 0.5)
        help_label.set_margin_top(136)
        box.add(help_label)

        help_box = Gtk.Box(spacing=6, visible=True)
        forums_button = get_link_button(_("Forums"))
        forums_button.set_size_request(-1, -1)
        forums_button.connect("clicked", lambda *x: open_uri(LINKS["forums"]))
        help_box.add(forums_button)
        irc_button = get_link_button(_("IRC"))
        irc_button.set_size_request(-1, -1)
        irc_button.connect("clicked", lambda *x: open_uri(LINKS["irc"]))
        help_box.add(irc_button)
        discord_button = get_link_button(_("Discord"))
        discord_button.set_size_request(-1, -1)
        discord_button.connect("clicked",
                               lambda *x: open_uri(LINKS["discord"]))
        help_box.add(discord_button)
        box.add(help_box)
        return box
Ejemplo n.º 3
0
    def _init_actions(self):
        Action = namedtuple("Action", ("callback", "type", "enabled", "default", "accel"))
        Action.__new__.__defaults__ = (None, None, True, None, None)

        actions = {
            "add-game": Action(self.on_add_game_button_clicked),
            "preferences": Action(self.on_preferences_activate),
            "about": Action(self.on_about_clicked),
            "show-installed-only": Action(  # delete?
                self.on_show_installed_state_change,
                type="b",
                default=self.filter_installed,
                accel="<Primary>h",
            ),
            "toggle-viewtype": Action(self.on_toggle_viewtype),
            "icon-type": Action(self.on_icontype_state_change, type="s", default=self.icon_type),
            "view-sorting": Action(self.on_view_sorting_state_change, type="s", default=self.view_sorting),
            "view-sorting-ascending": Action(
                self.on_view_sorting_direction_change,
                type="b",
                default=self.view_sorting_ascending,
            ),
            "show-side-panel": Action(
                self.on_side_panel_state_change,
                type="b",
                default=self.side_panel_visible,
                accel="F9",
            ),
            "show-hidden-games": Action(
                self.hidden_state_change,
                type="b",
                default=self.show_hidden_games,
            ),
            "open-forums": Action(lambda *x: open_uri("https://forums.lutris.net/")),
            "open-discord": Action(lambda *x: open_uri("https://discord.gg/Pnt5CuY")),
            "donate": Action(lambda *x: open_uri("https://lutris.net/donate")),
        }

        self.actions = {}
        app = self.props.application
        for name, value in actions.items():
            if not value.type:
                action = Gio.SimpleAction.new(name)
                action.connect("activate", value.callback)
            else:
                default_value = None
                param_type = None
                if value.default is not None:
                    default_value = GLib.Variant(value.type, value.default)
                if value.type != "b":
                    param_type = default_value.get_type()
                action = Gio.SimpleAction.new_stateful(name, param_type, default_value)
                action.connect("change-state", value.callback)
            self.actions[name] = action
            if value.enabled is False:
                action.props.enabled = False
            self.add_action(action)
            if value.accel:
                app.add_accelerator(value.accel, "win." + name)
Ejemplo n.º 4
0
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     path = self.game.get_browse_dir()
     if not path:
         dialogs.NoticeDialog("This game has no installation directory")
     elif path_exists(path):
         open_uri("file://%s" % path)
     else:
         dialogs.NoticeDialog("Can't open %s \nThe folder doesn't exist." % path)
Ejemplo n.º 5
0
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     path = self.game.get_browse_dir()
     if not path:
         dialogs.NoticeDialog(_("This game has no installation directory"))
     elif path_exists(path):
         open_uri("file://%s" % path)
     else:
         dialogs.NoticeDialog(_("Can't open %s \nThe folder doesn't exist.") % path)
Ejemplo n.º 6
0
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     path = self.game.get_browse_dir()
     if not path:
         dialogs.NoticeDialog("This game has no installation directory")
     elif path_exists(path):
         if self.game.runner.system_config.get("use_xdg_utils"):
             subprocess.run(["xdg-open", path])
         else:
             open_uri("file://%s" % path)
     else:
         dialogs.NoticeDialog("Can't open %s \nThe folder doesn't exist." %
                              path)
Ejemplo n.º 7
0
    def get_lutris_links(self):
        search_entry = Gtk.SearchEntry(visible=True)
        box = Gtk.VBox(spacing=6, visible=True)
        floss_button = get_link_button("Browse Open Source games")
        floss_button.connect(
            "clicked", lambda *x: search_entry.set_text("open source games"))
        box.add(floss_button)

        f2p_button = get_link_button("Browse Free to Play games")
        f2p_button.connect(
            "clicked", lambda *x: search_entry.set_text("free to play games"))
        box.add(f2p_button)

        donate_button = get_link_button("Support the project")
        donate_button.connect("clicked", lambda *x: open_uri(LINKS["donate"]))
        box.add(donate_button)

        search_label = Gtk.Label(visible=True)
        search_label.set_markup("<b>Search games on Lutris.net:</b>")
        search_label.set_alignment(0, 0.5)
        search_label.set_margin_top(12)
        box.add(search_label)

        search_entry = Gtk.SearchEntry(visible=True)
        search_entry.set_text(self.search_terms)
        search_entry.connect("changed", self.on_search_entry_changed)
        box.add(search_entry)

        help_label = Gtk.Label(visible=True)
        help_label.set_markup("<b>Help:</b>")
        help_label.set_alignment(0, 0.5)
        help_label.set_margin_top(12)
        box.add(help_label)

        help_box = Gtk.Box(spacing=6, visible=True)
        forums_button = get_link_button("Forums")
        forums_button.set_size_request(-1, -1)
        forums_button.connect("clicked", lambda *x: open_uri(LINKS["forums"]))
        help_box.add(forums_button)
        irc_button = get_link_button("IRC")
        irc_button.set_size_request(-1, -1)
        irc_button.connect("clicked", lambda *x: open_uri(LINKS["irc"]))
        help_box.add(irc_button)
        discord_button = get_link_button("Discord")
        discord_button.set_size_request(-1, -1)
        discord_button.connect("clicked",
                               lambda *x: open_uri(LINKS["discord"]))
        help_box.add(discord_button)
        box.add(help_box)
        return box
Ejemplo n.º 8
0
def check_donate():
    setting = "dont-support-lutris"
    if settings.read_setting(setting) != "True":
        open_uri("https://lutris.net/donate")
        DontShowAgainDialog(
            setting,
            "Please support Lutris!",
            secondary_message="Lutris is entirely funded by its community and will "
            "remain an independent gaming platform.\n"
            "For Lutris to survive and grow, the project needs your help.\n"
            "Please consider making a donation if you can. This will greatly help "
            "cover the costs of hosting the project and fund new features "
            "like cloud saves or a full-screen interface for the TV!\n"
            "<a href='https://lutris.net/donate'>SUPPORT US! https://lutris.net/donate</a>"
        )
Ejemplo n.º 9
0
    def get_user_info_box(self):
        user_box = Gtk.Box(spacing=6, visible=True)
        user_box.set_size_request(254, 64)
        if not system.path_exists(api.USER_INFO_FILE_PATH):
            return user_box
        if system.path_exists(api.USER_ICON_FILE_PATH):
            user_icon = Gtk.Image(visible=True)
            user_icon.set_from_pixbuf(get_pixbuf(api.USER_ICON_FILE_PATH, (56, 56)))
            icon_align = Gtk.Alignment(visible=True)
            icon_align.set(1, 0, 0, 0)
            icon_align.add(user_icon)
            user_box.pack_end(icon_align, False, False, 0)
        with open(api.USER_INFO_FILE_PATH) as user_info_file:
            user_info = json.load(user_info_file)
        user_info_box = Gtk.VBox(spacing=6, visible=True)
        user_label = Gtk.Label(visible=True)
        user_label.set_markup("<b>%s</b>" % user_info.get("username"))
        user_label.set_justify(Gtk.Justification.RIGHT)
        user_label.set_ellipsize(Pango.EllipsizeMode.END)
        user_label.set_alignment(1, 0.5)
        user_info_box.pack_start(user_label, False, False, 0)
        if user_info.get("steamid"):
            steam_button = Gtk.Button(visible=True)
            steam_button.set_image(Gtk.Image.new_from_icon_name("steam-symbolic", Gtk.IconSize.MENU))
            steam_button.connect(
                "clicked",
                lambda *x: open_uri("https://steamcommunity.com/profiles/%s" % user_info["steamid"]),
            )
            button_align = Gtk.Alignment(visible=True)
            button_align.set(1, 0, 0, 0)
            button_align.add(steam_button)
            user_info_box.pack_start(button_align, False, False, 0)

        user_box.pack_end(user_info_box, True, True, 0)
        return user_box
Ejemplo n.º 10
0
    def get_user_info_box(self):
        user_box = Gtk.Box(spacing=6, visible=True)
        user_box.set_size_request(254, 64)
        if not system.path_exists(api.USER_INFO_FILE_PATH):
            return user_box
        if system.path_exists(api.USER_ICON_FILE_PATH):
            user_icon = Gtk.Image(visible=True)
            user_icon.set_from_pixbuf(get_pixbuf(api.USER_ICON_FILE_PATH, (56, 56)))
            icon_align = Gtk.Alignment(visible=True)
            icon_align.set(1, 0, 0, 0)
            icon_align.add(user_icon)
            user_box.pack_end(icon_align, False, False, 0)
        with open(api.USER_INFO_FILE_PATH) as user_info_file:
            user_info = json.load(user_info_file)
        user_info_box = Gtk.VBox(spacing=6, visible=True)
        user_label = Gtk.Label(visible=True)
        user_label.set_markup("<b>%s</b>" % user_info.get("username"))
        user_label.set_justify(Gtk.Justification.RIGHT)
        user_label.set_ellipsize(Pango.EllipsizeMode.END)
        user_label.set_alignment(1, 0.5)
        user_info_box.pack_start(user_label, False, False, 0)
        if user_info.get("steamid"):
            steam_button = Gtk.Button(visible=True)
            steam_button.set_image(
                Gtk.Image.new_from_icon_name("steam-symbolic", Gtk.IconSize.MENU)
            )
            steam_button.connect(
                "clicked",
                lambda *x: open_uri(
                    "https://steamcommunity.com/profiles/%s" % user_info["steamid"]
                ),
            )
            button_align = Gtk.Alignment(visible=True)
            button_align.set(1, 0, 0, 0)
            button_align.add(steam_button)
            user_info_box.pack_start(button_align, False, False, 0)

        user_box.pack_end(user_info_box, True, True, 0)
        return user_box
Ejemplo n.º 11
0
    def _init_actions(self):
        Action = namedtuple(
            "Action", ("callback", "type", "enabled", "default", "accel"))
        Action.__new__.__defaults__ = (None, None, True, None, None)

        actions = {
            "browse-games":
            Action(lambda *x: open_uri("https://lutris.net/games/")),
            "register-account":
            Action(lambda *x: open_uri("https://lutris.net/user/register/")),
            "disconnect":
            Action(self.on_disconnect),
            "connect":
            Action(self.on_connect),
            "synchronize":
            Action(lambda *x: self.sync_library()),
            "sync-local":
            Action(lambda *x: self.open_sync_dialog()),
            "add-game":
            Action(self.on_add_game_button_clicked),
            "preferences":
            Action(self.on_preferences_activate),
            "manage-runners":
            Action(self.on_manage_runners),
            "about":
            Action(self.on_about_clicked),
            "show-installed-only":
            Action(
                self.on_show_installed_state_change,
                type="b",
                default=self.filter_installed,
                accel="<Primary>h",
            ),
            "show-installed-first":
            Action(
                self.on_show_installed_first_state_change,
                type="b",
                default=self.show_installed_first,
            ),
            "toggle-viewtype":
            Action(self.on_toggle_viewtype),
            "icon-type":
            Action(self.on_icontype_state_change,
                   type="s",
                   default=self.icon_type),
            "view-sorting":
            Action(self.on_view_sorting_state_change,
                   type="s",
                   default=self.view_sorting),
            "view-sorting-ascending":
            Action(
                self.on_view_sorting_direction_change,
                type="b",
                default=self.view_sorting_ascending,
            ),
            "use-dark-theme":
            Action(self.on_dark_theme_state_change,
                   type="b",
                   default=self.use_dark_theme),
            "show-tray-icon":
            Action(self.on_tray_icon_toggle,
                   type="b",
                   default=self.show_tray_icon),
            "show-side-bar":
            Action(
                self.on_sidebar_state_change,
                type="b",
                default=self.sidebar_visible,
                accel="F9",
            ),
        }

        self.actions = {}
        app = self.props.application
        for name, value in actions.items():
            if not value.type:
                action = Gio.SimpleAction.new(name)
                action.connect("activate", value.callback)
            else:
                default_value = None
                param_type = None
                if value.default is not None:
                    default_value = GLib.Variant(value.type, value.default)
                if value.type != "b":
                    param_type = default_value.get_type()
                action = Gio.SimpleAction.new_stateful(name, param_type,
                                                       default_value)
                action.connect("change-state", value.callback)
            self.actions[name] = action
            if value.enabled is False:
                action.props.enabled = False
            self.add_action(action)
            if value.accel:
                app.add_accelerator(value.accel, "win." + name)
Ejemplo n.º 12
0
 def on_view_game(self, _widget):
     """Callback to open a game on lutris.net"""
     open_uri("https://lutris.net/games/%s" % self.game.slug)
Ejemplo n.º 13
0
 def on_open_downloads_clicked(_widget):
     open_uri("http://lutris.net")
Ejemplo n.º 14
0
 def on_folder_clicked(_widget):
     open_uri("file://" + settings.RUNNER_DIR)
Ejemplo n.º 15
0
 def on_folder_clicked(_widget):
     open_uri("file://" + settings.RUNNER_DIR)
Ejemplo n.º 16
0
 def on_open_downloads_clicked(_widget):
     open_uri("http://lutris.net")
Ejemplo n.º 17
0
 def on_view_game(self, _widget):
     """Callback to open a game on lutris.net"""
     open_uri("https://lutris.net/games/%s" % self.game.slug)
Ejemplo n.º 18
0
    def _init_actions(self):
        Action = namedtuple(
            "Action", ("callback", "type", "enabled", "default", "accel")
        )
        Action.__new__.__defaults__ = (None, None, True, None, None)

        actions = {
            "browse-games": Action(lambda *x: open_uri("https://lutris.net/games/")),
            "register-account": Action(
                lambda *x: open_uri("https://lutris.net/user/register/")
            ),
            "disconnect": Action(self.on_disconnect),
            "connect": Action(self.on_connect),
            "synchronize": Action(lambda *x: self.sync_library()),
            "sync-local": Action(lambda *x: self.open_sync_dialog()),
            "add-game": Action(self.on_add_game_button_clicked),
            "preferences": Action(self.on_preferences_activate),
            "manage-runners": Action(self.on_manage_runners),
            "about": Action(self.on_about_clicked),
            "show-installed-only": Action(
                self.on_show_installed_state_change,
                type="b",
                default=self.filter_installed,
                accel="<Primary>h",
            ),
            "show-installed-first": Action(
                self.on_show_installed_first_state_change,
                type="b",
                default=self.show_installed_first,
            ),
            "toggle-viewtype": Action(self.on_toggle_viewtype),
            "icon-type": Action(
                self.on_icontype_state_change, type="s", default=self.icon_type
            ),
            "view-sorting": Action(
                self.on_view_sorting_state_change, type="s", default=self.view_sorting
            ),
            "view-sorting-ascending": Action(
                self.on_view_sorting_direction_change,
                type="b",
                default=self.view_sorting_ascending,
            ),
            "use-dark-theme": Action(
                self.on_dark_theme_state_change, type="b", default=self.use_dark_theme
            ),
            "show-side-bar": Action(
                self.on_sidebar_state_change,
                type="b",
                default=self.sidebar_visible,
                accel="F9",
            ),
            "open-forums": Action(lambda *x: open_uri("https://forums.lutris.net/")),
            "open-discord": Action(lambda *x: open_uri("https://discord.gg/Pnt5CuY")),
            "donate": Action(lambda *x: open_uri("https://lutris.net/donate")),
        }

        self.actions = {}
        app = self.props.application
        for name, value in actions.items():
            if not value.type:
                action = Gio.SimpleAction.new(name)
                action.connect("activate", value.callback)
            else:
                default_value = None
                param_type = None
                if value.default is not None:
                    default_value = GLib.Variant(value.type, value.default)
                if value.type != "b":
                    param_type = default_value.get_type()
                action = Gio.SimpleAction.new_stateful(name, param_type, default_value)
                action.connect("change-state", value.callback)
            self.actions[name] = action
            if value.enabled is False:
                action.props.enabled = False
            self.add_action(action)
            if value.accel:
                app.add_accelerator(value.accel, "win." + name)