Bottles import
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
Cartridges is a simple game launcher written in Python using GTK4 + Libadwaita.
|
Cartridges is a simple game launcher written in Python using GTK4 + Libadwaita.
|
||||||
### Features
|
### Features
|
||||||
- Manually adding and editing games
|
- Manually adding and editing games
|
||||||
- Importing games from Steam and Heroic
|
- Importing games from Steam, Heroic and Bottles
|
||||||
- Hiding games
|
- Hiding games
|
||||||
- Searching and sorting by title, date added and last played
|
- Searching and sorting by title, date added and last played
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<name>Cartridges</name>
|
<name>Cartridges</name>
|
||||||
<summary>Launch all your games</summary>
|
<summary>Launch all your games</summary>
|
||||||
<description>
|
<description>
|
||||||
<p>Cartridges is a simple game launcher. It has support for importing your games from Steam and Heroic with organizational features such as hiding and sorting by date added or last played.</p>
|
<p>Cartridges is a simple game launcher. It has support for importing your games from Steam, Heroic and Bottles with organizational features such as hiding and sorting by date added or last played.</p>
|
||||||
</description>
|
</description>
|
||||||
<launchable type="desktop-id">hu.kramo.Cartridges.desktop</launchable>
|
<launchable type="desktop-id">hu.kramo.Cartridges.desktop</launchable>
|
||||||
<developer_name>kramo</developer_name>
|
<developer_name>kramo</developer_name>
|
||||||
|
|||||||
@@ -69,5 +69,19 @@ template PreferencesWindow : Adw.PreferencesWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Adw.PreferencesGroup {
|
||||||
|
title: "Bottles";
|
||||||
|
|
||||||
|
Adw.ActionRow {
|
||||||
|
title: _("Bottles Install Location");
|
||||||
|
subtitle: _("Directory to use when importing games");
|
||||||
|
|
||||||
|
Button bottles_file_chooser_button {
|
||||||
|
icon-name: "folder-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
|
|
||||||
steam_file_chooser_button = Gtk.Template.Child()
|
steam_file_chooser_button = Gtk.Template.Child()
|
||||||
heroic_file_chooser_button = Gtk.Template.Child()
|
heroic_file_chooser_button = Gtk.Template.Child()
|
||||||
|
bottles_file_chooser_button = Gtk.Template.Child()
|
||||||
|
|
||||||
def __init__(self, parent_widget, **kwargs):
|
def __init__(self, parent_widget, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@@ -55,8 +56,15 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_bottles_dir(source, result, user_data):
|
||||||
|
try:
|
||||||
|
schema.set_string("bottles-location", filechooser.select_folder_finish(result).get_path())
|
||||||
|
except GLib.GError:
|
||||||
|
pass
|
||||||
|
|
||||||
def choose_folder(widget, function):
|
def choose_folder(widget, function):
|
||||||
filechooser.select_folder(parent_widget, None, function, None)
|
filechooser.select_folder(parent_widget, None, function, None)
|
||||||
|
|
||||||
self.steam_file_chooser_button.connect("clicked", choose_folder, set_steam_dir)
|
self.steam_file_chooser_button.connect("clicked", choose_folder, set_steam_dir)
|
||||||
self.heroic_file_chooser_button.connect("clicked", choose_folder, set_heroic_dir)
|
self.heroic_file_chooser_button.connect("clicked", choose_folder, set_heroic_dir)
|
||||||
|
self.bottles_file_chooser_button.connect("clicked", choose_folder, set_bottles_dir)
|
||||||
|
|||||||
@@ -69,6 +69,11 @@ def bottles_parser(parent_widget, action):
|
|||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
values["game_id"] = "bottles_" + game["id"]
|
values["game_id"] = "bottles_" + game["id"]
|
||||||
|
|
||||||
|
if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[
|
||||||
|
values["game_id"]].keys():
|
||||||
|
continue
|
||||||
|
|
||||||
values["name"] = game["name"]
|
values["name"] = game["name"]
|
||||||
values["executable"] = "xdg-open bottles:run/" + game["bottle"]["name"] + "/" + game["name"]
|
values["executable"] = "xdg-open bottles:run/" + game["bottle"]["name"] + "/" + game["name"]
|
||||||
values["hidden"] = False
|
values["hidden"] = False
|
||||||
@@ -77,7 +82,7 @@ def bottles_parser(parent_widget, action):
|
|||||||
values["last_played"] = 0
|
values["last_played"] = 0
|
||||||
|
|
||||||
if game["thumbnail"]:
|
if game["thumbnail"]:
|
||||||
values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(bottles_dir, "bottles", game["bottle"]["path"], "grids", game["thumbnail"].replace("grid:", "")))
|
values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(bottles_dir, "bottles", game["bottle"]["path"], "grids", game["thumbnail"].split(":")[1]))
|
||||||
|
|
||||||
bottles_games[values["game_id"]] = values
|
bottles_games[values["game_id"]] = values
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user