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


Commits:
075fca14 by Philipp Hörist at 2024-03-20T23:31:35+01:00
fix: Fix some pyright errors

- - - - -


2 changed files:

- gajim/gtk/control.py
- gajim/gtk/search_view.py


Changes:

=====================================
gajim/gtk/control.py
=====================================
@@ -176,7 +176,7 @@ def reset_view(self) -> None:
     def get_autoscroll(self) -> bool:
         return self._scrolled_view.get_autoscroll()
 
-    def scroll_to_message(self, log_line_id: int, timestamp: float) -> None:
+    def scroll_to_message(self, log_line_id: int, timestamp: dt.datetime) -> 
None:
         row = self._scrolled_view.get_row_by_log_line_id(log_line_id)
         if row is None:
             # Clear view and reload conversation around timestamp


=====================================
gajim/gtk/search_view.py
=====================================
@@ -205,6 +205,9 @@ def _update_calendar(self) -> None:
 
         self._ui.calendar_button.set_sensitive(True)
 
+        assert self._jid is not None
+        assert self._account is not None
+
         first_log = app.storage.archive.get_first_history_ts(
             self._account, self._jid)
         if first_log is None:
@@ -229,6 +232,9 @@ def _on_month_changed(self, calendar: Gtk.Calendar) -> None:
         calendar.clear_marks()
         month = python_month(month)
 
+        assert self._jid is not None
+        assert self._account is not None
+
         history_days = app.storage.archive.get_days_containing_messages(
             self._account, self._jid, year, month)
         for day in history_days:
@@ -273,6 +279,9 @@ def _select_date(self,
         py_m = python_month(month)
         date = datetime(year, py_m, day).astimezone()
 
+        assert self._jid is not None
+        assert self._account is not None
+
         has_history = False
         while not has_history:
             if direction == Direction.PREV:
@@ -297,6 +306,10 @@ def _scroll_to_date(self, date: datetime) -> None:
         if not control.has_active_chat():
             return
         if control.contact.jid == self._jid:
+
+            assert self._jid is not None
+            assert self._account is not None
+
             meta = app.storage.archive.get_first_message_meta_for_date(
                 self._account, self._jid, date)
             if meta is None:
@@ -401,13 +414,14 @@ def __init__(self, db_row: Message) -> None:
             format_string = app.settings.get('date_time_format')
         
self._ui.row_time_label.set_text(self.timestamp.strftime(format_string))
 
-        assert db_row.text is not None
-        message = db_row.text
+        text = db_row.text
         if db_row.corrections:
-            message = db_row.corrections[-1].text
+            text = db_row.get_last_correction().text
+
+        assert text is not None
 
         message_widget = MessageWidget(self.account, selectable=False)
-        message_widget.add_with_styling(message, nickname=contact_name)
+        message_widget.add_with_styling(text, nickname=contact_name)
         self._ui.result_row_grid.attach(message_widget, 1, 1, 2, 1)
 
         self.show_all()



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/075fca1420953f21595e02576e065f378d324985
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]

Reply via email to