Mastodon: Implemented OCR for images in posts

This commit is contained in:
2023-04-05 12:57:37 -06:00
parent db4607f17e
commit 00a5ad9e59
6 changed files with 76 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class Handler(object):
unfav=_("Remove from favorites"),
view=_("&Show post"),
view_conversation=_("View conversa&tion"),
ocr=None,
ocr=_("Read text in picture"),
delete=_("&Delete"),
# In user menu.
follow=_("&Actions..."),

View File

@@ -269,4 +269,12 @@ class viewPost(post):
def share(self, *args, **kwargs):
if hasattr(self, "item_url"):
output.copy(self.item_url)
output.speak(_("Link copied to clipboard."))
output.speak(_("Link copied to clipboard."))
class text(messages.basicMessage):
def __init__(self, title, text="", *args, **kwargs):
self.title = title
self.message = postDialogs.viewText(title=title, text=text, *args, **kwargs)
self.message.text.SetInsertionPoint(len(self.message.text.GetValue()))
widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck)
widgetUtils.connect_event(self.message.translateButton, widgetUtils.BUTTON_PRESSED, self.translate)