mirror of
https://github.com/aclist/dztui.git
synced 2026-10-29 14:12:45 +01:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cc1ba2864 | ||
|
|
8c4d0aecdc | ||
|
|
616f18452a | ||
|
|
1064f7a9d6 | ||
|
|
b0e85f0e35 | ||
|
|
4d02604bcf | ||
|
|
61860f6aee |
No files matched your search
+20
-8
@@ -255,16 +255,28 @@ class PeFileError(Exception):
|
|||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def parse_version_number(data: BinaryIO) -> FileVersion:
|
def parse_version_number(data: BinaryIO) -> FileVersion:
|
||||||
# https://learn.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo
|
# https://learn.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo
|
||||||
minor = struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF
|
"""
|
||||||
major = struct.unpack("<L", data.read(4))[0] >> 0 & 0xFFFF
|
Note: structure differs from standard VS_FIXEDFILEINFO
|
||||||
build = struct.unpack("<L", data.read(4))[0] >> 0 & 0xFFFF
|
Major: lower 16 bits of first DWORD
|
||||||
# NOTE: 0-pad revision number
|
Minor: upper 16 bits of first DWORD
|
||||||
revision = str(struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF)
|
Build: lower 16 bits of third DWORD
|
||||||
offset = 3 - len(revision)
|
Revision: upper 16 bits of second DWORD, zero-padded
|
||||||
padded = "0" * offset + revision
|
Lower 16 bits of revision DWORD appear unused.
|
||||||
return FileVersion(major, minor, build, padded)
|
"""
|
||||||
|
major_minor = struct.unpack("<I", data.read(4))[0]
|
||||||
|
revision_pair = struct.unpack("<I", data.read(4))[0]
|
||||||
|
build_dword = struct.unpack("<I", data.read(4))[0]
|
||||||
|
|
||||||
|
major = major_minor & 0xFFFF
|
||||||
|
minor = (major_minor >> 16) & 0xFFFF
|
||||||
|
build = build_dword & 0xFFFF
|
||||||
|
revision = (revision_pair >> 16) & 0xFFFF
|
||||||
|
revision = f"{revision:03d}"
|
||||||
|
|
||||||
|
return FileVersion(major, minor, build, revision)
|
||||||
|
|
||||||
|
|
||||||
def seek_to_hex(address: str, data: BinaryIO) -> None:
|
def seek_to_hex(address: str, data: BinaryIO) -> None:
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ def get_details(record: Record) -> Details | None:
|
|||||||
dlc = strings.dlc_none
|
dlc = strings.dlc_none
|
||||||
case 2:
|
case 2:
|
||||||
dlc = strings.dlc_frostline
|
dlc = strings.dlc_frostline
|
||||||
case 3:
|
case 4:
|
||||||
dlc = strings.dlc_badlands
|
dlc = strings.dlc_badlands
|
||||||
case _:
|
case _:
|
||||||
dlc = strings.unspecified
|
dlc = strings.unspecified
|
||||||
|
|||||||
+4
-4
@@ -11,7 +11,7 @@ from typing import Any, Union
|
|||||||
from warnings import deprecated
|
from warnings import deprecated
|
||||||
|
|
||||||
from dzgui.api.acf import ACF
|
from dzgui.api.acf import ACF
|
||||||
from dzgui.init.prereqs import has_any_client
|
from dzgui.init.prereqs import has_steam_client
|
||||||
from dzgui.const.constants import (
|
from dzgui.const.constants import (
|
||||||
APPID_DAYZ,
|
APPID_DAYZ,
|
||||||
APPID_DAYZ_EXP,
|
APPID_DAYZ_EXP,
|
||||||
@@ -59,7 +59,7 @@ class VDFLoadError(Exception):
|
|||||||
|
|
||||||
def get_steam_paths() -> list[tuple[Path, str]]:
|
def get_steam_paths() -> list[tuple[Path, str]]:
|
||||||
paths = []
|
paths = []
|
||||||
if has_any_client():
|
if has_steam_client():
|
||||||
HOME = Path.home()
|
HOME = Path.home()
|
||||||
env = os.environ.get("XDG_DATA_HOME")
|
env = os.environ.get("XDG_DATA_HOME")
|
||||||
if env is not None:
|
if env is not None:
|
||||||
@@ -265,12 +265,12 @@ def find_user_id_32(path: Path) -> int:
|
|||||||
|
|
||||||
|
|
||||||
class SteamAPIKeyError(Exception):
|
class SteamAPIKeyError(Exception):
|
||||||
def __init__(self, msg: str | None = None) -> None:
|
def __init__(self, msg: str | None = None):
|
||||||
super().__init__(msg or api_validation_error)
|
super().__init__(msg or api_validation_error)
|
||||||
|
|
||||||
|
|
||||||
class SteamWorkshopEndpointError(Exception):
|
class SteamWorkshopEndpointError(Exception):
|
||||||
def __init__(self, msg: str | None = None) -> None:
|
def __init__(self, msg: str | None = None):
|
||||||
super().__init__(msg or workshop_endpoint_error)
|
super().__init__(msg or workshop_endpoint_error)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ from dzgui.init.migrate import (
|
|||||||
migrate_cols_file,
|
migrate_cols_file,
|
||||||
)
|
)
|
||||||
from dzgui.init.flock import lock_acquire
|
from dzgui.init.flock import lock_acquire
|
||||||
from dzgui.init.prereqs import has_any_client
|
from dzgui.init.prereqs import has_steam_client
|
||||||
from dzgui.strings import boot
|
from dzgui.strings import boot
|
||||||
|
|
||||||
from dzgui.util.deck import is_steam_deck, is_game_mode
|
from dzgui.util.deck import is_steam_deck, is_game_mode
|
||||||
@@ -136,7 +136,7 @@ def load_gui(version: str, is_debug: bool) -> None:
|
|||||||
# TODO: sudo escalation dialog
|
# TODO: sudo escalation dialog
|
||||||
# count = get_map_count()
|
# count = get_map_count()
|
||||||
# TODO: move into module
|
# TODO: move into module
|
||||||
if has_any_client() is False:
|
if has_steam_client() is False:
|
||||||
EarlyAlertDialog(init.requires_steam)
|
EarlyAlertDialog(init.requires_steam)
|
||||||
|
|
||||||
bootwin = BootWindow(XDG, version)
|
bootwin = BootWindow(XDG, version)
|
||||||
|
|||||||
+7
-20
@@ -7,32 +7,19 @@ from dzgui.const.constants import APP_NAME, FLATPAK_APPID, FLATPAK_CMD, STEAM_CM
|
|||||||
logger = logging.getLogger(APP_NAME)
|
logger = logging.getLogger(APP_NAME)
|
||||||
|
|
||||||
|
|
||||||
def has_flatpak_client() -> bool:
|
def has_steam_client() -> bool:
|
||||||
|
if shutil.which(STEAM_CMD):
|
||||||
|
return True
|
||||||
|
if not shutil.which(FLATPAK_CMD):
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
res = subprocess.run(
|
res = subprocess.run(
|
||||||
[FLATPAK_CMD, "list", "--columns=application"],
|
[FLATPAK_CMD, "list"], capture_output=True, text=True, check=True
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
check=True,
|
|
||||||
)
|
)
|
||||||
if FLATPAK_APPID in res.stdout:
|
if FLATPAK_APPID in res.stdout:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except Exception as e:
|
except subprocess.CalledProcessError as e:
|
||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def has_steam_client() -> bool:
|
|
||||||
if shutil.which(STEAM_CMD):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def has_any_client() -> bool:
|
|
||||||
if shutil.which(STEAM_CMD):
|
|
||||||
return True
|
|
||||||
if not shutil.which(FLATPAK_CMD):
|
|
||||||
return False
|
|
||||||
return has_flatpak_client()
|
|
||||||
@@ -3,8 +3,6 @@ from dzgui.strings import options
|
|||||||
from dzgui.views.components.box import HBox
|
from dzgui.views.components.box import HBox
|
||||||
from dzgui.views.components.buttons import Icon
|
from dzgui.views.components.buttons import Icon
|
||||||
|
|
||||||
from typing import Self
|
|
||||||
from dzgui.init.prereqs import has_steam_client, has_flatpak_client
|
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
@@ -16,55 +14,36 @@ class ClientCombo(Gtk.ComboBox):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
has_steam = has_steam_client()
|
self.client_store = Gtk.ListStore(str, str)
|
||||||
has_flatpak = has_flatpak_client()
|
|
||||||
self.client_store = Gtk.ListStore(str, str, bool)
|
|
||||||
self.clients = (
|
self.clients = (
|
||||||
(
|
(
|
||||||
options.steam_combo,
|
options.steam_combo,
|
||||||
STEAM_CMD,
|
STEAM_CMD,
|
||||||
has_steam,
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
options.flatpak_combo,
|
options.flatpak_combo,
|
||||||
FLATPAK_RUN_CMD,
|
FLATPAK_RUN_CMD,
|
||||||
has_flatpak,
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
options.flatpak_container_combo,
|
options.flatpak_container_combo,
|
||||||
FLATPAK_SANDBOX,
|
FLATPAK_SANDBOX,
|
||||||
has_flatpak,
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
for client in self.clients:
|
for client in self.clients:
|
||||||
self.client_store.append(client)
|
self.client_store.append(client)
|
||||||
|
|
||||||
self.set_model(self.client_store)
|
self.set_model(self.client_store)
|
||||||
renderer_text = Gtk.CellRendererText()
|
renderer_text = Gtk.CellRendererText()
|
||||||
self.pack_start(renderer_text, True)
|
self.pack_start(renderer_text, True)
|
||||||
self.add_attribute(renderer_text, "text", 0)
|
self.add_attribute(renderer_text, "text", 0)
|
||||||
self.set_active(0)
|
self.set_active(0)
|
||||||
|
|
||||||
self.set_cell_data_func(self.get_cells()[0], self.data_func)
|
|
||||||
|
|
||||||
def data_func(
|
|
||||||
self,
|
|
||||||
combo: Self,
|
|
||||||
cell: Gtk.CellRendererText,
|
|
||||||
model: Gtk.ListStore,
|
|
||||||
_iter: Gtk.TreeIter,
|
|
||||||
) -> None:
|
|
||||||
sens = model[_iter][2]
|
|
||||||
cell.set_property("sensitive", sens)
|
|
||||||
|
|
||||||
def get_client_human_readable(self, cmd: str) -> str:
|
def get_client_human_readable(self, cmd: str) -> str:
|
||||||
for client in self.clients:
|
for client in self.clients:
|
||||||
human, command, sens = client
|
human, command = client
|
||||||
if command == cmd:
|
if command == cmd:
|
||||||
return human
|
return human
|
||||||
raise TypeError("Not a valid Steam client selection")
|
raise TypeError("Not a valid Steam client selection")
|
||||||
|
|
||||||
|
|
||||||
class ErrorPopover(Gtk.Popover):
|
class ErrorPopover(Gtk.Popover):
|
||||||
def __init__(self, relative_to: Gtk.Widget, position: Gtk.PositionType) -> None:
|
def __init__(self, relative_to: Gtk.Widget, position: Gtk.PositionType) -> None:
|
||||||
super().__init__(relative_to=relative_to, position=position)
|
super().__init__(relative_to=relative_to, position=position)
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ description = "DayZ server browser and mod manager for Linux"
|
|||||||
authors = [
|
authors = [
|
||||||
{name = "aclist"}
|
{name = "aclist"}
|
||||||
]
|
]
|
||||||
version = "7.0.0b26"
|
version = "7.0.0b28"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
license-files = ["LICENSE"]
|
license-files = ["LICENSE"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
Reference in new issue
Block a user