Commit 7679ecea authored by Daniel Brötzmann's avatar Daniel Brötzmann
Browse files

Typing: Rename ControlType to avoid confusion

parent cef7d2e8
Pipeline #9059 canceled with stages
in 3 minutes and 25 seconds
......@@ -37,7 +37,7 @@
from .chat_list_stack import ChatListStack
from .chat_stack import ChatStack
from .search_view import SearchView
from .types import ControlType
from .types import ControlT
from .const import UNLOAD_CHAT_TIME
......@@ -96,7 +96,7 @@ def __init__(self):
self._ui.paned.set_position(app.settings.get('chat_handle_position'))
self._ui.paned.connect('button-release-event', self._on_button_release)
self._last_control: Optional[ControlType] = None
self._last_control: Optional[ControlT] = None
self._startup_finished: bool = False
self._add_actions()
......@@ -334,10 +334,10 @@ def remove_chats_for_account(self, account: str) -> None:
self._chat_list_stack.remove_chats_for_account(account)
self._chat_stack.remove_chats_for_account(account)
def get_control(self, account: str, jid: JID) -> Optional[ControlType]:
def get_control(self, account: str, jid: JID) -> Optional[ControlT]:
return self._chat_stack.get_control(account, jid)
def get_active_control(self) -> Optional[ControlType]:
def get_active_control(self) -> Optional[ControlT]:
chat = self._chat_list_stack.get_selected_chat()
if chat is None:
return None
......@@ -347,7 +347,7 @@ def is_chat_loaded(self, account: str, jid: JID) -> bool:
return self._chat_stack.is_chat_loaded(account, jid)
def get_controls(self, account: Optional[str]
) -> Generator[ControlType, None, None]:
) -> Generator[ControlT, None, None]:
return self._chat_stack.get_controls(account)
def hide_search(self) -> bool:
......
......@@ -32,7 +32,7 @@
from .controls.groupchat import GroupchatControl
from .controls.private import PrivateChatControl
from .types import ControlType
from .types import ControlT
from .util import EventHelper
log = logging.getLogger('gajim.gui.chatstack')
......@@ -54,16 +54,16 @@ def __init__(self):
])
self.show_all()
self._controls: dict[tuple[str, JID], ControlType] = {}
self._controls: dict[tuple[str, JID], ControlT] = {}
def get_control(self, account: str, jid: JID) -> Optional[ControlType]:
def get_control(self, account: str, jid: JID) -> Optional[ControlT]:
try:
return self._controls[(account, jid)]
except KeyError:
return None
def get_controls(self, account: Optional[str]
) -> Generator[ControlType, None, None]:
) -> Generator[ControlT, None, None]:
if account is None:
for control in self._controls.values():
yield control
......
......@@ -42,7 +42,7 @@
from .menus import get_groupchat_roster_menu
from .tooltips import GCTooltip
from .builder import get_builder
from .types import GroupchatControlType
from .types import GroupchatControlT
from .util import EventHelper
......@@ -75,7 +75,7 @@ class GroupchatRoster(Gtk.ScrolledWindow, EventHelper):
def __init__(self,
account: str,
room_jid: str,
control: GroupchatControlType
control: GroupchatControlT
) -> None:
Gtk.ScrolledWindow.__init__(self)
EventHelper.__init__(self)
......
......@@ -51,7 +51,7 @@
from .dialogs import DialogButton
from .dialogs import ConfirmationDialog
from .dialogs import ConfirmationCheckDialog
from .types import ControlType
from .types import ControlT
from .builder import get_builder
from .util import get_key_theme
from .util import resize_window
......@@ -533,14 +533,14 @@ def add_app_message(self, category: str,
message: Optional[str] = None) -> None:
self._app_page.add_app_message(category, message)
def get_control(self, account: str, jid: JID) -> Optional[ControlType]:
def get_control(self, account: str, jid: JID) -> Optional[ControlT]:
return self._chat_page.get_control(account, jid)
def get_controls(self, account: Optional[str] = None
) -> Generator[ControlType, None, None]:
) -> Generator[ControlT, None, None]:
return self._chat_page.get_controls(account)
def get_active_control(self) -> Optional[ControlType]:
def get_active_control(self) -> Optional[ControlT]:
return self._chat_page.get_active_control()
def is_chat_loaded(self, account: str, jid: JID) -> bool:
......
......@@ -39,13 +39,13 @@
ControlType = Union [
ControlT = Union [
'BaseControl',
'ChatControl',
'PrivateChatControl',
'GroupchatControl'
]
GroupchatControlType = Union['GroupchatControl']
GroupchatControlT = Union['GroupchatControl']
ConversationViewT = Union['ConversationView']
......@@ -104,7 +104,7 @@
from gajim.gui.util import get_app_windows
from gajim.gui.util import get_color_for_account
from gajim.gui.util import open_window
from gajim.gui.types import ControlType
from gajim.gui.types import ControlT
log = logging.getLogger('gajim.interface')
......@@ -550,7 +550,7 @@ def __compare_hashes(account: str, file_props: FileProp) -> None:
session.end_session()
def send_httpupload(self,
chat_control: ControlType,
chat_control: ControlT,
path: Optional[str] = None
) -> None:
if path is not None:
......@@ -563,13 +563,13 @@ def send_httpupload(self,
transient_for=app.window)
def _on_file_dialog_ok(self,
chat_control: ControlType,
chat_control: ControlT,
paths: list[str]
) -> None:
for path in paths:
self._send_httpupload(chat_control, path)
def _send_httpupload(self, chat_control: ControlType, path: str) -> None:
def _send_httpupload(self, chat_control: ControlT, path: str) -> None:
client = app.get_client(chat_control.account)
try:
transfer = client.get_module('HTTPUpload').make_transfer(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment