Updated reply dialog with some changes in add menu

This commit is contained in:
Manuel Cortez 2021-11-10 16:32:14 -06:00
parent 77d13fdc28
commit b0cfc5978c
7 changed files with 26 additions and 25 deletions

View File

@ -408,8 +408,8 @@ class BaseBuffer(base.Buffer):
if len(users) > 0:
config.app["app-settings"]["mention_all"] = message.message.mention_all.GetValue()
config.app.write()
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments)
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)
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())
if hasattr(message.message, "destroy"): message.message.destroy()
self.session.settings.write()

View File

@ -92,8 +92,8 @@ class DirectMessagesBuffer(base.BaseBuffer):
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,])
if message.message.ShowModal() == widgetUtils.OK:
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments)
call_threaded(self.session.send_tweet, *[tweet_data])
tweet_data = message.get_tweet_data()
call_threaded(self.session.send_tweet, tweet_data)
if hasattr(message.message, "destroy"):
message.message.destroy()

View File

@ -94,8 +94,8 @@ class PeopleBuffer(base.BaseBuffer):
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)
if message.message.ShowModal() == widgetUtils.OK:
tweet_data = dict(text=message.message.text.GetValue(), attachments=message.attachments)
call_threaded(self.session.send_tweet, *[tweet_data])
tweet_data = message.get_tweet_data()
call_threaded(self.session.send_tweet, tweet_data)
if hasattr(message.message, "destroy"):
message.message.destroy()

View File

@ -131,21 +131,13 @@ class TrendsBuffer(base.Buffer):
def tweet_about_this_trend(self, *args, **kwargs):
if self.buffer.list.get_count() == 0: return
title = _(u"Tweet")
caption = _(u"Write the tweet here")
tweet = messages.tweet(self.session, title, caption, self.get_message()+ " ")
tweet.message.set_cursor_at_end()
if tweet.message.get_response() == widgetUtils.OK:
text = tweet.message.get_text()
if len(text) > 280 and tweet.message.get("long_tweet") == True:
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)
title = _("Tweet")
caption = _("Write the tweet here")
tweet = messages.tweet(session=self.session, title=title, caption=caption, text=self.get_message()+ " ")
tweet.message.SetInsertionPoint(len(tweet.message.GetValue()))
if tweet.message.ShowModal() == widgetUtils.OK:
tweet_data = tweet.get_tweet_data()
call_threaded(self.session.send_tweet, *tweet_data)
if hasattr(tweet.message, "destroy"): tweet.message.destroy()
def show_menu_by_key(self, ev):

View File

@ -93,6 +93,7 @@ class basicTweet(object):
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_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.PopupMenu(menu, self.message.add.GetPosition())
@ -243,10 +244,10 @@ class reply(tweet):
i.Show()
def get_ids(self):
excluded_ids = ""
excluded_ids = []
for i in range(0, len(self.message.checkboxes)):
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
def get_people(self):

View File

@ -636,7 +636,7 @@ class Session(base.baseSession):
def reply(self, text="", in_reply_to_status_id=None, attachments=[], *args, **kwargs):
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:
media_ids = []
for i in attachments:

View File

@ -217,6 +217,14 @@ class reply(tweet):
self.SetEscapeId(self.cancel.GetId())
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):
def __init__(self, users: List[str] = [], *args, **kwargs) -> None: