mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 11:47:17 +02:00
Compare commits
8 Commits
c4cc9f04c4
...
20dab38fff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20dab38fff | ||
|
|
1ddc4a5ff1 | ||
|
|
d605447fca | ||
|
|
94fe3f9dff | ||
|
|
a966993999 | ||
|
|
8ee3b36816 | ||
|
|
3af53775cd | ||
|
|
e2d6a462db |
@ -73,14 +73,9 @@ def get_local_signatures(version_file: Path) -> dict[str, int]:
|
|||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
|
||||||
def enqueue_mod(mod: str, appid: int) -> None:
|
def enqueue_mod(client: str, mod: str, appid: int) -> None:
|
||||||
args = [
|
client_args = concat_bash_args(client)
|
||||||
"steam",
|
subprocess.Popen([*client_args, "+workshop_download_item", str(appid), mod])
|
||||||
f"steam://url/CommunityFilePage/{mod}+workshop_download_item",
|
|
||||||
str(appid),
|
|
||||||
mod,
|
|
||||||
]
|
|
||||||
subprocess.Popen(["/usr/bin/env", "bash", *args])
|
|
||||||
|
|
||||||
|
|
||||||
def get_needs_update(
|
def get_needs_update(
|
||||||
@ -146,7 +141,7 @@ def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> i
|
|||||||
return proc.returncode
|
return proc.returncode
|
||||||
|
|
||||||
|
|
||||||
def load_to_menu(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
def load_to_menu(client: str, appid: int, name: str, mods: list[str]) -> int:
|
||||||
"""Loads to the menu screen with the selected mods; used for AFK/pre-joining"""
|
"""Loads to the menu screen with the selected mods; used for AFK/pre-joining"""
|
||||||
concat = concat_mods(mods)
|
concat = concat_mods(mods)
|
||||||
client_args = concat_bash_args(client)
|
client_args = concat_bash_args(client)
|
||||||
|
|||||||
@ -88,6 +88,7 @@ class ConnectionManager:
|
|||||||
self.record: Record
|
self.record: Record
|
||||||
self.workshop: Path
|
self.workshop: Path
|
||||||
|
|
||||||
|
self.client: str
|
||||||
self.remote_mod_ids: list[str] = []
|
self.remote_mod_ids: list[str] = []
|
||||||
self.missing_mods: list[tuple[str, str, int, int]] = []
|
self.missing_mods: list[tuple[str, str, int, int]] = []
|
||||||
|
|
||||||
@ -171,6 +172,7 @@ class ConnectionManager:
|
|||||||
client = self.controller.query_config(Preferences.CLIENT)
|
client = self.controller.query_config(Preferences.CLIENT)
|
||||||
running = is_steam_running(client)
|
running = is_steam_running(client)
|
||||||
steam_proc = SteamProcess(client_name, running)
|
steam_proc = SteamProcess(client_name, running)
|
||||||
|
self.client = client
|
||||||
|
|
||||||
game_mode = prefs.is_game_mode
|
game_mode = prefs.is_game_mode
|
||||||
|
|
||||||
@ -263,11 +265,10 @@ class ConnectionManager:
|
|||||||
def _connect_steam(self, menu_only: bool) -> None:
|
def _connect_steam(self, menu_only: bool) -> None:
|
||||||
addr = f"{self.record.ip}:{self.record.gameport}"
|
addr = f"{self.record.ip}:{self.record.gameport}"
|
||||||
playername = self.controller.query_config(Preferences.NAME)
|
playername = self.controller.query_config(Preferences.NAME)
|
||||||
client = self.controller.query_config(Preferences.CLIENT)
|
|
||||||
if menu_only:
|
if menu_only:
|
||||||
rc = load_to_menu(client, addr, self.appid, playername, self.remote_mod_ids)
|
rc = load_to_menu(self.client, self.appid, playername, self.remote_mod_ids)
|
||||||
else:
|
else:
|
||||||
rc = connect(client, addr, self.appid, playername, self.remote_mod_ids)
|
rc = connect(self.client, addr, self.appid, playername, self.remote_mod_ids)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
# TODO: log/pop the error
|
# TODO: log/pop the error
|
||||||
func = StoredFunc(self.controller.update_status)
|
func = StoredFunc(self.controller.update_status)
|
||||||
@ -298,7 +299,8 @@ class ConnectionManager:
|
|||||||
for title, mod, stamp, size in self.missing_mods:
|
for title, mod, stamp, size in self.missing_mods:
|
||||||
if self.controller.is_cancel_pending():
|
if self.controller.is_cancel_pending():
|
||||||
return
|
return
|
||||||
enqueue_mod(mod, self.appid)
|
enqueue_mod(self.client, mod, self.appid)
|
||||||
|
# NOTE: prevents rate limiting
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
if raise_window is True:
|
if raise_window is True:
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
from typing import Self, Union, TYPE_CHECKING
|
from typing import Self, Union, TYPE_CHECKING
|
||||||
from warnings import deprecated
|
|
||||||
|
|
||||||
from dzgui.const.enum import NotebookPage, ServerTab
|
from dzgui.const.enum import NotebookPage, ServerTab
|
||||||
from dzgui.util.strings import esc_to_return, question_to_return
|
from dzgui.util.strings import esc_to_return, question_to_return
|
||||||
@ -26,6 +25,8 @@ class Statusbar(Gtk.Grid):
|
|||||||
self.controller.register_widget("statusbar", self)
|
self.controller.register_widget("statusbar", self)
|
||||||
self.emitter = controller.get_emitter()
|
self.emitter = controller.get_emitter()
|
||||||
|
|
||||||
|
self.prior_enum: NotebookPage
|
||||||
|
self.prior_status: str
|
||||||
self.playercount = ""
|
self.playercount = ""
|
||||||
self.statusbar = Gtk.Statusbar()
|
self.statusbar = Gtk.Statusbar()
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ class Statusbar(Gtk.Grid):
|
|||||||
NotebookPage.LOG,
|
NotebookPage.LOG,
|
||||||
NotebookPage.CONNECTION,
|
NotebookPage.CONNECTION,
|
||||||
):
|
):
|
||||||
|
self.prior_enum = enum
|
||||||
self.set_by_context(enum, esc_to_return)
|
self.set_by_context(enum, esc_to_return)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -80,8 +82,9 @@ class Statusbar(Gtk.Grid):
|
|||||||
case NotebookPage.KEYS:
|
case NotebookPage.KEYS:
|
||||||
bar = question_to_return
|
bar = question_to_return
|
||||||
case _:
|
case _:
|
||||||
return
|
bar = self.prior_status
|
||||||
|
|
||||||
|
self.prior_enum = enum
|
||||||
self.set_by_context(enum, bar)
|
self.set_by_context(enum, bar)
|
||||||
|
|
||||||
def _on_server_row_changed(self, statusbar: Self) -> None:
|
def _on_server_row_changed(self, statusbar: Self) -> None:
|
||||||
@ -97,6 +100,10 @@ class Statusbar(Gtk.Grid):
|
|||||||
context: Union["ServerTab", NotebookPage],
|
context: Union["ServerTab", NotebookPage],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.spinner.stop()
|
self.spinner.stop()
|
||||||
|
|
||||||
|
if type(context) is NotebookPage:
|
||||||
|
self.prior_enum = context
|
||||||
|
self.prior_status = ""
|
||||||
# FIXME: CalcDist is being called when table is not loaded
|
# FIXME: CalcDist is being called when table is not loaded
|
||||||
if dist is None:
|
if dist is None:
|
||||||
return
|
return
|
||||||
@ -121,6 +128,8 @@ class Statusbar(Gtk.Grid):
|
|||||||
def set_by_context(
|
def set_by_context(
|
||||||
self, context: Union[NotebookPage, "ServerTab"], string: str
|
self, context: Union[NotebookPage, "ServerTab"], string: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if context != NotebookPage.KEYS:
|
||||||
|
self.prior_status = string
|
||||||
meta = self.statusbar.get_context_id(str(context))
|
meta = self.statusbar.get_context_id(str(context))
|
||||||
self.statusbar.push(meta, string)
|
self.statusbar.push(meta, string)
|
||||||
self.set_cache(string)
|
self.set_cache(string)
|
||||||
|
|||||||
@ -327,10 +327,7 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
self.connect_last.hide()
|
self.connect_last.hide()
|
||||||
|
|
||||||
self._process_warnings(prereqs)
|
self._process_warnings(prereqs)
|
||||||
if self.tree.is_visible():
|
self.tree.grab_focus()
|
||||||
self.tree.grab_focus()
|
|
||||||
else:
|
|
||||||
self.grab_focus()
|
|
||||||
|
|
||||||
def mark_finished(self) -> None:
|
def mark_finished(self) -> None:
|
||||||
self.mod_count.set_label(preconnect.all_updated)
|
self.mod_count.set_label(preconnect.all_updated)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from typing import Any, Optional, TYPE_CHECKING
|
|||||||
from warnings import deprecated
|
from warnings import deprecated
|
||||||
|
|
||||||
from dzgui.const.constants import APP_NAME, SEPARATOR
|
from dzgui.const.constants import APP_NAME, SEPARATOR
|
||||||
from dzgui.util.keys import is_navkey
|
from dzgui.util.keys import is_ctrl_mask, is_navkey
|
||||||
from dzgui.views.mixins.cursor_mixin import CursorMixin
|
from dzgui.views.mixins.cursor_mixin import CursorMixin
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@ -85,10 +85,17 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
|||||||
model, rows = sel.get_selected_rows()
|
model, rows = sel.get_selected_rows()
|
||||||
return [model[row] for row in rows]
|
return [model[row] for row in rows]
|
||||||
|
|
||||||
def _on_keypress(self, treeview: Gtk.TreeView, event: Gdk.EventKey) -> None:
|
def _on_keypress(self, treeview: Gtk.TreeView, event: Gdk.EventKey) -> bool:
|
||||||
|
from dzgui.views.trees.tree_servers import ServerTreeView
|
||||||
|
|
||||||
|
# NOTE: suppress popup search and delegate binding to server view (cf. request_keyword_focus)
|
||||||
|
if not isinstance(treeview, ServerTreeView):
|
||||||
|
if is_ctrl_mask(event) and event.keyval == Gdk.KEY_f:
|
||||||
|
return True
|
||||||
|
|
||||||
if is_navkey(event.keyval):
|
if is_navkey(event.keyval):
|
||||||
if self.get_model() is None:
|
if self.get_model() is None:
|
||||||
return
|
return True
|
||||||
if self.sel_blocked is False:
|
if self.sel_blocked is False:
|
||||||
self.sel_blocked = True
|
self.sel_blocked = True
|
||||||
self.controller.suppress_signal(
|
self.controller.suppress_signal(
|
||||||
@ -98,7 +105,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
|||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
self._vim_nav(event)
|
self._vim_nav(event)
|
||||||
return
|
return False
|
||||||
|
|
||||||
def _on_key_release(self, treeview: Gtk.TreeView, event: Gdk.EventKey) -> None:
|
def _on_key_release(self, treeview: Gtk.TreeView, event: Gdk.EventKey) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -30,8 +30,6 @@ class ModTreeView(ModsMixin, ContextMixin, TreeView): # type: ignore
|
|||||||
emitter.connect("mods_highlighted", self._on_mods_highlighted)
|
emitter.connect("mods_highlighted", self._on_mods_highlighted)
|
||||||
|
|
||||||
self.set_fixed_height_mode(True)
|
self.set_fixed_height_mode(True)
|
||||||
self.set_headers_visible(True)
|
|
||||||
|
|
||||||
self.set_model(None)
|
self.set_model(None)
|
||||||
|
|
||||||
for i, column_title in enumerate(strings.mod_cols):
|
for i, column_title in enumerate(strings.mod_cols):
|
||||||
@ -64,6 +62,7 @@ class ModTreeView(ModsMixin, ContextMixin, TreeView): # type: ignore
|
|||||||
def _on_mods_updated(self, emitter: "Emitter", msg: str, mods: int) -> None:
|
def _on_mods_updated(self, emitter: "Emitter", msg: str, mods: int) -> None:
|
||||||
if mods < 1:
|
if mods < 1:
|
||||||
return
|
return
|
||||||
|
self.set_headers_visible(True)
|
||||||
path = Gtk.TreePath.new_from_indices([0])
|
path = Gtk.TreePath.new_from_indices([0])
|
||||||
self.set_cursor(path)
|
self.set_cursor(path)
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ description = "DayZ server browser and mod manager for Linux"
|
|||||||
authors = [
|
authors = [
|
||||||
{name = "aclist"}
|
{name = "aclist"}
|
||||||
]
|
]
|
||||||
version = "7.0.0b10"
|
version = "7.0.0b11"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
license-files = ["LICENSE"]
|
license-files = ["LICENSE"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user