Philipp Hörist pushed to branch master at gajim / gajim
Commits:
ab80339c by Philipp Hörist at 2024-05-01T19:42:31+02:00
cfix: MAM: Use correct log attribute
- - - - -
709afe9d by Philipp Hörist at 2024-05-01T20:11:52+02:00
refactor: Message: Reduce unnecessary logging
- - - - -
5 changed files:
- gajim/common/const.py
- gajim/common/modules/mam.py
- gajim/common/modules/message.py
- gajim/gtk/notification.py
- gajim/gtk/util.py
Changes:
=====================================
gajim/common/const.py
=====================================
@@ -66,7 +66,7 @@ class AvatarSize(IntEnum):
WORKSPACE_EDIT = 100
CHAT = 48
MESSAGE_REPLY = 24
- NOTIFICATION = 48
+ NOTIFICATION = 96
CALL = 100
CALL_BIG = 200
GROUP_INFO = 100
=====================================
gajim/common/modules/mam.py
=====================================
@@ -206,8 +206,8 @@ def _mam_message_received(self,
stanza_id = self._get_stanza_id(properties, properties.mam.archive)
if stanza_id is None:
- self.log.warning('Unable to determine stanza id')
- self.log.warning(stanza)
+ self._log.warning('Unable to determine stanza id')
+ self._log.warning(stanza)
raise nbxmpp.NodeProcessed
if app.storage.archive.check_if_stanza_id_exists(
=====================================
gajim/common/modules/message.py
=====================================
@@ -134,11 +134,9 @@ def _message_received(self,
message_id = properties.id
if message_id is None:
- self._log.warning('Received message without message id')
- self._log.warning(stanza)
# TODO: Make Gajim not depend on a message_id being present
message_id = get_uuid()
- self._log.warning('Generating id')
+ self._log.debug('Generating id for message')
stanza_id = self._get_stanza_id(properties)
=====================================
gajim/gtk/notification.py
=====================================
@@ -51,7 +51,6 @@
from gajim.gtk.structs import AccountJidParam
from gajim.gtk.structs import OpenEventActionParams
from gajim.gtk.util import add_css_to_widget
-from gajim.gtk.util import get_monitor_scale_factor
from gajim.gtk.util import get_total_screen_geometry
log = logging.getLogger('gajim.gtk.notification')
@@ -420,26 +419,24 @@ def _make_id(details: list[Any]) -> str:
def _get_surface_for_notification(account: str,
jid: JID | str) -> cairo.ImageSurface:
- scale = get_monitor_scale_factor()
size = AvatarSize.NOTIFICATION
client = app.get_client(account)
contact = client.get_module('Contacts').get_contact(jid)
if isinstance(contact, GroupchatContact):
- return contact.get_avatar(size, scale)
+ return contact.get_avatar(size, 1)
assert not isinstance(contact, ResourceContact)
- return contact.get_avatar(size, scale, add_show=False)
+ return contact.get_avatar(size, 1, add_show=False)
def _get_pixbuf_icon(account: str, jid: JID | str) -> GdkPixbuf.Pixbuf:
- scale = get_monitor_scale_factor()
size = AvatarSize.NOTIFICATION
surface = _get_surface_for_notification(account, jid)
pixbuf = Gdk.pixbuf_get_from_surface(surface,
0,
0,
- size * scale,
- size * scale)
+ size,
+ size)
assert pixbuf is not None
return pixbuf
=====================================
gajim/gtk/util.py
=====================================
@@ -376,6 +376,7 @@ def make_rgba(color_string: str) -> Gdk.RGBA:
def get_monitor_scale_factor() -> int:
+ # Does not work on Wayland
display = Gdk.Display.get_default()
assert display is not None
monitor = display.get_primary_monitor()
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/b6b58c444d8907d6445f9d9fa76de4bf4a6288dd...709afe9d3d9fc918a2f34cdf3644051563f15fc2
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/b6b58c444d8907d6445f9d9fa76de4bf4a6288dd...709afe9d3d9fc918a2f34cdf3644051563f15fc2
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]