mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
chore: drop unused code
This commit is contained in:
1 parent
107c672b1c
commit
891abcc049
4 files changed
+14
-86
No files matched your search
+7
-6
@@ -8,18 +8,22 @@ from dzgui.const import endpoints
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from requests import Response
|
from requests import Response
|
||||||
|
|
||||||
|
|
||||||
def test_steam_api(key: str) -> bool:
|
def test_steam_api(key: str) -> bool:
|
||||||
appid = APPID_DAYZ
|
appid = APPID_DAYZ
|
||||||
payload: dict[str, Union[int, str]] = {
|
payload: dict[str, Union[int, str]] = {
|
||||||
"filter": r"\appid" + fr"\{appid}",
|
"filter": r"\appid" + rf"\{appid}",
|
||||||
"limit": 10,
|
"limit": 10,
|
||||||
"key": key,
|
"key": key,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
res = requests.get(endpoints.STEAM_SERVERS, params=payload, timeout=REQUEST_TIMEOUT)
|
res = requests.get(
|
||||||
|
endpoints.STEAM_SERVERS, params=payload, timeout=REQUEST_TIMEOUT
|
||||||
|
)
|
||||||
return is_remote_up(res)
|
return is_remote_up(res)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
@@ -44,10 +48,7 @@ def test_bm_api(key: str) -> bool:
|
|||||||
hdr = {"Authorization": "Bearer " + key}
|
hdr = {"Authorization": "Bearer " + key}
|
||||||
try:
|
try:
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
endpoints.BM_SERVERS,
|
endpoints.BM_SERVERS, params=payload, headers=hdr, timeout=REQUEST_TIMEOUT
|
||||||
params=payload,
|
|
||||||
headers=hdr,
|
|
||||||
timeout=REQUEST_TIMEOUT
|
|
||||||
)
|
)
|
||||||
return is_remote_up(res)
|
return is_remote_up(res)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ import dayzquery
|
|||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
logging.getLogger("a2s").setLevel(logging.ERROR)
|
||||||
|
|
||||||
# TODO: confirm that patches from testing are incorporated here
|
# TODO: confirm that patches from testing are incorporated here
|
||||||
# particularly around malformed values. check commit log
|
# particularly around malformed values in JSON response. check commit log
|
||||||
|
|
||||||
params = [
|
params = [
|
||||||
r"\nor\1\map\chernarusplus\nor\1\map\sakhal\nor\1\map\enoch\empty\1\nor\1\map\namalsk", # noqa
|
r"\nor\1\map\chernarusplus\nor\1\map\sakhal\nor\1\map\enoch\empty\1\nor\1\map\namalsk", # noqa
|
||||||
@@ -467,10 +468,12 @@ def query_playercount(record: Record) -> Optional[tuple[int]]:
|
|||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def query_by_ip(addr: str) -> Optional[dict]:
|
def query_by_ip(addr: str) -> Optional[dict]:
|
||||||
record = short_ip_to_record(addr)
|
record = short_ip_to_record(addr)
|
||||||
return query_by_record(record)
|
return query_by_record(record)
|
||||||
|
|
||||||
|
|
||||||
def query_by_record(record: Record) -> Optional[dict]:
|
def query_by_record(record: Record) -> Optional[dict]:
|
||||||
try:
|
try:
|
||||||
return query_direct(record.ip, record.qport)
|
return query_direct(record.ip, record.qport)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ from dzgui.views.base import App
|
|||||||
from dzgui.views.dialogs.early_alert import EarlyAlertDialog, EarlyIgnoreDialog
|
from dzgui.views.dialogs.early_alert import EarlyAlertDialog, EarlyIgnoreDialog
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=flags.description)
|
parser = argparse.ArgumentParser(description=flags.description)
|
||||||
|
|
||||||
parser.add_argument("-v", "--version", action="store_true", help=flags.version)
|
parser.add_argument("-v", "--version", action="store_true", help=flags.version)
|
||||||
|
|||||||
+2
-79
@@ -4,7 +4,6 @@ import warnings
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING, Literal
|
from typing import TYPE_CHECKING, Literal
|
||||||
|
|
||||||
# TODO: import notebook only and add components there?
|
|
||||||
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER, STEAM_ICON
|
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER, STEAM_ICON
|
||||||
from dzgui.const.enum import NotebookPage
|
from dzgui.const.enum import NotebookPage
|
||||||
from dzgui.controllers.emitter import Emitter
|
from dzgui.controllers.emitter import Emitter
|
||||||
@@ -15,6 +14,8 @@ from dzgui.views.components.crumbs import Breadcrumbs
|
|||||||
from dzgui.views.components.right_panel import RightPanel
|
from dzgui.views.components.right_panel import RightPanel
|
||||||
from dzgui.views.components.statusbar import Statusbar
|
from dzgui.views.components.statusbar import Statusbar
|
||||||
from dzgui.views.mixins.scrollable_mixin import ScrollableMixin
|
from dzgui.views.mixins.scrollable_mixin import ScrollableMixin
|
||||||
|
|
||||||
|
# TODO: import notebook only and add components there?
|
||||||
from dzgui.views.pages.changelog import Changelog
|
from dzgui.views.pages.changelog import Changelog
|
||||||
from dzgui.views.pages.devs import Developers
|
from dzgui.views.pages.devs import Developers
|
||||||
from dzgui.views.pages.help import Help
|
from dzgui.views.pages.help import Help
|
||||||
@@ -38,10 +39,6 @@ logger = logging.getLogger(__name__)
|
|||||||
warnings.filterwarnings("ignore", ".*g_value_get_int", Warning)
|
warnings.filterwarnings("ignore", ".*g_value_get_int", Warning)
|
||||||
|
|
||||||
|
|
||||||
# TODO: move to controller
|
|
||||||
# kilometer cache; note, user may change measurement it partway through, flush cache
|
|
||||||
# cache: dict[str, int] = {}
|
|
||||||
|
|
||||||
## TODO: move to configs/servers
|
## TODO: move to configs/servers
|
||||||
# def query_history() -> list | None:
|
# def query_history() -> list | None:
|
||||||
# history_file = MainController.get_prefs().paths.history
|
# history_file = MainController.get_prefs().paths.history
|
||||||
@@ -52,38 +49,6 @@ warnings.filterwarnings("ignore", ".*g_value_get_int", Warning)
|
|||||||
# rows = None
|
# rows = None
|
||||||
# return rows
|
# return rows
|
||||||
#
|
#
|
||||||
# def process_tree_option(choice: RowType) -> None:
|
|
||||||
# # server tables
|
|
||||||
# if command == RowType.RESOLVE_IP:
|
|
||||||
# record = treeview.get_record()
|
|
||||||
# wait_msg = command.dict["wait_msg"]
|
|
||||||
# show_wait_dialog = True
|
|
||||||
#
|
|
||||||
# # TODO: needs threading, this is a slow process
|
|
||||||
# # TODO: needs saving into config
|
|
||||||
# # TODO: used by add/remove servers
|
|
||||||
# real_ip = ip.resolve_ip(record)
|
|
||||||
# #call_on_thread(
|
|
||||||
# # show_wait_dialog, cmd_string, wait_msg, record, choice=choice
|
|
||||||
# #)
|
|
||||||
# return
|
|
||||||
#
|
|
||||||
# if command == RowType.QUICK_CONNECT:
|
|
||||||
# record = MainController.query_config(Preferences.FAV_SRV)
|
|
||||||
# if record == "":
|
|
||||||
# spawn_dialog("No favorite server currently set", Popup.NOTIFY)
|
|
||||||
# return
|
|
||||||
#
|
|
||||||
# record = str_to_record(record)
|
|
||||||
# thread_new_with_dialog(
|
|
||||||
# treeview.prepare_connection,
|
|
||||||
# parse_shell_output,
|
|
||||||
# "Querying server",
|
|
||||||
# command,
|
|
||||||
# [record],
|
|
||||||
# )
|
|
||||||
# return
|
|
||||||
#
|
|
||||||
## TODO: belongs in model
|
## TODO: belongs in model
|
||||||
# def str_to_record(record: str) -> Record | None:
|
# def str_to_record(record: str) -> Record | None:
|
||||||
# r = record.split(":")
|
# r = record.split(":")
|
||||||
@@ -96,44 +61,6 @@ warnings.filterwarnings("ignore", ".*g_value_get_int", Warning)
|
|||||||
# return f"{record.ip}:{record.gameport}:{record.qport}"
|
# return f"{record.ip}:{record.gameport}:{record.qport}"
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# def connect_by_ip(enum: RowType, response: str) -> None:
|
|
||||||
# def _prep(response: str) -> None:
|
|
||||||
# record = Servers.validate_ip(response)
|
|
||||||
# proc = treeview.prepare_connection(record)
|
|
||||||
# return proc
|
|
||||||
#
|
|
||||||
# thread_new_with_dialog(
|
|
||||||
# _prep, parse_shell_output, "Querying IP", enum, [response]
|
|
||||||
# )
|
|
||||||
# return
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# def connect_by_id(enum: RowType, uid: str, key: str) -> None:
|
|
||||||
# def _prep(key: str, response: str) -> None:
|
|
||||||
# # TODO: if response is non numeric, raise dialog
|
|
||||||
# if response.isnumeric() is False:
|
|
||||||
# pass
|
|
||||||
# # raise error
|
|
||||||
# # raise BmIdError("ID must be numeric only")
|
|
||||||
# # return
|
|
||||||
# from dzgui.api.bm import map_id_to_record
|
|
||||||
# try:
|
|
||||||
# record = map_id_to_record(config, uid)
|
|
||||||
# except Exception as e:
|
|
||||||
# logger.critical(e)
|
|
||||||
# # raise dialog
|
|
||||||
# return
|
|
||||||
# # proc = treeview.prepare_connection(record)
|
|
||||||
# # return proc
|
|
||||||
#
|
|
||||||
# #thread_new_with_dialog(
|
|
||||||
# # _prep, parse_shell_output, "Querying API", enum, [key, response]
|
|
||||||
# #)
|
|
||||||
# #return
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
class OuterWindow(Gtk.Window):
|
class OuterWindow(Gtk.Window):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__(title=APP_NAME, border_width=10, icon_name=APP_NAME_LOWER)
|
super().__init__(title=APP_NAME, border_width=10, icon_name=APP_NAME_LOWER)
|
||||||
@@ -304,10 +231,6 @@ class Grid(Gtk.Grid):
|
|||||||
|
|
||||||
MainController.register_widget("grid", self)
|
MainController.register_widget("grid", self)
|
||||||
|
|
||||||
# self.bu = Gtk.Button(label="Shrink to fit", halign=Gtk.Align.END)
|
|
||||||
# self.bu.connect("clicked", self._shrink)
|
|
||||||
# self.crumb_box.add(self.bu)
|
|
||||||
|
|
||||||
self.emitter = MainController.get_emitter()
|
self.emitter = MainController.get_emitter()
|
||||||
|
|
||||||
self.notebook = Notebook()
|
self.notebook = Notebook()
|
||||||
|
|||||||
Reference in new issue
Block a user