mirror of
https://github.com/aclist/dztui.git
synced 2026-08-28 18:57:12 +02:00
chore: boilerplate
This commit is contained in:
parent
67eff054a3
commit
cf913eff1b
@ -6,8 +6,6 @@ from enum import Enum
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import BinaryIO, Self, Union
|
from typing import BinaryIO, Self, Union
|
||||||
|
|
||||||
from packaging.version import Version
|
|
||||||
|
|
||||||
from dzgui.const.constants import (
|
from dzgui.const.constants import (
|
||||||
APPID_DAYZ,
|
APPID_DAYZ,
|
||||||
APPID_DAYZ_EXP,
|
APPID_DAYZ_EXP,
|
||||||
@ -448,21 +446,6 @@ def get_app_path(folders_path: Path, appid: int) -> Path:
|
|||||||
return app_path
|
return app_path
|
||||||
|
|
||||||
|
|
||||||
# TODO: tests
|
|
||||||
#def compare_versions(local: DayZVersion, remote: DayZVersion) -> VersionMatch:
|
|
||||||
# local_str = Version(dayz_version_to_str(local))
|
|
||||||
# remote_str = Version(dayz_version_to_str(remote))
|
|
||||||
#
|
|
||||||
# if local_str == remote_str:
|
|
||||||
# return VersionMatch.SAME_VERSION
|
|
||||||
#
|
|
||||||
# if local_str < remote_str:
|
|
||||||
# return VersionMatch.LOCAL_OLDER
|
|
||||||
#
|
|
||||||
# if local_str > remote_str:
|
|
||||||
# return VersionMatch.LOCAL_NEWER
|
|
||||||
|
|
||||||
|
|
||||||
def get_pretty_version(steam_path: Path, appid: int) -> str | None:
|
def get_pretty_version(steam_path: Path, appid: int) -> str | None:
|
||||||
try:
|
try:
|
||||||
pe_file_path = get_pefile_path(steam_path, appid)
|
pe_file_path = get_pefile_path(steam_path, appid)
|
||||||
|
|||||||
@ -221,7 +221,7 @@ def parse_json(json: list) -> list:
|
|||||||
mapname = row["map"].lower()
|
mapname = row["map"].lower()
|
||||||
players = row["players"]
|
players = row["players"]
|
||||||
max_players = row["max_players"]
|
max_players = row["max_players"]
|
||||||
raw = [
|
raw = (
|
||||||
name,
|
name,
|
||||||
mapname,
|
mapname,
|
||||||
view,
|
view,
|
||||||
@ -234,7 +234,7 @@ def parse_json(json: list) -> list:
|
|||||||
ping,
|
ping,
|
||||||
provider,
|
provider,
|
||||||
modded,
|
modded,
|
||||||
]
|
)
|
||||||
rows.append(raw)
|
rows.append(raw)
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
|
|||||||
@ -323,6 +323,7 @@ class Controller(GObject.GObject):
|
|||||||
def _on_servers_loaded_init(self, emitter: "Emitter") -> None:
|
def _on_servers_loaded_init(self, emitter: "Emitter") -> None:
|
||||||
"""Triggered after servers load but prior to maps loading"""
|
"""Triggered after servers load but prior to maps loading"""
|
||||||
# FIXME: wipe maps store when changing tabs if model is none
|
# FIXME: wipe maps store when changing tabs if model is none
|
||||||
|
# e.g. select recent, toggle map, then select lan -> not wiped
|
||||||
tv = self.get_active_treeview()
|
tv = self.get_active_treeview()
|
||||||
if tv.loaded is False:
|
if tv.loaded is False:
|
||||||
return
|
return
|
||||||
|
|||||||
@ -83,13 +83,12 @@ def main() -> None:
|
|||||||
if args.version is True:
|
if args.version is True:
|
||||||
print(get_version())
|
print(get_version())
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.uninstall is True:
|
if args.uninstall is True:
|
||||||
uninstall()
|
uninstall()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.debug is True:
|
if args.debug is True:
|
||||||
warnings.filterwarnings("default", category=DeprecationWarning)
|
warnings.filterwarnings("default", category=DeprecationWarning)
|
||||||
|
|
||||||
version = get_version()
|
version = get_version()
|
||||||
set_locale()
|
set_locale()
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import gi # noqa E402
|
|
||||||
gi.require_version("Gtk", "3.0")
|
|
||||||
from gi.repository import Gtk, Gdk, GLib, GObject
|
|
||||||
|
|
||||||
from dzgui.util.strings import picker
|
from dzgui.util.strings import picker
|
||||||
|
|
||||||
|
import gi # noqa E402
|
||||||
|
|
||||||
|
gi.require_version("Gtk", "3.0")
|
||||||
|
from gi.repository import Gtk # noqa E402
|
||||||
|
|
||||||
|
|
||||||
class FilePicker(Gtk.FileChooserDialog):
|
class FilePicker(Gtk.FileChooserDialog):
|
||||||
def __init__(self, parent: Gtk.Window) -> None:
|
def __init__(self, parent: Gtk.Window) -> None:
|
||||||
|
|||||||
@ -45,6 +45,7 @@ class ServerDialog(GenericDialog):
|
|||||||
self.content = self.get_content_area()
|
self.content = self.get_content_area()
|
||||||
self.content.pack_start(self.scrollable_tree, EXPAND, FILL, 0)
|
self.content.pack_start(self.scrollable_tree, EXPAND, FILL, 0)
|
||||||
|
|
||||||
|
# TODO:
|
||||||
# def pack(self, widget: Gtk.Widget) -> None:
|
# def pack(self, widget: Gtk.Widget) -> None:
|
||||||
# self.content.pack_start(widget, EXPAND, FILL, NO_PADDING)
|
# self.content.pack_start(widget, EXPAND, FILL, NO_PADDING)
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
indent-width = 4
|
indent-width = 4
|
||||||
extend-exclude = ["tree_server_mods.py", "dialogs", "*lib/a2s"]
|
extend-exclude = ["*lib/a2s"]
|
||||||
lint.unfixable = ["F401"]
|
lint.unfixable = ["F401"]
|
||||||
|
|
||||||
[tool.ruff.format]
|
[tool.ruff.format]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user