Twishort preferences are saved

This commit is contained in:
Manuel Cortez 2015-07-29 14:47:14 -05:00
parent 10bc483887
commit 370340de0b
4 changed files with 11 additions and 5 deletions

View File

@ -36,6 +36,7 @@ autoread_buffers = list(default=list(mentions, direct_messages, events))
spelling_language = string(default="")
save_followers_in_autocompletion_db = boolean(default=False)
save_friends_in_autocompletion_db = boolean(default=False)
twishort_enabled = boolean(default=False)
[services]
pocket_access_token = string(default="")

View File

@ -5,7 +5,7 @@ if snapshot == False:
version = "0.80"
update_url = 'http://twblue.es/updates/twblue_ngen.json'
else:
version = "9.9"
version = "9.10"
update_url = 'http://twblue.es/updates/snapshots_ngen.json'
author = u"Manuel Cortéz, Bill Dengler"
authorEmail = "manuel@manuelcortez.net"

View File

@ -127,8 +127,9 @@ class bufferController(object):
def post_tweet(self, *args, **kwargs):
title = _(u"Tweet")
caption = _(u"Write the tweet here")
tweet = messages.tweet(self.session, title, caption, "")
tweet = messages.tweet(self.session, title, caption, "", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"])
if tweet.message.get_response() == widgetUtils.OK:
self.session.settings["mysc"]["twishort_enabled"] = tweet.message.long_tweet.GetValue()
text = tweet.message.get_text()
if len(text) > 140 and tweet.message.get("long_tweet") == True:
if tweet.image == None:
@ -374,8 +375,9 @@ class baseBufferController(bufferController):
screen_name = tweet["user"]["screen_name"]
id = tweet["id"]
users = utils.get_all_mentioned(tweet, self.session.db)
message = messages.reply(self.session, _(u"Reply"), _(u"Reply to %s") % (screen_name,), "@%s " % (screen_name,), users)
message = messages.reply(self.session, _(u"Reply"), _(u"Reply to %s") % (screen_name,), "@%s " % (screen_name,), users, twishort_enabled=self.session.settings["mysc"]["twishort_enabled"])
if message.message.get_response() == widgetUtils.OK:
self.session.settings["mysc"]["twishort_enabled"] = message.message.long_tweet.GetValue()
text = message.message.get_text()
if len(text) > 140 and message.message.get("long_tweet") == True:
if message.image == None:
@ -421,10 +423,11 @@ class baseBufferController(bufferController):
self._retweet_with_comment(tweet, id)
def _retweet_with_comment(self, tweet, id, comment=''):
retweet = messages.tweet(self.session, _(u"Retweet"), _(u"Add your comment to the tweet"), u"“@%s: %s" % (tweet["user"]["screen_name"], tweet["text"]), max=116-len("@%s " % (tweet["user"]["screen_name"],)), messageType="retweet")
retweet = messages.tweet(self.session, _(u"Retweet"), _(u"Add your comment to the tweet"), u"“@%s: %s" % (tweet["user"]["screen_name"], tweet["text"]), max=116-len("@%s " % (tweet["user"]["screen_name"],)), messageType="retweet", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"])
if comment != '':
retweet.message.set_text(comment)
if retweet.message.get_response() == widgetUtils.OK:
self.session.settings["mysc"]["twishort_enabled"] = retweet.message.long_tweet.GetValue()
text = retweet.message.get_text()
comments=text
if len(text+ u"“@%s: %s" % (tweet["user"]["screen_name"], tweet["text"])) < 140:

View File

@ -111,11 +111,13 @@ class basicTweet(object):
dlg = audioUploader.audioUploader(self.session.settings, completed_callback)
class tweet(basicTweet):
def __init__(self, session, title, caption, text, messageType="tweet", max=140):
def __init__(self, session, title, caption, text, twishort_enabled, messageType="tweet", max=140):
super(tweet, self).__init__(session, title, caption, text, messageType, max)
self.image = None
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)
if twishort_enabled == False:
self.message.long_tweet.SetValue(False)
def upload_image(self, *args, **kwargs):
if self.message.get("upload_image") == _(u"Discard image"):