Skip to content
Snippets Groups Projects
Commit 39c15df4 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by mesonium
Browse files

refactor: Completion: Fix usage of Type, rename Users to Participants

parent 31960901
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@
from typing import Any
from typing import Generic
from typing import Type
from typing import TypeVar
from gi.repository import Gio
......@@ -45,7 +44,7 @@ class BaseCompletionProvider:
trigger_char = ''
name = ''
def get_model(self) -> tuple[Gio.ListModel, Type[BaseCompletionViewItem[Any]]]:
def get_model(self) -> tuple[Gio.ListModel, type[BaseCompletionViewItem[Any]]]:
raise NotImplementedError
def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool:
......
......@@ -6,7 +6,6 @@
from typing import Any
from typing import Final
from typing import Type
import logging
......@@ -98,7 +97,7 @@ def __init__(self) -> None:
model=filter_model, size=MAX_COMPLETION_ENTRIES
)
def get_model(self) -> tuple[Gio.ListModel, Type[CommandsCompletionViewItem]]:
def get_model(self) -> tuple[Gio.ListModel, type[CommandsCompletionViewItem]]:
return self._model, CommandsCompletionViewItem
def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool:
......
......@@ -6,7 +6,6 @@
from typing import Any
from typing import Final
from typing import Type
import logging
......@@ -280,7 +279,7 @@ def __init__(self) -> None:
model=self._filter_model, size=MAX_COMPLETION_ENTRIES
)
def get_model(self) -> tuple[Gio.ListModel, Type[EmojiCompletionViewItem]]:
def get_model(self) -> tuple[Gio.ListModel, type[EmojiCompletionViewItem]]:
return self._model, EmojiCompletionViewItem
@staticmethod
......
......@@ -6,7 +6,6 @@
from typing import Any
from typing import Final
from typing import Type
import logging
......@@ -84,7 +83,7 @@ def do_unroot(self) -> None:
class NicknameCompletionProvider(BaseCompletionProvider):
trigger_char: Final = '@'
name = _('Users')
name = _('Participants')
def __init__(self) -> None:
self._list_store = Gio.ListStore(item_type=NicknameCompletionListItem)
......@@ -107,7 +106,7 @@ def __init__(self) -> None:
model=filter_model, size=MAX_COMPLETION_ENTRIES
)
def get_model(self) -> tuple[Gio.ListModel, Type[NicknameCompletionViewItem]]:
def get_model(self) -> tuple[Gio.ListModel, type[NicknameCompletionViewItem]]:
return self._model, NicknameCompletionViewItem
def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool:
......
......@@ -6,7 +6,6 @@
from typing import Any
from typing import cast
from typing import Type
import logging
......@@ -46,7 +45,7 @@ def __init__(self, message_input: GtkSource.View) -> None:
self._message_input = message_input
self._provider: BaseCompletionProvider | None = None
self._widget_cls: Type[BaseCompletionViewItem[Any]] | None = None
self._widget_cls: type[BaseCompletionViewItem[Any]] | None = None
controller = Gtk.EventControllerKey(
propagation_phase=Gtk.PropagationPhase.CAPTURE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment