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