Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5ec9ff00 by Philipp Hörist at 2024-05-30T08:58:08+02:00
cfix: SearchView: Display rows with localtime
- - - - -
1 changed file:
- gajim/gtk/search_view.py
Changes:
=====================================
gajim/gtk/search_view.py
=====================================
@@ -83,7 +83,7 @@ def _header_func(row: ResultRow, before: ResultRow | None) ->
None:
if before.jid != row.jid:
row.set_header(RowHeader(
row.account, row.remote_jid, row.timestamp))
- elif before.timestamp.date() != row.timestamp.date():
+ elif before.local_timestamp.date() != row.local_timestamp.date():
row.set_header(RowHeader(
row.account, row.remote_jid, row.timestamp))
else:
@@ -368,10 +368,12 @@ def __init__(self, account: str, jid: JID, timestamp:
dt.datetime) -> None:
contact, BareContact | GroupchatContact | GroupchatParticipant)
self._ui.header_name_label.set_text(contact.name or '')
+ local_timestamp = timestamp.astimezone()
+
format_string = app.settings.get('time_format')
- if timestamp.date() < dt.datetime.today().date():
- format_string = app.settings.get('date_time_format')
- self._ui.header_date_label.set_text(timestamp.strftime(format_string))
+ if local_timestamp.date() <= dt.datetime.today().date():
+ format_string = app.settings.get('date_format')
+
self._ui.header_date_label.set_text(local_timestamp.strftime(format_string))
self.show_all()
@@ -392,6 +394,7 @@ def __init__(self, db_row: Message) -> None:
self.pk = db_row.pk
self.timestamp = db_row.timestamp
+ self.local_timestamp = db_row.timestamp.astimezone()
self.type = MessageType(db_row.type)
@@ -416,7 +419,8 @@ def __init__(self, db_row: Message) -> None:
self._ui.row_avatar.set_from_surface(avatar)
format_string = app.settings.get('time_format')
-
self._ui.row_time_label.set_text(self.timestamp.strftime(format_string))
+ self._ui.row_time_label.set_text(
+ self.local_timestamp.strftime(format_string))
text = db_row.text
if db_row.corrections:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5ec9ff00417e887817b8aed54d370521a4e4be9c
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5ec9ff00417e887817b8aed54d370521a4e4be9c
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]