mirror of
https://github.com/aclist/dztui.git
synced 2026-11-11 04:20:39 +01:00
chore: clear typehinting errors
This commit is contained in:
1 parent
cacfab35bf
commit
2d265c4b9b
19 files changed
+74
-44
No files matched your search
@@ -21,7 +21,7 @@ if TYPE_CHECKING:
|
||||
|
||||
class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
||||
def __init__(
|
||||
self, controller: "Controller", menu: Optional["ContextMenuGroup"] = None
|
||||
self, controller: "Controller", menu: Optional["ContextMenuGroup"]
|
||||
) -> None:
|
||||
super().__init__(
|
||||
enable_search=False,
|
||||
@@ -72,10 +72,13 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
||||
return model.get_iter(path)
|
||||
|
||||
def get_focused_row_path(self) -> Gtk.TreePath:
|
||||
return self.get_cursor().path
|
||||
path, column = self.get_cursor()
|
||||
return path
|
||||
|
||||
def get_focused_row_index(self) -> int:
|
||||
return self.get_cursor().path[0]
|
||||
path, column = self.get_cursor()
|
||||
index = path.get_indices()[0]
|
||||
return index
|
||||
|
||||
def get_selected_records(self) -> list:
|
||||
sel = self.get_selection()
|
||||
@@ -140,7 +143,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
||||
path = Gtk.TreePath.new_from_indices([0])
|
||||
self.set_cursor(path)
|
||||
|
||||
def get_value_at_index(self, index: int) -> str:
|
||||
def get_value_at_index(self, index: int) -> Any:
|
||||
(model, pathlist) = self.get_model_and_pathlist()
|
||||
if len(pathlist) < 1:
|
||||
return ""
|
||||
@@ -151,7 +154,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
||||
|
||||
def get_name(self) -> str:
|
||||
name = self.get_value_at_index(0)
|
||||
return name
|
||||
return str(name)
|
||||
|
||||
def select_first_row(self) -> None:
|
||||
sel = self.get_selection()
|
||||
@@ -164,7 +167,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
||||
return (model, pathlist)
|
||||
|
||||
@deprecated("Currently unused")
|
||||
#def get_mpath(self) -> Optional[Gtk.TreePath]:
|
||||
# def get_mpath(self) -> Optional[Gtk.TreePath]:
|
||||
# (model, pathlist) = self.get_model_and_pathlist()
|
||||
# if len(pathlist) < 1:
|
||||
# return None
|
||||
@@ -186,7 +189,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
|
||||
return False
|
||||
|
||||
@deprecated("unused")
|
||||
#def get_selected_row(self) -> Optional[Gtk.TreeModelRow]:
|
||||
# def get_selected_row(self) -> Optional[Gtk.TreeModelRow]:
|
||||
# ind = self.get_selected_row_index()
|
||||
# model = self.get_model()
|
||||
# if model is None:
|
||||
|
||||
@@ -91,7 +91,7 @@ class LogTreeView(ContextMixin, TreeView): # type: ignore
|
||||
return None
|
||||
for record in records:
|
||||
raw_record = model[record]
|
||||
els = tuple(raw_record)
|
||||
els: tuple[Any] = tuple(raw_record) # type: ignore
|
||||
concat = strings.delimiter.join(map(str, els))
|
||||
final.append(concat)
|
||||
text = "\n".join(final)
|
||||
|
||||
@@ -25,7 +25,7 @@ class MenuTreeView(TreeView):
|
||||
"""
|
||||
|
||||
def __init__(self, controller: "Controller") -> None:
|
||||
super().__init__(controller)
|
||||
super().__init__(controller, menu=None)
|
||||
|
||||
self.controller = controller
|
||||
|
||||
@@ -73,6 +73,8 @@ class MenuTreeView(TreeView):
|
||||
def get_row_enum(self) -> str:
|
||||
# NOTE: col 1 contains a RowType enum
|
||||
model = self.get_model()
|
||||
if model is None:
|
||||
raise ValueError("Trying to call a method on non-existent model")
|
||||
_iter = self.get_focused_row_iter()
|
||||
rowtype = model.get_value(_iter, 1)
|
||||
return str(rowtype.dict["tooltip"])
|
||||
@@ -73,7 +73,7 @@ class ModTreeView(ModsMixin, ContextMixin, TreeView): # type: ignore
|
||||
if model is None:
|
||||
raise AttributeError("Trying to call a method on a non-existent model")
|
||||
tree_iter = model.get_iter(path)
|
||||
mod = model.get(tree_iter, 2)[0]
|
||||
mod = model.get_value(tree_iter, 2)
|
||||
return str(mod)
|
||||
|
||||
def _parent_selection_changed(
|
||||
|
||||
@@ -65,7 +65,7 @@ class ServerModTreeView(ContextMixin, TreeView): # type: ignore
|
||||
raise AttributeError("Trying to call a method on a non-existent model")
|
||||
tree_iter = model.get_iter(path)
|
||||
# FIXME: https://docs.gtk.org/gtk3/method.TreeModel.get.html
|
||||
mod = model.get(tree_iter, 1)[0]
|
||||
mod = model.get_value(tree_iter, 1)
|
||||
return str(mod)
|
||||
|
||||
def populate(self, mods: list[list[str]]) -> None:
|
||||
|
||||
@@ -292,7 +292,7 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore
|
||||
self.start_distcalc()
|
||||
|
||||
def get_name(self) -> str:
|
||||
return self.get_value_at_index(0)
|
||||
return str(self.get_value_at_index(0))
|
||||
|
||||
def get_simplified_ip(self) -> str:
|
||||
addr = self.get_value_at_index(7)
|
||||
|
||||
Reference in new issue
Block a user