lbry-sdk/lbrynet/lbrynet_gui/gui.py

33 lines
802 B
Python
Raw Normal View History

2015-08-20 17:27:15 +02:00
import logging
import sys
2015-09-18 06:09:53 +02:00
from lbrynet.lbrynet_gui.GuiApp import DownloaderApp
2015-08-28 21:17:28 +02:00
from twisted.internet import reactor, task
import locale
2015-08-20 17:27:15 +02:00
2015-09-18 06:09:53 +02:00
def start_gui():
2015-08-20 17:27:15 +02:00
log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
formatter = logging.Formatter(log_format)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
2015-09-18 06:09:53 +02:00
file_handler = logging.FileHandler("gui.log")
file_handler.setFormatter(formatter)
file_handler.addFilter(logging.Filter("lbrynet"))
logger.addHandler(file_handler)
2015-09-18 06:09:53 +02:00
sys.stdout = open("gui.out.log", 'w')
sys.stderr = open("gui.err.log", 'w')
2015-08-20 17:27:15 +02:00
locale.setlocale(locale.LC_ALL, '')
2015-08-28 21:17:28 +02:00
app = DownloaderApp()
2015-08-20 17:27:15 +02:00
d = task.deferLater(reactor, 0, app.start)
reactor.run()
if __name__ == "__main__":
2015-09-18 06:09:53 +02:00
start_gui()