mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -06:00
Updated reply dialog with some changes in add menu
This commit is contained in:
parent
77d13fdc28
commit
b0cfc5978c
@ -408,8 +408,8 @@ class BaseBuffer(base.Buffer):
|
|||||||
if len(users) > 0:
|
if len(users) > 0:
|
||||||
config.app["app-settings"]["mention_all"] = message.message.mention_all.GetValue()
|
config.app["app-settings"]["mention_all"] = message.message.mention_all.GetValue()
|
||||||
config.app.write()
|
config.app.write()
|
||||||
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments)
|
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments, poll_options=message.poll_options, poll_period=message.poll_period)
|
||||||
call_threaded(self.session.reply, in_reply_to_status_id=id, text=message.message.text.GetValue(), attachments=message.attachments, exclude_reply_user_ids=message.get_ids(), auto_populate_reply_metadata=True)
|
call_threaded(self.session.reply, in_reply_to_status_id=id, text=message.message.text.GetValue(), attachments=message.attachments, exclude_reply_user_ids=message.get_ids())
|
||||||
if hasattr(message.message, "destroy"): message.message.destroy()
|
if hasattr(message.message, "destroy"): message.message.destroy()
|
||||||
self.session.settings.write()
|
self.session.settings.write()
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ class DirectMessagesBuffer(base.BaseBuffer):
|
|||||||
screen_name = self.session.get_user(tweet.message_create["sender_id"]).screen_name
|
screen_name = self.session.get_user(tweet.message_create["sender_id"]).screen_name
|
||||||
message = messages.reply(session=self.session, title=_("Mention"), caption=_("Mention to %s") % (screen_name,), text="@%s " % (screen_name,), thread_mode=False, users=[screen_name,])
|
message = messages.reply(session=self.session, title=_("Mention"), caption=_("Mention to %s") % (screen_name,), text="@%s " % (screen_name,), thread_mode=False, users=[screen_name,])
|
||||||
if message.message.ShowModal() == widgetUtils.OK:
|
if message.message.ShowModal() == widgetUtils.OK:
|
||||||
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments)
|
tweet_data = message.get_tweet_data()
|
||||||
call_threaded(self.session.send_tweet, *[tweet_data])
|
call_threaded(self.session.send_tweet, tweet_data)
|
||||||
if hasattr(message.message, "destroy"):
|
if hasattr(message.message, "destroy"):
|
||||||
message.message.destroy()
|
message.message.destroy()
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ class PeopleBuffer(base.BaseBuffer):
|
|||||||
screen_name = tweet.screen_name
|
screen_name = tweet.screen_name
|
||||||
message = messages.tweet(session=self.session, title=_("Mention"), caption=_("Mention to %s") % (screen_name,), text="@%s " % (screen_name,), thread_mode=False)
|
message = messages.tweet(session=self.session, title=_("Mention"), caption=_("Mention to %s") % (screen_name,), text="@%s " % (screen_name,), thread_mode=False)
|
||||||
if message.message.ShowModal() == widgetUtils.OK:
|
if message.message.ShowModal() == widgetUtils.OK:
|
||||||
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments)
|
tweet_data = message.get_tweet_data()
|
||||||
call_threaded(self.session.send_tweet, *[tweet_data])
|
call_threaded(self.session.send_tweet, tweet_data)
|
||||||
if hasattr(message.message, "destroy"):
|
if hasattr(message.message, "destroy"):
|
||||||
message.message.destroy()
|
message.message.destroy()
|
||||||
|
|
||||||
|
@ -131,21 +131,13 @@ class TrendsBuffer(base.Buffer):
|
|||||||
|
|
||||||
def tweet_about_this_trend(self, *args, **kwargs):
|
def tweet_about_this_trend(self, *args, **kwargs):
|
||||||
if self.buffer.list.get_count() == 0: return
|
if self.buffer.list.get_count() == 0: return
|
||||||
title = _(u"Tweet")
|
title = _("Tweet")
|
||||||
caption = _(u"Write the tweet here")
|
caption = _("Write the tweet here")
|
||||||
tweet = messages.tweet(self.session, title, caption, self.get_message()+ " ")
|
tweet = messages.tweet(session=self.session, title=title, caption=caption, text=self.get_message()+ " ")
|
||||||
tweet.message.set_cursor_at_end()
|
tweet.message.SetInsertionPoint(len(tweet.message.GetValue()))
|
||||||
if tweet.message.get_response() == widgetUtils.OK:
|
if tweet.message.ShowModal() == widgetUtils.OK:
|
||||||
text = tweet.message.get_text()
|
tweet_data = tweet.get_tweet_data()
|
||||||
if len(text) > 280 and tweet.message.get("long_tweet") == True:
|
call_threaded(self.session.send_tweet, *tweet_data)
|
||||||
if tweet.image == None:
|
|
||||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
|
|
||||||
else:
|
|
||||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text, 1)
|
|
||||||
if tweet.image == None:
|
|
||||||
call_threaded(self.session.api_call, call_name="update_status", status=text)
|
|
||||||
else:
|
|
||||||
call_threaded(self.session.api_call, call_name="update_status_with_media", status=text, media=tweet.image)
|
|
||||||
if hasattr(tweet.message, "destroy"): tweet.message.destroy()
|
if hasattr(tweet.message, "destroy"): tweet.message.destroy()
|
||||||
|
|
||||||
def show_menu_by_key(self, ev):
|
def show_menu_by_key(self, ev):
|
||||||
|
@ -93,6 +93,7 @@ class basicTweet(object):
|
|||||||
menu = self.message.attach_menu(can_attach)
|
menu = self.message.attach_menu(can_attach)
|
||||||
self.message.Bind(wx.EVT_MENU, self.on_attach_image, self.message.add_image)
|
self.message.Bind(wx.EVT_MENU, self.on_attach_image, self.message.add_image)
|
||||||
self.message.Bind(wx.EVT_MENU, self.on_attach_video, self.message.add_video)
|
self.message.Bind(wx.EVT_MENU, self.on_attach_video, self.message.add_video)
|
||||||
|
if hasattr(self.message, "add_poll"):
|
||||||
self.message.Bind(wx.EVT_MENU, self.on_attach_poll, self.message.add_poll)
|
self.message.Bind(wx.EVT_MENU, self.on_attach_poll, self.message.add_poll)
|
||||||
self.message.PopupMenu(menu, self.message.add.GetPosition())
|
self.message.PopupMenu(menu, self.message.add.GetPosition())
|
||||||
|
|
||||||
@ -243,10 +244,10 @@ class reply(tweet):
|
|||||||
i.Show()
|
i.Show()
|
||||||
|
|
||||||
def get_ids(self):
|
def get_ids(self):
|
||||||
excluded_ids = ""
|
excluded_ids = []
|
||||||
for i in range(0, len(self.message.checkboxes)):
|
for i in range(0, len(self.message.checkboxes)):
|
||||||
if self.message.checkboxes[i].GetValue() == False:
|
if self.message.checkboxes[i].GetValue() == False:
|
||||||
excluded_ids = excluded_ids + "{0},".format(self.ids[i],)
|
excluded_ids.append(self.ids[i])
|
||||||
return excluded_ids
|
return excluded_ids
|
||||||
|
|
||||||
def get_people(self):
|
def get_people(self):
|
||||||
|
@ -636,7 +636,7 @@ class Session(base.baseSession):
|
|||||||
|
|
||||||
def reply(self, text="", in_reply_to_status_id=None, attachments=[], *args, **kwargs):
|
def reply(self, text="", in_reply_to_status_id=None, attachments=[], *args, **kwargs):
|
||||||
if len(attachments) == 0:
|
if len(attachments) == 0:
|
||||||
item = self.api_call(call_name="update_status", status=text, _sound="reply_send.ogg", tweet_mode="extended", in_reply_to_status_id=in_reply_to_status_id, *args, **kwargs)
|
item = self.api_call_v2(call_name="create_tweet", text=text, _sound="reply_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
media_ids = []
|
media_ids = []
|
||||||
for i in attachments:
|
for i in attachments:
|
||||||
|
@ -217,6 +217,14 @@ class reply(tweet):
|
|||||||
self.SetEscapeId(self.cancel.GetId())
|
self.SetEscapeId(self.cancel.GetId())
|
||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
|
def attach_menu(self, event=None, enabled=True, *args, **kwargs):
|
||||||
|
menu = wx.Menu()
|
||||||
|
self.add_image = menu.Append(wx.ID_ANY, _("Image"))
|
||||||
|
self.add_image.Enable(enabled)
|
||||||
|
self.add_video = menu.Append(wx.ID_ANY, _("Video"))
|
||||||
|
self.add_video.Enable(enabled)
|
||||||
|
return menu
|
||||||
|
|
||||||
class dm(tweet):
|
class dm(tweet):
|
||||||
|
|
||||||
def __init__(self, users: List[str] = [], *args, **kwargs) -> None:
|
def __init__(self, users: List[str] = [], *args, **kwargs) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user