mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Allow to copy tweet URLS from tweet displayer dialog
This commit is contained in:
parent
c67b415934
commit
f4ecf10885
@ -3,6 +3,7 @@
|
|||||||
## changes in this version
|
## changes in this version
|
||||||
|
|
||||||
* When reading a tweet, if the tweet contains more than 2 consecutive mentions, TWBlue will announce how many more users the tweet includes, as opposed to read every user in the conversation. You still can display the tweet to read all users.
|
* When reading a tweet, if the tweet contains more than 2 consecutive mentions, TWBlue will announce how many more users the tweet includes, as opposed to read every user in the conversation. You still can display the tweet to read all users.
|
||||||
|
* In the tweet displayer, It is possible to copy a link to the current tweet or person by pressing a button called "copy link to clipboard".
|
||||||
* Added a keymap capable to work under Windows 11. ([#391](https://github.com/manuelcortez/TWBlue/pull/391))
|
* Added a keymap capable to work under Windows 11. ([#391](https://github.com/manuelcortez/TWBlue/pull/391))
|
||||||
* Added user aliases to TWBlue. This feature allows you to rename user's display names on Twitter, so the next time you'll read an user it will be announced as you configured. For adding an alias to an user, select the "add alias" option in the user menu, located in the menu bar. This feature works only if you have set display screen names unchecked. Users are displayed with their display name in people buffers only. This action is supported in all keymaps, although it is undefined by default. ([#389](https://github.com/manuelcortez/TWBlue/pull/389))
|
* Added user aliases to TWBlue. This feature allows you to rename user's display names on Twitter, so the next time you'll read an user it will be announced as you configured. For adding an alias to an user, select the "add alias" option in the user menu, located in the menu bar. This feature works only if you have set display screen names unchecked. Users are displayed with their display name in people buffers only. This action is supported in all keymaps, although it is undefined by default. ([#389](https://github.com/manuelcortez/TWBlue/pull/389))
|
||||||
* There are some changes to the autocomplete users feature:
|
* There are some changes to the autocomplete users feature:
|
||||||
|
@ -644,8 +644,12 @@ class BaseBuffer(base.Buffer):
|
|||||||
original_tweet.text = utils.find_urls_in_text(original_tweet.text, original_tweet.entities)
|
original_tweet.text = utils.find_urls_in_text(original_tweet.text, original_tweet.entities)
|
||||||
return compose.compose_quoted_tweet(quoted_tweet, original_tweet, self.session.db, self.session.settings["general"]["relative_times"])
|
return compose.compose_quoted_tweet(quoted_tweet, original_tweet, self.session.db, self.session.settings["general"]["relative_times"])
|
||||||
|
|
||||||
def open_in_browser(self, *args, **kwargs):
|
def get_item_url(self):
|
||||||
tweet = self.get_tweet()
|
tweet = self.get_tweet()
|
||||||
output.speak(_(u"Opening item in web browser..."))
|
|
||||||
url = "https://twitter.com/{screen_name}/status/{tweet_id}".format(screen_name=self.session.get_user(tweet.user).screen_name, tweet_id=tweet.id)
|
url = "https://twitter.com/{screen_name}/status/{tweet_id}".format(screen_name=self.session.get_user(tweet.user).screen_name, tweet_id=tweet.id)
|
||||||
|
return url
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
url = self.get_item_url()
|
||||||
|
output.speak(_(u"Opening item in web browser..."))
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
@ -252,8 +252,7 @@ class PeopleBuffer(base.BaseBuffer):
|
|||||||
elif number_of_items > 1 and self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
|
elif number_of_items > 1 and self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
|
||||||
output.speak(_(u"{0} new followers.").format(number_of_items))
|
output.speak(_(u"{0} new followers.").format(number_of_items))
|
||||||
|
|
||||||
def open_in_browser(self, *args, **kwargs):
|
def get_item_url(self, *args, **kwargs):
|
||||||
tweet = self.get_tweet()
|
tweet = self.get_tweet()
|
||||||
output.speak(_(u"Opening item in web browser..."))
|
|
||||||
url = "https://twitter.com/{screen_name}".format(screen_name=tweet.screen_name)
|
url = "https://twitter.com/{screen_name}".format(screen_name=tweet.screen_name)
|
||||||
webbrowser.open(url)
|
return url
|
@ -831,7 +831,7 @@ class Controller(object):
|
|||||||
return
|
return
|
||||||
elif buffer.type == "baseBuffer" or buffer.type == "favourites_timeline" or buffer.type == "list" or buffer.type == "search":
|
elif buffer.type == "baseBuffer" or buffer.type == "favourites_timeline" or buffer.type == "list" or buffer.type == "search":
|
||||||
tweet, tweetsList = buffer.get_full_tweet()
|
tweet, tweetsList = buffer.get_full_tweet()
|
||||||
msg = messages.viewTweet(tweet, tweetsList, utc_offset=buffer.session.db["utc_offset"])
|
msg = messages.viewTweet(tweet, tweetsList, utc_offset=buffer.session.db["utc_offset"], item_url=buffer.get_item_url())
|
||||||
elif buffer.type == "dm":
|
elif buffer.type == "dm":
|
||||||
non_tweet = buffer.get_formatted_message()
|
non_tweet = buffer.get_formatted_message()
|
||||||
item = buffer.get_right_tweet()
|
item = buffer.get_right_tweet()
|
||||||
@ -839,8 +839,11 @@ class Controller(object):
|
|||||||
date = original_date.shift(seconds=buffer.session.db["utc_offset"]).format(_(u"MMM D, YYYY. H:m"), locale=languageHandler.getLanguage())
|
date = original_date.shift(seconds=buffer.session.db["utc_offset"]).format(_(u"MMM D, YYYY. H:m"), locale=languageHandler.getLanguage())
|
||||||
msg = messages.viewTweet(non_tweet, [], False, date=date)
|
msg = messages.viewTweet(non_tweet, [], False, date=date)
|
||||||
else:
|
else:
|
||||||
|
item_url = ""
|
||||||
|
if hasattr(buffer, "get_item_url"):
|
||||||
|
item_url = buffer.get_item_url()
|
||||||
non_tweet = buffer.get_formatted_message()
|
non_tweet = buffer.get_formatted_message()
|
||||||
msg = messages.viewTweet(non_tweet, [], False)
|
msg = messages.viewTweet(non_tweet, [], False, item_url=item_url)
|
||||||
|
|
||||||
def open_in_browser(self, *args, **kwargs):
|
def open_in_browser(self, *args, **kwargs):
|
||||||
buffer = self.get_current_buffer()
|
buffer = self.get_current_buffer()
|
||||||
|
@ -205,7 +205,7 @@ class dm(basicTweet):
|
|||||||
c.show_menu("dm")
|
c.show_menu("dm")
|
||||||
|
|
||||||
class viewTweet(basicTweet):
|
class viewTweet(basicTweet):
|
||||||
def __init__(self, tweet, tweetList, is_tweet=True, utc_offset=0, date=""):
|
def __init__(self, tweet, tweetList, is_tweet=True, utc_offset=0, date="", item_url=""):
|
||||||
""" This represents a tweet displayer. However it could be used for showing something wich is not a tweet, like a direct message or an event.
|
""" This represents a tweet displayer. However it could be used for showing something wich is not a tweet, like a direct message or an event.
|
||||||
param tweet: A dictionary that represents a full tweet or a string for non-tweets.
|
param tweet: A dictionary that represents a full tweet or a string for non-tweets.
|
||||||
param tweetList: If is_tweet is set to True, this could be a list of quoted tweets.
|
param tweetList: If is_tweet is set to True, this could be a list of quoted tweets.
|
||||||
@ -273,6 +273,10 @@ class viewTweet(basicTweet):
|
|||||||
text = tweet
|
text = tweet
|
||||||
self.message = message.viewNonTweet(text, date)
|
self.message = message.viewNonTweet(text, date)
|
||||||
widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck)
|
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)
|
widgetUtils.connect_event(self.message.translateButton, widgetUtils.BUTTON_PRESSED, self.translate)
|
||||||
if self.contain_urls() == True:
|
if self.contain_urls() == True:
|
||||||
self.message.enable_button("unshortenButton")
|
self.message.enable_button("unshortenButton")
|
||||||
@ -290,3 +294,8 @@ class viewTweet(basicTweet):
|
|||||||
if "https://twitter.com/" in i:
|
if "https://twitter.com/" in i:
|
||||||
text = text.replace(i, "\n")
|
text = text.replace(i, "\n")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
def share(self, *args, **kwargs):
|
||||||
|
if hasattr(self, "item_url"):
|
||||||
|
output.copy(self.item_url)
|
||||||
|
output.speak(_("Link copied to clipboard."))
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
from builtins import str
|
|
||||||
import wx
|
import wx
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
|
||||||
@ -356,6 +354,8 @@ class viewTweet(widgetUtils.BaseDialog):
|
|||||||
infoBox.Add(sourceBox, 0, wx.ALL, 5)
|
infoBox.Add(sourceBox, 0, wx.ALL, 5)
|
||||||
mainBox.Add(infoBox, 0, wx.ALL, 5)
|
mainBox.Add(infoBox, 0, wx.ALL, 5)
|
||||||
mainBox.Add(dateBox, 0, wx.ALL, 5)
|
mainBox.Add(dateBox, 0, wx.ALL, 5)
|
||||||
|
self.share = wx.Button(panel, wx.ID_ANY, _("Copy link to clipboard"))
|
||||||
|
self.share.Enable(False)
|
||||||
self.spellcheck = wx.Button(panel, -1, _("Check &spelling..."), size=wx.DefaultSize)
|
self.spellcheck = wx.Button(panel, -1, _("Check &spelling..."), size=wx.DefaultSize)
|
||||||
self.unshortenButton = wx.Button(panel, -1, _(u"&Expand URL"), size=wx.DefaultSize)
|
self.unshortenButton = wx.Button(panel, -1, _(u"&Expand URL"), size=wx.DefaultSize)
|
||||||
self.unshortenButton.Disable()
|
self.unshortenButton.Disable()
|
||||||
@ -363,6 +363,7 @@ class viewTweet(widgetUtils.BaseDialog):
|
|||||||
cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize)
|
cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize)
|
||||||
cancelButton.SetDefault()
|
cancelButton.SetDefault()
|
||||||
buttonsBox = wx.BoxSizer(wx.HORIZONTAL)
|
buttonsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
buttonsBox.Add(self.share, 0, wx.ALL, 5)
|
||||||
buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5)
|
buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5)
|
||||||
buttonsBox.Add(self.unshortenButton, 0, wx.ALL, 5)
|
buttonsBox.Add(self.unshortenButton, 0, wx.ALL, 5)
|
||||||
buttonsBox.Add(self.translateButton, 0, wx.ALL, 5)
|
buttonsBox.Add(self.translateButton, 0, wx.ALL, 5)
|
||||||
@ -429,6 +430,8 @@ class viewNonTweet(widgetUtils.BaseDialog):
|
|||||||
dateBox.Add(dateLabel, 0, wx.ALL, 5)
|
dateBox.Add(dateLabel, 0, wx.ALL, 5)
|
||||||
dateBox.Add(date, 0, wx.ALL, 5)
|
dateBox.Add(date, 0, wx.ALL, 5)
|
||||||
mainBox.Add(dateBox, 0, wx.ALL, 5)
|
mainBox.Add(dateBox, 0, wx.ALL, 5)
|
||||||
|
self.share = wx.Button(panel, wx.ID_ANY, _("Copy link to clipboard"))
|
||||||
|
self.share.Enable(False)
|
||||||
self.spellcheck = wx.Button(panel, -1, _("Check &spelling..."), size=wx.DefaultSize)
|
self.spellcheck = wx.Button(panel, -1, _("Check &spelling..."), size=wx.DefaultSize)
|
||||||
self.unshortenButton = wx.Button(panel, -1, _(u"&Expand URL"), size=wx.DefaultSize)
|
self.unshortenButton = wx.Button(panel, -1, _(u"&Expand URL"), size=wx.DefaultSize)
|
||||||
self.unshortenButton.Disable()
|
self.unshortenButton.Disable()
|
||||||
@ -436,6 +439,7 @@ class viewNonTweet(widgetUtils.BaseDialog):
|
|||||||
cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize)
|
cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize)
|
||||||
cancelButton.SetDefault()
|
cancelButton.SetDefault()
|
||||||
buttonsBox = wx.BoxSizer(wx.HORIZONTAL)
|
buttonsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
buttonsBox.Add(self.share, 0, wx.ALL, 5)
|
||||||
buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5)
|
buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5)
|
||||||
buttonsBox.Add(self.unshortenButton, 0, wx.ALL, 5)
|
buttonsBox.Add(self.unshortenButton, 0, wx.ALL, 5)
|
||||||
buttonsBox.Add(self.translateButton, 0, wx.ALL, 5)
|
buttonsBox.Add(self.translateButton, 0, wx.ALL, 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user