mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-08-26 01:49:22 +00:00
Compare commits
6 Commits
snapshot9.
...
snapshot9.
Author | SHA1 | Date | |
---|---|---|---|
370340de0b | |||
10bc483887 | |||
f66b2ccbad | |||
6460c20a97 | |||
9f2c240fc1 | |||
a4cbbfcb9f |
@@ -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="")
|
@@ -14,6 +14,7 @@ play_ready_sound = boolean(default=True)
|
||||
speak_ready_msg = boolean(default=True)
|
||||
log_level = string(default="error")
|
||||
load_keymap = string(default="default.keymap")
|
||||
donation_dialog_displayed = boolean(default=False)
|
||||
|
||||
[proxy]
|
||||
server = string(default="")
|
||||
|
@@ -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"
|
||||
|
@@ -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:
|
||||
@@ -455,7 +458,7 @@ class baseBufferController(bufferController):
|
||||
self.session.sound.play("audio.ogg")
|
||||
if utils.is_geocoded(tweet):
|
||||
self.session.sound.play("geo.ogg")
|
||||
self.session.db[str(self.name+"_pos")]=self.buffer.list.get_selected()
|
||||
# self.session.db[str(self.name+"_pos")]=self.buffer.list.get_selected()
|
||||
|
||||
@_tweets_exist
|
||||
def audio(self,url=''):
|
||||
|
@@ -696,6 +696,9 @@ class Controller(object):
|
||||
msg = messages.viewTweet(tweet, tweetsList)
|
||||
elif buffer.type == "account" or buffer.type == "empty":
|
||||
return
|
||||
elif buffer.name == "sent_tweets":
|
||||
tweet, tweetsList = buffer.get_full_tweet()
|
||||
msg = messages.viewTweet(tweet, tweetsList)
|
||||
else:
|
||||
non_tweet = buffer.get_formatted_message()
|
||||
msg = messages.viewTweet(non_tweet, [], False)
|
||||
@@ -920,7 +923,7 @@ class Controller(object):
|
||||
|
||||
def left(self, *args, **kwargs):
|
||||
buff = self.view.get_current_buffer_pos()
|
||||
print buff
|
||||
# print buff
|
||||
buffer = self.get_current_buffer()
|
||||
if not hasattr(buffer.buffer, "list"):
|
||||
output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True)
|
||||
@@ -1337,7 +1340,7 @@ class Controller(object):
|
||||
# print ref_buf.name, ref_buf.account
|
||||
# if ref_buf.account != buffer.account or ref_buf.type == "account" or type(ref_buf) == buffers.emptyPanel:
|
||||
buffers = self.get_buffers_for_account(buffer.account)
|
||||
# ref_buf = self.buffers[position+1]
|
||||
ref_buf = self.buffers[position+1]
|
||||
empty = True
|
||||
for i in buffers[position+1:]:
|
||||
if i.type == "account" or i.invisible == False:
|
||||
@@ -1346,11 +1349,11 @@ class Controller(object):
|
||||
empty = False
|
||||
if empty == True:
|
||||
self.buffers.append(buffer)
|
||||
print "account"
|
||||
# print "account"
|
||||
else:
|
||||
self.buffers.insert(position+1, buffer)
|
||||
for i in self.buffers:
|
||||
print i.name, i.account
|
||||
# for i in self.buffers:
|
||||
# print i.name, i.account
|
||||
|
||||
def __del__(self):
|
||||
config.app.write()
|
||||
@@ -1359,3 +1362,10 @@ class Controller(object):
|
||||
buff = self.buffers[bufferPosition]
|
||||
newPos = self.view.search(buff.name, buff.account)
|
||||
self.view.change_buffer(newPos)
|
||||
|
||||
def copy_to_clipboard(self, *args, **kwargs):
|
||||
output.copy(self.get_current_buffer().get_message())
|
||||
output.speak(_(u"Copied"))
|
||||
|
||||
def repeat_item(self, *args, **kwargs):
|
||||
output.speak(self.get_current_buffer().get_message())
|
@@ -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"):
|
||||
|
@@ -36,7 +36,7 @@ update_profile = alt+win+p
|
||||
delete = control+win+delete
|
||||
clear_buffer = control+win+shift+delete
|
||||
repeat_item = control+win+space
|
||||
copy_to_clipboard = control+win+c
|
||||
copy_to_clipboard = control+win+shift+c
|
||||
add_to_list = control+win+a
|
||||
remove_from_list = control+win+shift+a
|
||||
toggle_buffer_mute = control+win+shift+m
|
||||
|
10
src/main.py
10
src/main.py
@@ -25,6 +25,8 @@ from mysc.thread_utils import call_threaded
|
||||
import fixes
|
||||
#extra variables to control the temporal stdout and stderr, while the final files are opened. We understand that some errors could happen while all outputs are closed, so let's try to avoid it.
|
||||
import widgetUtils
|
||||
import webbrowser
|
||||
from wxUI import commonMessageDialogs
|
||||
if system == "Windows":
|
||||
from logger import logger
|
||||
from update import updater
|
||||
@@ -63,6 +65,8 @@ def setup():
|
||||
from sessionmanager import sessionManager
|
||||
app = widgetUtils.mainLoopObject()
|
||||
if system == "Windows":
|
||||
if config.app["app-settings"]["donation_dialog_displayed"] == False:
|
||||
donation()
|
||||
updater.do_update()
|
||||
sm = sessionManager.sessionManagerController()
|
||||
sm.fill_list()
|
||||
@@ -82,4 +86,10 @@ def setup():
|
||||
GLib.idle_add(r.start)
|
||||
app.run()
|
||||
|
||||
def donation():
|
||||
dlg = commonMessageDialogs.donation()
|
||||
if dlg == widgetUtils.YES:
|
||||
webbrowser.open_new_tab("http://twblue.es/donate")
|
||||
config.app["app-settings"]["donation_dialog_displayed"] = True
|
||||
|
||||
setup()
|
||||
|
@@ -24,7 +24,7 @@ def setup ():
|
||||
except:
|
||||
return logging.exception("Output: Error during initialization.")
|
||||
|
||||
def Copy(text):
|
||||
def copy(text):
|
||||
import win32clipboard
|
||||
#Copies text to the clipboard.
|
||||
win32clipboard.OpenClipboard()
|
||||
|
@@ -28,7 +28,7 @@ class twitter(object):
|
||||
|
||||
def authorise(self, settings):
|
||||
authorisationHandler.logged = False
|
||||
port = random.randint(30000, 66000)
|
||||
port = random.randint(30000, 65535)
|
||||
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', port), authorisationHandler.handler)
|
||||
if config.app["proxy"]["server"] != "" and config.app["proxy"]["port"] != "":
|
||||
args = {"proxies": {"http": "http://{0}:{1}".format(config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
|
@@ -7,6 +7,9 @@ import os
|
||||
import platform
|
||||
import requests
|
||||
import tempfile
|
||||
from wxUI import commonMessageDialogs
|
||||
import widgetUtils
|
||||
import webbrowser
|
||||
try:
|
||||
import czipfile as zipfile
|
||||
except ImportError:
|
||||
@@ -27,6 +30,7 @@ def perform_update(endpoint, current_version, app_name='', password=None, update
|
||||
available_description = available_update.get('description', None)
|
||||
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
|
||||
logger.info("A new update is available. Version %s" % available_version)
|
||||
donation()
|
||||
if callable(update_available_callback) and not update_available_callback(version=available_version, description=available_description): #update_available_callback should return a falsy value to stop the process
|
||||
logger.info("User canceled update.")
|
||||
return
|
||||
@@ -114,3 +118,8 @@ def call_callback(callback, *args, **kwargs):
|
||||
callback(*args, **kwargs)
|
||||
# except:
|
||||
# logger.exception("Failed calling callback %r with args %r and kwargs %r" % (callback, args, kwargs))
|
||||
|
||||
def donation():
|
||||
dlg = commonMessageDialogs.donation()
|
||||
if dlg == widgetUtils.YES:
|
||||
webbrowser.open_new_tab("http://twblue.es/donate")
|
@@ -47,3 +47,7 @@ def protected_user():
|
||||
|
||||
def no_following():
|
||||
return wx.MessageDialog(None, _(u"This is a protected user account, you need follow to this user for viewing your tweets or favourites."), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def donation():
|
||||
dlg = wx.MessageDialog(None, _(u"If you like this application, we need your help to keep it operational. Help us donating to the project. This will let us pay the server, the domain on the Internet and some other things to ensure that TWBlue will keep developing. Your donation will let us continue writing features for TWBlue, and these features to be free. Would you like to donate now?"), _(u"We need your help"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
return dlg.ShowModal()
|
||||
|
@@ -5,7 +5,6 @@ import widgetUtils
|
||||
class textLimited(widgetUtils.BaseDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(textLimited, self).__init__(parent=None, *args, **kwargs)
|
||||
self.shift=False
|
||||
def createTextArea(self, message="", text=""):
|
||||
self.panel = wx.Panel(self)
|
||||
self.label = wx.StaticText(self.panel, -1, message)
|
||||
@@ -16,8 +15,7 @@ class textLimited(widgetUtils.BaseDialog):
|
||||
# dc.SetFont(font)
|
||||
# x, y = dc.GetTextExtent("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
||||
# self.text.SetSize((x, y))
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.on_enter)
|
||||
self.Bind(wx.EVT_CHAR_HOOK, self.handle_keys)
|
||||
self.Bind(wx.EVT_CHAR_HOOK, self.handle_keys, self.text)
|
||||
self.text.SetFocus()
|
||||
self.textBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.textBox.Add(self.label, 0, wx.ALL, 5)
|
||||
@@ -46,14 +44,11 @@ class textLimited(widgetUtils.BaseDialog):
|
||||
def onSelect(self, ev):
|
||||
self.text.SelectAll()
|
||||
|
||||
def on_enter(self,event):
|
||||
if self.shift==False and hasattr(self,'okButton'):
|
||||
return wx.PostEvent(self.okButton.GetEventHandler(),wx.PyCommandEvent(wx.EVT_BUTTON.typeId,wx.ID_OK))
|
||||
else:
|
||||
return self.text.WriteText('\n')
|
||||
|
||||
def handle_keys(self, event):
|
||||
self.shift=event.ShiftDown()
|
||||
shift=event.ShiftDown()
|
||||
if event.GetKeyCode() == wx.WXK_RETURN and shift==False and hasattr(self,'okButton'):
|
||||
wx.PostEvent(self.okButton.GetEventHandler(), wx.PyCommandEvent(wx.EVT_BUTTON.typeId,wx.ID_OK))
|
||||
else:
|
||||
event.Skip()
|
||||
|
||||
def set_cursor_at_end(self):
|
||||
|
Reference in New Issue
Block a user