Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
cfd2c525
by wurstsalat at 2022-01-20T19:52:31+01:00
-
293ae9ef
by wurstsalat at 2022-01-20T20:02:51+01:00
-
ea8dba3a
by wurstsalat at 2022-01-20T20:10:34+01:00
3 changed files:
Changes:
| ... | ... | @@ -12,11 +12,11 @@ |
| 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 __future__ import annotations
|
|
| 16 |
+ |
|
| 15 | 17 |
from typing import Any
|
| 16 |
-from typing import Dict
|
|
| 17 |
-from typing import List
|
|
| 18 |
+from typing import cast
|
|
| 18 | 19 |
from typing import Optional
|
| 19 |
-from typing import Tuple
|
|
| 20 | 20 |
from typing import Union
|
| 21 | 21 |
|
| 22 | 22 |
import logging
|
| ... | ... | @@ -40,6 +40,7 @@ |
| 40 | 40 |
from .assistant import Assistant
|
| 41 | 41 |
from .assistant import Page
|
| 42 | 42 |
from .assistant import ErrorPage
|
| 43 |
+from .assistant import ProgressPage
|
|
| 43 | 44 |
from .groupchat_info import GroupChatInfoScrolled
|
| 44 | 45 |
from .builder import get_builder
|
| 45 | 46 |
from .util import open_window
|
| ... | ... | @@ -75,7 +76,7 @@ def __init__(self, |
| 75 | 76 |
'gateway': Gateway(),
|
| 76 | 77 |
})
|
| 77 | 78 |
|
| 78 |
- progress = self.add_default_page('progress')
|
|
| 79 |
+ progress = cast(ProgressPage, self.add_default_page('progress'))
|
|
| 79 | 80 |
progress.set_title(_('Gathering information…'))
|
| 80 | 81 |
progress.set_text(_('Trying to gather information on this address…'))
|
| 81 | 82 |
|
| ... | ... | @@ -92,8 +93,8 @@ def _on_button_clicked(self, |
| 92 | 93 |
button_name: str
|
| 93 | 94 |
) -> None:
|
| 94 | 95 |
page = self.get_current_page()
|
| 95 |
- account, _ = self.get_page('address').get_account_and_jid()
|
|
| 96 |
- assert account is not None
|
|
| 96 |
+ address_page = cast(Address, self.get_page('address'))
|
|
| 97 |
+ account, _ = address_page.get_account_and_jid()
|
|
| 97 | 98 |
|
| 98 | 99 |
if button_name == 'next':
|
| 99 | 100 |
self._start_disco()
|
| ... | ... | @@ -102,13 +103,14 @@ def _on_button_clicked(self, |
| 102 | 103 |
if button_name == 'back':
|
| 103 | 104 |
self.show_page('address',
|
| 104 | 105 |
Gtk.StackTransitionType.SLIDE_RIGHT)
|
| 105 |
- self.get_page('address').focus()
|
|
| 106 |
+ address_page.focus()
|
|
| 106 | 107 |
return
|
| 107 | 108 |
|
| 108 | 109 |
if button_name == 'add':
|
| 109 | 110 |
client = app.get_client(account)
|
| 110 | 111 |
if page == 'contact':
|
| 111 |
- data = self.get_page('contact').get_subscription_data()
|
|
| 112 |
+ contact_page = cast(Contact, self.get_page('contact'))
|
|
| 113 |
+ data = contact_page.get_subscription_data()
|
|
| 112 | 114 |
client.get_module('Presence').subscribe(
|
| 113 | 115 |
self._result.jid,
|
| 114 | 116 |
msg=data['message'],
|
| ... | ... | @@ -124,7 +126,7 @@ def _on_button_clicked(self, |
| 124 | 126 |
return
|
| 125 | 127 |
|
| 126 | 128 |
if button_name == 'join':
|
| 127 |
- _, jid = self.get_page('address').get_account_and_jid()
|
|
| 129 |
+ _, jid = address_page.get_account_and_jid()
|
|
| 128 | 130 |
open_window('GroupchatJoin', account=account, jid=jid)
|
| 129 | 131 |
self.destroy()
|
| 130 | 132 |
|
| ... | ... | @@ -132,22 +134,25 @@ def _start_disco(self) -> None: |
| 132 | 134 |
self._result = None
|
| 133 | 135 |
self.show_page('progress', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 134 | 136 |
|
| 135 |
- account, jid = self.get_page('address').get_account_and_jid()
|
|
| 137 |
+ address_page = cast(Address, self.get_page('address'))
|
|
| 138 |
+ account, jid = address_page.get_account_and_jid()
|
|
| 136 | 139 |
assert account is not None
|
| 137 | 140 |
self._disco_info(account, jid)
|
| 138 | 141 |
|
| 139 | 142 |
@as_task
|
| 140 |
- def _disco_info(self, account: str, address: str) -> None:
|
|
| 143 |
+ def _disco_info(self, account: str, address: str) -> Any:
|
|
| 141 | 144 |
_task = yield
|
| 142 | 145 |
|
| 143 | 146 |
client = app.get_client(account)
|
| 144 | 147 |
|
| 145 | 148 |
result = yield client.get_module('Discovery').disco_info(address)
|
| 146 | 149 |
if is_error(result):
|
| 150 |
+ assert isinstance(result, StanzaError)
|
|
| 147 | 151 |
self._process_error(account, result)
|
| 148 | 152 |
raise result
|
| 149 | 153 |
|
| 150 | 154 |
log.info('Disco Info received: %s', address)
|
| 155 |
+ assert isinstance(result, DiscoInfo)
|
|
| 151 | 156 |
self._process_info(account, result)
|
| 152 | 157 |
|
| 153 | 158 |
def _process_error(self, account: str, result: StanzaError) -> None:
|
| ... | ... | @@ -160,10 +165,12 @@ def _process_error(self, account: str, result: StanzaError) -> None: |
| 160 | 165 |
]
|
| 161 | 166 |
if result.condition in contact_conditions:
|
| 162 | 167 |
# It seems to be a contact
|
| 163 |
- self.get_page('contact').prepare(account, result)
|
|
| 168 |
+ address_page = cast(Contact, self.get_page('contact'))
|
|
| 169 |
+ address_page.prepare(account, result)
|
|
| 164 | 170 |
self.show_page('contact', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 165 | 171 |
else:
|
| 166 |
- self.get_page('error').set_text(result.get_text())
|
|
| 172 |
+ error_page = cast(ErrorPage, self.get_page('error'))
|
|
| 173 |
+ error_page.set_text(result.get_text())
|
|
| 167 | 174 |
self.show_page('error', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 168 | 175 |
|
| 169 | 176 |
def _process_info(self, account: str, result: DiscoInfo) -> None:
|
| ... | ... | @@ -175,7 +182,8 @@ def _process_info(self, account: str, result: DiscoInfo) -> None: |
| 175 | 182 |
if identity.type == 'text' and result.jid.is_domain:
|
| 176 | 183 |
# It's a group chat component advertising
|
| 177 | 184 |
# category 'conference'
|
| 178 |
- self.get_page('error').set_text(
|
|
| 185 |
+ error_page = cast(ErrorPage, self.get_page('error'))
|
|
| 186 |
+ error_page.set_text(
|
|
| 179 | 187 |
_('This address does not seem to offer any gateway '
|
| 180 | 188 |
'service.'))
|
| 181 | 189 |
self.show_page('error')
|
| ... | ... | @@ -183,21 +191,25 @@ def _process_info(self, account: str, result: DiscoInfo) -> None: |
| 183 | 191 |
|
| 184 | 192 |
if identity.type == 'irc' and result.jid.is_domain:
|
| 185 | 193 |
# It's an IRC gateway advertising category 'conference'
|
| 186 |
- self.get_page('gateway').prepare(account, result)
|
|
| 194 |
+ gateway_page = cast(Gateway, self.get_page('gateway'))
|
|
| 195 |
+ gateway_page.prepare(account, result)
|
|
| 187 | 196 |
self.show_page(
|
| 188 | 197 |
'gateway', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 189 | 198 |
return
|
| 190 | 199 |
|
| 191 |
- self.get_page('groupchat').prepare(account, result)
|
|
| 200 |
+ groupchat_page = cast(GroupChat, self.get_page('groupchat'))
|
|
| 201 |
+ groupchat_page.prepare(account, result)
|
|
| 192 | 202 |
self.show_page('groupchat', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 193 | 203 |
return
|
| 194 | 204 |
|
| 195 | 205 |
if result.is_gateway:
|
| 196 |
- self.get_page('gateway').prepare(account, result)
|
|
| 206 |
+ gateway_page = cast(Gateway, self.get_page('gateway'))
|
|
| 207 |
+ gateway_page.prepare(account, result)
|
|
| 197 | 208 |
self.show_page('gateway', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 198 | 209 |
return
|
| 199 | 210 |
|
| 200 |
- self.get_page('contact').prepare(account, result)
|
|
| 211 |
+ contact_page = cast(Contact, self.get_page('contact'))
|
|
| 212 |
+ contact_page.prepare(account, result)
|
|
| 201 | 213 |
self.show_page('contact', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 202 | 214 |
|
| 203 | 215 |
|
| ... | ... | @@ -217,6 +229,7 @@ def __init__(self, account: Optional[str], jid: Optional[JID]) -> None: |
| 217 | 229 |
|
| 218 | 230 |
accounts = app.get_enabled_accounts_with_labels(connected_only=True)
|
| 219 | 231 |
liststore = self._ui.account_combo.get_model()
|
| 232 |
+ assert isinstance(liststore, Gtk.ListStore)
|
|
| 220 | 233 |
for acc in accounts:
|
| 221 | 234 |
liststore.append(acc)
|
| 222 | 235 |
|
| ... | ... | @@ -238,13 +251,14 @@ def __init__(self, account: Optional[str], jid: Optional[JID]) -> None: |
| 238 | 251 |
|
| 239 | 252 |
self.show_all()
|
| 240 | 253 |
|
| 241 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 254 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 242 | 255 |
return ['next']
|
| 243 | 256 |
|
| 244 | 257 |
def get_default_button(self) -> str:
|
| 245 | 258 |
return 'next'
|
| 246 | 259 |
|
| 247 |
- def get_account_and_jid(self) -> Tuple[str, str]:
|
|
| 260 |
+ def get_account_and_jid(self) -> tuple[str, str]:
|
|
| 261 |
+ assert self._account is not None
|
|
| 248 | 262 |
return self._account, self._ui.address_entry.get_text()
|
| 249 | 263 |
|
| 250 | 264 |
def focus(self) -> None:
|
| ... | ... | @@ -316,7 +330,7 @@ def __init__(self) -> None: |
| 316 | 330 |
self.set_title(_('Add Contact'))
|
| 317 | 331 |
self.set_heading(_('An Error Occurred'))
|
| 318 | 332 |
|
| 319 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 333 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 320 | 334 |
return ['back']
|
| 321 | 335 |
|
| 322 | 336 |
def get_default_button(self) -> str:
|
| ... | ... | @@ -339,7 +353,7 @@ def __init__(self) -> None: |
| 339 | 353 |
|
| 340 | 354 |
self.show_all()
|
| 341 | 355 |
|
| 342 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 356 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 343 | 357 |
return ['back', 'add']
|
| 344 | 358 |
|
| 345 | 359 |
def get_default_button(self) -> str:
|
| ... | ... | @@ -357,7 +371,9 @@ def prepare(self, account: str, result: Union[DiscoInfo, StanzaError]): |
| 357 | 371 |
self._ui.contact_grid.set_sensitive(True)
|
| 358 | 372 |
|
| 359 | 373 |
def _update_groups(self, account: str) -> None:
|
| 360 |
- self._ui.group_combo.get_model().clear()
|
|
| 374 |
+ model = self._ui.group_combo.get_model()
|
|
| 375 |
+ assert isinstance(model, Gtk.ListStore)
|
|
| 376 |
+ model.clear()
|
|
| 361 | 377 |
client = app.get_client(account)
|
| 362 | 378 |
for group in client.get_module('Roster').get_groups():
|
| 363 | 379 |
self._ui.group_combo.append_text(group)
|
| ... | ... | @@ -366,7 +382,7 @@ def _on_info_clicked(self, _button: Gtk.Button) -> None: |
| 366 | 382 |
open_window(
|
| 367 | 383 |
'ContactInfo', account=self._account, contact=self._contact)
|
| 368 | 384 |
|
| 369 |
- def get_subscription_data(self) -> Dict[str, Union[str, List[str], bool]]:
|
|
| 385 |
+ def get_subscription_data(self) -> dict[str, Union[str, list[str], bool]]:
|
|
| 370 | 386 |
group = self._ui.group_combo.get_child().get_text()
|
| 371 | 387 |
groups = [group] if group else []
|
| 372 | 388 |
return {
|
| ... | ... | @@ -392,7 +408,7 @@ def __init__(self) -> None: |
| 392 | 408 |
|
| 393 | 409 |
self.show_all()
|
| 394 | 410 |
|
| 395 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 411 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 396 | 412 |
return ['back', 'add']
|
| 397 | 413 |
|
| 398 | 414 |
def get_default_button(self) -> str:
|
| ... | ... | @@ -482,7 +498,7 @@ def __init__(self) -> None: |
| 482 | 498 |
|
| 483 | 499 |
self.show_all()
|
| 484 | 500 |
|
| 485 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 501 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 486 | 502 |
return ['back', 'join']
|
| 487 | 503 |
|
| 488 | 504 |
def get_default_button(self) -> str:
|
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 |
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 |
|
| 15 | 15 |
from typing import Any
|
| 16 |
-from typing import List
|
|
| 16 |
+from typing import cast
|
|
| 17 | 17 |
|
| 18 | 18 |
import logging
|
| 19 | 19 |
|
| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 |
from .assistant import Assistant
|
| 33 | 33 |
from .assistant import Page
|
| 34 | 34 |
from .assistant import ErrorPage
|
| 35 |
+from .assistant import ProgressPage
|
|
| 35 | 36 |
from .assistant import SuccessPage
|
| 36 | 37 |
from .dataform import DataFormWidget
|
| 37 | 38 |
from .util import ensure_not_destroyed
|
| ... | ... | @@ -57,7 +58,7 @@ def __init__(self, account: str) -> None: |
| 57 | 58 |
'error': Error(),
|
| 58 | 59 |
'success': Success()})
|
| 59 | 60 |
|
| 60 |
- progress = self.add_default_page('progress')
|
|
| 61 |
+ progress = cast(ProgressPage, self.add_default_page('progress'))
|
|
| 61 | 62 |
progress.set_title(_('Changing Password...'))
|
| 62 | 63 |
progress.set_text(_('Trying to change password...'))
|
| 63 | 64 |
|
| ... | ... | @@ -83,11 +84,13 @@ def _on_button_clicked(self, |
| 83 | 84 |
|
| 84 | 85 |
def _on_apply(self, next_stage: bool = False) -> None:
|
| 85 | 86 |
if next_stage:
|
| 86 |
- form = self.get_page('next_stage').get_submit_form()
|
|
| 87 |
+ next_stage_page = cast(NextStage, self.get_page('next_stage'))
|
|
| 88 |
+ form = next_stage_page.get_submit_form()
|
|
| 87 | 89 |
self._client.get_module('Register').change_password_with_form(
|
| 88 | 90 |
form, callback=self._on_change_password)
|
| 89 | 91 |
else:
|
| 90 |
- password = self.get_page('password').get_password()
|
|
| 92 |
+ password_page = cast(EnterPassword, self.get_page('password'))
|
|
| 93 |
+ password = password_page.get_password()
|
|
| 91 | 94 |
self._client.get_module('Register').change_password(
|
| 92 | 95 |
password, callback=self._on_change_password)
|
| 93 | 96 |
|
| ... | ... | @@ -96,16 +99,19 @@ def _on_change_password(self, task: Task) -> None: |
| 96 | 99 |
try:
|
| 97 | 100 |
task.finish()
|
| 98 | 101 |
except ChangePasswordStanzaError as error:
|
| 99 |
- self.get_page('next_stage').set_form(error.get_form())
|
|
| 102 |
+ next_stage_page = cast(NextStage, self.get_page('next_stage'))
|
|
| 103 |
+ next_stage_page.set_form(error.get_form())
|
|
| 100 | 104 |
self.show_page('next_stage', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 101 | 105 |
|
| 102 | 106 |
except StanzaError as error:
|
| 103 | 107 |
error_text = to_user_string(error)
|
| 104 |
- self.get_page('error').set_text(error_text)
|
|
| 108 |
+ error_page = cast(Error, self.get_page('error'))
|
|
| 109 |
+ error_page.set_text(error_text)
|
|
| 105 | 110 |
self.show_page('error', Gtk.StackTransitionType.SLIDE_LEFT)
|
| 106 | 111 |
|
| 107 | 112 |
else:
|
| 108 |
- password = self.get_page('password').get_password()
|
|
| 113 |
+ password_page = cast(EnterPassword, self.get_page('password'))
|
|
| 114 |
+ password = password_page.get_password()
|
|
| 109 | 115 |
passwords.save_password(self.account, password)
|
| 110 | 116 |
self.show_page('success')
|
| 111 | 117 |
|
| ... | ... | @@ -190,7 +196,7 @@ def _set_complete(self, state: bool) -> None: |
| 190 | 196 |
def get_password(self) -> str:
|
| 191 | 197 |
return self._password1_entry.get_text()
|
| 192 | 198 |
|
| 193 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 199 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 194 | 200 |
return ['apply']
|
| 195 | 201 |
|
| 196 | 202 |
|
| ... | ... | @@ -219,9 +225,10 @@ def set_form(self, form: SimpleDataForm) -> None: |
| 219 | 225 |
self._current_form.show_all()
|
| 220 | 226 |
|
| 221 | 227 |
def get_submit_form(self) -> SimpleDataForm:
|
| 228 |
+ assert self._current_form is not None
|
|
| 222 | 229 |
return self._current_form.get_submit_form()
|
| 223 | 230 |
|
| 224 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 231 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 225 | 232 |
return ['apply']
|
| 226 | 233 |
|
| 227 | 234 |
|
| ... | ... | @@ -233,7 +240,7 @@ def __init__(self) -> None: |
| 233 | 240 |
self.set_text(
|
| 234 | 241 |
_('An error occurred while trying to change your password.'))
|
| 235 | 242 |
|
| 236 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 243 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 237 | 244 |
return ['back']
|
| 238 | 245 |
|
| 239 | 246 |
|
| ... | ... | @@ -244,5 +251,5 @@ def __init__(self) -> None: |
| 244 | 251 |
self.set_heading(_('Password Changed'))
|
| 245 | 252 |
self.set_text(_('Your password has successfully been changed.'))
|
| 246 | 253 |
|
| 247 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 254 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 248 | 255 |
return ['close']
|
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 |
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 |
|
| 15 | 15 |
from typing import Any
|
| 16 |
-from typing import List
|
|
| 16 |
+from typing import cast
|
|
| 17 | 17 |
|
| 18 | 18 |
import logging
|
| 19 | 19 |
|
| ... | ... | @@ -24,12 +24,15 @@ |
| 24 | 24 |
|
| 25 | 25 |
from gajim.common import app
|
| 26 | 26 |
from gajim.common import ged
|
| 27 |
+from gajim.common.events import AccountConnected
|
|
| 28 |
+from gajim.common.events import AccountDisonnected
|
|
| 27 | 29 |
from gajim.common.i18n import _
|
| 28 | 30 |
from gajim.common.helpers import to_user_string
|
| 29 | 31 |
from gajim.common.helpers import event_filter
|
| 30 | 32 |
|
| 31 | 33 |
from .assistant import Assistant
|
| 32 | 34 |
from .assistant import Page
|
| 35 |
+from .assistant import ProgressPage
|
|
| 33 | 36 |
from .assistant import ErrorPage
|
| 34 | 37 |
from .assistant import SuccessPage
|
| 35 | 38 |
|
| ... | ... | @@ -58,7 +61,7 @@ def __init__(self, account: str) -> None: |
| 58 | 61 |
'error': Error(),
|
| 59 | 62 |
'success': Success()})
|
| 60 | 63 |
|
| 61 |
- progress = self.add_default_page('progress')
|
|
| 64 |
+ progress = cast(ProgressPage, self.add_default_page('progress'))
|
|
| 62 | 65 |
progress.set_title(_('Removing Account...'))
|
| 63 | 66 |
progress.set_text(_('Trying to remove account...'))
|
| 64 | 67 |
|
| ... | ... | @@ -75,12 +78,12 @@ def __init__(self, account: str) -> None: |
| 75 | 78 |
self.show_all()
|
| 76 | 79 |
|
| 77 | 80 |
@event_filter(['account'])
|
| 78 |
- def _on_account_connected(self, _event):
|
|
| 81 |
+ def _on_account_connected(self, _event: AccountConnected) -> None:
|
|
| 79 | 82 |
self._client = app.get_client(self.account)
|
| 80 | 83 |
self._set_remove_from_server_checkbox()
|
| 81 | 84 |
|
| 82 | 85 |
@event_filter(['account'])
|
| 83 |
- def _on_account_disconnected(self, _event):
|
|
| 86 |
+ def _on_account_disconnected(self, _event: AccountDisonnected) -> None:
|
|
| 84 | 87 |
self._set_remove_from_server_checkbox()
|
| 85 | 88 |
|
| 86 | 89 |
if self._account_removed:
|
| ... | ... | @@ -89,7 +92,8 @@ def _on_account_disconnected(self, _event): |
| 89 | 92 |
|
| 90 | 93 |
def _set_remove_from_server_checkbox(self) -> None:
|
| 91 | 94 |
enabled = self._client is not None and self._client.state.is_available
|
| 92 |
- self.get_page('remove_choice').set_remove_from_server(enabled)
|
|
| 95 |
+ remove_choice_page = cast(RemoveChoice, self.get_page('remove_choice'))
|
|
| 96 |
+ remove_choice_page.set_remove_from_server(enabled)
|
|
| 93 | 97 |
|
| 94 | 98 |
def _on_button_clicked(self,
|
| 95 | 99 |
_assistant: Assistant,
|
| ... | ... | @@ -112,7 +116,9 @@ def _on_button_clicked(self, |
| 112 | 116 |
self.destroy()
|
| 113 | 117 |
|
| 114 | 118 |
def _on_remove(self, *args: Any) -> None:
|
| 115 |
- if self.get_page('remove_choice').remove_from_server:
|
|
| 119 |
+ remove_choice_page = cast(RemoveChoice, self.get_page('remove_choice'))
|
|
| 120 |
+ if remove_choice_page.remove_from_server:
|
|
| 121 |
+ assert self._client is not None
|
|
| 116 | 122 |
self._client.set_remove_account(True)
|
| 117 | 123 |
self._client.get_module('Register').unregister(
|
| 118 | 124 |
callback=self._on_remove_response)
|
| ... | ... | @@ -130,10 +136,12 @@ def _on_remove_response(self, task: Task) -> None: |
| 130 | 136 |
try:
|
| 131 | 137 |
task.finish()
|
| 132 | 138 |
except StanzaError as error:
|
| 139 |
+ assert self._client is not None
|
|
| 133 | 140 |
self._client.set_remove_account(False)
|
| 134 | 141 |
|
| 135 | 142 |
error_text = to_user_string(error)
|
| 136 |
- self.get_page('error').set_text(error_text)
|
|
| 143 |
+ error_page = cast(Error, self.get_page('error'))
|
|
| 144 |
+ error_page.set_text(error_text)
|
|
| 137 | 145 |
self.show_page('error')
|
| 138 | 146 |
return
|
| 139 | 147 |
|
| ... | ... | @@ -194,7 +202,7 @@ def set_remove_from_server(self, enabled: bool) -> None: |
| 194 | 202 |
self._server.set_active(False)
|
| 195 | 203 |
self._server.set_tooltip_text(_('Account has to be connected'))
|
| 196 | 204 |
|
| 197 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 205 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 198 | 206 |
return ['remove']
|
| 199 | 207 |
|
| 200 | 208 |
|
| ... | ... | @@ -204,7 +212,7 @@ def __init__(self) -> None: |
| 204 | 212 |
self.set_title(_('Account Removal Failed'))
|
| 205 | 213 |
self.set_heading(_('Account Removal Failed'))
|
| 206 | 214 |
|
| 207 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 215 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 208 | 216 |
return ['back']
|
| 209 | 217 |
|
| 210 | 218 |
|
| ... | ... | @@ -216,5 +224,5 @@ def __init__(self) -> None: |
| 216 | 224 |
self.set_text(
|
| 217 | 225 |
_('Your account has has been removed successfully.'))
|
| 218 | 226 |
|
| 219 |
- def get_visible_buttons(self) -> List[str]:
|
|
| 227 |
+ def get_visible_buttons(self) -> list[str]:
|
|
| 220 | 228 |
return ['close']
|