mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 21:56:07 -04:00
Added support for posting polls
This commit is contained in:
@@ -457,11 +457,10 @@ class BaseBuffer(base.Buffer):
|
||||
if hasattr(tweet, "retweeted_status"):
|
||||
tweet = tweet.retweeted_status
|
||||
retweet = messages.tweet(session=self.session, title=_("Quote"), caption=_("Add your comment to the tweet"), max=256, thread_mode=False)
|
||||
retweet = messages.tweet(session=self.session, title=_("Quote"), caption=_("Add your comment to the tweet"), max=256, thread_mode=False)
|
||||
if retweet.message.ShowModal() == widgetUtils.OK:
|
||||
text = retweet.message.text.GetValue()
|
||||
text = text+" https://twitter.com/{0}/status/{1}".format(self.session.get_user(tweet.user).screen_name, id)
|
||||
tweet_data = dict(text=text, attachments=retweet.attachments)
|
||||
tweet_data = dict(text=text, attachments=retweet.attachments, poll_period=retweet.poll_period, poll_options=retweet.poll_options)
|
||||
call_threaded(self.session.send_tweet, *[tweet_data])
|
||||
if hasattr(retweet.message, "destroy"):
|
||||
retweet.message.destroy()
|
||||
|
@@ -131,7 +131,11 @@ class basicTweet(object):
|
||||
self.text_processor()
|
||||
|
||||
def on_attach_poll(self, *args, **kwargs):
|
||||
pass
|
||||
dlg = twitterDialogs.poll()
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
self.poll_options = dlg.get_options()
|
||||
self.poll_period = 60*24*dlg.period.GetValue()
|
||||
dlg.Destroy()
|
||||
|
||||
def remove_attachment(self, *args, **kwargs):
|
||||
attachment = self.message.attachments.GetFocusedItem()
|
||||
@@ -144,6 +148,8 @@ class basicTweet(object):
|
||||
class tweet(basicTweet):
|
||||
def __init__(self, session, title, caption, text="", max=280, messageType="tweet", *args, **kwargs):
|
||||
self.thread = []
|
||||
self.poll_options = None
|
||||
self.poll_period = None
|
||||
super(tweet, self).__init__(session, title, caption, text, messageType, max, *args, **kwargs)
|
||||
widgetUtils.connect_event(self.message.autocomplete_users, widgetUtils.BUTTON_PRESSED, self.autocomplete_users)
|
||||
if hasattr(self.message, "add_tweet"):
|
||||
@@ -159,9 +165,11 @@ class tweet(basicTweet):
|
||||
def add_tweet(self, event, update_gui=True, *args, **kwargs):
|
||||
text = self.message.text.GetValue()
|
||||
attachments = self.attachments[::]
|
||||
tweetdata = dict(text=text, attachments=attachments)
|
||||
tweetdata = dict(text=text, attachments=attachments, poll_options=self.poll_options, poll_period=self.poll_period)
|
||||
self.thread.append(tweetdata)
|
||||
self.attachments = []
|
||||
self.poll_options = None
|
||||
self.poll_period = None
|
||||
if update_gui:
|
||||
self.message.reset_controls()
|
||||
self.message.add_item(item=[text, len(attachments)], list_type="tweet")
|
||||
|
Reference in New Issue
Block a user