Long tweet and mention to all options won't be saved in config. Closes #170

This commit is contained in:
Manuel Cortez 2017-11-08 12:09:53 -06:00
parent ed7c9802d1
commit 0d0aed0490
5 changed files with 11 additions and 25 deletions

View File

@ -6,6 +6,7 @@
* In the translator module, the list of available languages is fetched automatically from the provider. That means all of these languages will work and there will not be inconsistencies. Also we've removed the first combo box, because the language is detected automatically by Yandex'S API. ([#153](https://github.com/manuelcortez/TWBlue/issues/153)) * In the translator module, the list of available languages is fetched automatically from the provider. That means all of these languages will work and there will not be inconsistencies. Also we've removed the first combo box, because the language is detected automatically by Yandex'S API. ([#153](https://github.com/manuelcortez/TWBlue/issues/153))
* Trending topics, searches and conversation buffers will use mute settings set for the session in wich they were opened. ([#157](https://github.com/manuelcortez/TWBlue/issues/157)) * Trending topics, searches and conversation buffers will use mute settings set for the session in wich they were opened. ([#157](https://github.com/manuelcortez/TWBlue/issues/157))
* The Tweet limit is now 280 characters lenght instead 140. It means you can tweet longer tweets. ([#172](https://github.com/manuelcortez/TWBlue/issues/172)) * The Tweet limit is now 280 characters lenght instead 140. It means you can tweet longer tweets. ([#172](https://github.com/manuelcortez/TWBlue/issues/172))
* Per popular request, Status for mention to all and long tweet checkboxes will not be saved in settings. ([#170](https://github.com/manuelcortez/TWBlue/issues/170))
* And more. ([#156,](https://github.com/manuelcortez/TWBlue/issues/156) [#163,](https://github.com/manuelcortez/TWBlue/issues/163) [#159,](https://github.com/manuelcortez/TWBlue/issues/159) [#173,](https://github.com/manuelcortez/TWBlue/issues/173) [#174,](https://github.com/manuelcortez/TWBlue/issues/174)) * And more. ([#156,](https://github.com/manuelcortez/TWBlue/issues/156) [#163,](https://github.com/manuelcortez/TWBlue/issues/163) [#159,](https://github.com/manuelcortez/TWBlue/issues/159) [#173,](https://github.com/manuelcortez/TWBlue/issues/173) [#174,](https://github.com/manuelcortez/TWBlue/issues/174))
## changes in version 0.91 and 0.92 ## changes in version 0.91 and 0.92

View File

@ -42,6 +42,4 @@ autoread_buffers = list(default=list(mentions, direct_messages, events))
spelling_language = string(default="") spelling_language = string(default="")
save_followers_in_autocompletion_db = boolean(default=False) save_followers_in_autocompletion_db = boolean(default=False)
save_friends_in_autocompletion_db = boolean(default=False) save_friends_in_autocompletion_db = boolean(default=False)
twishort_enabled = boolean(default=False)
mention_all = boolean(default=True)
ocr_language = string(default="") ocr_language = string(default="")

View File

@ -136,11 +136,10 @@ class bufferController(object):
def post_tweet(self, *args, **kwargs): def post_tweet(self, *args, **kwargs):
title = _(u"Tweet") title = _(u"Tweet")
caption = _(u"Write the tweet here") caption = _(u"Write the tweet here")
tweet = messages.tweet(self.session, title, caption, "", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) tweet = messages.tweet(self.session, title, caption, "")
if tweet.message.get_response() == widgetUtils.OK: if tweet.message.get_response() == widgetUtils.OK:
self.session.settings["mysc"]["twishort_enabled"] = tweet.message.long_tweet.GetValue()
text = tweet.message.get_text() text = tweet.message.get_text()
if len(text) > 140 and tweet.message.get("long_tweet") == True: if len(text) > 280 and tweet.message.get("long_tweet") == True:
if not hasattr(tweet, "attachments"): if not hasattr(tweet, "attachments"):
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text) text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
else: else:
@ -517,12 +516,9 @@ class baseBufferController(bufferController):
title=_("Reply to {arg0}").format(arg0=screen_name) title=_("Reply to {arg0}").format(arg0=screen_name)
else: else:
title=_("Reply") title=_("Reply")
message = messages.reply(self.session, title, _(u"Reply to %s") % (screen_name,), "", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"], users=users, ids=ids) message = messages.reply(self.session, title, _(u"Reply to %s") % (screen_name,), "", users=users, ids=ids)
if message.message.get_response() == widgetUtils.OK: if message.message.get_response() == widgetUtils.OK:
params = {"_sound": "reply_send.ogg", "in_reply_to_status_id": id,} params = {"_sound": "reply_send.ogg", "in_reply_to_status_id": id,}
self.session.settings["mysc"]["twishort_enabled"] = message.message.long_tweet.GetValue()
if len(message.users) > 0:
self.session.settings["mysc"]["mention_all"] = message.message.mentionAll.GetValue()
text = message.message.get_text() text = message.message.get_text()
if twishort_enabled == False: if twishort_enabled == False:
excluded_ids = message.get_ids() excluded_ids = message.get_ids()
@ -531,7 +527,7 @@ class baseBufferController(bufferController):
else: else:
mentioned_people = message.get_people() mentioned_people = message.get_people()
text = "@"+screen_name+" "+mentioned_people+u" "+text text = "@"+screen_name+" "+mentioned_people+u" "+text
if len(text) > 140 and message.message.get("long_tweet") == True: if len(text) > 280 and message.message.get("long_tweet") == True:
if message.image == None: if message.image == None:
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text) text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
else: else:
@ -589,7 +585,7 @@ class baseBufferController(bufferController):
comments = tweet["full_text"] comments = tweet["full_text"]
else: else:
comments = tweet["text"] comments = tweet["text"]
retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s" % (tweet["user"]["screen_name"], comments), max=116, messageType="retweet", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s" % (tweet["user"]["screen_name"], comments), max=256, messageType="retweet")
if comment != '': if comment != '':
retweet.message.set_text(comment) retweet.message.set_text(comment)
if retweet.message.get_response() == widgetUtils.OK: if retweet.message.get_response() == widgetUtils.OK:
@ -1217,12 +1213,11 @@ class trendsBufferController(bufferController):
if self.buffer.list.get_count() == 0: return if self.buffer.list.get_count() == 0: return
title = _(u"Tweet") title = _(u"Tweet")
caption = _(u"Write the tweet here") caption = _(u"Write the tweet here")
tweet = messages.tweet(self.session, title, caption, self.get_message()+ " ", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) tweet = messages.tweet(self.session, title, caption, self.get_message()+ " ")
tweet.message.set_cursor_at_end() tweet.message.set_cursor_at_end()
if tweet.message.get_response() == widgetUtils.OK: if tweet.message.get_response() == widgetUtils.OK:
self.session.settings["mysc"]["twishort_enabled"] = tweet.message.long_tweet.GetValue()
text = tweet.message.get_text() text = tweet.message.get_text()
if len(text) > 140 and tweet.message.get("long_tweet") == True: if len(text) > 280 and tweet.message.get("long_tweet") == True:
if tweet.image == None: if tweet.image == None:
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text) text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
else: else:

View File

@ -124,14 +124,11 @@ class basicTweet(object):
self.message.text_focus() self.message.text_focus()
class tweet(basicTweet): class tweet(basicTweet):
def __init__(self, session, title, caption, text, twishort_enabled, max=280, messageType="tweet", *args, **kwargs): def __init__(self, session, title, caption, text, max=280, messageType="tweet", *args, **kwargs):
super(tweet, self).__init__(session, title, caption, text, messageType, max, *args, **kwargs) super(tweet, self).__init__(session, title, caption, text, messageType, max, *args, **kwargs)
self.image = None self.image = None
widgetUtils.connect_event(self.message.upload_image, widgetUtils.BUTTON_PRESSED, self.upload_image) widgetUtils.connect_event(self.message.upload_image, widgetUtils.BUTTON_PRESSED, self.upload_image)
widgetUtils.connect_event(self.message.autocompletionButton, widgetUtils.BUTTON_PRESSED, self.autocomplete_users) widgetUtils.connect_event(self.message.autocompletionButton, widgetUtils.BUTTON_PRESSED, self.autocomplete_users)
if twishort_enabled == False:
try: self.message.long_tweet.SetValue(False)
except AttributeError: pass
self.text_processor() self.text_processor()
def upload_image(self, *args, **kwargs): def upload_image(self, *args, **kwargs):
@ -144,16 +141,13 @@ class tweet(basicTweet):
c.show_menu() c.show_menu()
class reply(tweet): class reply(tweet):
def __init__(self, session, title, caption, text, twishort_enabled, users=[], ids=[]): def __init__(self, session, title, caption, text, users=[], ids=[]):
super(reply, self).__init__(session, title, caption, text, twishort_enabled, messageType="reply", users=users) super(reply, self).__init__(session, title, caption, text, messageType="reply", users=users)
self.ids = ids self.ids = ids
self.users = users self.users = users
if len(users) > 0: if len(users) > 0:
widgetUtils.connect_event(self.message.mentionAll, widgetUtils.CHECKBOX, self.mention_all) widgetUtils.connect_event(self.message.mentionAll, widgetUtils.CHECKBOX, self.mention_all)
self.message.enable_button("mentionAll") self.message.enable_button("mentionAll")
self.message.mentionAll.SetValue(self.session.settings["mysc"]["mention_all"])
if self.message.mentionAll.GetValue() == True:
self.mention_all()
self.message.set_cursor_at_end() self.message.set_cursor_at_end()
self.text_processor() self.text_processor()
@ -167,7 +161,6 @@ class reply(tweet):
i.SetValue(False) i.SetValue(False)
i.Show() i.Show()
def get_ids(self): def get_ids(self):
excluded_ids = "" excluded_ids = ""
for i in xrange(0, len(self.message.checkboxes)): for i in xrange(0, len(self.message.checkboxes)):

View File

@ -71,7 +71,6 @@ class tweet(textLimited):
self.createTextArea(message, text) self.createTextArea(message, text)
self.mainBox.Add(self.textBox, 0, wx.ALL, 5) self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
self.long_tweet = wx.CheckBox(self.panel, -1, _(u"&Long tweet")) self.long_tweet = wx.CheckBox(self.panel, -1, _(u"&Long tweet"))
self.long_tweet.SetValue(True)
self.upload_image = wx.Button(self.panel, -1, _(u"&Upload image..."), size=wx.DefaultSize) self.upload_image = wx.Button(self.panel, -1, _(u"&Upload image..."), size=wx.DefaultSize)
self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize) self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize)
self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize) self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize)