mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Added functions to make TWBlue respect Twitter limits when adding media items
This commit is contained in:
parent
8fed52118f
commit
605868eff9
@ -10,7 +10,6 @@ import config
|
||||
from pubsub import pub
|
||||
from twitter_text import parse_tweet
|
||||
from wxUI.dialogs import twitterDialogs, urlList
|
||||
#from wxUI.dialogs import twitterDialogs
|
||||
from wxUI import commonMessageDialogs
|
||||
from extra import translator, SpellChecker, autocompletionUsers
|
||||
from extra.AudioUploader import audioUploader
|
||||
@ -98,6 +97,14 @@ class basicTweet(object):
|
||||
self.message.PopupMenu(menu, self.message.add.GetPosition())
|
||||
|
||||
def on_attach_image(self, *args, **kwargs):
|
||||
can_attach = self.can_attach()
|
||||
video_or_gif_present = False
|
||||
for a in self.attachments:
|
||||
if a["type"] == "video" or a["type"] == "gif":
|
||||
video_or_gif = True
|
||||
break
|
||||
if can_attach == False or video_or_gif_present == True:
|
||||
return self.message.unable_to_attach_file()
|
||||
image, description = self.message.get_image()
|
||||
if image != None:
|
||||
if image.endswith("gif"):
|
||||
@ -112,6 +119,8 @@ class basicTweet(object):
|
||||
self.text_processor()
|
||||
|
||||
def on_attach_video(self, *args, **kwargs):
|
||||
if len(self.attachments) > 0:
|
||||
return self.message.unable_to_attach_file()
|
||||
video = self.message.get_video()
|
||||
if video != None:
|
||||
videoInfo = {"type": "video", "file": video, "description": ""}
|
||||
|
@ -145,7 +145,7 @@ class tweet(wx.Dialog):
|
||||
return openFileDialog.GetPath()
|
||||
|
||||
def unable_to_attach_file(self, *args, **kwargs):
|
||||
return wx.MessageDialog(self, _("You need to delete other attachments first, as Videos and GIF's cannot be added with other attachments."), _("Error adding attachment"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(self, _("It is not possible to add more attachments. Please make sure your tweet complies with Twitter'S attachment rules. You can add only one video or GIF in every tweet, and a maximum of 4 photos."), _("Error adding attachment"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
class reply(tweet):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user