Feat: Read long posts from GUI

This commit is contained in:
Manuel Cortez 2024-05-22 17:55:52 -06:00
parent 503bf72b11
commit fe43ce562c
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
5 changed files with 14 additions and 5 deletions

View File

@ -4,6 +4,8 @@ TWBlue Changelog
* Core: * Core:
* The way sessions are named has been changed. Now the account is indicated first, followed by the social network it belongs to. * 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: * Mastodon:
* fixed an error that caused TWBlue to not display some posts correctly. * 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. * Fixed name for community timelines when created during startup. Now it should be clear if it's a federated or local timeline.

View File

@ -9,8 +9,7 @@ update_period = integer(default=2)
hide_gui = boolean(default=False) hide_gui = boolean(default=False)
voice_enabled = boolean(default=False) voice_enabled = boolean(default=False)
ask_at_exit = boolean(default=True) ask_at_exit = boolean(default=True)
autostart = boolean(default=False) read_long_posts_in_gui = boolean(default=True)
handle_longtweets = boolean(default=True)
use_invisible_keyboard_shorcuts = boolean(default=True) use_invisible_keyboard_shorcuts = boolean(default=True)
play_ready_sound = boolean(default=True) play_ready_sound = boolean(default=True)
speak_ready_msg = boolean(default=True) speak_ready_msg = boolean(default=True)
@ -18,9 +17,6 @@ log_level = string(default="error")
load_keymap = string(default="default.keymap") load_keymap = string(default="default.keymap")
donation_dialog_displayed = boolean(default=False) donation_dialog_displayed = boolean(default=False)
check_for_updates = boolean(default=True) 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) no_streaming = boolean(default=False)
[proxy] [proxy]

View File

@ -406,6 +406,8 @@ class BaseBuffer(base.Buffer):
original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at) original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at)
ts = original_date.humanize(locale=languageHandler.getLanguage()) ts = original_date.humanize(locale=languageHandler.getLanguage())
self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, ts) 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): if self.session.settings['sound']['indicate_audio'] and utils.is_audio_or_video(post):
self.session.sound.play("audio.ogg") self.session.sound.play("audio.ogg")
if self.session.settings['sound']['indicate_img'] and utils.is_image(post): if self.session.settings['sound']['indicate_img'] and utils.is_image(post):

View File

@ -4,6 +4,7 @@ import logging
import wx import wx
import widgetUtils import widgetUtils
import output import output
import config
from mastodon import MastodonNotFoundError from mastodon import MastodonNotFoundError
from controller.mastodon import messages from controller.mastodon import messages
from controller.buffers.mastodon.base import BaseBuffer from controller.buffers.mastodon.base import BaseBuffer
@ -162,6 +163,8 @@ class ConversationListBuffer(BaseBuffer):
def onFocus(self, *args, **kwargs): def onFocus(self, *args, **kwargs):
post = self.get_item() 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): if self.session.settings['sound']['indicate_audio'] and utils.is_audio_or_video(post):
self.session.sound.play("audio.ogg") self.session.sound.play("audio.ogg")
if self.session.settings['sound']['indicate_img'] and utils.is_image(post): if self.session.settings['sound']['indicate_img'] and utils.is_image(post):

View File

@ -1,8 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import time import time
import logging import logging
import arrow
import widgetUtils import widgetUtils
import output import output
import languageHandler
import config
from pubsub import pub from pubsub import pub
from controller.buffers.mastodon.base import BaseBuffer from controller.buffers.mastodon.base import BaseBuffer
from controller.mastodon import messages from controller.mastodon import messages
@ -38,8 +41,11 @@ class NotificationsBuffer(BaseBuffer):
original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at) original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at)
ts = original_date.humanize(locale=languageHandler.getLanguage()) ts = original_date.humanize(locale=languageHandler.getLanguage())
self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 1, ts) 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): 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.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.post_status, self.buffer.post)
widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.destroy_status, self.buffer.dismiss) widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.destroy_status, self.buffer.dismiss)