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


Commits:
af19d4ab by lovetox at 2021-12-09T18:27:58+01:00
Avatar: Fix contact annotations

- - - - -


1 changed file:

- gajim/gtk/avatar.py


Changes:

=====================================
gajim/gtk/avatar.py
=====================================
@@ -12,7 +12,10 @@
 # You should have received a copy of the GNU General Public License
 # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
 
-from typing import Optional, Union
+from __future__ import annotations
+
+from typing import Optional
+from typing import Union
 
 import logging
 import hashlib
@@ -50,9 +53,6 @@
 AvatarCacheT = dict[JID, dict[tuple[int, int, Optional[str]],
                               cairo.ImageSurface]]
 
-ContactT = Union[types.BareContact,
-                 types.GroupchatContact,
-                 types.GroupchatParticipant]
 
 def generate_avatar(letters: str,
                     color: tuple[float, float, float],
@@ -360,7 +360,9 @@ def invalidate_cache(self, jid: JID) -> None:
         self._cache.pop(jid, None)
 
     def get_pixbuf(self,
-                   contact: ContactT,
+                   contact: Union[types.BareContact,
+                                  types.GroupchatContact,
+                                  types.GroupchatParticipant],
                    size: int,
                    scale: int,
                    show: Optional[str] = None,
@@ -373,7 +375,9 @@ def get_pixbuf(self,
         return Gdk.pixbuf_get_from_surface(surface, 0, 0, size, size)
 
     def get_surface(self,
-                    contact: ContactT,
+                    contact: Union[types.BareContact,
+                                   types.GroupchatContact,
+                                   types.GroupchatParticipant],
                     size: int,
                     scale: int,
                     show: Optional[str] = None,
@@ -554,7 +558,9 @@ def _load_surface_from_storage(self,
         return fit(surface, size)
 
     def _get_avatar_from_storage(self,
-                                 contact: ContactT,
+                                 contact: Union[types.BareContact,
+                                                types.GroupchatContact,
+                                                types.GroupchatParticipant],
                                  size: int,
                                  scale: int,
                                  style: str) -> Optional[cairo.ImageSurface]:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/af19d4abacd19805a395b5a9ee1cb47a7b707b55

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/af19d4abacd19805a395b5a9ee1cb47a7b707b55
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to