Merge pull request #55 from codeofdusk/longtweets

Longtweets
This commit is contained in:
Manuel Cortez 2015-06-27 18:07:48 -05:00
commit c79ab213cb
4 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@ language = string(default="system")
hide_gui = boolean(default=False)
voice_enabled = boolean(default=False)
ask_at_exit = boolean(default=True)
handle_longtweets = boolean(default=False)
use_invisible_keyboard_shorcuts = boolean(default=True)
play_ready_sound = boolean(default=True)
speak_ready_msg = boolean(default=True)

View File

@ -60,6 +60,7 @@ class globalSettingsController(object):
self.dialog.set_value("general", "play_ready_sound", config.app["app-settings"]["play_ready_sound"])
self.dialog.set_value("general", "speak_ready_msg", config.app["app-settings"]["speak_ready_msg"])
self.dialog.set_value("general", "handle_longtweets", config.app["app-settings"]["handle_longtweets"])
self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"])
self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"])
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
@ -86,6 +87,7 @@ class globalSettingsController(object):
config.app["app-settings"]["voice_enabled"] = self.dialog.get_value("general", "disable_sapi5")
config.app["app-settings"]["hide_gui"] = self.dialog.get_value("general", "hide_gui")
config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit")
config.app["app-settings"]["handle_longtweets"] = self.dialog.get_value("general", "handle_longtweets")
config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound")
config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg")
if config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):

View File

@ -9,6 +9,7 @@ import output
import languageHandler
import arrow
import logging
import config
from long_tweets import twishort
log = logging.getLogger("compose")
@ -55,6 +56,12 @@ def compose_tweet(tweet, db, relative_times):
for url in range(0, len(urls)):
try: text = text.replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])
except IndexError: pass
if config.app['app-settings']['handle_longtweets'] and 'long_uri' in tweet:
try:
oldtext=text
text=twishort.get_full_text(tweet['long_uri'])
except:
text=oldtext
tweet["text"] = text
return [user+", ", tweet["text"], ts+", ", source]

View File

@ -30,6 +30,8 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(self.disable_sapi5, 0, wx.ALL, 5)
self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch"))
sizer.Add(self.hide_gui, 0, wx.ALL, 5)
self.handle_longtweets = wx.CheckBox(self, wx.NewId(), _(u"Use Codeofdusk's longtweet handlers (may decrease client performance)"))
sizer.Add(self.handle_longtweets, 0, wx.ALL, 5)
kmbox = wx.BoxSizer(wx.VERTICAL)
km_label = wx.StaticText(self, -1, _(u"Keymap"))
self.km = wx.ComboBox(self, -1, choices=keymaps, style=wx.CB_READONLY)