Skip to content

Commit

Permalink
Merge branch 'main' into bottlesdevs-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin authored Aug 5, 2023
2 parents 7069c04 + 6f74949 commit 5c84349
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 33 deletions.
17 changes: 9 additions & 8 deletions bottles/backend/managers/steam.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,24 +298,25 @@ def list_prefixes(self) -> Dict[str, BottleConfig]:
continue

_conf = BottleConfig()
_conf.Name = _acf["AppState"]["name"]
_conf.Name = _acf["AppState"].get("name", "Unknown")
_conf.Environment = "Steam"
_conf.CompatData = _dir_name
_conf.Path = os.path.join(_path, "pfx")
_conf.Runner = os.path.basename(_runner_path)
_conf.RunnerPath = _runner_path
_conf.WorkingDir = os.path.join(_conf["Path"], "drive_c")
_conf.WorkingDir = os.path.join(_conf.get("Path", ""), "drive_c")
_conf.Creation_Date = _creation_date
_conf.Update_Date = datetime.fromtimestamp(
int(_acf["AppState"]["LastUpdated"])
int(_acf["AppState"].get("LastUpdated", 0))
).strftime("%Y-%m-%d %H:%M:%S.%f")

# Launch options
_conf.Parameters.mangohud = ("mangohud" in _launch_options["command"])
_conf.Parameters.gamemode = ("gamemode" in _launch_options["command"])
_conf.Environment_Variables = _launch_options["env_vars"]
for p in _launch_options["env_params"]:
_conf.Parameters[p] = _launch_options["env_params"][p]
_conf.Parameters.mangohud = ("mangohud" in _launch_options.get("command", ""))
_conf.Parameters.gamemode = ("gamemode" in _launch_options.get("command", ""))
_conf.Environment_Variables = _launch_options.get("env_vars", {})
for p in _launch_options.get("env_params", {}):
_conf.Parameters[p] = _launch_options["env_params"].get(p, "")


prefixes[_dir_name] = _conf

Expand Down
4 changes: 3 additions & 1 deletion bottles/frontend/views/bottle_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __init__(self, details, config, **kwargs):
self.manager = details.window.manager
self.stack_bottle = details.stack_bottle
self.leaflet = details.leaflet
self.details = details
self.config = config
self.show_hidden = False

Expand Down Expand Up @@ -149,7 +150,6 @@ def __init__(self, details, config, **kwargs):
"flatpak/black-screen-or-silent-crash"
)


if "FLATPAK_ID" in os.environ:
'''
If Flatpak, show the btn_flatpak_doc widget to reach
Expand All @@ -162,6 +162,8 @@ def __change_page(self, _widget, page_name):
This function try to change the page based on user choice, if
the page is not available, it will show the "bottle" page.
"""
if page_name == "taskmanager":
self.details.view_taskmanager.update(config=self.config)
try:
self.stack_bottle.set_visible_child_name(page_name)
self.leaflet.navigate(Adw.NavigationDirection.FORWARD)
Expand Down
52 changes: 31 additions & 21 deletions bottles/frontend/views/bottle_taskmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,39 @@ def update(self, widget=False, config: Optional[BottleConfig] = None):
This function scan for new processed and update the
liststore_processes with the new data
"""
if config is None:
config = BottleConfig()
self.config = config
if not config.Runner:
return

self.liststore_processes.clear()
winebridge = WineBridge(config)

if winebridge.is_available():
processes = winebridge.get_procs()
else:
winedbg = WineDbg(config)
processes = winedbg.get_processes()

if len(processes) > 0:
for process in processes:
self.liststore_processes.append([
process.get("pid"),
process.get("name", "n/a"),
process.get("threads", "0"),
# process.get("parent", "0")
])
def fetch_processes(config: Optional[BottleConfig] = None):
if config is None:
config = BottleConfig()
self.config = config
if not config.Runner:
return

winebridge = WineBridge(config)

if winebridge.is_available():
processes = winebridge.get_procs()
else:
winedbg = WineDbg(config)
processes = winedbg.get_processes()
return processes

def update_processes(processes: list, *_args):
if len(processes) > 0:
for process in processes:
self.liststore_processes.append([
process.get("pid"),
process.get("name", "n/a"),
process.get("threads", "0"),
# process.get("parent", "0")
])

RunAsync(
task_func=fetch_processes,
callback=update_processes,
config=config
)

def sensitive_update(self, widget):
@GtkUtils.run_in_main_loop
Expand Down
14 changes: 13 additions & 1 deletion bottles/frontend/windows/drives.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def __remove(self, *_args):
destroy the widget
"""
Drives(self.config).remove_drive(self.drive[0])
self.parent.str_list_letters.append(self.drive[0])
self.parent.list_drives.remove(self)
self.parent.add_combo_letter(self.drive[0])


@Gtk.Template(resource_path='/com/usebottles/bottles/dialog-drives.ui')
Expand Down Expand Up @@ -151,3 +151,15 @@ def __populate_combo_letter(self):
self.btn_save.set_sensitive(True)

self.combo_letter.set_selected(0)

def add_combo_letter(self, letter):
list_copy = list(map(lambda item: item.get_string(), self.str_list_letters))

self.str_list_letters.splice(0, self.str_list_letters.get_n_items())

for item in self.__alphabet:
if item in list_copy or item == letter:
self.str_list_letters.append(item)

self.combo_letter.set_selected(0)

4 changes: 2 additions & 2 deletions com.usebottles.bottles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ inherit-extensions:
add-extensions:
org.gnome.Platform.Compat.i386:
directory: lib/i386-linux-gnu
version: "44"
version: "43"

org.gnome.Platform.Compat.i386.Debug:
directory: lib/debug/lib/i386-linux-gnu
version: "44"
version: "43"
no-autodownload: true

com.valvesoftware.Steam.CompatibilityTool:
Expand Down

0 comments on commit 5c84349

Please sign in to comment.