Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
813143be
by wurstsalat at 2021-12-22T21:04:46+01:00
-
89450395
by wurstsalat at 2021-12-22T21:08:18+01:00
-
51ad2f92
by wurstsalat at 2021-12-22T21:26:30+01:00
-
7c145ffa
by wurstsalat at 2021-12-22T21:37:07+01:00
-
ca9aee26
by wurstsalat at 2021-12-22T21:45:48+01:00
-
d26bb934
by wurstsalat at 2021-12-22T21:56:04+01:00
6 changed files:
- gajim/gtk/account_wizard.py
- gajim/gtk/add_contact.py
- gajim/gtk/app_side_bar.py
- gajim/gtk/avatar_selector.py
- gajim/gtk/change_password.py
- gajim/gtk/chat_list_stack.py
Changes:
| ... | ... | @@ -12,8 +12,9 @@ |
| 12 | 12 |
# You should have received a copy of the GNU General Public License
|
| 13 | 13 |
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 |
|
| 15 |
-from typing import Optional
|
|
| 15 |
+from typing import Any
|
|
| 16 | 16 |
from typing import List
|
| 17 |
+from typing import Optional
|
|
| 17 | 18 |
from typing import Tuple
|
| 18 | 19 |
from typing import Union
|
| 19 | 20 |
|
| ... | ... | @@ -35,6 +36,7 @@ |
| 35 | 36 |
from nbxmpp.errors import StanzaError
|
| 36 | 37 |
from nbxmpp.errors import MalformedStanzaError
|
| 37 | 38 |
from nbxmpp.errors import RegisterStanzaError
|
| 39 |
+from nbxmpp.task import Task
|
|
| 38 | 40 |
|
| 39 | 41 |
from gajim.common import app
|
| 40 | 42 |
from gajim.common import configpaths
|
| ... | ... | @@ -101,7 +103,7 @@ def __init__(self) -> None: |
| 101 | 103 |
def get_currenct_method(self) -> str:
|
| 102 | 104 |
return self._method
|
| 103 | 105 |
|
| 104 |
- def _on_button_clicked(self, _page, button_name):
|
|
| 106 |
+ def _on_button_clicked(self, _page: Gtk.Widget, button_name: str) -> None:
|
|
| 105 | 107 |
if button_name == 'login':
|
| 106 | 108 |
if self.get_page('login').is_advanced():
|
| 107 | 109 |
self.show_page('advanced',
|
| ... | ... | @@ -112,7 +114,10 @@ def _on_button_clicked(self, _page, button_name): |
| 112 | 114 |
elif button_name == 'signup':
|
| 113 | 115 |
self.show_page('signup', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 114 | 116 |
|
| 115 |
- def _on_assistant_button_clicked(self, _assistant, button_name):
|
|
| 117 |
+ def _on_assistant_button_clicked(self,
|
|
| 118 |
+ _assistant: Assistant,
|
|
| 119 |
+ button_name: str
|
|
| 120 |
+ ) -> None:
|
|
| 116 | 121 |
page = self.get_current_page()
|
| 117 | 122 |
|
| 118 | 123 |
if button_name == 'login':
|
| ... | ... | @@ -185,7 +190,10 @@ def _on_assistant_button_clicked(self, _assistant, button_name): |
| 185 | 190 |
elif page == 'redirect':
|
| 186 | 191 |
self.show_page('login', Gtk.StackTransitionType.SLIDE_RIGHT)
|
| 187 | 192 |
|
| 188 |
- def _on_page_changed(self, _assistant, page_name):
|
|
| 193 |
+ def _on_page_changed(self,
|
|
| 194 |
+ _assistant: Assistant,
|
|
| 195 |
+ page_name: str
|
|
| 196 |
+ ) -> None:
|
|
| 189 | 197 |
if page_name == 'signup':
|
| 190 | 198 |
self._method = page_name
|
| 191 | 199 |
self.get_page('signup').focus()
|
| ... | ... | @@ -240,13 +248,19 @@ def _disconnect(self) -> None: |
| 240 | 248 |
self._client = None
|
| 241 | 249 |
|
| 242 | 250 |
@staticmethod
|
| 243 |
- def _on_stanza_sent(_client, _signal_name, stanza):
|
|
| 251 |
+ def _on_stanza_sent(_client: Client,
|
|
| 252 |
+ _signal_name: str,
|
|
| 253 |
+ stanza: Any
|
|
| 254 |
+ ) -> None:
|
|
| 244 | 255 |
app.nec.push_incoming_event(NetworkEvent('stanza-sent',
|
| 245 | 256 |
account='AccountWizard',
|
| 246 | 257 |
stanza=stanza))
|
| 247 | 258 |
|
| 248 | 259 |
@staticmethod
|
| 249 |
- def _on_stanza_received(_client, _signal_name, stanza):
|
|
| 260 |
+ def _on_stanza_received(_client: Client,
|
|
| 261 |
+ _signal_name: str,
|
|
| 262 |
+ stanza: Any
|
|
| 263 |
+ ) -> None:
|
|
| 250 | 264 |
app.nec.push_incoming_event(NetworkEvent('stanza-received',
|
| 251 | 265 |
account='AccountWizard',
|
| 252 | 266 |
stanza=stanza))
|
| ... | ... | @@ -304,7 +318,7 @@ def _register_with_server(self, ignore_all_errors: bool = False) -> None: |
| 304 | 318 |
|
| 305 | 319 |
self._client.connect()
|
| 306 | 320 |
|
| 307 |
- def _on_login_successful(self, client, _signal_name):
|
|
| 321 |
+ def _on_login_successful(self, client: Client, _signal_name: str) -> None:
|
|
| 308 | 322 |
account = self._generate_account_name(client.domain)
|
| 309 | 323 |
proxy_name = None
|
| 310 | 324 |
if client.proxy is not None:
|
| ... | ... | @@ -319,11 +333,14 @@ def _on_login_successful(self, client, _signal_name): |
| 319 | 333 |
self.get_page('success').set_account(account)
|
| 320 | 334 |
self.show_page('success', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 321 | 335 |
|
| 322 |
- def _on_connected(self, client, _signal_name):
|
|
| 336 |
+ def _on_connected(self, client: Client, _signal_name: str) -> None:
|
|
| 323 | 337 |
client.get_module('Register').request_register_form(
|
| 324 | 338 |
callback=self._on_register_form)
|
| 325 | 339 |
|
| 326 |
- def _on_anonymous_supported(self, client, _signal_name):
|
|
| 340 |
+ def _on_anonymous_supported(self,
|
|
| 341 |
+ client: Client,
|
|
| 342 |
+ _signal_name: str
|
|
| 343 |
+ ) -> None:
|
|
| 327 | 344 |
account = self._generate_account_name(client.domain)
|
| 328 | 345 |
proxy_name = None
|
| 329 | 346 |
if client.proxy is not None:
|
| ... | ... | @@ -339,7 +356,7 @@ def _on_anonymous_supported(self, client, _signal_name): |
| 339 | 356 |
self.get_page('success').set_account(account)
|
| 340 | 357 |
self.show_page('success', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 341 | 358 |
|
| 342 |
- def _on_disconnected(self, client, _signal_name):
|
|
| 359 |
+ def _on_disconnected(self, client: Client, _signal_name: str) -> None:
|
|
| 343 | 360 |
domain, error, text = client.get_error()
|
| 344 | 361 |
if domain == StreamError.SASL:
|
| 345 | 362 |
if error == 'anonymous-not-supported':
|
| ... | ... | @@ -380,7 +397,10 @@ def _on_disconnected(self, client, _signal_name): |
| 380 | 397 |
self._client.destroy()
|
| 381 | 398 |
self._client = None
|
| 382 | 399 |
|
| 383 |
- def _on_connection_failed(self, _client, _signal_name):
|
|
| 400 |
+ def _on_connection_failed(self,
|
|
| 401 |
+ _client: Client,
|
|
| 402 |
+ _signal_name: str
|
|
| 403 |
+ ) -> None:
|
|
| 384 | 404 |
self._show_error_page(_('Connection failed'),
|
| 385 | 405 |
_('Connection failed'),
|
| 386 | 406 |
_('Gajim was not able to reach the server. '
|
| ... | ... | @@ -407,7 +427,7 @@ def _generate_account_name(domain: str) -> str: |
| 407 | 427 |
i += 1
|
| 408 | 428 |
return domain
|
| 409 | 429 |
|
| 410 |
- def _on_register_form(self, task):
|
|
| 430 |
+ def _on_register_form(self, task: Task) -> None:
|
|
| 411 | 431 |
try:
|
| 412 | 432 |
result = task.finish()
|
| 413 | 433 |
except (StanzaError, MalformedStanzaError) as error:
|
| ... | ... | @@ -446,7 +466,7 @@ def _submit_form(self) -> None: |
| 446 | 466 |
form,
|
| 447 | 467 |
callback=self._on_register_result)
|
| 448 | 468 |
|
| 449 |
- def _on_register_result(self, task):
|
|
| 469 |
+ def _on_register_result(self, task: Task) -> None:
|
|
| 450 | 470 |
try:
|
| 451 | 471 |
task.finish()
|
| 452 | 472 |
except RegisterStanzaError as error:
|
| ... | ... | @@ -505,7 +525,7 @@ def _set_error_text(self, |
| 505 | 525 |
'without an error message')
|
| 506 | 526 |
self._show_error_page(_('Error'), _('Error'), error_text)
|
| 507 | 527 |
|
| 508 |
- def _on_destroy(self, *args):
|
|
| 528 |
+ def _on_destroy(self, *args: Any) -> None:
|
|
| 509 | 529 |
self._disconnect()
|
| 510 | 530 |
self._destroyed = True
|
| 511 | 531 |
|
| ... | ... | @@ -540,10 +560,10 @@ def __init__(self) -> None: |
| 540 | 560 |
def focus(self) -> None:
|
| 541 | 561 |
self._ui.log_in_address_entry.grab_focus()
|
| 542 | 562 |
|
| 543 |
- def _on_login(self, *args):
|
|
| 563 |
+ def _on_login(self, *args: Any) -> None:
|
|
| 544 | 564 |
self.emit('clicked', 'login')
|
| 545 | 565 |
|
| 546 |
- def _on_signup(self, *args):
|
|
| 566 |
+ def _on_signup(self, *args: Any) -> None:
|
|
| 547 | 567 |
self.emit('clicked', 'signup')
|
| 548 | 568 |
|
| 549 | 569 |
def _create_server_completion(self) -> None:
|
| ... | ... | @@ -558,11 +578,11 @@ def _create_server_completion(self) -> None: |
| 558 | 578 |
address_model.append((server,))
|
| 559 | 579 |
self._ui.log_in_address_entry.get_completion().set_model(address_model)
|
| 560 | 580 |
|
| 561 |
- def _on_address_changed(self, entry):
|
|
| 581 |
+ def _on_address_changed(self, entry: Gtk.Entry) -> None:
|
|
| 562 | 582 |
self._update_completion(entry)
|
| 563 | 583 |
self._set_complete()
|
| 564 | 584 |
|
| 565 |
- def _update_completion(self, entry):
|
|
| 585 |
+ def _update_completion(self, entry: Gtk.Entry) -> None:
|
|
| 566 | 586 |
text = entry.get_text()
|
| 567 | 587 |
if '@' not in text:
|
| 568 | 588 |
self._show_icon(False)
|
| ... | ... | @@ -580,10 +600,10 @@ def _show_icon(self, show: bool) -> None: |
| 580 | 600 |
self._ui.log_in_address_entry.set_icon_from_icon_name(
|
| 581 | 601 |
Gtk.EntryIconPosition.SECONDARY, icon)
|
| 582 | 602 |
|
| 583 |
- def _on_address_entry_activate(self, _widget):
|
|
| 603 |
+ def _on_address_entry_activate(self, _entry: Gtk.Entry) -> None:
|
|
| 584 | 604 |
GLib.idle_add(self._ui.log_in_password_entry.grab_focus)
|
| 585 | 605 |
|
| 586 |
- def _on_password_entry_activate(self, _widget):
|
|
| 606 |
+ def _on_password_entry_activate(self, _entry: Gtk.Entry) -> None:
|
|
| 587 | 607 |
if self._ui.log_in_button.get_sensitive():
|
| 588 | 608 |
self._ui.log_in_button.activate()
|
| 589 | 609 |
|
| ... | ... | @@ -605,7 +625,7 @@ def _validate_jid(self, address: str) -> bool: |
| 605 | 625 |
self._show_icon(False)
|
| 606 | 626 |
return True
|
| 607 | 627 |
|
| 608 |
- def _set_complete(self, *args):
|
|
| 628 |
+ def _set_complete(self, *args: Any) -> None:
|
|
| 609 | 629 |
address = self._validate_jid(self._ui.log_in_address_entry.get_text())
|
| 610 | 630 |
password = self._ui.log_in_password_entry.get_text()
|
| 611 | 631 |
self._ui.log_in_button.set_sensitive(address and password)
|
| ... | ... | @@ -620,7 +640,7 @@ def get_credentials(self) -> Tuple[str, str]: |
| 620 | 640 |
|
| 621 | 641 |
|
| 622 | 642 |
class Signup(Page):
|
| 623 |
- def __init__(self):
|
|
| 643 |
+ def __init__(self) -> None:
|
|
| 624 | 644 |
Page.__init__(self)
|
| 625 | 645 |
self.complete: bool = False
|
| 626 | 646 |
self.title: str = _('Create New Account')
|
| ... | ... | @@ -660,13 +680,13 @@ def _create_server_completion(self) -> None: |
| 660 | 680 |
self._ui.server_comboboxtext_sign_up_entry.get_completion().set_model(
|
| 661 | 681 |
servers_model)
|
| 662 | 682 |
|
| 663 |
- def _on_visit_server(self, _widget):
|
|
| 683 |
+ def _on_visit_server(self, _button: Gtk.Button) -> int:
|
|
| 664 | 684 |
server = self._ui.server_comboboxtext_sign_up_entry.get_text().strip()
|
| 665 | 685 |
server = f'https://{server}'
|
| 666 | 686 |
open_uri(server)
|
| 667 | 687 |
return Gdk.EVENT_STOP
|
| 668 | 688 |
|
| 669 |
- def _set_complete(self, *args):
|
|
| 689 |
+ def _set_complete(self, *args: Any) -> None:
|
|
| 670 | 690 |
try:
|
| 671 | 691 |
self.get_server()
|
| 672 | 692 |
except Exception:
|
| ... | ... | @@ -689,7 +709,7 @@ def get_server(self) -> str: |
| 689 | 709 |
self._ui.server_comboboxtext_sign_up_entry.get_text())
|
| 690 | 710 |
|
| 691 | 711 |
@staticmethod
|
| 692 |
- def _on_activate_link(_label, uri):
|
|
| 712 |
+ def _on_activate_link(_label: Gtk.Label, uri: str) -> int:
|
|
| 693 | 713 |
# We have to use this, because the default GTK handler
|
| 694 | 714 |
# is not cross-platform compatible
|
| 695 | 715 |
open_uri(uri)
|
| ... | ... | @@ -703,7 +723,7 @@ def get_default_button(self) -> str: |
| 703 | 723 |
|
| 704 | 724 |
|
| 705 | 725 |
class AdvancedSettings(Page):
|
| 706 |
- def __init__(self):
|
|
| 726 |
+ def __init__(self) -> None:
|
|
| 707 | 727 |
Page.__init__(self)
|
| 708 | 728 |
self.title: str = _('Advanced settings')
|
| 709 | 729 |
self.complete: bool = False
|
| ... | ... | @@ -719,7 +739,7 @@ def __init__(self): |
| 719 | 739 |
self.show_all()
|
| 720 | 740 |
|
| 721 | 741 |
@staticmethod
|
| 722 |
- def _on_proxy_manager(_widget):
|
|
| 742 |
+ def _on_proxy_manager(_button: Gtk.Button) -> None:
|
|
| 723 | 743 |
app.app.activate_action('manage-proxies')
|
| 724 | 744 |
|
| 725 | 745 |
def update_proxy_list(self) -> None:
|
| ... | ... | @@ -811,7 +831,7 @@ def _is_custom_host_set(self) -> bool: |
| 811 | 831 |
def _is_proxy_set(self) -> bool:
|
| 812 | 832 |
return self._ui.proxies_combobox.get_active() != 0
|
| 813 | 833 |
|
| 814 |
- def _set_complete(self, *args):
|
|
| 834 |
+ def _set_complete(self, *args: Any) -> None:
|
|
| 815 | 835 |
self.complete = False
|
| 816 | 836 |
if self._is_proxy_set():
|
| 817 | 837 |
self.complete = True
|
| ... | ... | @@ -875,7 +895,7 @@ def set_warning(self, |
| 875 | 895 |
self._ui.trust_cert_checkbutton.set_visible(
|
| 876 | 896 |
Gio.TlsCertificateFlags.UNKNOWN_CA in errors)
|
| 877 | 897 |
|
| 878 |
- def _on_view_cert(self, _button):
|
|
| 898 |
+ def _on_view_cert(self, _button: Gtk.Button) -> None:
|
|
| 879 | 899 |
open_window('CertificateDialog',
|
| 880 | 900 |
account=self._domain,
|
| 881 | 901 |
transient_for=self.get_toplevel(),
|
| ... | ... | @@ -896,9 +916,9 @@ class Form(Page): |
| 896 | 916 |
def __init__(self) -> None:
|
| 897 | 917 |
Page.__init__(self)
|
| 898 | 918 |
self.set_valign(Gtk.Align.FILL)
|
| 899 |
- self.complete = False
|
|
| 919 |
+ self.complete: bool = False
|
|
| 900 | 920 |
self.title: str = _('Create Account')
|
| 901 |
- self._current_form = None
|
|
| 921 |
+ self._current_form: Optional[Any] = None
|
|
| 902 | 922 |
|
| 903 | 923 |
heading = Gtk.Label(label=_('Create Account'))
|
| 904 | 924 |
heading.get_style_context().add_class('large-header')
|
| ... | ... | @@ -914,11 +934,11 @@ def __init__(self) -> None: |
| 914 | 934 |
def has_form(self) -> bool:
|
| 915 | 935 |
return self._current_form is not None
|
| 916 | 936 |
|
| 917 |
- def _on_is_valid(self, _widget, is_valid):
|
|
| 937 |
+ def _on_is_valid(self, _widget: DataFormWidget, is_valid: bool) -> None:
|
|
| 918 | 938 |
self.complete = is_valid
|
| 919 | 939 |
self.update_page_complete()
|
| 920 | 940 |
|
| 921 |
- def add_form(self, form):
|
|
| 941 |
+ def add_form(self, form: Any) -> None:
|
|
| 922 | 942 |
self.remove_form()
|
| 923 | 943 |
|
| 924 | 944 |
options = {'hide-fallback-fields': True,
|
| ... | ... | @@ -933,7 +953,7 @@ def get_credentials(self) -> Tuple[str, str]: |
| 933 | 953 |
return (self._current_form.get_form()['username'].value,
|
| 934 | 954 |
self._current_form.get_form()['password'].value)
|
| 935 | 955 |
|
| 936 |
- def get_submit_form(self):
|
|
| 956 |
+ def get_submit_form(self) -> Any:
|
|
| 937 | 957 |
return self._current_form.get_submit_form()
|
| 938 | 958 |
|
| 939 | 959 |
def remove_form(self) -> None:
|
| ... | ... | @@ -971,7 +991,7 @@ def set_redirect(self, link: str, instructions: str) -> None: |
| 971 | 991 |
self._ui.instructions.set_text(instructions)
|
| 972 | 992 |
self._link = link
|
| 973 | 993 |
|
| 974 |
- def _on_link_button(self, _button):
|
|
| 994 |
+ def _on_link_button(self, _button:Gtk.Button) -> None:
|
|
| 975 | 995 |
open_uri(self._link)
|
| 976 | 996 |
|
| 977 | 997 |
def get_visible_buttons(self) -> List[str]:
|
| ... | ... | @@ -985,9 +1005,9 @@ def __init__(self) -> None: |
| 985 | 1005 |
self.set_heading(_('Account has been added successfully'))
|
| 986 | 1006 |
|
| 987 | 1007 |
self._account: Optional[str] = None
|
| 988 |
- self._our_jid = None
|
|
| 989 |
- self._label = None
|
|
| 990 |
- self._color = None
|
|
| 1008 |
+ self._our_jid: Optional[str] = None
|
|
| 1009 |
+ self._label: Optional[str] = None
|
|
| 1010 |
+ self._color: Optional[str] = None
|
|
| 991 | 1011 |
|
| 992 | 1012 |
self._ui = get_builder('account_wizard.ui')
|
| 993 | 1013 |
self.pack_start(self._ui.account_label_box, True, True, 0)
|
| ... | ... | @@ -1013,28 +1033,28 @@ def set_account(self, account: str) -> None: |
| 1013 | 1033 |
def account(self) -> Optional[str]:
|
| 1014 | 1034 |
return self._account
|
| 1015 | 1035 |
|
| 1016 |
- def _add_css_provider(self):
|
|
| 1036 |
+ def _add_css_provider(self) -> Gtk.CssProvider:
|
|
| 1017 | 1037 |
context = self._ui.badge_preview.get_style_context()
|
| 1018 | 1038 |
provider = Gtk.CssProvider()
|
| 1019 | 1039 |
context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
| 1020 | 1040 |
return provider
|
| 1021 | 1041 |
|
| 1022 |
- def _on_name_changed(self, entry):
|
|
| 1042 |
+ def _on_name_changed(self, entry: Gtk.Entry):
|
|
| 1023 | 1043 |
self._label = entry.get_text()
|
| 1024 | 1044 |
self._ui.badge_preview.set_text(self._label or self._our_jid)
|
| 1025 | 1045 |
self._save_config()
|
| 1026 | 1046 |
|
| 1027 |
- def _on_color_set(self, button):
|
|
| 1047 |
+ def _on_color_set(self, button: Gtk.ColorButton):
|
|
| 1028 | 1048 |
rgba = button.get_rgba()
|
| 1029 | 1049 |
self._color = rgba.to_string()
|
| 1030 | 1050 |
self._set_badge_color(self._color)
|
| 1031 | 1051 |
self._save_config()
|
| 1032 | 1052 |
|
| 1033 |
- def _set_badge_color(self, color):
|
|
| 1053 |
+ def _set_badge_color(self, color: str) -> None:
|
|
| 1034 | 1054 |
css = '.badge { background-color: %s; font-size: 100%%; }' % color
|
| 1035 | 1055 |
self._provider.load_from_data(bytes(css.encode()))
|
| 1036 | 1056 |
|
| 1037 |
- def _save_config(self):
|
|
| 1057 |
+ def _save_config(self) -> None:
|
|
| 1038 | 1058 |
app.settings.set_account_setting(
|
| 1039 | 1059 |
self._account, 'account_color', self._color)
|
| 1040 | 1060 |
if self._label:
|
| ... | ... | @@ -93,6 +93,7 @@ def _on_button_clicked(self, |
| 93 | 93 |
) -> None:
|
| 94 | 94 |
page = self.get_current_page()
|
| 95 | 95 |
account, _ = self.get_page('address').get_account_and_jid()
|
| 96 |
+ assert account is not None
|
|
| 96 | 97 |
|
| 97 | 98 |
if button_name == 'next':
|
| 98 | 99 |
self._start_disco()
|
| ... | ... | @@ -132,6 +133,7 @@ def _start_disco(self) -> None: |
| 132 | 133 |
self.show_page('progress', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 133 | 134 |
|
| 134 | 135 |
account, jid = self.get_page('address').get_account_and_jid()
|
| 136 |
+ assert account is not None
|
|
| 135 | 137 |
self._disco_info(account, jid)
|
| 136 | 138 |
|
| 137 | 139 |
@as_task
|
| ... | ... | @@ -213,7 +215,7 @@ def __init__(self, account: Optional[str], jid: Optional[JID]) -> None: |
| 213 | 215 |
self._ui.account_combo.connect('changed', self._on_account_changed)
|
| 214 | 216 |
self._ui.address_entry.connect('changed', self._set_complete)
|
| 215 | 217 |
|
| 216 |
- accounts = app.get_enabled_accounts_with_labels()
|
|
| 218 |
+ accounts = app.get_enabled_accounts_with_labels(connected_only=True)
|
|
| 217 | 219 |
liststore = self._ui.account_combo.get_model()
|
| 218 | 220 |
for acc in accounts:
|
| 219 | 221 |
liststore.append(acc)
|
| ... | ... | @@ -17,11 +17,12 @@ |
| 17 | 17 |
|
| 18 | 18 |
from gajim.common import app
|
| 19 | 19 |
|
| 20 |
-from gajim.gui.util import load_icon
|
|
| 20 |
+from .app_page import AppPage
|
|
| 21 |
+from .util import load_icon
|
|
| 21 | 22 |
|
| 22 | 23 |
|
| 23 | 24 |
class AppSideBar(Gtk.ListBox):
|
| 24 |
- def __init__(self, app_page):
|
|
| 25 |
+ def __init__(self, app_page: AppPage) -> None:
|
|
| 25 | 26 |
Gtk.ListBox.__init__(self)
|
| 26 | 27 |
self.set_valign(Gtk.Align.START)
|
| 27 | 28 |
self.set_selection_mode(Gtk.SelectionMode.SINGLE)
|
| ... | ... | @@ -40,15 +41,17 @@ def __init__(self, app_page): |
| 40 | 41 |
GLib.idle_add(self.unselect_all)
|
| 41 | 42 |
|
| 42 | 43 |
@staticmethod
|
| 43 |
- def _on_app_row_activated(_listbox, _row):
|
|
| 44 |
+ def _on_app_row_activated(_listbox: Gtk.ListBox,
|
|
| 45 |
+ _row: Gtk.ListBoxRow
|
|
| 46 |
+ ) -> None:
|
|
| 44 | 47 |
app.window.show_app_page()
|
| 45 | 48 |
|
| 46 |
- def _on_unread_count_changed(self, _app_page, count):
|
|
| 49 |
+ def _on_unread_count_changed(self, _app_page: AppPage, count: int) -> None:
|
|
| 47 | 50 |
self._app_row.set_unread_count(count)
|
| 48 | 51 |
|
| 49 | 52 |
|
| 50 | 53 |
class AppRow(Gtk.ListBoxRow):
|
| 51 |
- def __init__(self):
|
|
| 54 |
+ def __init__(self) -> None:
|
|
| 52 | 55 |
Gtk.ListBoxRow.__init__(self)
|
| 53 | 56 |
self.get_style_context().add_class('workspace-sidebar-item')
|
| 54 | 57 |
|
| ... | ... | @@ -78,7 +81,7 @@ def __init__(self): |
| 78 | 81 |
self.add(overlay)
|
| 79 | 82 |
self.show_all()
|
| 80 | 83 |
|
| 81 |
- def set_unread_count(self, count):
|
|
| 84 |
+ def set_unread_count(self, count: int) -> None:
|
|
| 82 | 85 |
if count < 1000:
|
| 83 | 86 |
self._unread_label.set_text(str(count))
|
| 84 | 87 |
else:
|
| ... | ... | @@ -109,7 +109,7 @@ def prepare_crop_area(self, path: str) -> None: |
| 109 | 109 |
self._helper_label.hide()
|
| 110 | 110 |
self._crop_area.show()
|
| 111 | 111 |
|
| 112 |
- def _on_load_clicked(self, _button):
|
|
| 112 |
+ def _on_load_clicked(self, _button: Gtk.Button) -> None:
|
|
| 113 | 113 |
def _on_file_selected(path):
|
| 114 | 114 |
self.prepare_crop_area(path)
|
| 115 | 115 |
|
| ... | ... | @@ -117,8 +117,15 @@ def _on_file_selected(path): |
| 117 | 117 |
transient_for=self.get_toplevel(),
|
| 118 | 118 |
modal=True)
|
| 119 | 119 |
|
| 120 |
- def _on_drag_data_received(self, _widget, _context, _x_coord, _y_coord,
|
|
| 121 |
- selection, target_type, _timestamp):
|
|
| 120 |
+ def _on_drag_data_received(self,
|
|
| 121 |
+ _widget: Gtk.Widget,
|
|
| 122 |
+ _context: Gdk.DragContext,
|
|
| 123 |
+ _x_coord: int,
|
|
| 124 |
+ _y_coord: int,
|
|
| 125 |
+ selection: Gtk.SelectionData,
|
|
| 126 |
+ target_type: int,
|
|
| 127 |
+ _timestamp: int
|
|
| 128 |
+ ) -> None:
|
|
| 122 | 129 |
if not selection.get_data():
|
| 123 | 130 |
return
|
| 124 | 131 |
|
| ... | ... | @@ -184,10 +191,10 @@ def __init__(self) -> None: |
| 184 | 191 |
|
| 185 | 192 |
self._image = Gdk.Rectangle()
|
| 186 | 193 |
self._crop = Gdk.Rectangle()
|
| 187 |
- self._pixbuf = None
|
|
| 188 |
- self._browse_pixbuf = None
|
|
| 189 |
- self._color_shifted_pixbuf = None
|
|
| 190 |
- self._current_cursor = None
|
|
| 194 |
+ self._pixbuf: Optional[GdkPixbuf.Pixbuf] = None
|
|
| 195 |
+ self._browse_pixbuf: Optional[GdkPixbuf.Pixbuf] = None
|
|
| 196 |
+ self._color_shifted_pixbuf: Optional[GdkPixbuf.Pixbuf] = None
|
|
| 197 |
+ self._current_cursor: Optional[Gdk.CursorType] = None
|
|
| 191 | 198 |
|
| 192 | 199 |
self._scale = float(0.0)
|
| 193 | 200 |
self._image.x = 0
|
| ... | ... | @@ -259,7 +266,7 @@ def get_pixbuf(self) -> Optional[GdkPixbuf.Pixbuf]: |
| 259 | 266 |
return GdkPixbuf.Pixbuf.new_subpixbuf(
|
| 260 | 267 |
self._browse_pixbuf, self._crop.x, self._crop.y, width, height)
|
| 261 | 268 |
|
| 262 |
- def _on_draw(self, _widget, context):
|
|
| 269 |
+ def _on_draw(self, _widget: Gtk.Widget, context: cairo.Context) -> bool:
|
|
| 263 | 270 |
if self._browse_pixbuf is None:
|
| 264 | 271 |
return False
|
| 265 | 272 |
|
| ... | ... | @@ -342,7 +349,10 @@ def _on_draw(self, _widget, context): |
| 342 | 349 |
|
| 343 | 350 |
return False
|
| 344 | 351 |
|
| 345 |
- def _on_button_press(self, _widget, event):
|
|
| 352 |
+ def _on_button_press(self,
|
|
| 353 |
+ _widget: Gtk.Widget,
|
|
| 354 |
+ event: Gdk.EventButton
|
|
| 355 |
+ ) -> bool:
|
|
| 346 | 356 |
if self._browse_pixbuf is None:
|
| 347 | 357 |
return False
|
| 348 | 358 |
|
| ... | ... | @@ -357,7 +367,10 @@ def _on_button_press(self, _widget, event): |
| 357 | 367 |
|
| 358 | 368 |
return False
|
| 359 | 369 |
|
| 360 |
- def _on_button_release(self, _widget, _event):
|
|
| 370 |
+ def _on_button_release(self,
|
|
| 371 |
+ _widget: Gtk.Widget,
|
|
| 372 |
+ _event: Gdk.EventButton
|
|
| 373 |
+ ) -> bool:
|
|
| 361 | 374 |
if self._browse_pixbuf is None:
|
| 362 | 375 |
return False
|
| 363 | 376 |
|
| ... | ... | @@ -371,7 +384,10 @@ def _on_button_release(self, _widget, _event): |
| 371 | 384 |
|
| 372 | 385 |
return False
|
| 373 | 386 |
|
| 374 |
- def _on_motion_notify(self, _widget, event):
|
|
| 387 |
+ def _on_motion_notify(self,
|
|
| 388 |
+ _widget: Gtk.Widget,
|
|
| 389 |
+ event: Gdk.EventMotion
|
|
| 390 |
+ ) -> bool:
|
|
| 375 | 391 |
# pylint: disable=too-many-boolean-expressions
|
| 376 | 392 |
# pylint: disable=too-many-branches
|
| 377 | 393 |
# pylint: disable=too-many-statements
|
| ... | ... | @@ -565,7 +581,7 @@ def _on_motion_notify(self, _widget, event): |
| 565 | 581 |
|
| 566 | 582 |
return False
|
| 567 | 583 |
|
| 568 |
- def _update_pixbufs(self):
|
|
| 584 |
+ def _update_pixbufs(self) -> None:
|
|
| 569 | 585 |
allocation = self.get_allocation()
|
| 570 | 586 |
width = self._browse_pixbuf.get_width()
|
| 571 | 587 |
height = self._browse_pixbuf.get_height()
|
| ... | ... | @@ -625,7 +641,7 @@ def _update_pixbufs(self): |
| 625 | 641 |
self._image.width = dest_width
|
| 626 | 642 |
self._image.height = dest_height
|
| 627 | 643 |
|
| 628 |
- def _crop_to_widget(self):
|
|
| 644 |
+ def _crop_to_widget(self) -> Gdk.Rectangle:
|
|
| 629 | 645 |
crop = Gdk.Rectangle()
|
| 630 | 646 |
crop.x = self._image.x + self._crop.x * self._scale
|
| 631 | 647 |
crop.y = self._image.y + self._crop.y * self._scale
|
| ... | ... | @@ -633,7 +649,7 @@ def _crop_to_widget(self): |
| 633 | 649 |
crop.height = self._crop.height * self._scale
|
| 634 | 650 |
return crop
|
| 635 | 651 |
|
| 636 |
- def _update_cursor(self, x_coord, y_coord):
|
|
| 652 |
+ def _update_cursor(self, x_coord: float, y_coord: float) -> None:
|
|
| 637 | 653 |
region = self._active_region
|
| 638 | 654 |
if self._active_region == Loc.OUTSIDE:
|
| 639 | 655 |
crop = self._crop_to_widget()
|
| ... | ... | @@ -668,7 +684,12 @@ def _update_cursor(self, x_coord, y_coord): |
| 668 | 684 |
self._current_cursor = cursor_type
|
| 669 | 685 |
|
| 670 | 686 |
@staticmethod
|
| 671 |
- def _eval_radial_line(center_x, center_y, bounds_x, bounds_y, user_x):
|
|
| 687 |
+ def _eval_radial_line(center_x: float,
|
|
| 688 |
+ center_y: float,
|
|
| 689 |
+ bounds_x: int,
|
|
| 690 |
+ bounds_y: int,
|
|
| 691 |
+ user_x: int
|
|
| 692 |
+ ) -> int:
|
|
| 672 | 693 |
slope_y = float(bounds_y - center_y)
|
| 673 | 694 |
slope_x = bounds_x - center_x
|
| 674 | 695 |
if slope_y == 0 or slope_x == 0:
|
| ... | ... | @@ -679,7 +700,11 @@ def _eval_radial_line(center_x, center_y, bounds_x, bounds_y, user_x): |
| 679 | 700 |
decision_intercept = - float(decision_slope * bounds_x)
|
| 680 | 701 |
return int(decision_slope * user_x + decision_intercept)
|
| 681 | 702 |
|
| 682 |
- def _find_location(self, rect, x_coord, y_coord):
|
|
| 703 |
+ def _find_location(self,
|
|
| 704 |
+ rect: Gdk.Rectangle,
|
|
| 705 |
+ x_coord: float,
|
|
| 706 |
+ y_coord: float
|
|
| 707 |
+ ) -> Loc:
|
|
| 683 | 708 |
# pylint: disable=line-too-long
|
| 684 | 709 |
location = [
|
| 685 | 710 |
[Loc.OUTSIDE, Loc.OUTSIDE, Loc.OUTSIDE, Loc.OUTSIDE, Loc.OUTSIDE],
|
| ... | ... | @@ -696,7 +721,7 @@ def _find_location(self, rect, x_coord, y_coord): |
| 696 | 721 |
return location[y_range][x_range]
|
| 697 | 722 |
|
| 698 | 723 |
@staticmethod
|
| 699 |
- def _find_range(coord, min_v, max_v):
|
|
| 724 |
+ def _find_range(coord: float, min_v: int, max_v: int) -> Range:
|
|
| 700 | 725 |
tolerance = 12
|
| 701 | 726 |
if coord < min_v - tolerance:
|
| 702 | 727 |
return Range.BELOW
|
| ... | ... | @@ -708,7 +733,7 @@ def _find_range(coord, min_v, max_v): |
| 708 | 733 |
return Range.UPPER
|
| 709 | 734 |
return Range.ABOVE
|
| 710 | 735 |
|
| 711 |
- def _generate_color_shifted_pixbuf(self):
|
|
| 736 |
+ def _generate_color_shifted_pixbuf(self) -> None:
|
|
| 712 | 737 |
# pylint: disable=no-member
|
| 713 | 738 |
surface = cairo.ImageSurface(
|
| 714 | 739 |
cairo.Format.ARGB32,
|
| ... | ... | @@ -12,12 +12,17 @@ |
| 12 | 12 |
# You should have received a copy of the GNU General Public License
|
| 13 | 13 |
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 |
|
| 15 |
+from typing import Any
|
|
| 16 |
+from typing import List
|
|
| 17 |
+ |
|
| 15 | 18 |
import logging
|
| 16 | 19 |
|
| 17 | 20 |
from gi.repository import Gtk
|
| 18 | 21 |
|
| 19 | 22 |
from nbxmpp.errors import StanzaError
|
| 20 | 23 |
from nbxmpp.errors import ChangePasswordStanzaError
|
| 24 |
+from nbxmpp.modules.dataforms import SimpleDataForm
|
|
| 25 |
+from nbxmpp.task import Task
|
|
| 21 | 26 |
|
| 22 | 27 |
from gajim.common import app
|
| 23 | 28 |
from gajim.common.i18n import _
|
| ... | ... | @@ -35,7 +40,7 @@ |
| 35 | 40 |
|
| 36 | 41 |
|
| 37 | 42 |
class ChangePassword(Assistant):
|
| 38 |
- def __init__(self, account):
|
|
| 43 |
+ def __init__(self, account: str) -> None:
|
|
| 39 | 44 |
Assistant.__init__(self)
|
| 40 | 45 |
|
| 41 | 46 |
self.account = account
|
| ... | ... | @@ -61,7 +66,10 @@ def __init__(self, account): |
| 61 | 66 |
|
| 62 | 67 |
self.show_all()
|
| 63 | 68 |
|
| 64 |
- def _on_button_clicked(self, _assistant, button_name):
|
|
| 69 |
+ def _on_button_clicked(self,
|
|
| 70 |
+ _assistant: Assistant,
|
|
| 71 |
+ button_name: str
|
|
| 72 |
+ ) -> None:
|
|
| 65 | 73 |
page = self.get_current_page()
|
| 66 | 74 |
if button_name == 'apply':
|
| 67 | 75 |
self.show_page('progress', Gtk.StackTransitionType.SLIDE_LEFT)
|
| ... | ... | @@ -73,7 +81,7 @@ def _on_button_clicked(self, _assistant, button_name): |
| 73 | 81 |
elif button_name == 'close':
|
| 74 | 82 |
self.destroy()
|
| 75 | 83 |
|
| 76 |
- def _on_apply(self, next_stage=False):
|
|
| 84 |
+ def _on_apply(self, next_stage: bool = False) -> None:
|
|
| 77 | 85 |
if next_stage:
|
| 78 | 86 |
form = self.get_page('next_stage').get_submit_form()
|
| 79 | 87 |
self._client.get_module('Register').change_password_with_form(
|
| ... | ... | @@ -84,7 +92,7 @@ def _on_apply(self, next_stage=False): |
| 84 | 92 |
password, callback=self._on_change_password)
|
| 85 | 93 |
|
| 86 | 94 |
@ensure_not_destroyed
|
| 87 |
- def _on_change_password(self, task):
|
|
| 95 |
+ def _on_change_password(self, task: Task) -> None:
|
|
| 88 | 96 |
try:
|
| 89 | 97 |
task.finish()
|
| 90 | 98 |
except ChangePasswordStanzaError as error:
|
| ... | ... | @@ -101,12 +109,12 @@ def _on_change_password(self, task): |
| 101 | 109 |
passwords.save_password(self.account, password)
|
| 102 | 110 |
self.show_page('success')
|
| 103 | 111 |
|
| 104 |
- def _on_destroy(self, *args):
|
|
| 112 |
+ def _on_destroy(self, *args: Any) -> None:
|
|
| 105 | 113 |
self._destroyed = True
|
| 106 | 114 |
|
| 107 | 115 |
|
| 108 | 116 |
class EnterPassword(Page):
|
| 109 |
- def __init__(self):
|
|
| 117 |
+ def __init__(self) -> None:
|
|
| 110 | 118 |
Page.__init__(self)
|
| 111 | 119 |
self.complete = False
|
| 112 | 120 |
self.title = _('Change Password')
|
| ... | ... | @@ -150,7 +158,7 @@ def __init__(self): |
| 150 | 158 |
self._show_icon(False)
|
| 151 | 159 |
self.show_all()
|
| 152 | 160 |
|
| 153 |
- def _show_icon(self, show):
|
|
| 161 |
+ def _show_icon(self, show: bool) -> None:
|
|
| 154 | 162 |
if show:
|
| 155 | 163 |
self._password2_entry.set_icon_from_icon_name(
|
| 156 | 164 |
Gtk.EntryIconPosition.SECONDARY, 'dialog-warning-symbolic')
|
| ... | ... | @@ -160,7 +168,7 @@ def _show_icon(self, show): |
| 160 | 168 |
self._password2_entry.set_icon_from_icon_name(
|
| 161 | 169 |
Gtk.EntryIconPosition.SECONDARY, None)
|
| 162 | 170 |
|
| 163 |
- def _on_changed(self, _entry):
|
|
| 171 |
+ def _on_changed(self, _entry: Gtk.Entry) -> None:
|
|
| 164 | 172 |
password1 = self._password1_entry.get_text()
|
| 165 | 173 |
if not password1:
|
| 166 | 174 |
self._show_icon(True)
|
| ... | ... | @@ -175,19 +183,19 @@ def _on_changed(self, _entry): |
| 175 | 183 |
self._show_icon(False)
|
| 176 | 184 |
self._set_complete(True)
|
| 177 | 185 |
|
| 178 |
- def _set_complete(self, state):
|
|
| 186 |
+ def _set_complete(self, state: bool) -> None:
|
|
| 179 | 187 |
self.complete = state
|
| 180 | 188 |
self.update_page_complete()
|
| 181 | 189 |
|
| 182 |
- def get_password(self):
|
|
| 190 |
+ def get_password(self) -> str:
|
|
| 183 | 191 |
return self._password1_entry.get_text()
|
| 184 | 192 |
|
| 185 |
- def get_visible_buttons(self):
|
|
| 193 |
+ def get_visible_buttons(self) -> List[str]:
|
|
| 186 | 194 |
return ['apply']
|
| 187 | 195 |
|
| 188 | 196 |
|
| 189 | 197 |
class NextStage(Page):
|
| 190 |
- def __init__(self):
|
|
| 198 |
+ def __init__(self) -> None:
|
|
| 191 | 199 |
Page.__init__(self)
|
| 192 | 200 |
self.set_valign(Gtk.Align.FILL)
|
| 193 | 201 |
self.complete = False
|
| ... | ... | @@ -196,11 +204,11 @@ def __init__(self): |
| 196 | 204 |
|
| 197 | 205 |
self.show_all()
|
| 198 | 206 |
|
| 199 |
- def _on_is_valid(self, _widget, is_valid):
|
|
| 207 |
+ def _on_is_valid(self, _widget: Gtk.Widget, is_valid: bool) -> None:
|
|
| 200 | 208 |
self.complete = is_valid
|
| 201 | 209 |
self.update_page_complete()
|
| 202 | 210 |
|
| 203 |
- def set_form(self, form):
|
|
| 211 |
+ def set_form(self, form: SimpleDataForm) -> None:
|
|
| 204 | 212 |
if self._current_form is not None:
|
| 205 | 213 |
self.remove(self._current_form)
|
| 206 | 214 |
self._current_form.destroy()
|
| ... | ... | @@ -210,31 +218,31 @@ def set_form(self, form): |
| 210 | 218 |
self.pack_start(self._current_form, True, True, 0)
|
| 211 | 219 |
self._current_form.show_all()
|
| 212 | 220 |
|
| 213 |
- def get_submit_form(self):
|
|
| 221 |
+ def get_submit_form(self) -> SimpleDataForm:
|
|
| 214 | 222 |
return self._current_form.get_submit_form()
|
| 215 | 223 |
|
| 216 |
- def get_visible_buttons(self):
|
|
| 224 |
+ def get_visible_buttons(self) -> List[str]:
|
|
| 217 | 225 |
return ['apply']
|
| 218 | 226 |
|
| 219 | 227 |
|
| 220 | 228 |
class Error(ErrorPage):
|
| 221 |
- def __init__(self):
|
|
| 229 |
+ def __init__(self) -> None:
|
|
| 222 | 230 |
ErrorPage.__init__(self)
|
| 223 | 231 |
self.set_title(_('Password Change Failed'))
|
| 224 | 232 |
self.set_heading(_('Password Change Failed'))
|
| 225 | 233 |
self.set_text(
|
| 226 | 234 |
_('An error occurred while trying to change your password.'))
|
| 227 | 235 |
|
| 228 |
- def get_visible_buttons(self):
|
|
| 236 |
+ def get_visible_buttons(self) -> List[str]:
|
|
| 229 | 237 |
return ['back']
|
| 230 | 238 |
|
| 231 | 239 |
|
| 232 | 240 |
class Success(SuccessPage):
|
| 233 |
- def __init__(self):
|
|
| 241 |
+ def __init__(self) -> None:
|
|
| 234 | 242 |
SuccessPage.__init__(self)
|
| 235 | 243 |
self.set_title(_('Password Changed'))
|
| 236 | 244 |
self.set_heading(_('Password Changed'))
|
| 237 | 245 |
self.set_text(_('Your password has successfully been changed.'))
|
| 238 | 246 |
|
| 239 |
- def get_visible_buttons(self):
|
|
| 247 |
+ def get_visible_buttons(self) -> List[str]:
|
|
| 240 | 248 |
return ['close']
|
| ... | ... | @@ -24,10 +24,10 @@ |
| 24 | 24 |
|
| 25 | 25 |
from gajim.common import app
|
| 26 | 26 |
|
| 27 |
+from .chat_filter import ChatFilter
|
|
| 27 | 28 |
from .chat_list import ChatList
|
| 28 | 29 |
from .chat_list import ChatRow
|
| 29 | 30 |
|
| 30 |
- |
|
| 31 | 31 |
HANDLED_EVENTS = [
|
| 32 | 32 |
'message-received',
|
| 33 | 33 |
'mam-message-received',
|
| ... | ... | @@ -58,7 +58,10 @@ class ChatListStack(Gtk.Stack): |
| 58 | 58 |
(str, object, str)),
|
| 59 | 59 |
}
|
| 60 | 60 |
|
| 61 |
- def __init__(self, chat_filter, search_entry):
|
|
| 61 |
+ def __init__(self,
|
|
| 62 |
+ chat_filter: ChatFilter,
|
|
| 63 |
+ search_entry: Gtk.SearchEntry
|
|
| 64 |
+ ) -> None:
|
|
| 62 | 65 |
Gtk.Stack.__init__(self)
|
| 63 | 66 |
self.set_hexpand(True)
|
| 64 | 67 |
self.set_vexpand(True)
|
| ... | ... | @@ -77,7 +80,7 @@ def __init__(self, chat_filter, search_entry): |
| 77 | 80 |
self._add_actions()
|
| 78 | 81 |
self.show_all()
|
| 79 | 82 |
|
| 80 |
- def _add_actions(self):
|
|
| 83 |
+ def _add_actions(self) -> None:
|
|
| 81 | 84 |
actions = [
|
| 82 | 85 |
('toggle-chat-pinned', 'as', self._toggle_chat_pinned),
|
| 83 | 86 |
('move-chat-to-workspace', 'as', self._move_chat_to_workspace),
|
| ... | ... | @@ -92,7 +95,7 @@ def _add_actions(self): |
| 92 | 95 |
act.connect('activate', func)
|
| 93 | 96 |
app.window.add_action(act)
|
| 94 | 97 |
|
| 95 |
- def _on_visible_child_name(self, _stack, _param):
|
|
| 98 |
+ def _on_visible_child_name(self, _stack: Gtk.Stack, _param: str) -> None:
|
|
| 96 | 99 |
if self._last_visible_child_name == self.get_visible_child_name():
|
| 97 | 100 |
return
|
| 98 | 101 |
|
| ... | ... | @@ -125,11 +128,11 @@ def is_chat_active(self, account: str, jid: JID) -> bool: |
| 125 | 128 |
return False
|
| 126 | 129 |
return chat.is_active
|
| 127 | 130 |
|
| 128 |
- def _on_filter_changed(self, _filter, name):
|
|
| 131 |
+ def _on_filter_changed(self, _filter: ChatFilter, name: str) -> None:
|
|
| 129 | 132 |
chat_list = self.get_visible_child()
|
| 130 | 133 |
chat_list.set_filter(name)
|
| 131 | 134 |
|
| 132 |
- def _on_search_changed(self, search_entry):
|
|
| 135 |
+ def _on_search_changed(self, search_entry: Gtk.SearchEntry) -> None:
|
|
| 133 | 136 |
chat_list = self.get_visible_child()
|
| 134 | 137 |
chat_list.set_filter_text(search_entry.get_text())
|
| 135 | 138 |
|
| ... | ... | @@ -150,7 +153,10 @@ def remove_chat_list(self, workspace_id: str) -> None: |
| 150 | 153 |
self._chat_lists.pop(workspace_id)
|
| 151 | 154 |
chat_list.destroy()
|
| 152 | 155 |
|
| 153 |
- def _on_row_selected(self, _chat_list, row):
|
|
| 156 |
+ def _on_row_selected(self,
|
|
| 157 |
+ _chat_list: ChatList,
|
|
| 158 |
+ row: Optional[ChatRow]
|
|
| 159 |
+ ) -> None:
|
|
| 154 | 160 |
if row is None:
|
| 155 | 161 |
self.emit('chat-unselected')
|
| 156 | 162 |
return
|
| ... | ... | @@ -188,7 +194,10 @@ def store_open_chats(self, workspace_id: str) -> None: |
| 188 | 194 |
app.settings.set_workspace_setting(
|
| 189 | 195 |
workspace_id, 'open_chats', open_chats)
|
| 190 | 196 |
|
| 191 |
- def _toggle_chat_pinned(self, _action, param):
|
|
| 197 |
+ def _toggle_chat_pinned(self,
|
|
| 198 |
+ _action: Gio.SimpleAction,
|
|
| 199 |
+ param: GLib.Variant
|
|
| 200 |
+ ) -> None:
|
|
| 192 | 201 |
workspace_id, account, jid = param.unpack()
|
| 193 | 202 |
jid = JID.from_string(jid)
|
| 194 | 203 |
|
| ... | ... | @@ -196,7 +205,10 @@ def _toggle_chat_pinned(self, _action, param): |
| 196 | 205 |
chat_list.toggle_chat_pinned(account, jid)
|
| 197 | 206 |
self.store_open_chats(workspace_id)
|
| 198 | 207 |
|
| 199 |
- def _move_chat_to_workspace(self, _action, param):
|
|
| 208 |
+ def _move_chat_to_workspace(self,
|
|
| 209 |
+ _action: Gio.SimpleAction,
|
|
| 210 |
+ param: GLib.Variant
|
|
| 211 |
+ ) -> None:
|
|
| 200 | 212 |
new_workspace_id, account, jid = param.unpack()
|
| 201 | 213 |
jid = JID.from_string(jid)
|
| 202 | 214 |
|
| ... | ... | @@ -209,7 +221,10 @@ def _move_chat_to_workspace(self, _action, param): |
| 209 | 221 |
self.store_open_chats(current_chatlist.workspace_id)
|
| 210 | 222 |
self.store_open_chats(new_workspace_id)
|
| 211 | 223 |
|
| 212 |
- def _mark_as_read(self, _action, param):
|
|
| 224 |
+ def _mark_as_read(self,
|
|
| 225 |
+ _action: Gio.SimpleAction,
|
|
| 226 |
+ param: GLib.Variant
|
|
| 227 |
+ ) -> None:
|
|
| 213 | 228 |
_workspace_id, account, jid = param.unpack()
|
| 214 | 229 |
self.mark_as_read(account, JID.from_string(jid))
|
| 215 | 230 |
|