mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 21:56:07 -04:00
some useful functions
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import gettext_windows, os
|
||||
import os
|
||||
import languageHandler
|
||||
|
||||
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):
|
||||
return defaultLocale
|
||||
else:
|
||||
|
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import threading
|
||||
import wx
|
||||
from pubsub import pub
|
||||
from twython import TwythonRateLimitError
|
||||
import time
|
||||
|
||||
@@ -19,3 +20,14 @@ def call_threaded(func, *args, **kwargs):
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
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
|
Reference in New Issue
Block a user