Skip to content

Commit

Permalink
Feat: Read long posts from GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelcortez committed May 22, 2024
1 parent 503bf72 commit fe43ce5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions src/app-configuration.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ 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)
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]
Expand Down
2 changes: 2 additions & 0 deletions src/controller/buffers/mastodon/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions src/controller/buffers/mastodon/conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions src/controller/buffers/mastodon/notifications.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fe43ce5

Please sign in to comment.