mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 03:37:00 +02:00
Compare commits
No commits in common. "20dab38fff81a270584deff296d1dd0da6db419d" and "c4cc9f04c4a7db9d26b82e714f21324f368d24dc" have entirely different histories.
20dab38fff
...
c4cc9f04c4
@ -73,9 +73,14 @@ def get_local_signatures(version_file: Path) -> dict[str, int]:
|
|||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
|
||||||
def enqueue_mod(client: str, mod: str, appid: int) -> None:
|
def enqueue_mod(mod: str, appid: int) -> None:
|
||||||
client_args = concat_bash_args(client)
|
args = [
|
||||||
subprocess.Popen([*client_args, "+workshop_download_item", str(appid), mod])
|
"steam",
|
||||||
|
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(
|
||||||
@ -141,7 +146,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, appid: int, name: str, mods: list[str]) -> int:
|
def load_to_menu(client: str, addr: 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,7 +88,6 @@ 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]] = []
|
||||||
|
|
||||||
@ -172,7 +171,6 @@ 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
|
||||||
|
|
||||||
@ -265,10 +263,11 @@ 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(self.client, self.appid, playername, self.remote_mod_ids)
|
rc = load_to_menu(client, addr, self.appid, playername, self.remote_mod_ids)
|
||||||
else:
|
else:
|
||||||
rc = connect(self.client, addr, self.appid, playername, self.remote_mod_ids)
|
rc = connect(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)
|
||||||
@ -299,8 +298,7 @@ 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(self.client, mod, self.appid)
|
enqueue_mod(mod, self.appid)
|
||||||
# NOTE: prevents rate limiting
|
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
if raise_window is True:
|
if raise_window is True:
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
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
|
||||||
@ -25,8 +26,6 @@ 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()
|
||||||
|
|
||||||
@ -72,7 +71,6 @@ 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
|
||||||
|
|
||||||
@ -82,9 +80,8 @@ class Statusbar(Gtk.Grid):
|
|||||||
case NotebookPage.KEYS:
|
case NotebookPage.KEYS:
|
||||||
bar = question_to_return
|
bar = question_to_return
|
||||||
case _:
|
case _:
|
||||||
bar = self.prior_status
|
return
|
||||||
|
|
||||||
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:
|
||||||
@ -100,10 +97,6 @@ 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
|
||||||
@ -128,8 +121,6 @@ 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,7 +327,10 @@ 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_ctrl_mask, is_navkey
|
from dzgui.util.keys import is_navkey
|
||||||
from dzgui.views.mixins.cursor_mixin import CursorMixin
|
from dzgui.views.mixins.cursor_mixin import CursorMixin
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@ -85,17 +85,10 @@ 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) -> bool:
|
def _on_keypress(self, treeview: Gtk.TreeView, event: Gdk.EventKey) -> None:
|
||||||
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 True
|
return
|
||||||
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(
|
||||||
@ -105,7 +98,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
|||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
self._vim_nav(event)
|
self._vim_nav(event)
|
||||||
return False
|
return
|
||||||
|
|
||||||
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,6 +30,8 @@ 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):
|
||||||
@ -62,7 +64,6 @@ 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.0b11"
|
version = "7.0.0b10"
|
||||||
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