refactor: rename steam_game to game_source for better clarity
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
parent
61964d21c7
commit
5d84dbad8e
@ -40,7 +40,7 @@ class ContextMenuManager:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
menu = QMenu(self.parent)
|
menu = QMenu(self.parent)
|
||||||
if game_card.steam_game != "true":
|
if game_card.game_source not in ("steam", "epic"):
|
||||||
desktop_dir = subprocess.check_output(['xdg-user-dir', 'DESKTOP']).decode('utf-8').strip()
|
desktop_dir = subprocess.check_output(['xdg-user-dir', 'DESKTOP']).decode('utf-8').strip()
|
||||||
desktop_path = os.path.join(desktop_dir, f"{game_card.name}.desktop")
|
desktop_path = os.path.join(desktop_dir, f"{game_card.name}.desktop")
|
||||||
if os.path.exists(desktop_path):
|
if os.path.exists(desktop_path):
|
||||||
|
@ -27,7 +27,7 @@ class GameCard(QFrame):
|
|||||||
openGameFolderRequested = Signal(str, str) # name, exec_line
|
openGameFolderRequested = Signal(str, str) # name, exec_line
|
||||||
|
|
||||||
def __init__(self, name, description, cover_path, appid, controller_support, exec_line,
|
def __init__(self, name, description, cover_path, appid, controller_support, exec_line,
|
||||||
last_launch, formatted_playtime, protondb_tier, anticheat_status, last_launch_ts, playtime_seconds, steam_game,
|
last_launch, formatted_playtime, protondb_tier, anticheat_status, last_launch_ts, playtime_seconds, game_source,
|
||||||
select_callback, theme=None, card_width=250, parent=None, context_menu_manager=None):
|
select_callback, theme=None, card_width=250, parent=None, context_menu_manager=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -40,7 +40,7 @@ class GameCard(QFrame):
|
|||||||
self.formatted_playtime = formatted_playtime
|
self.formatted_playtime = formatted_playtime
|
||||||
self.protondb_tier = protondb_tier
|
self.protondb_tier = protondb_tier
|
||||||
self.anticheat_status = anticheat_status
|
self.anticheat_status = anticheat_status
|
||||||
self.steam_game = steam_game
|
self.game_source = game_source
|
||||||
self.last_launch_ts = last_launch_ts
|
self.last_launch_ts = last_launch_ts
|
||||||
self.playtime_seconds = playtime_seconds
|
self.playtime_seconds = playtime_seconds
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ class GameCard(QFrame):
|
|||||||
)
|
)
|
||||||
self.steamLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
self.steamLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
self.steamLabel.setFixedWidth(int(card_width * 2/3))
|
self.steamLabel.setFixedWidth(int(card_width * 2/3))
|
||||||
steam_visible = (str(steam_game).lower() == "true")
|
steam_visible = (str(game_source).lower() == "steam")
|
||||||
self.steamLabel.setVisible(steam_visible)
|
self.steamLabel.setVisible(steam_visible)
|
||||||
|
|
||||||
# Epic Games Store бейдж
|
# Epic Games Store бейдж
|
||||||
@ -167,7 +167,7 @@ class GameCard(QFrame):
|
|||||||
)
|
)
|
||||||
self.egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
self.egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
self.egsLabel.setFixedWidth(int(card_width * 2/3))
|
self.egsLabel.setFixedWidth(int(card_width * 2/3))
|
||||||
egs_visible = (str(steam_game).lower() == "epic")
|
egs_visible = (str(game_source).lower() == "epic")
|
||||||
self.egsLabel.setVisible(egs_visible)
|
self.egsLabel.setVisible(egs_visible)
|
||||||
|
|
||||||
# PortProton badge
|
# PortProton badge
|
||||||
@ -182,7 +182,7 @@ class GameCard(QFrame):
|
|||||||
)
|
)
|
||||||
self.portprotonLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
self.portprotonLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
self.portprotonLabel.setFixedWidth(int(card_width * 2/3))
|
self.portprotonLabel.setFixedWidth(int(card_width * 2/3))
|
||||||
portproton_visible = (str(steam_game).lower() == "false")
|
portproton_visible = (str(game_source).lower() == "portproton")
|
||||||
self.portprotonLabel.setVisible(portproton_visible)
|
self.portprotonLabel.setVisible(portproton_visible)
|
||||||
|
|
||||||
# WeAntiCheatYet бейдж
|
# WeAntiCheatYet бейдж
|
||||||
@ -496,7 +496,7 @@ class GameCard(QFrame):
|
|||||||
self.last_launch,
|
self.last_launch,
|
||||||
self.formatted_playtime,
|
self.formatted_playtime,
|
||||||
self.protondb_tier,
|
self.protondb_tier,
|
||||||
self.steam_game,
|
self.game_source,
|
||||||
self.anticheat_status
|
self.anticheat_status
|
||||||
)
|
)
|
||||||
super().mousePressEvent(event)
|
super().mousePressEvent(event)
|
||||||
@ -513,7 +513,7 @@ class GameCard(QFrame):
|
|||||||
self.last_launch,
|
self.last_launch,
|
||||||
self.formatted_playtime,
|
self.formatted_playtime,
|
||||||
self.protondb_tier,
|
self.protondb_tier,
|
||||||
self.steam_game,
|
self.game_source,
|
||||||
self.anticheat_status
|
self.anticheat_status
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -314,7 +314,7 @@ class MainWindow(QMainWindow):
|
|||||||
'controller_support': '',
|
'controller_support': '',
|
||||||
'protondb_tier': '',
|
'protondb_tier': '',
|
||||||
'name': name,
|
'name': name,
|
||||||
'steam_game': 'true'
|
'game_source': 'steam'
|
||||||
}
|
}
|
||||||
last_launch = format_last_launch(datetime.fromtimestamp(last_played)) if last_played else _("Never")
|
last_launch = format_last_launch(datetime.fromtimestamp(last_played)) if last_played else _("Never")
|
||||||
steam_games.append((
|
steam_games.append((
|
||||||
@ -330,7 +330,7 @@ class MainWindow(QMainWindow):
|
|||||||
info.get("anticheat_status", ""),
|
info.get("anticheat_status", ""),
|
||||||
last_played,
|
last_played,
|
||||||
playtime_seconds,
|
playtime_seconds,
|
||||||
"true"
|
"steam"
|
||||||
))
|
))
|
||||||
processed_count += 1
|
processed_count += 1
|
||||||
self.pending_games.append(None)
|
self.pending_games.append(None)
|
||||||
@ -462,7 +462,6 @@ class MainWindow(QMainWindow):
|
|||||||
final_cover = (user_cover if user_cover else
|
final_cover = (user_cover if user_cover else
|
||||||
builtin_cover if builtin_cover else
|
builtin_cover if builtin_cover else
|
||||||
steam_info.get("cover", "") or entry.get("Icon", ""))
|
steam_info.get("cover", "") or entry.get("Icon", ""))
|
||||||
steam_game = "false"
|
|
||||||
callback((
|
callback((
|
||||||
final_name,
|
final_name,
|
||||||
final_desc,
|
final_desc,
|
||||||
@ -476,7 +475,7 @@ class MainWindow(QMainWindow):
|
|||||||
steam_info.get("anticheat_status", ""),
|
steam_info.get("anticheat_status", ""),
|
||||||
get_last_launch_timestamp(exe_name) if exe_name else 0,
|
get_last_launch_timestamp(exe_name) if exe_name else 0,
|
||||||
playtime_seconds,
|
playtime_seconds,
|
||||||
steam_game
|
"portproton"
|
||||||
))
|
))
|
||||||
|
|
||||||
get_steam_game_info_async(desktop_name, exec_line, on_steam_info)
|
get_steam_game_info_async(desktop_name, exec_line, on_steam_info)
|
||||||
@ -1320,7 +1319,7 @@ class MainWindow(QMainWindow):
|
|||||||
def darkenColor(self, color, factor=200):
|
def darkenColor(self, color, factor=200):
|
||||||
return color.darker(factor)
|
return color.darker(factor)
|
||||||
|
|
||||||
def openGameDetailPage(self, name, description, cover_path=None, appid="", exec_line="", controller_support="", last_launch="", formatted_playtime="", protondb_tier="", steam_game="", anticheat_status=""):
|
def openGameDetailPage(self, name, description, cover_path=None, appid="", exec_line="", controller_support="", last_launch="", formatted_playtime="", protondb_tier="", game_source="", anticheat_status=""):
|
||||||
detailPage = QWidget()
|
detailPage = QWidget()
|
||||||
self._animations = {}
|
self._animations = {}
|
||||||
imageLabel = QLabel()
|
imageLabel = QLabel()
|
||||||
@ -1388,7 +1387,7 @@ class MainWindow(QMainWindow):
|
|||||||
favoriteLabelCover.move(8, 8)
|
favoriteLabelCover.move(8, 8)
|
||||||
favoriteLabelCover.raise_()
|
favoriteLabelCover.raise_()
|
||||||
|
|
||||||
# Добавляем бейджи (ProtonDB, Steam, WeAntiCheatYet)
|
# Добавляем бейджи (ProtonDB, Steam, PortProton, WeAntiCheatYet)
|
||||||
right_margin = 8
|
right_margin = 8
|
||||||
badge_spacing = 5
|
badge_spacing = 5
|
||||||
top_y = 10
|
top_y = 10
|
||||||
@ -1428,7 +1427,7 @@ class MainWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
steamLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
steamLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
steamLabel.setFixedWidth(badge_width)
|
steamLabel.setFixedWidth(badge_width)
|
||||||
steam_visible = (str(steam_game).lower() == "true")
|
steam_visible = (str(game_source).lower() == "steam")
|
||||||
steamLabel.setVisible(steam_visible)
|
steamLabel.setVisible(steam_visible)
|
||||||
steamLabel.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(f"https://steamcommunity.com/app/{appid}")))
|
steamLabel.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(f"https://steamcommunity.com/app/{appid}")))
|
||||||
|
|
||||||
@ -1444,7 +1443,7 @@ class MainWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
egsLabel.setFixedWidth(badge_width)
|
egsLabel.setFixedWidth(badge_width)
|
||||||
egs_visible = (str(steam_game).lower() == "epic")
|
egs_visible = (str(game_source).lower() == "epic")
|
||||||
egsLabel.setVisible(egs_visible)
|
egsLabel.setVisible(egs_visible)
|
||||||
|
|
||||||
# PortProton badge
|
# PortProton badge
|
||||||
@ -1459,7 +1458,7 @@ class MainWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
portprotonLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
portprotonLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
portprotonLabel.setFixedWidth(badge_width)
|
portprotonLabel.setFixedWidth(badge_width)
|
||||||
portproton_visible = (str(steam_game).lower() == "false")
|
portproton_visible = (str(game_source).lower() == "portproton")
|
||||||
portprotonLabel.setVisible(portproton_visible)
|
portprotonLabel.setVisible(portproton_visible)
|
||||||
|
|
||||||
# WeAntiCheatYet бейдж
|
# WeAntiCheatYet бейдж
|
||||||
@ -1665,7 +1664,7 @@ class MainWindow(QMainWindow):
|
|||||||
focused_widget.last_launch,
|
focused_widget.last_launch,
|
||||||
focused_widget.formatted_playtime,
|
focused_widget.formatted_playtime,
|
||||||
focused_widget.protondb_tier,
|
focused_widget.protondb_tier,
|
||||||
focused_widget.steam_game
|
focused_widget.game_source
|
||||||
)
|
)
|
||||||
|
|
||||||
def goBackDetailPage(self, page: QWidget | None) -> None:
|
def goBackDetailPage(self, page: QWidget | None) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user