mirror of
https://github.com/aclist/dztui.git
synced 2026-10-25 12:12:31 +01:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3d1d62b4d | ||
|
|
1dcfdda657 | ||
|
|
019847dcf9 | ||
|
|
c2cfe2b4d9 | ||
|
|
5cb8c68f5c | ||
|
|
2f92c2a44f | ||
|
|
da48834fa7 | ||
|
|
197c2eba06 | ||
|
|
0131ee6f0e |
No files matched your search
+10
-3
@@ -10,8 +10,8 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from dzgui.api.steam import find_user_id_32
|
from dzgui.api.steam import find_user_id_32
|
||||||
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER, IMAGES_PATH
|
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER, GTK_APP_ID, IMAGES_PATH
|
||||||
from dzgui.util.dirs import copy_dzgui_to_xdg_data
|
from dzgui.util.dirs import copy_dzgui_to_xdg_data, make_parents
|
||||||
from dzgui.util.strings import unknown
|
from dzgui.util.strings import unknown
|
||||||
|
|
||||||
logger = logging.getLogger(APP_NAME)
|
logger = logging.getLogger(APP_NAME)
|
||||||
@@ -75,6 +75,8 @@ class Shortcuts:
|
|||||||
shortcuts = vdf.binary_load(f)
|
shortcuts = vdf.binary_load(f)
|
||||||
self.shortcuts = shortcuts
|
self.shortcuts = shortcuts
|
||||||
logger.debug("Loaded shortcuts file")
|
logger.debug("Loaded shortcuts file")
|
||||||
|
except FileNotFoundError:
|
||||||
|
self.shortcuts = {"shortcuts": {}}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
raise e
|
raise e
|
||||||
@@ -109,6 +111,7 @@ class Shortcuts:
|
|||||||
for img in ("_hero", "p", "_logo"):
|
for img in ("_hero", "p", "_logo"):
|
||||||
filename = str(self.bpid) + img
|
filename = str(self.bpid) + img
|
||||||
dest = grid_path.joinpath(filename).with_suffix(".png")
|
dest = grid_path.joinpath(filename).with_suffix(".png")
|
||||||
|
make_parents(dest)
|
||||||
b = images.joinpath(img).with_suffix(".png").read_bytes()
|
b = images.joinpath(img).with_suffix(".png").read_bytes()
|
||||||
dest.write_bytes(b)
|
dest.write_bytes(b)
|
||||||
|
|
||||||
@@ -155,7 +158,8 @@ class Shortcuts:
|
|||||||
NEW_ENTRY["DevkitGameID"] = ""
|
NEW_ENTRY["DevkitGameID"] = ""
|
||||||
NEW_ENTRY["DevkitOverrideAppID"] = 0
|
NEW_ENTRY["DevkitOverrideAppID"] = 0
|
||||||
NEW_ENTRY["LastPlayTime"] = 0
|
NEW_ENTRY["LastPlayTime"] = 0
|
||||||
NEW_ENTRY["FlatpakAppID"] = ""
|
NEW_ENTRY["FlatpakAppID"] = GTK_APP_ID
|
||||||
|
|
||||||
NEW_ENTRY["sortas"] = ""
|
NEW_ENTRY["sortas"] = ""
|
||||||
NEW_ENTRY["tags"] = {}
|
NEW_ENTRY["tags"] = {}
|
||||||
return NEW_ENTRY
|
return NEW_ENTRY
|
||||||
@@ -172,6 +176,9 @@ class Shortcuts:
|
|||||||
try:
|
try:
|
||||||
backup = self.shortcuts_path.with_suffix(".vdf.bak")
|
backup = self.shortcuts_path.with_suffix(".vdf.bak")
|
||||||
shutil.copy(self.shortcuts_path, backup)
|
shutil.copy(self.shortcuts_path, backup)
|
||||||
|
except Exception as e:
|
||||||
|
logger.critical(e)
|
||||||
|
try:
|
||||||
with open(self.shortcuts_path, "wb") as f:
|
with open(self.shortcuts_path, "wb") as f:
|
||||||
vdf.binary_dump(self.shortcuts, f)
|
vdf.binary_dump(self.shortcuts, f)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
+28
-2
@@ -1,10 +1,13 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
from warnings import deprecated
|
||||||
|
|
||||||
|
|
||||||
from dzgui.const.constants import APP_NAME
|
from dzgui.const.constants import APP_NAME, STEAM_ICON, STEAM_ICONS_PATH
|
||||||
from dzgui.const.enum import Preferences
|
from dzgui.const.enum import Preferences
|
||||||
from dzgui.config.query import lookup
|
from dzgui.config.query import lookup
|
||||||
from dzgui.config.userprefs import UserPrefs
|
from dzgui.config.userprefs import UserPrefs
|
||||||
@@ -23,7 +26,7 @@ from dzgui.util.dirs import make_parents
|
|||||||
from dzgui.util.localize import set_locale
|
from dzgui.util.localize import set_locale
|
||||||
from dzgui.util.map_count import test_map_count
|
from dzgui.util.map_count import test_map_count
|
||||||
from dzgui.util.redact import RedactionFilter, REDACTION_PATTERNS
|
from dzgui.util.redact import RedactionFilter, REDACTION_PATTERNS
|
||||||
from dzgui.util.strings import init
|
from dzgui.util.strings import init, steam_icon_missing
|
||||||
|
|
||||||
from dzgui.views.base import App
|
from dzgui.views.base import App
|
||||||
from dzgui.views.dialogs.boot import BootWindow
|
from dzgui.views.dialogs.boot import BootWindow
|
||||||
@@ -96,6 +99,28 @@ def copy_bare_configs(config: "Path", resolution: "Path") -> tuple[bool, bool]:
|
|||||||
return (config_changed, state_changed)
|
return (config_changed, state_changed)
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("Currently unused")
|
||||||
|
def load_steam_icon(config: Path) -> None:
|
||||||
|
import gi
|
||||||
|
|
||||||
|
gi.require_version("Gtk", "3.0")
|
||||||
|
from gi.repository import Gtk # noqa
|
||||||
|
|
||||||
|
default = lookup(config, Preferences.DEFAULT)
|
||||||
|
icon_path = Path(default).joinpath(STEAM_ICONS_PATH)
|
||||||
|
try:
|
||||||
|
theme = Gtk.IconTheme.get_default()
|
||||||
|
paths = theme.get_search_path()
|
||||||
|
theme.set_search_path(paths + [str(icon_path)])
|
||||||
|
paths = theme.get_search_path()
|
||||||
|
icons = theme.list_icons(None)
|
||||||
|
if STEAM_ICON not in icons:
|
||||||
|
logger.warning(steam_icon_missing)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
logger.warning(e)
|
||||||
|
|
||||||
|
|
||||||
def load_gui(version: str, is_debug: bool) -> None:
|
def load_gui(version: str, is_debug: bool) -> None:
|
||||||
lock = lock_acquire() # noqa
|
lock = lock_acquire() # noqa
|
||||||
|
|
||||||
@@ -143,6 +168,7 @@ def load_gui(version: str, is_debug: bool) -> None:
|
|||||||
local_coords, latest_release = bootwin.get_results()
|
local_coords, latest_release = bootwin.get_results()
|
||||||
|
|
||||||
use_miles = lookup(XDG.config, Preferences.DIST)
|
use_miles = lookup(XDG.config, Preferences.DIST)
|
||||||
|
|
||||||
prefs = UserPrefs(
|
prefs = UserPrefs(
|
||||||
is_steam_deck=_is_steam_deck,
|
is_steam_deck=_is_steam_deck,
|
||||||
is_game_mode=_is_game_mode,
|
is_game_mode=_is_game_mode,
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ FLATPAK_ROOT_PATH = ".var/app/com.valvesoftware.Steam"
|
|||||||
FLATPAK_STEAM_PATH = FLATPAK_ROOT_PATH + "/data/Steam"
|
FLATPAK_STEAM_PATH = FLATPAK_ROOT_PATH + "/data/Steam"
|
||||||
UBUNTU_STEAM_PATH = ".steam/steam"
|
UBUNTU_STEAM_PATH = ".steam/steam"
|
||||||
DEBIAN_STEAM_PATH = ".steam/debian-installation"
|
DEBIAN_STEAM_PATH = ".steam/debian-installation"
|
||||||
|
STEAM_ICONS_PATH = "public"
|
||||||
|
|
||||||
LOG_FILTERS = ("CRITICAL", "WARNING", "INFO", "DEBUG")
|
LOG_FILTERS = ("CRITICAL", "WARNING", "INFO", "DEBUG")
|
||||||
|
|
||||||
|
|||||||
+1
-11
@@ -7,12 +7,11 @@ from dzgui.const.constants import (
|
|||||||
APP_NAME,
|
APP_NAME,
|
||||||
APP_NAME_LOWER,
|
APP_NAME_LOWER,
|
||||||
GTK_APP_ID,
|
GTK_APP_ID,
|
||||||
STEAM_ICON,
|
|
||||||
)
|
)
|
||||||
from dzgui.const.enum import NotebookPage
|
from dzgui.const.enum import NotebookPage
|
||||||
from dzgui.controllers.emitter import Emitter
|
from dzgui.controllers.emitter import Emitter
|
||||||
from dzgui.controllers.mc import Controller
|
from dzgui.controllers.mc import Controller
|
||||||
from dzgui.util import css, strings
|
from dzgui.util import css
|
||||||
from dzgui.util.keys import is_ctrl_mask
|
from dzgui.util.keys import is_ctrl_mask
|
||||||
from dzgui.views.components.connect_panel import ConnectPanel
|
from dzgui.views.components.connect_panel import ConnectPanel
|
||||||
from dzgui.views.components.crumbs import Breadcrumbs
|
from dzgui.views.components.crumbs import Breadcrumbs
|
||||||
@@ -332,13 +331,4 @@ class App(ColorAwareApp, Gtk.Application): # type: ignore
|
|||||||
) -> None:
|
) -> None:
|
||||||
self.win.halt_proc_and_quit()
|
self.win.halt_proc_and_quit()
|
||||||
|
|
||||||
|
|
||||||
MainController = Controller()
|
MainController = Controller()
|
||||||
|
|
||||||
try:
|
|
||||||
theme = Gtk.IconTheme.get_default()
|
|
||||||
icons = theme.list_icons(None)
|
|
||||||
if STEAM_ICON not in icons:
|
|
||||||
logger.warning(strings.steam_icon_missing)
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(e)
|
|
||||||
@@ -65,6 +65,7 @@ class IconButton(Gtk.Button):
|
|||||||
self.set_image(self.icon)
|
self.set_image(self.icon)
|
||||||
self.set_image_position(position)
|
self.set_image_position(position)
|
||||||
self.set_focus_on_click(False)
|
self.set_focus_on_click(False)
|
||||||
|
self.set_always_show_image(True)
|
||||||
|
|
||||||
def swap_icon(self, icon: str) -> None:
|
def swap_icon(self, icon: str) -> None:
|
||||||
start = self.icon.get_margin_start()
|
start = self.icon.get_margin_start()
|
||||||
|
|||||||
Reference in new issue
Block a user