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 @@ ...@@ -6,7 +6,6 @@
from typing import Any from typing import Any
from typing import Generic from typing import Generic
from typing import Type
from typing import TypeVar from typing import TypeVar
from gi.repository import Gio from gi.repository import Gio
...@@ -45,7 +44,7 @@ class BaseCompletionProvider: ...@@ -45,7 +44,7 @@ class BaseCompletionProvider:
trigger_char = '' trigger_char = ''
name = '' name = ''
def get_model(self) -> tuple[Gio.ListModel, Type[BaseCompletionViewItem[Any]]]: def get_model(self) -> tuple[Gio.ListModel, type[BaseCompletionViewItem[Any]]]:
raise NotImplementedError raise NotImplementedError
def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool: def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool:
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
from typing import Any from typing import Any
from typing import Final from typing import Final
from typing import Type
import logging import logging
...@@ -98,7 +97,7 @@ def __init__(self) -> None: ...@@ -98,7 +97,7 @@ def __init__(self) -> None:
model=filter_model, size=MAX_COMPLETION_ENTRIES 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 return self._model, CommandsCompletionViewItem
def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool: def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool:
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
from typing import Any from typing import Any
from typing import Final from typing import Final
from typing import Type
import logging import logging
...@@ -280,7 +279,7 @@ def __init__(self) -> None: ...@@ -280,7 +279,7 @@ def __init__(self) -> None:
model=self._filter_model, size=MAX_COMPLETION_ENTRIES 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 return self._model, EmojiCompletionViewItem
@staticmethod @staticmethod
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
from typing import Any from typing import Any
from typing import Final from typing import Final
from typing import Type
import logging import logging
...@@ -84,7 +83,7 @@ def do_unroot(self) -> None: ...@@ -84,7 +83,7 @@ def do_unroot(self) -> None:
class NicknameCompletionProvider(BaseCompletionProvider): class NicknameCompletionProvider(BaseCompletionProvider):
trigger_char: Final = '@' trigger_char: Final = '@'
name = _('Users') name = _('Participants')
def __init__(self) -> None: def __init__(self) -> None:
self._list_store = Gio.ListStore(item_type=NicknameCompletionListItem) self._list_store = Gio.ListStore(item_type=NicknameCompletionListItem)
...@@ -107,7 +106,7 @@ def __init__(self) -> None: ...@@ -107,7 +106,7 @@ def __init__(self) -> None:
model=filter_model, size=MAX_COMPLETION_ENTRIES 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 return self._model, NicknameCompletionViewItem
def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool: def check(self, candidate: str, start_iter: Gtk.TextIter) -> bool:
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
from typing import Any from typing import Any
from typing import cast from typing import cast
from typing import Type
import logging import logging
...@@ -46,7 +45,7 @@ def __init__(self, message_input: GtkSource.View) -> None: ...@@ -46,7 +45,7 @@ def __init__(self, message_input: GtkSource.View) -> None:
self._message_input = message_input self._message_input = message_input
self._provider: BaseCompletionProvider | None = None self._provider: BaseCompletionProvider | None = None
self._widget_cls: Type[BaseCompletionViewItem[Any]] | None = None self._widget_cls: type[BaseCompletionViewItem[Any]] | None = None
controller = Gtk.EventControllerKey( controller = Gtk.EventControllerKey(
propagation_phase=Gtk.PropagationPhase.CAPTURE 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