From fe43ce562ce03acecbb7093fa432d49a9679a198 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Wed, 22 May 2024 17:55:52 -0600 Subject: [PATCH] Feat: Read long posts from GUI --- doc/changelog.md | 2 ++ src/app-configuration.defaults | 6 +----- src/controller/buffers/mastodon/base.py | 2 ++ src/controller/buffers/mastodon/conversations.py | 3 +++ src/controller/buffers/mastodon/notifications.py | 6 ++++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index ad07f5986..d8995a39f 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -4,6 +4,8 @@ TWBlue Changelog * Core: * The way sessions are named has been changed. Now the account is indicated first, followed by the social network it belongs to. + * An option has been added to the global options dialog that allows for the reading of long posts in the graphical interface. This is especially useful since, by default, the graphical interface can only display a limited number of characters in the post. + * Some options that are no longer necessary in the application have been removed from the global settings dialog. * Mastodon: * fixed an error that caused TWBlue to not display some posts correctly. * Fixed name for community timelines when created during startup. Now it should be clear if it's a federated or local timeline. diff --git a/src/app-configuration.defaults b/src/app-configuration.defaults index b3c23ea8c..8b00a71b8 100644 --- a/src/app-configuration.defaults +++ b/src/app-configuration.defaults @@ -9,8 +9,7 @@ update_period = integer(default=2) hide_gui = boolean(default=False) voice_enabled = boolean(default=False) ask_at_exit = boolean(default=True) -autostart = boolean(default=False) -handle_longtweets = boolean(default=True) +read_long_posts_in_gui = boolean(default=True) use_invisible_keyboard_shorcuts = boolean(default=True) play_ready_sound = boolean(default=True) speak_ready_msg = boolean(default=True) @@ -18,9 +17,6 @@ log_level = string(default="error") load_keymap = string(default="default.keymap") donation_dialog_displayed = boolean(default=False) check_for_updates = boolean(default=True) -remember_mention_and_longtweet = boolean(default=False) -longtweet = boolean(default=false) -mention_all = boolean(default=False) no_streaming = boolean(default=False) [proxy] diff --git a/src/controller/buffers/mastodon/base.py b/src/controller/buffers/mastodon/base.py index b042caa72..e714ee489 100644 --- a/src/controller/buffers/mastodon/base.py +++ b/src/controller/buffers/mastodon/base.py @@ -406,6 +406,8 @@ def onFocus(self, *args, **kwargs): original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at) ts = original_date.humanize(locale=languageHandler.getLanguage()) self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, ts) + if config.app["app-settings"]["read_long_posts_in_gui"] == True and self.buffer.list.list.HasFocus(): + output.speak(self.get_message(), interrupt=True) if self.session.settings['sound']['indicate_audio'] and utils.is_audio_or_video(post): self.session.sound.play("audio.ogg") if self.session.settings['sound']['indicate_img'] and utils.is_image(post): diff --git a/src/controller/buffers/mastodon/conversations.py b/src/controller/buffers/mastodon/conversations.py index c536ce16e..c195ff913 100644 --- a/src/controller/buffers/mastodon/conversations.py +++ b/src/controller/buffers/mastodon/conversations.py @@ -4,6 +4,7 @@ import wx import widgetUtils import output +import config from mastodon import MastodonNotFoundError from controller.mastodon import messages from controller.buffers.mastodon.base import BaseBuffer @@ -162,6 +163,8 @@ def send_message(self): def onFocus(self, *args, **kwargs): post = self.get_item() + if config.app["app-settings"]["read_long_posts_in_gui"] == True and self.buffer.list.list.HasFocus(): + output.speak(self.get_message(), interrupt=True) if self.session.settings['sound']['indicate_audio'] and utils.is_audio_or_video(post): self.session.sound.play("audio.ogg") if self.session.settings['sound']['indicate_img'] and utils.is_image(post): diff --git a/src/controller/buffers/mastodon/notifications.py b/src/controller/buffers/mastodon/notifications.py index 484cdee5f..d0d418874 100644 --- a/src/controller/buffers/mastodon/notifications.py +++ b/src/controller/buffers/mastodon/notifications.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- import time import logging +import arrow import widgetUtils import output +import languageHandler +import config from pubsub import pub from controller.buffers.mastodon.base import BaseBuffer from controller.mastodon import messages @@ -38,8 +41,11 @@ def onFocus(self, *args, **kwargs): original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at) ts = original_date.humanize(locale=languageHandler.getLanguage()) self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 1, ts) + if config.app["app-settings"]["read_long_posts_in_gui"] == True and self.buffer.list.list.HasFocus(): + output.speak(self.get_message(), interrupt=True) def bind_events(self): + self.buffer.set_focus_function(self.onFocus) widgetUtils.connect_event(self.buffer.list.list, widgetUtils.KEYPRESS, self.get_event) widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.post_status, self.buffer.post) widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.destroy_status, self.buffer.dismiss)