mirror of
https://github.com/aclist/dztui.git
synced 2026-11-02 08:02:44 +01:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b47cb482f5 | ||
|
|
152999d728 | ||
|
|
cdcb3b794f | ||
|
|
cd23f403c9 | ||
|
|
a40bef8f82 |
No files matched your search
@@ -21,7 +21,7 @@ def write_desktop_file(exe_path: Path) -> Path:
|
|||||||
Terminal=false
|
Terminal=false
|
||||||
Exec={exe_path}
|
Exec={exe_path}
|
||||||
Name=DZGUI
|
Name=DZGUI
|
||||||
Comment=DayZ server browser and mod manager
|
Comment=dzgui
|
||||||
Icon={icon}
|
Icon={icon}
|
||||||
Categories=Game"""
|
Categories=Game"""
|
||||||
|
|
||||||
|
|||||||
@@ -162,8 +162,7 @@ class APIEntry(Gtk.Box):
|
|||||||
self.entry.connect("icon-release", self._on_icon_release)
|
self.entry.connect("icon-release", self._on_icon_release)
|
||||||
self.entry.connect("activate", self._on_field_activated)
|
self.entry.connect("activate", self._on_field_activated)
|
||||||
|
|
||||||
# TODO: strings
|
self.submit = Gtk.Button(label="Submit")
|
||||||
self.submit = Gtk.Button(label="Validate")
|
|
||||||
self.submit.set_sensitive(False)
|
self.submit.set_sensitive(False)
|
||||||
self.submit.connect("clicked", self._on_submit)
|
self.submit.connect("clicked", self._on_submit)
|
||||||
|
|
||||||
|
|||||||
@@ -50,13 +50,6 @@ class PageNum(Enum):
|
|||||||
FINAL = 8
|
FINAL = 8
|
||||||
|
|
||||||
|
|
||||||
class OptionalPageMixin:
|
|
||||||
"""Marks optional pages as advanceable"""
|
|
||||||
|
|
||||||
def _on_map(self, page: "ScrolledWizardPage") -> None:
|
|
||||||
EMITTER.emit("step_complete")
|
|
||||||
|
|
||||||
|
|
||||||
class DescriptionArea(Gtk.Box):
|
class DescriptionArea(Gtk.Box):
|
||||||
def __init__(self, text: str):
|
def __init__(self, text: str):
|
||||||
super().__init__(orientation=Gtk.Orientation.VERTICAL)
|
super().__init__(orientation=Gtk.Orientation.VERTICAL)
|
||||||
@@ -98,7 +91,6 @@ class ScrolledWizardPage(Gtk.ScrolledWindow):
|
|||||||
margin_top=50,
|
margin_top=50,
|
||||||
spacing=20,
|
spacing=20,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.add(self.box)
|
self.add(self.box)
|
||||||
self.prog = Progress()
|
self.prog = Progress()
|
||||||
self.box.pack_end(self.prog, expand=False, fill=False, padding=0)
|
self.box.pack_end(self.prog, expand=False, fill=False, padding=0)
|
||||||
@@ -223,7 +215,7 @@ class APIValidationPage(ScrolledWizardPage):
|
|||||||
self.spinner.stop()
|
self.spinner.stop()
|
||||||
|
|
||||||
|
|
||||||
class BMValidationPage(OptionalPageMixin, APIValidationPage): # type: ignore
|
class BMValidationPage(APIValidationPage):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
enum=PageNum.BM_API,
|
enum=PageNum.BM_API,
|
||||||
@@ -232,7 +224,6 @@ class BMValidationPage(OptionalPageMixin, APIValidationPage): # type: ignore
|
|||||||
link=BM_API_SETUP,
|
link=BM_API_SETUP,
|
||||||
func=self._validate,
|
func=self._validate,
|
||||||
)
|
)
|
||||||
self.connect("map", self._on_map)
|
|
||||||
|
|
||||||
@call_on_thread("", show_dialog=False)
|
@call_on_thread("", show_dialog=False)
|
||||||
def _validate(self, key: str) -> None:
|
def _validate(self, key: str) -> None:
|
||||||
@@ -449,11 +440,11 @@ class Assistant(Gtk.Assistant):
|
|||||||
def __init__(self, is_deck: bool, XDG: "Xdg"):
|
def __init__(self, is_deck: bool, XDG: "Xdg"):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
if is_deck:
|
if is_deck:
|
||||||
self.fullscreen()
|
# NOTE: deemed to be "safe" dimensions that exclude taskbar size
|
||||||
|
self.set_default_size(1085, 670)
|
||||||
else:
|
else:
|
||||||
self.set_default_size(1500, 900)
|
self.set_default_size(1500, 900)
|
||||||
|
|
||||||
self.is_binary = False if os.getenv("PYAPP") is None else True
|
|
||||||
self.config_path = XDG.config
|
self.config_path = XDG.config
|
||||||
|
|
||||||
self.config_values: dict[str, Any] = config_boilerplate
|
self.config_values: dict[str, Any] = config_boilerplate
|
||||||
@@ -494,7 +485,7 @@ class Assistant(Gtk.Assistant):
|
|||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
# NOTE: disabled for now on system-provided packages
|
# NOTE: disabled for now on system-provided packages
|
||||||
if isinstance(page, ShortcutCreationPage) and not self.is_binary:
|
if isinstance(page, ShortcutCreationPage) and os.getenv("PYAPP") is None:
|
||||||
continue
|
continue
|
||||||
self._add_page(page, page.get_page_type())
|
self._add_page(page, page.get_page_type())
|
||||||
|
|
||||||
@@ -509,33 +500,32 @@ class Assistant(Gtk.Assistant):
|
|||||||
|
|
||||||
def _advance_page(self, index: int) -> int:
|
def _advance_page(self, index: int) -> int:
|
||||||
page = self.get_nth_page(index)
|
page = self.get_nth_page(index)
|
||||||
|
# TODO: use enums/isinstance
|
||||||
match page:
|
match page:
|
||||||
case IntroductionPage():
|
case self.page1:
|
||||||
pass
|
pass
|
||||||
case ConfigMigrationPage():
|
case self.page2:
|
||||||
if page.is_migrated():
|
if self.page2.is_migrated():
|
||||||
steam_path = lookup(self.config_path, Preferences.DEFAULT)
|
steam_path = lookup(self.config_path, Preferences.DEFAULT)
|
||||||
self.page7.set_steam_path(steam_path)
|
self.page7.set_steam_path(steam_path)
|
||||||
offset = 1 if not self.is_binary else 2
|
return self.get_n_pages() - 2
|
||||||
self.setup_complete = True
|
case self.page3:
|
||||||
return self.get_n_pages() - offset
|
|
||||||
case SteamPathPage():
|
|
||||||
self.config_values["default_steam_path"] = page.get_path_from_radio()
|
self.config_values["default_steam_path"] = page.get_path_from_radio()
|
||||||
case SteamValidationPage():
|
case self.page4:
|
||||||
self.config_values["steam_api"] = page.get_api_key()
|
self.config_values["steam_api"] = page.get_api_key()
|
||||||
case BMValidationPage():
|
case self.page5:
|
||||||
self.config_values["bm_api"] = page.get_api_key()
|
self.config_values["bm_api"] = page.get_api_key()
|
||||||
case PreferencesPage():
|
# NOTE: collects config values before advancing to last page
|
||||||
# NOTE: collects config values before advancing to last page
|
case self.page6:
|
||||||
name, use_miles, client = self.page6.get_prefs()
|
name, use_miles, client = self.page6.get_prefs()
|
||||||
self.config_values["name"] = name
|
self.config_values["name"] = name
|
||||||
self.config_values["use_miles"] = use_miles
|
self.config_values["use_miles"] = use_miles
|
||||||
self.config_values["client"] = client
|
self.config_values["client"] = client
|
||||||
self.write_config()
|
self.write_config()
|
||||||
self.page7.set_steam_path(self.config_values["default_steam_path"])
|
self.page7.set_steam_path(self.config_values["default_steam_path"])
|
||||||
|
case self.page7:
|
||||||
|
self.page7.create_shortcuts()
|
||||||
self.setup_complete = True
|
self.setup_complete = True
|
||||||
case ShortcutCreationPage():
|
|
||||||
page.create_shortcuts()
|
|
||||||
case _:
|
case _:
|
||||||
raise AttributeError("Trying to advance a non-canonical page")
|
raise AttributeError("Trying to advance a non-canonical page")
|
||||||
return index + 1
|
return index + 1
|
||||||
@@ -579,7 +569,11 @@ class Assistant(Gtk.Assistant):
|
|||||||
bar.set_fraction(fraction)
|
bar.set_fraction(fraction)
|
||||||
bar.set_text(f"{page_num}/{total}")
|
bar.set_text(f"{page_num}/{total}")
|
||||||
|
|
||||||
if not isinstance(page, IntroductionPage):
|
# NOTE: disable forward action
|
||||||
|
# TODO: use page enums
|
||||||
|
if page == self.page5:
|
||||||
|
return
|
||||||
|
if page != self.page1:
|
||||||
EMITTER.emit("step_pending")
|
EMITTER.emit("step_pending")
|
||||||
|
|
||||||
|
|
||||||
@@ -606,7 +600,7 @@ class CheckboxWithLabel(Gtk.Box):
|
|||||||
self.button.set_active(state)
|
self.button.set_active(state)
|
||||||
|
|
||||||
|
|
||||||
class ShortcutCreationPage(OptionalPageMixin, ScrolledWizardPage): # type: ignore
|
class ShortcutCreationPage(ScrolledWizardPage):
|
||||||
def __init__(self, shortcut: Path) -> None:
|
def __init__(self, shortcut: Path) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
enum=PageNum.SHORTCUTS,
|
enum=PageNum.SHORTCUTS,
|
||||||
@@ -649,6 +643,9 @@ class ShortcutCreationPage(OptionalPageMixin, ScrolledWizardPage): # type: igno
|
|||||||
self.desktop_checkbox.set_active(state)
|
self.desktop_checkbox.set_active(state)
|
||||||
self.desktop_checkbox.set_sensitive(state)
|
self.desktop_checkbox.set_sensitive(state)
|
||||||
|
|
||||||
|
def _on_map(self, page: "ScrolledWizardPage") -> None:
|
||||||
|
EMITTER.emit("step_complete")
|
||||||
|
|
||||||
def set_steam_path(self, path: Path) -> None:
|
def set_steam_path(self, path: Path) -> None:
|
||||||
self.steam_path = path
|
self.steam_path = path
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ description = "DayZ server browser and mod manager for Linux"
|
|||||||
authors = [
|
authors = [
|
||||||
{name = "aclist"}
|
{name = "aclist"}
|
||||||
]
|
]
|
||||||
version = "7.0.0b18"
|
version = "7.0.0b19"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
license-files = ["LICENSE"]
|
license-files = ["LICENSE"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@@ -107,11 +107,11 @@ config-settings-package = { pygobject-stubs = { config = "Gtk3,Gdk3,Soup2" } }
|
|||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
markers = [
|
markers = [
|
||||||
"apitest: checks remote endpoints",
|
|
||||||
"config: config file keys/values",
|
"config: config file keys/values",
|
||||||
"mods: tests mod metadata/link creation",
|
"mods: tests mod metadata/link creation",
|
||||||
"pefile: validate PE files",
|
"pefile: validate PE files",
|
||||||
"post_install: requires a completed installation",
|
"post_install: requires a completed installation",
|
||||||
"redact: log redaction mechanisms",
|
"redact: log redaction mechanisms",
|
||||||
"slow: long-running tests",
|
"slow: long-running tests",
|
||||||
|
"webtest: checks remote endpoints"
|
||||||
]
|
]
|
||||||
@@ -4,7 +4,7 @@ from dzgui.config.query import get_config
|
|||||||
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
||||||
from dzgui.api import probe
|
from dzgui.api import probe
|
||||||
|
|
||||||
pytestmark = pytest.mark.apitest
|
pytestmark = pytest.mark.webtest
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
Reference in new issue
Block a user