mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 07:02:50 +01:00
chore: clear typehinting errors
This commit is contained in:
1 parent
8fc7aa5165
commit
a3875789c1
5 files changed
+19
-15
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from typing import Any, Optional, TYPE_CHECKING, Union
|
from typing import Any, TYPE_CHECKING, Union
|
||||||
from warnings import deprecated
|
from warnings import deprecated
|
||||||
|
|
||||||
from dzgui.const.enum import FilterMode
|
from dzgui.const.enum import FilterMode
|
||||||
@@ -14,7 +14,6 @@ if TYPE_CHECKING:
|
|||||||
from dzgui.model.servers import NewPlayerCount
|
from dzgui.model.servers import NewPlayerCount
|
||||||
|
|
||||||
|
|
||||||
# TODO: annotate list contents (list[list[Any]])
|
|
||||||
class ProxyModelManager:
|
class ProxyModelManager:
|
||||||
"""
|
"""
|
||||||
Manages access to cached FastInsertListStore resources and
|
Manages access to cached FastInsertListStore resources and
|
||||||
@@ -35,9 +34,13 @@ class ProxyModelManager:
|
|||||||
self.proxy_model: "FastInsertListStore"
|
self.proxy_model: "FastInsertListStore"
|
||||||
self.filter_man = filter_man
|
self.filter_man = filter_man
|
||||||
|
|
||||||
# TODO: list typehints
|
self.control_model: (
|
||||||
self.control_model: list | None = None
|
list[tuple[str, str, str, str, int, int, int, str, int, int, str, bool]]
|
||||||
self.filtered: list = []
|
| None
|
||||||
|
) = None
|
||||||
|
self.filtered: list[
|
||||||
|
tuple[str, str, str, str, int, int, int, str, int, int, str, bool]
|
||||||
|
] = []
|
||||||
self.success = True
|
self.success = True
|
||||||
|
|
||||||
def has_control_model(self) -> bool:
|
def has_control_model(self) -> bool:
|
||||||
@@ -48,7 +51,9 @@ class ProxyModelManager:
|
|||||||
def append_row(self, row: list) -> None:
|
def append_row(self, row: list) -> None:
|
||||||
self.proxy_model.append(row)
|
self.proxy_model.append(row)
|
||||||
|
|
||||||
def append_row_to_control(self, row: list) -> None:
|
def append_row_to_control(
|
||||||
|
self, row: tuple[str, str, str, str, int, int, int, str, int, int, str, bool]
|
||||||
|
) -> None:
|
||||||
if self.control_model is None:
|
if self.control_model is None:
|
||||||
raise AttributeError("Trying to add rows to a non-existent model")
|
raise AttributeError("Trying to add rows to a non-existent model")
|
||||||
self.control_model.append(row)
|
self.control_model.append(row)
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class ServerModelManager:
|
|||||||
There may be cases where you want to instantiate this class without dumping servers,
|
There may be cases where you want to instantiate this class without dumping servers,
|
||||||
e.g., adding saved servers from another tab
|
e.g., adding saved servers from another tab
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.first_iteration = True
|
self.first_iteration = True
|
||||||
match self.enum:
|
match self.enum:
|
||||||
case ServerTab.BROWSER:
|
case ServerTab.BROWSER:
|
||||||
@@ -92,12 +93,10 @@ class ServerModelManager:
|
|||||||
futures = [executor.submit(job, key, APPID_DAYZ, param) for param in params]
|
futures = [executor.submit(job, key, APPID_DAYZ, param) for param in params]
|
||||||
for future in as_completed(futures):
|
for future in as_completed(futures):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# NOTE: faciliates early aborting via sigint
|
# NOTE: faciliates early aborting via sigint
|
||||||
# TODO: make this logic available to all dump contexts
|
# TODO: make this logic available to all dump contexts
|
||||||
if self.controller.get_exit_event().is_set():
|
if self.controller.get_exit_event().is_set():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.thread_man.increment_dialog()
|
self.thread_man.increment_dialog()
|
||||||
res = future.result(timeout=API_TIMEOUT)
|
res = future.result(timeout=API_TIMEOUT)
|
||||||
if res.status != 200 or not res.parsed:
|
if res.status != 200 or not res.parsed:
|
||||||
@@ -236,7 +235,6 @@ class ServerModelManager:
|
|||||||
def add_to_history(self, record: dict[str, Any]) -> None:
|
def add_to_history(self, record: dict[str, Any]) -> None:
|
||||||
proxy_man = self._get_proxy_man()
|
proxy_man = self._get_proxy_man()
|
||||||
row = Servers.parse_json([record])
|
row = Servers.parse_json([record])
|
||||||
print(type(row[0]))
|
|
||||||
proxy_man.append_row_to_history(row[0])
|
proxy_man.append_row_to_history(row[0])
|
||||||
self.update_history()
|
self.update_history()
|
||||||
|
|
||||||
@@ -285,7 +283,7 @@ class ServerModelManager:
|
|||||||
proxy_man = self._get_proxy_man()
|
proxy_man = self._get_proxy_man()
|
||||||
config_man = self.controller.get_config_man()
|
config_man = self.controller.get_config_man()
|
||||||
fqip = Servers.response_to_fqip(row)
|
fqip = Servers.response_to_fqip(row)
|
||||||
record = response.get_record() # Servers.response_to_record(row)
|
record = response.get_record()
|
||||||
|
|
||||||
# TODO: less convoluted
|
# TODO: less convoluted
|
||||||
if delete:
|
if delete:
|
||||||
@@ -394,7 +392,8 @@ class ServerModelManager:
|
|||||||
|
|
||||||
# TODO: distinguish signals, e.g. "servers_failed_to_load", "servers_loaded_empty"
|
# TODO: distinguish signals, e.g. "servers_failed_to_load", "servers_loaded_empty"
|
||||||
# customize statusbar and dialog accordingly
|
# customize statusbar and dialog accordingly
|
||||||
self.emitter.emit("servers_loaded", self.enum)
|
# TODO: drop, causes errors
|
||||||
|
# self.emitter.emit("servers_loaded", self.enum)
|
||||||
# FIXME: destroy wait dialog first
|
# FIXME: destroy wait dialog first
|
||||||
# see threadman.set_cleanup_func(_, destroy_first=True)
|
# see threadman.set_cleanup_func(_, destroy_first=True)
|
||||||
if show_dialog:
|
if show_dialog:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class ButtonGrid(Gtk.Grid):
|
|||||||
checkbox = Gtk.CheckButton(label=check)
|
checkbox = Gtk.CheckButton(label=check)
|
||||||
label = checkbox.get_child()
|
label = checkbox.get_child()
|
||||||
if label is not None:
|
if label is not None:
|
||||||
label.set_ellipsize(Pango.EllipsizeMode.END) # type: ignore
|
label.set_ellipsize(Pango.EllipsizeMode.END) # type: ignore
|
||||||
|
|
||||||
if defaults[check]:
|
if defaults[check]:
|
||||||
checkbox.set_active(True)
|
checkbox.set_active(True)
|
||||||
@@ -188,6 +188,7 @@ class FilterPanel(Gtk.Box):
|
|||||||
|
|
||||||
self.maps_entry: Gtk.Entry = self.maps_combo.get_child() # type: ignore
|
self.maps_entry: Gtk.Entry = self.maps_combo.get_child() # type: ignore
|
||||||
self.maps_entry.set_completion(completion)
|
self.maps_entry.set_completion(completion)
|
||||||
|
# TODO: strings
|
||||||
self.maps_entry.set_placeholder_text("Filter by map")
|
self.maps_entry.set_placeholder_text("Filter by map")
|
||||||
self.maps_entry.connect("changed", self._on_map_completion, True)
|
self.maps_entry.connect("changed", self._on_map_completion, True)
|
||||||
self.maps_entry.connect("key-press-event", self._on_map_entry_keypress)
|
self.maps_entry.connect("key-press-event", self._on_map_entry_keypress)
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ from dzgui.views.components.eventbox import InfoEventBox
|
|||||||
from dzgui.views.components.buttons import WebButton
|
from dzgui.views.components.buttons import WebButton
|
||||||
from dzgui.views.components.frame import HeadingFrame
|
from dzgui.views.components.frame import HeadingFrame
|
||||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||||
from dzgui.views.dialogs.link_dialog import WorkshopLinkDialog
|
|
||||||
|
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore
|
|||||||
"IP": 240,
|
"IP": 240,
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: abstract
|
# TODO: abstract column population logic
|
||||||
# FIXME: resize col width func causes snapping behavior
|
# TODO: resize col width func causes snapping behavior
|
||||||
browser_cols = strings.browser_cols
|
browser_cols = strings.browser_cols
|
||||||
for i, column_title in enumerate(browser_cols):
|
for i, column_title in enumerate(browser_cols):
|
||||||
renderer = Gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
|
|||||||
Reference in new issue
Block a user