Philipp Hörist pushed to branch master at gajim / gajim

Commits:

5 changed files:

Changes:

  • gajim/common/modules/chatstates.py
    ... ... @@ -32,7 +32,6 @@
    32 32
     from gajim.common.structs import OutgoingMessage
    
    33 33
     from gajim.common.modules.base import BaseModule
    
    34 34
     
    
    35
    -from gajim.common.types import ContactT
    
    36 35
     from gajim.common.types import ConnectionT
    
    37 36
     
    
    38 37
     
    
    ... ... @@ -184,13 +183,13 @@ def get_remote_chatstate(self, jid):
    184 183
             return self._remote_chatstate.get(jid)
    
    185 184
     
    
    186 185
         @ensure_enabled
    
    187
    -    def set_active(self, contact: ContactT) -> None:
    
    186
    +    def set_active(self, contact) -> None:
    
    188 187
             if contact.settings.get('send_chatstate') == 'disabled':
    
    189 188
                 return
    
    190 189
             self._last_mouse_activity[contact.jid] = time.time()
    
    191 190
             self._chatstates[contact.jid] = State.ACTIVE
    
    192 191
     
    
    193
    -    def get_active_chatstate(self, contact: ContactT) -> Optional[str]:
    
    192
    +    def get_active_chatstate(self, contact) -> Optional[str]:
    
    194 193
             # determines if we add 'active' on outgoing messages
    
    195 194
             if contact.settings.get('send_chatstate') == 'disabled':
    
    196 195
                 return None
    
    ... ... @@ -207,7 +206,7 @@ def get_active_chatstate(self, contact: ContactT) -> Optional[str]:
    207 206
             return 'active'
    
    208 207
     
    
    209 208
         @ensure_enabled
    
    210
    -    def block_chatstates(self, contact: ContactT, block: bool) -> None:
    
    209
    +    def block_chatstates(self, contact, block: bool) -> None:
    
    211 210
             # Block sending chatstates to a contact
    
    212 211
             # Used for example if we cycle through the MUC nick list, which
    
    213 212
             # produces a lot of buffer 'changed' signals from the input textview.
    
    ... ... @@ -218,7 +217,7 @@ def block_chatstates(self, contact: ContactT, block: bool) -> None:
    218 217
                 self._blocked.remove(contact.jid)
    
    219 218
     
    
    220 219
         @ensure_enabled
    
    221
    -    def set_chatstate_delayed(self, contact: ContactT, state: State) -> None:
    
    220
    +    def set_chatstate_delayed(self, contact, state: State) -> None:
    
    222 221
             # Used when we go from Composing -> Active after deleting all text
    
    223 222
             # from the Textview. We delay the Active state because maybe the
    
    224 223
             # User starts writing again.
    
    ... ... @@ -227,7 +226,7 @@ def set_chatstate_delayed(self, contact: ContactT, state: State) -> None:
    227 226
                 2, self.set_chatstate, contact, state)
    
    228 227
     
    
    229 228
         @ensure_enabled
    
    230
    -    def set_chatstate(self, contact: ContactT, state: State) -> None:
    
    229
    +    def set_chatstate(self, contact, state: State) -> None:
    
    231 230
             # Don’t send chatstates to ourself
    
    232 231
             if self._con.get_own_jid().bare_match(contact.jid):
    
    233 232
                 return
    
    ... ... @@ -298,7 +297,7 @@ def _send_chatstate(self, contact, chatstate):
    298 297
             self._con.send_message(message)
    
    299 298
     
    
    300 299
         @ensure_enabled
    
    301
    -    def set_mouse_activity(self, contact: ContactT, was_paused: bool) -> None:
    
    300
    +    def set_mouse_activity(self, contact, was_paused: bool) -> None:
    
    302 301
             if contact.settings.get('send_chatstate') == 'disabled':
    
    303 302
                 return
    
    304 303
             self._last_mouse_activity[contact.jid] = time.time()
    
    ... ... @@ -309,7 +308,7 @@ def set_mouse_activity(self, contact: ContactT, was_paused: bool) -> None:
    309 308
                     self.set_chatstate(contact, State.ACTIVE)
    
    310 309
     
    
    311 310
         @ensure_enabled
    
    312
    -    def set_keyboard_activity(self, contact: ContactT) -> None:
    
    311
    +    def set_keyboard_activity(self, contact) -> None:
    
    313 312
             self._last_keyboard_activity[contact.jid] = time.time()
    
    314 313
     
    
    315 314
         def remove_delay_timeout(self, contact):
    

  • gajim/common/modules/ping.py
    ... ... @@ -25,7 +25,6 @@
    25 25
     from gajim.common import app
    
    26 26
     from gajim.common.nec import NetworkEvent
    
    27 27
     from gajim.common.types import ConnectionT
    
    28
    -from gajim.common.types import ContactsT
    
    29 28
     from gajim.common.modules.base import BaseModule
    
    30 29
     from gajim.common.modules.util import as_task
    
    31 30
     
    
    ... ... @@ -43,7 +42,7 @@ def __init__(self, con: ConnectionT) -> None:
    43 42
             self.handlers = []
    
    44 43
     
    
    45 44
         @as_task
    
    46
    -    def send_ping(self, contact: ContactsT) -> Generator:
    
    45
    +    def send_ping(self, contact) -> Generator:
    
    47 46
             _task = yield
    
    48 47
     
    
    49 48
             if not app.account_is_available(self._account):
    

  • gajim/common/types.py
    ... ... @@ -38,9 +38,11 @@
    38 38
         # pylint: disable=unused-import
    
    39 39
         from gajim.common.client import Client
    
    40 40
         from gajim.common.zeroconf.connection_zeroconf import ConnectionZeroconf
    
    41
    -    from gajim.common.contacts import Contact
    
    42
    -    from gajim.common.contacts import GC_Contact
    
    43
    -    from gajim.common.contacts import LegacyContactsAPI
    
    41
    +    from gajim.common.modules.contacts import CommonContact
    
    42
    +    from gajim.common.modules.contacts import BareContact
    
    43
    +    from gajim.common.modules.contacts import ResourceContact
    
    44
    +    from gajim.common.modules.contacts import GroupchatContact
    
    45
    +    from gajim.common.modules.contacts import GroupchatParticipant
    
    44 46
         from gajim.common.nec import NetworkEvent
    
    45 47
         from gajim.common.nec import NetworkEventsController
    
    46 48
     
    
    ... ... @@ -53,8 +55,6 @@
    53 55
     InterfaceT = Union['Interface']
    
    54 56
     
    
    55 57
     ConnectionT = Union['Client', 'ConnectionZeroconf']
    
    56
    -ContactsT = Union['Contact', 'GC_Contact']
    
    57
    -ContactT = Union['Contact']
    
    58 58
     CSSConfigT = Union['CSSConfig']
    
    59 59
     
    
    60 60
     # PEP
    

  • gajim/gtk/avatar.py
    ... ... @@ -12,22 +12,28 @@
    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, Union
    
    16
    +
    
    15 17
     import logging
    
    16 18
     import hashlib
    
    17 19
     from math import pi
    
    18 20
     from functools import lru_cache
    
    19 21
     from collections import defaultdict
    
    22
    +from pathlib import Path
    
    20 23
     
    
    21 24
     from gi.repository import Gdk
    
    22 25
     from gi.repository import GdkPixbuf
    
    23 26
     import cairo
    
    27
    +from nbxmpp.protocol import JID
    
    24 28
     
    
    29
    +from gajim.common import types
    
    25 30
     from gajim.common import app
    
    26 31
     from gajim.common import configpaths
    
    27 32
     from gajim.common.helpers import Singleton
    
    28 33
     from gajim.common.helpers import get_groupchat_name
    
    29 34
     from gajim.common.const import AvatarSize
    
    30 35
     from gajim.common.const import StyleAttr
    
    36
    +from gajim.common.modules.contacts import Contacts
    
    31 37
     
    
    32 38
     from .const import DEFAULT_WORKSPACE_COLOR
    
    33 39
     from .util import load_pixbuf
    
    ... ... @@ -42,7 +48,18 @@
    42 48
     log = logging.getLogger('gajim.gui.avatar')
    
    43 49
     
    
    44 50
     
    
    45
    -def generate_avatar(letters, color, size, scale):
    
    51
    +AvatarCacheT = dict[JID, dict[tuple[int, int, Optional[str]],
    
    52
    +                              cairo.ImageSurface]]
    
    53
    +
    
    54
    +ContactT = Union[types.BareContact,
    
    55
    +                 types.GroupchatContact,
    
    56
    +                 types.GroupchatParticipant]
    
    57
    +
    
    58
    +def generate_avatar(letters: str,
    
    59
    +                    color: tuple[float, float, float],
    
    60
    +                    size: int,
    
    61
    +                    scale: int) -> cairo.ImageSurface:
    
    62
    +
    
    46 63
         # Get color for nickname with XEP-0392
    
    47 64
         color_r, color_g, color_b = color
    
    48 65
     
    
    ... ... @@ -84,7 +101,12 @@ def generate_avatar(letters, color, size, scale):
    84 101
     
    
    85 102
     
    
    86 103
     @lru_cache(maxsize=None)
    
    87
    -def generate_default_avatar(letter, color_string, size, scale, style='circle'):
    
    104
    +def generate_default_avatar(letter: str,
    
    105
    +                            color_string: str,
    
    106
    +                            size: int,
    
    107
    +                            scale: int,
    
    108
    +                            style: str = 'circle') -> cairo.ImageSurface:
    
    109
    +
    
    88 110
         color = text_to_color(color_string)
    
    89 111
         surface = generate_avatar(letter, color, size, scale)
    
    90 112
         surface = clip(surface, style)
    
    ... ... @@ -93,14 +115,21 @@ def generate_default_avatar(letter, color_string, size, scale, style='circle'):
    93 115
     
    
    94 116
     
    
    95 117
     @lru_cache(maxsize=None)
    
    96
    -def make_workspace_avatar(letter, color, size, scale, style='round-corners'):
    
    118
    +def make_workspace_avatar(letter: str,
    
    119
    +                          color: tuple[float, float, float],
    
    120
    +                          size: int,
    
    121
    +                          scale: int,
    
    122
    +                          style: str = 'round-corners') -> cairo.ImageSurface:
    
    123
    +
    
    97 124
         surface = generate_avatar(letter, color, size, scale)
    
    98 125
         surface = clip(surface, style)
    
    99 126
         surface.set_device_scale(scale, scale)
    
    100 127
         return surface
    
    101 128
     
    
    102 129
     
    
    103
    -def add_status_to_avatar(surface, show):
    
    130
    +def add_status_to_avatar(surface: cairo.ImageSurface,
    
    131
    +                         show) -> cairo.ImageSurface:
    
    132
    +
    
    104 133
         width = surface.get_width()
    
    105 134
         height = surface.get_height()
    
    106 135
     
    
    ... ... @@ -149,7 +178,10 @@ def add_status_to_avatar(surface, show):
    149 178
         return context.get_target()
    
    150 179
     
    
    151 180
     
    
    152
    -def get_icon_avatar(size, scale, icon_name):
    
    181
    +def get_icon_avatar(size: int,
    
    182
    +                    scale: int,
    
    183
    +                    icon_name: str) -> cairo.ImageSurface:
    
    184
    +
    
    153 185
         if scale is not None:
    
    154 186
             size = size * scale
    
    155 187
     
    
    ... ... @@ -171,7 +203,7 @@ def get_icon_avatar(size, scale, icon_name):
    171 203
     
    
    172 204
     
    
    173 205
     @lru_cache(maxsize=128)
    
    174
    -def get_show_circle(show, size, scale):
    
    206
    +def get_show_circle(show, size: int, scale: int) -> cairo.ImageSurface:
    
    175 207
         if not isinstance(show, str):
    
    176 208
             show = show.value
    
    177 209
     
    
    ... ... @@ -203,7 +235,7 @@ def get_show_circle(show, size, scale):
    203 235
         return context.get_target()
    
    204 236
     
    
    205 237
     
    
    206
    -def fit(surface: cairo.Surface, size: int) -> cairo.Surface:
    
    238
    +def fit(surface: cairo.ImageSurface, size: int) -> cairo.ImageSurface:
    
    207 239
         width = surface.get_width()
    
    208 240
         height = surface.get_height()
    
    209 241
         if width == height:
    
    ... ... @@ -226,7 +258,7 @@ def fit(surface: cairo.Surface, size: int) -> cairo.Surface:
    226 258
         return context.get_target()
    
    227 259
     
    
    228 260
     
    
    229
    -def square(surface, size):
    
    261
    +def square(surface: cairo.ImageSurface, size: int) -> cairo.ImageSurface:
    
    230 262
         width = surface.get_width()
    
    231 263
         height = surface.get_height()
    
    232 264
         if width == height:
    
    ... ... @@ -250,7 +282,7 @@ def square(surface, size):
    250 282
         return context.get_target()
    
    251 283
     
    
    252 284
     
    
    253
    -def clip(surface, mode):
    
    285
    +def clip(surface: cairo.ImageSurface, mode: str) -> cairo.ImageSurface:
    
    254 286
         if mode == 'circle':
    
    255 287
             return clip_circle(surface)
    
    256 288
         if mode == 'round-corners':
    
    ... ... @@ -258,7 +290,7 @@ def clip(surface, mode):
    258 290
         raise ValueError('clip mode unknown: %s' % mode)
    
    259 291
     
    
    260 292
     
    
    261
    -def clip_circle(surface):
    
    293
    +def clip_circle(surface: cairo.ImageSurface) -> cairo.ImageSurface:
    
    262 294
         new_surface = cairo.ImageSurface(cairo.Format.ARGB32,
    
    263 295
                                          surface.get_width(),
    
    264 296
                                          surface.get_height())
    
    ... ... @@ -280,7 +312,7 @@ def clip_circle(surface):
    280 312
         return context.get_target()
    
    281 313
     
    
    282 314
     
    
    283
    -def round_corners(surface):
    
    315
    +def round_corners(surface: cairo.ImageSurface) -> cairo.ImageSurface:
    
    284 316
         new_surface = cairo.ImageSurface(cairo.Format.ARGB32,
    
    285 317
                                          surface.get_width(),
    
    286 318
                                          surface.get_height())
    
    ... ... @@ -308,7 +340,7 @@ def round_corners(surface):
    308 340
         return context.get_target()
    
    309 341
     
    
    310 342
     
    
    311
    -def convert_to_greyscale(surface):
    
    343
    +def convert_to_greyscale(surface: cairo.ImageSurface) -> cairo.ImageSurface:
    
    312 344
         context = cairo.Context(surface)
    
    313 345
         context.set_operator(cairo.Operator.HSL_COLOR)
    
    314 346
         context.set_source_rgb(1, 1, 1)
    
    ... ... @@ -323,31 +355,32 @@ def convert_to_greyscale(surface):
    323 355
     
    
    324 356
     class AvatarStorage(metaclass=Singleton):
    
    325 357
         def __init__(self):
    
    326
    -        self._cache = defaultdict(dict)
    
    358
    +        self._cache: AvatarCacheT = defaultdict(dict)
    
    327 359
     
    
    328
    -    def invalidate_cache(self, jid):
    
    360
    +    def invalidate_cache(self, jid: JID) -> None:
    
    329 361
             self._cache.pop(jid, None)
    
    330 362
     
    
    331 363
         def get_pixbuf(self,
    
    332
    -                   contact,
    
    333
    -                   size,
    
    334
    -                   scale,
    
    335
    -                   show=None,
    
    336
    -                   default=False,
    
    337
    -                   transport_icon=None,
    
    338
    -                   style='circle'):
    
    364
    +                   contact: ContactT,
    
    365
    +                   size: int,
    
    366
    +                   scale: int,
    
    367
    +                   show: Optional[str] = None,
    
    368
    +                   default: bool = False,
    
    369
    +                   transport_icon: Optional[str] = None,
    
    370
    +                   style: str = 'circle') -> cairo.ImageSurface:
    
    371
    +
    
    339 372
             surface = self.get_surface(
    
    340 373
                 contact, size, scale, show, default, transport_icon, style)
    
    341 374
             return Gdk.pixbuf_get_from_surface(surface, 0, 0, size, size)
    
    342 375
     
    
    343 376
         def get_surface(self,
    
    344
    -                    contact,
    
    345
    -                    size,
    
    346
    -                    scale,
    
    347
    -                    show=None,
    
    348
    -                    default=False,
    
    349
    -                    transport_icon=None,
    
    350
    -                    style='circle'):
    
    377
    +                    contact: ContactT,
    
    378
    +                    size: int,
    
    379
    +                    scale: int,
    
    380
    +                    show: Optional[str] = None,
    
    381
    +                    default: bool = False,
    
    382
    +                    transport_icon: Optional[str] = None,
    
    383
    +                    style: str = 'circle') -> cairo.ImageSurface:
    
    351 384
     
    
    352 385
             jid = contact.jid
    
    353 386
     
    
    ... ... @@ -382,13 +415,13 @@ def get_surface(self,
    382 415
             return surface
    
    383 416
     
    
    384 417
         def get_muc_surface(self,
    
    385
    -                        account,
    
    386
    -                        jid,
    
    387
    -                        size,
    
    388
    -                        scale,
    
    389
    -                        default=False,
    
    390
    -                        transport_icon=None,
    
    391
    -                        style='circle'):
    
    418
    +                        account: str,
    
    419
    +                        jid: JID,
    
    420
    +                        size: int,
    
    421
    +                        scale: int,
    
    422
    +                        default: bool = False,
    
    423
    +                        transport_icon: Optional[str] = None,
    
    424
    +                        style: str = 'circle') -> Optional[cairo.ImageSurface]:
    
    392 425
     
    
    393 426
             if transport_icon is not None:
    
    394 427
                 surface = get_icon_avatar(size, scale, transport_icon)
    
    ... ... @@ -416,7 +449,11 @@ def get_muc_surface(self,
    416 449
             self._cache[jid][(size, scale)] = surface
    
    417 450
             return surface
    
    418 451
     
    
    419
    -    def get_workspace_surface(self, workspace_id, size, scale):
    
    452
    +    def get_workspace_surface(self,
    
    453
    +                              workspace_id: str,
    
    454
    +                              size: int,
    
    455
    +                              scale: int) -> Optional[cairo.ImageSurface]:
    
    456
    +
    
    420 457
             surface = self._cache[workspace_id].get((size, scale))
    
    421 458
             if surface is not None:
    
    422 459
                 return surface
    
    ... ... @@ -438,18 +475,8 @@ def get_workspace_surface(self, workspace_id, size, scale):
    438 475
             self._cache[workspace_id][(size, scale)] = surface
    
    439 476
             return surface
    
    440 477
     
    
    441
    -    def prepare_for_publish(self, path):
    
    442
    -        success, data = self._load_for_publish(path)
    
    443
    -        if not success:
    
    444
    -            return None, None
    
    445
    -
    
    446
    -        sha = self.save_avatar(data)
    
    447
    -        if sha is None:
    
    448
    -            return None, None
    
    449
    -        return data, sha
    
    450
    -
    
    451 478
         @staticmethod
    
    452
    -    def _load_for_publish(path):
    
    479
    +    def _load_for_publish(path: str) -> Optional[tuple[bool, bytes]]:
    
    453 480
             pixbuf = load_pixbuf(path)
    
    454 481
             if pixbuf is None:
    
    455 482
                 return None
    
    ... ... @@ -466,7 +493,7 @@ def _load_for_publish(path):
    466 493
             return pixbuf.save_to_bufferv('png', [], [])
    
    467 494
     
    
    468 495
         @staticmethod
    
    469
    -    def save_avatar(data):
    
    496
    +    def save_avatar(data: bytes) -> Optional[str]:
    
    470 497
             """
    
    471 498
             Save an avatar to the harddisk
    
    472 499
     
    
    ... ... @@ -488,13 +515,17 @@ def save_avatar(data):
    488 515
             return sha
    
    489 516
     
    
    490 517
         @staticmethod
    
    491
    -    def get_avatar_path(filename):
    
    518
    +    def get_avatar_path(filename: str) -> Optional[Path]:
    
    492 519
             path = configpaths.get('AVATAR') / filename
    
    493 520
             if not path.is_file():
    
    494 521
                 return None
    
    495 522
             return path
    
    496 523
     
    
    497
    -    def surface_from_filename(self, filename, size, scale):
    
    524
    +    def surface_from_filename(self,
    
    525
    +                              filename: str,
    
    526
    +                              size: int,
    
    527
    +                              scale: int) -> Optional[cairo.ImageSurface]:
    
    528
    +
    
    498 529
             size = size * scale
    
    499 530
             path = self.get_avatar_path(filename)
    
    500 531
             if path is None:
    
    ... ... @@ -507,7 +538,11 @@ def surface_from_filename(self, filename, size, scale):
    507 538
             surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, scale)
    
    508 539
             return fit(surface, size)
    
    509 540
     
    
    510
    -    def _load_surface_from_storage(self, filename, size, scale):
    
    541
    +    def _load_surface_from_storage(self,
    
    542
    +                                   filename: str,
    
    543
    +                                   size: int,
    
    544
    +                                   scale: int) -> Optional[cairo.ImageSurface]:
    
    545
    +
    
    511 546
             size = size * scale
    
    512 547
             path = self.get_avatar_path(filename)
    
    513 548
             if path is None:
    
    ... ... @@ -519,7 +554,12 @@ def _load_surface_from_storage(self, filename, size, scale):
    519 554
             surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, scale)
    
    520 555
             return fit(surface, size)
    
    521 556
     
    
    522
    -    def _get_avatar_from_storage(self, contact, size, scale, style):
    
    557
    +    def _get_avatar_from_storage(self,
    
    558
    +                                 contact: ContactT,
    
    559
    +                                 size: int,
    
    560
    +                                 scale: int,
    
    561
    +                                 style: str) -> Optional[cairo.ImageSurface]:
    
    562
    +
    
    523 563
             avatar_sha = contact.avatar_sha
    
    524 564
             if avatar_sha is None:
    
    525 565
                 return None
    
    ... ... @@ -530,7 +570,7 @@ def _get_avatar_from_storage(self, contact, size, scale, style):
    530 570
             return clip(surface, style)
    
    531 571
     
    
    532 572
         @staticmethod
    
    533
    -    def _generate_letter(name):
    
    573
    +    def _generate_letter(name: str) -> str:
    
    534 574
             for letter in name:
    
    535 575
                 if letter.isalpha():
    
    536 576
                     return letter.capitalize()
    

  • gajim/gtk/status_selector.py
    ... ... @@ -12,6 +12,8 @@
    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, Optional
    
    16
    +
    
    15 17
     from gi.repository import Gtk
    
    16 18
     from gi.repository import Pango
    
    17 19
     
    
    ... ... @@ -28,7 +30,7 @@
    28 30
     
    
    29 31
     
    
    30 32
     class StatusSelector(Gtk.MenuButton):
    
    31
    -    def __init__(self, account=None, compact=False):
    
    33
    +    def __init__(self, account: Optional[str] = None, compact: bool = False):
    
    32 34
             Gtk.MenuButton.__init__(self)
    
    33 35
             self.set_direction(Gtk.ArrowType.UP)
    
    34 36
             self._account = account
    
    ... ... @@ -55,7 +57,7 @@ def __init__(self, account=None, compact=False):
    55 57
     
    
    56 58
             app.ged.register_event_handler('our-show', ged.POSTGUI, self.update)
    
    57 59
     
    
    58
    -    def _create_popover(self):
    
    60
    +    def _create_popover(self) -> None:
    
    59 61
             popover_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
    
    60 62
             popover_box.get_style_context().add_class('margin-3')
    
    61 63
             popover_items = [
    
    ... ... @@ -98,12 +100,12 @@ def _create_popover(self):
    98 100
             self._status_popover.add(popover_box)
    
    99 101
             self.set_popover(self._status_popover)
    
    100 102
     
    
    101
    -    def _on_change_status(self, button):
    
    103
    +    def _on_change_status(self, button: Gtk.Button) -> None:
    
    102 104
             self._status_popover.popdown()
    
    103 105
             new_status = button.get_name()
    
    104 106
             app.interface.change_status(status=new_status, account=self._account)
    
    105 107
     
    
    106
    -    def update(self, *args, **kwargs):
    
    108
    +    def update(self, *args: Any, **kwargs: Any) -> None:
    
    107 109
             if self._account is None:
    
    108 110
                 show = get_global_show()
    
    109 111
             else: