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

Commits:

1 changed file:

Changes:

  • gajim/gtk/avatar.py
    ... ... @@ -12,7 +12,10 @@
    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
    
    15
    +from __future__ import annotations
    
    16
    +
    
    17
    +from typing import Optional
    
    18
    +from typing import Union
    
    16 19
     
    
    17 20
     import logging
    
    18 21
     import hashlib
    
    ... ... @@ -50,9 +53,6 @@
    50 53
     AvatarCacheT = dict[JID, dict[tuple[int, int, Optional[str]],
    
    51 54
                                   cairo.ImageSurface]]
    
    52 55
     
    
    53
    -ContactT = Union[types.BareContact,
    
    54
    -                 types.GroupchatContact,
    
    55
    -                 types.GroupchatParticipant]
    
    56 56
     
    
    57 57
     def generate_avatar(letters: str,
    
    58 58
                         color: tuple[float, float, float],
    
    ... ... @@ -360,7 +360,9 @@ def invalidate_cache(self, jid: JID) -> None:
    360 360
             self._cache.pop(jid, None)
    
    361 361
     
    
    362 362
         def get_pixbuf(self,
    
    363
    -                   contact: ContactT,
    
    363
    +                   contact: Union[types.BareContact,
    
    364
    +                                  types.GroupchatContact,
    
    365
    +                                  types.GroupchatParticipant],
    
    364 366
                        size: int,
    
    365 367
                        scale: int,
    
    366 368
                        show: Optional[str] = None,
    
    ... ... @@ -373,7 +375,9 @@ def get_pixbuf(self,
    373 375
             return Gdk.pixbuf_get_from_surface(surface, 0, 0, size, size)
    
    374 376
     
    
    375 377
         def get_surface(self,
    
    376
    -                    contact: ContactT,
    
    378
    +                    contact: Union[types.BareContact,
    
    379
    +                                   types.GroupchatContact,
    
    380
    +                                   types.GroupchatParticipant],
    
    377 381
                         size: int,
    
    378 382
                         scale: int,
    
    379 383
                         show: Optional[str] = None,
    
    ... ... @@ -554,7 +558,9 @@ def _load_surface_from_storage(self,
    554 558
             return fit(surface, size)
    
    555 559
     
    
    556 560
         def _get_avatar_from_storage(self,
    
    557
    -                                 contact: ContactT,
    
    561
    +                                 contact: Union[types.BareContact,
    
    562
    +                                                types.GroupchatContact,
    
    563
    +                                                types.GroupchatParticipant],
    
    558 564
                                      size: int,
    
    559 565
                                      scale: int,
    
    560 566
                                      style: str) -> Optional[cairo.ImageSurface]: