mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
some useful functions
This commit is contained in:
parent
a84d35c6af
commit
4979b2aa66
@ -106,9 +106,9 @@ class bufferController(object):
|
|||||||
if tweet.message.get_response() == widgetUtils.OK:
|
if tweet.message.get_response() == widgetUtils.OK:
|
||||||
text = tweet.message.get_text()
|
text = tweet.message.get_text()
|
||||||
if tweet.image == None:
|
if tweet.image == None:
|
||||||
call_threaded(buffer.session.api_call, call_name="update_status", _sound="tweet_send.ogg", status=text)
|
call_threaded(self.session.api_call, call_name="update_status", status=text)
|
||||||
else:
|
else:
|
||||||
call_threaded(buffer.session.api_call, call_name="update_status_with_media", _sound="tweet_send.ogg", status=text, media=tweet.image)
|
call_threaded(self.session.api_call, call_name="update_status_with_media", status=text, media=tweet.image)
|
||||||
|
|
||||||
class accountPanel(bufferController):
|
class accountPanel(bufferController):
|
||||||
def __init__(self, parent, name, account):
|
def __init__(self, parent, name, account):
|
||||||
@ -228,7 +228,7 @@ class baseBufferController(bufferController):
|
|||||||
users = utils.get_all_users(tweet, self.session.db)
|
users = utils.get_all_users(tweet, self.session.db)
|
||||||
dm = messages.dm(self.session, _(u"Direct message to %s") % (screen_name,), _(u"New direct message"), users)
|
dm = messages.dm(self.session, _(u"Direct message to %s") % (screen_name,), _(u"New direct message"), users)
|
||||||
if dm.message.get_response() == widgetUtils.OK:
|
if dm.message.get_response() == widgetUtils.OK:
|
||||||
call_threaded(self.session.api_call, call_name="send_direct_message", _sound="dm_sent.ogg", text=dm.message.get_text(), screen_name=dm.message.get("cb"))
|
call_threaded(self.session.api_call, call_name="send_direct_message", text=dm.message.get_text(), screen_name=dm.message.get("cb"))
|
||||||
|
|
||||||
def retweet(self, *args, **kwargs):
|
def retweet(self, *args, **kwargs):
|
||||||
tweet = self.get_right_tweet()
|
tweet = self.get_right_tweet()
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import gettext_windows, os
|
import os
|
||||||
|
import languageHandler
|
||||||
|
|
||||||
def get(rootFolder):
|
def get(rootFolder):
|
||||||
defaultLocale = gettext_windows.get_language()[0][:2]
|
defaultLocale = languageHandler.curLang
|
||||||
|
if len(defaultLocale) > 2:
|
||||||
|
defaultLocale = defaultLocale[:2]
|
||||||
if os.path.exists(rootFolder+"/"+defaultLocale):
|
if os.path.exists(rootFolder+"/"+defaultLocale):
|
||||||
return defaultLocale
|
return defaultLocale
|
||||||
else:
|
else:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import threading
|
import threading
|
||||||
import wx
|
import wx
|
||||||
|
from pubsub import pub
|
||||||
from twython import TwythonRateLimitError
|
from twython import TwythonRateLimitError
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -19,3 +20,14 @@ def call_threaded(func, *args, **kwargs):
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
|
def stream_threaded(func, *args, **kwargs):
|
||||||
|
def new_func(*a, **k):
|
||||||
|
try:
|
||||||
|
func(*a, **k)
|
||||||
|
except:
|
||||||
|
pub.sendMessage("streamError")
|
||||||
|
thread = threading.Thread(target=new_func, args=args, kwargs=kwargs)
|
||||||
|
thread.daemon = True
|
||||||
|
thread.start()
|
||||||
|
return thread
|
Loading…
Reference in New Issue
Block a user