Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
014ee8f9 by wurstsalat at 2022-10-25T23:05:15+02:00
refactor: MessageInputTextView: Remove 'correcting' setter
- - - - -
2 changed files:
- gajim/gtk/message_actions_box.py
- gajim/gtk/message_input.py
Changes:
=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -229,7 +229,7 @@ def clear(self) -> None:
@property
def is_correcting(self) -> bool:
- return self.msg_textview.correcting
+ return self.msg_textview.is_correcting
def toggle_message_correction(self) -> None:
self.msg_textview.toggle_message_correction()
=====================================
gajim/gtk/message_input.py
=====================================
@@ -115,15 +115,10 @@ def __init__(self) -> None:
app.plugin_manager.gui_extension_point('message_input', self)
@property
- def correcting(self) -> bool:
+ def is_correcting(self) -> bool:
assert self._contact is not None
return self._correcting[self._contact]
- @correcting.setter
- def correcting(self, state: bool) -> None:
- assert self._contact is not None
- self._correcting[self._contact] = state
-
def get_last_message_id(self, contact: ChatContactT) -> Optional[str]:
return self._last_message_id.get(contact)
@@ -131,8 +126,8 @@ def toggle_message_correction(self) -> None:
self.clear()
self.grab_focus()
- if self.correcting:
- self.correcting = False
+ if self.is_correcting:
+ self._set_correcting(False)
self.get_style_context().remove_class('gajim-msg-correcting')
return
@@ -146,13 +141,13 @@ def toggle_message_correction(self) -> None:
if message_row is None:
return
- self.correcting = True
+ self._set_correcting(True)
self.get_style_context().add_class('gajim-msg-correcting')
self.insert_text(message_row.message)
def try_message_correction(self, message: str) -> Optional[str]:
assert self._contact is not None
- if not self.correcting:
+ if not self.is_correcting:
return None
self.toggle_message_correction()
@@ -170,6 +165,10 @@ def try_message_correction(self, message: str) ->
Optional[str]:
return correct_id
+ def _set_correcting(self, state: bool) -> None:
+ assert self._contact is not None
+ self._correcting[self._contact] = state
+
def _on_message_sent(self, event: MessageSent) -> None:
if not event.message:
return
@@ -249,7 +248,7 @@ def switch_contact(self, contact: ChatContactT) -> None:
self.insert_text(draft)
self._contact = contact
- if self.correcting:
+ if self.is_correcting:
self.get_style_context().add_class('gajim-msg-correcting')
else:
self.get_style_context().remove_class('gajim-msg-correcting')
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/014ee8f902dcb20d2d2770807a2d88b71e267a18
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/014ee8f902dcb20d2d2770807a2d88b71e267a18
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