-
-
Notifications
You must be signed in to change notification settings - Fork 50
CtInfo: Add Button to Mark Compat Tool as Global #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
83537b1
6e8cbdf
5236d50
98dc0ec
cbd2318
03cd5c3
b2ded73
5aad7b8
618083e
5b0793a
6fd4d26
9f7c1c2
02fd807
24061ce
05fb631
08849b7
922f9cf
c1fa092
6394f9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
from pupgui2.datastructures import BasicCompatTool, CTType, SteamApp, LutrisGame, HeroicGame | ||
from pupgui2.lutrisutil import get_lutris_game_list | ||
from pupgui2.pupgui2ctbatchupdatedialog import PupguiCtBatchUpdateDialog | ||
from pupgui2.steamutil import get_steam_game_list | ||
from pupgui2.steamutil import get_steam_game_list, set_global_compat_tool | ||
from pupgui2.util import open_webbrowser_thread, get_random_game_name | ||
from pupgui2.heroicutil import get_heroic_game_list, is_heroic_launcher | ||
|
||
|
@@ -29,6 +29,7 @@ def __init__(self, parent=None, ctool: BasicCompatTool = None, install_loc=None) | |
self.games: List[Union[SteamApp, LutrisGame, HeroicGame]] = [] | ||
self.install_loc = install_loc | ||
self.is_batch_update_available = False | ||
self.is_mark_global_available = (self.ctool.ct_type == CTType.CUSTOM and not self.ctool.is_global) and self.install_loc.get('launcher') == 'steam' and 'vdf_dir' in self.install_loc | ||
|
||
self.load_ui() | ||
self.setup_ui() | ||
|
@@ -46,6 +47,7 @@ def setup_ui(self): | |
self.ui.txtInstallDirectory.setText(self.ctool.get_install_dir()) | ||
self.ui.btnBatchUpdate.setVisible(False) | ||
self.ui.searchBox.setVisible(False) | ||
self.ui.btnMarkGlobal.setVisible(self.is_mark_global_available) | ||
|
||
self.update_game_list() | ||
|
||
|
@@ -64,6 +66,7 @@ def update_game_list(self, cached=True): | |
self.is_batch_update_available = True | ||
self.ui.btnBatchUpdate.setVisible(not self.ui.searchBox.isVisible()) | ||
self.ui.btnBatchUpdate.clicked.connect(self.btn_batch_update_clicked) | ||
self.ui.btnMarkGlobal.clicked.connect(self.btn_mark_global_clicked) | ||
elif self.install_loc.get('launcher') == 'lutris': | ||
self.update_game_list_lutris() | ||
elif is_heroic_launcher(self.install_loc.get('launcher')): | ||
|
@@ -161,3 +164,7 @@ def search_ctinfo_games(self, text): | |
for row in range(self.ui.listGames.rowCount()): | ||
should_hide: bool = not text.lower() in self.ui.listGames.item(row, 1).text().lower() | ||
self.ui.listGames.setRowHidden(row, should_hide) | ||
|
||
def btn_mark_global_clicked(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should disable the button after clicking because there currently is no visual feedback of the event. That could be as simple as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh that's a good idea! There's no reason to click this button again after marking a tool as global, at least not in the context of the currently open dialog. An edge case could be opening two ctinfo dialogs at once, say GE-Proton9-7 and Luxtorpeda (just to have distinct examples). This is extremely unlikely to ever happen and could be alleviated with other behaviour, it's not a reason against implementing this button disabling but an outline of a potential problem scenario (although again, I really don't think anyone would do this if they weren't trying to break something)
A big way to alleviate this being a problem is the confirmation dialog noted earlier, because it would vastly reduce the likelihood of accidentally setting a tool as global. There's also the possibility of closing the dialog which could be seen as expected since it's on the bottom row of the dialog buttons, but perhaps also not. Disabling the button makes sense to me, I'll add it when I get home. I'm not sure if we want to close dialogs after a tool is marked as global, it might be a little jarring. I also had a thought, I don't remember what happens if a tool is marked as global and then the game list is refreshed. If we get the "tool is global" text like if the user closed and re-opened the dialog, maybe the button also gets hidden, which I think is good too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, actually it seems like we don't hide the Mark Global button when the games list is refreshed. We check if we should display the Mark Global button when loading the ctinfo dialog with I'm thinking we should rework the logic like this:
Basically we move the logic to set whether the button is visible or not into The reason showing and hiding may be better is because we show/hide the button when the dialog opens. |
||
set_global_compat_tool(self.ctool, self.install_loc.get('vdf_dir')) | ||
self.btn_refresh_games_clicked() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reference to So if GE-Proton9-7's CtInfo dialog is open, and the global compat tool in However, it does update the compat tool list on the Main Menu to display And re-opening the dialog of course works as expected. I'm not sure how to fix this one, it is a bit of an edge-case and at worst something we can update in a later PR. |
Uh oh!
There was an error while loading. Please reload this page.