mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 23:22:44 +01:00
chore: consolidate is_in_favs() methods
This commit is contained in:
1 parent
eb4ee41742
commit
29aeb550b3
3 files changed
+6
-11
No files matched your search
@@ -40,11 +40,11 @@ def get_favorites(path: Path) -> list[str]:
|
|||||||
return conf["ip_list"]
|
return conf["ip_list"]
|
||||||
|
|
||||||
|
|
||||||
def is_in_favs(record: str, path: Path) -> bool:
|
# def is_in_favs(record: str, path: Path) -> bool:
|
||||||
favs = get_favorites(path)
|
# favs = get_favorites(path)
|
||||||
if record in favs:
|
# if record in favs:
|
||||||
return True
|
# return True
|
||||||
return False
|
# return False
|
||||||
|
|
||||||
|
|
||||||
def enum_to_key(enum: Preferences) -> str:
|
def enum_to_key(enum: Preferences) -> str:
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import inspect
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from typing import Any, Callable, TYPE_CHECKING
|
from typing import Any, Callable, TYPE_CHECKING
|
||||||
from warnings import deprecated
|
|
||||||
|
|
||||||
import dzgui.util._json as JSON # noqa
|
import dzgui.util._json as JSON # noqa
|
||||||
|
|
||||||
@@ -373,9 +372,6 @@ class Controller(GObject.GObject):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# def is_in_favs(self) -> bool:
|
|
||||||
# return self.config_man.is_in_favs()
|
|
||||||
|
|
||||||
def get_config_man(self) -> ConfigManager:
|
def get_config_man(self) -> ConfigManager:
|
||||||
return self.config_man
|
return self.config_man
|
||||||
|
|
||||||
|
|||||||
@@ -271,8 +271,7 @@ class ServerTreeView(ContextMixin, TreeView):
|
|||||||
|
|
||||||
def is_in_favs(self) -> bool:
|
def is_in_favs(self) -> bool:
|
||||||
record = self.get_record_string()
|
record = self.get_record_string()
|
||||||
ips = self.controller.get_config_man().lookup(Preferences.IP_LIST)
|
if self.controller.get_config_man().is_in_favs(record):
|
||||||
if record in ips:
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user