mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 13:46:07 -04:00
Added basic toot viewing (untested yet)
This commit is contained in:
@@ -458,7 +458,7 @@ class BaseBuffer(base.Buffer):
|
||||
def view_item(self):
|
||||
toot = self.get_item()
|
||||
print(toot)
|
||||
pass
|
||||
msg = messages.viewToot(toot, offset_hours=self.session.db["utc_offset"], item_url=self.get_item_url())
|
||||
|
||||
def ocr_image(self):
|
||||
toot = self.get_item()
|
||||
|
@@ -1,7 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import widgetUtils
|
||||
import config
|
||||
import output
|
||||
from controller.twitter import messages
|
||||
from sessions.mastodon import templates
|
||||
from wxUI.dialogs.mastodon import tootDialogs
|
||||
|
||||
class toot(messages.tweet):
|
||||
def __init__(self, max=500, *args, **kwargs):
|
||||
@@ -47,3 +50,42 @@ class reply(toot):
|
||||
if self.message.checkboxes[i].GetValue() == True:
|
||||
people = people + "{0} ".format(self.message.checkboxes[i].GetLabel(),)
|
||||
return people
|
||||
|
||||
class viewToot(toot):
|
||||
def __init__(self, toot, offset_hours=0, date="", item_url=""):
|
||||
if toot.reblog != None:
|
||||
toot = toot.reblog
|
||||
author = toot.account.display_name if toot.account.display_name != "" else toot.account.username
|
||||
title = _(u"Toot from {}").format(author)
|
||||
image_description = templates.process_image_descriptions(toot.media_attachments)
|
||||
text = templates.process_text(toot, safe=False)
|
||||
date = templates.process_date(toot.created_at, relative_times=False, offset_hours=offset_hours)
|
||||
boost_count = str(toot.reblogs_count)
|
||||
favs_count = str(toot.favourites_count)
|
||||
# Gets the client from where this toot was made.
|
||||
source_obj = toot.get("application")
|
||||
if source_obj == None:
|
||||
source = _("Remote instance")
|
||||
else:
|
||||
source = source_obj.get("name")
|
||||
self.message = tootDialogs.viewToot(text=text, boosts_count=boost_count, favs_count=favs_count, source=source, date=date)
|
||||
self.message.SetTitle(title)
|
||||
if image_description != "":
|
||||
self.message.image_description.Enable(True)
|
||||
self.message.image_description.ChangeValue(image_description)
|
||||
widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck)
|
||||
if item_url != "":
|
||||
self.message.enable_button("share")
|
||||
widgetUtils.connect_event(self.message.share, widgetUtils.BUTTON_PRESSED, self.share)
|
||||
self.item_url = item_url
|
||||
widgetUtils.connect_event(self.message.translateButton, widgetUtils.BUTTON_PRESSED, self.translate)
|
||||
self.message.ShowModal()
|
||||
|
||||
# We won't need text_processor in this dialog, so let's avoid it.
|
||||
def text_processor(self):
|
||||
pass
|
||||
|
||||
def share(self, *args, **kwargs):
|
||||
if hasattr(self, "item_url"):
|
||||
output.copy(self.item_url)
|
||||
output.speak(_("Link copied to clipboard."))
|
Reference in New Issue
Block a user