mirror of
https://github.com/aclist/dztui.git
synced 2026-11-05 17:45:10 +01:00
chore: consolidate filter enums
This commit is contained in:
1 parent
4bccaec427
commit
7b8388376c
6 files changed
+15
-23
No files matched your search
@@ -11,6 +11,7 @@ from dzgui.util import strings
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.managers.filter_man import FilterManager
|
||||
from dzgui.model.model_factory import FastInsertListStore
|
||||
from dzgui.api.servers import Record
|
||||
from dzgui.model.servers import NewPlayerCount
|
||||
|
||||
|
||||
@@ -68,7 +69,6 @@ class ProxyModelManager:
|
||||
|
||||
# TODO: consolidate with remove_row_from_control()
|
||||
def remove_from_history(self, record: "Record") -> None:
|
||||
print(record)
|
||||
addr = f"{record.ip}:{record.gameport}"
|
||||
qport = record.qport
|
||||
for record in self.control_model:
|
||||
@@ -85,7 +85,6 @@ class ProxyModelManager:
|
||||
return self.proxy_model
|
||||
|
||||
def filter(self, mode: FilterMode, skip_cache: bool = False) -> None:
|
||||
# TODO: proxy model can fetch args directly from filter man, no need to process extra input
|
||||
"""
|
||||
Native Gtk.TreeView.refilter() method was not performant enough
|
||||
when running in the main loop with 40k+ records
|
||||
@@ -109,7 +108,7 @@ class ProxyModelManager:
|
||||
rows = self.filter_initial(filters)
|
||||
|
||||
# TODO: consolidate into one enum
|
||||
case FilterMode.MAP | FilterMode.KEYWORD | FilterMode.TOGGLE_ON:
|
||||
case FilterMode.TOGGLE_ON:
|
||||
rows = self.filter_toggle_on(filters)
|
||||
|
||||
case FilterMode.TOGGLE_OFF:
|
||||
|
||||
@@ -213,18 +213,13 @@ class ServerModelManager:
|
||||
|
||||
def remove_from_history(self, record: Servers.Record) -> None:
|
||||
"""Fully unthreaded, just removes a row"""
|
||||
port = record.ip
|
||||
gport = record.gameport
|
||||
qport = record.qport
|
||||
|
||||
fqip = f"{port}:{gport}:{qport}"
|
||||
config_man = self.controller.get_config_man()
|
||||
config_man.remove_history_server(fqip)
|
||||
|
||||
proxy_man = self._get_proxy_man()
|
||||
proxy_man.remove_from_history(record)
|
||||
control_model = proxy_man.get_control()
|
||||
|
||||
config_man = self.controller.get_config_man()
|
||||
config_man.update_history_file(control_model)
|
||||
|
||||
self._sort_unique_maps(control_model)
|
||||
proxy = proxy_man.get_proxy_model()
|
||||
self.tv.set_model(proxy)
|
||||
|
||||
Reference in new issue
Block a user