2016-02-13 17:06:36 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
2016-06-29 17:21:00 -05:00
|
|
|
import logger
|
2016-02-21 08:16:36 -06:00
|
|
|
import sys
|
2019-01-13 22:35:45 -06:00
|
|
|
import traceback
|
2019-01-19 23:24:10 -06:00
|
|
|
#if hasattr(sys, "frozen"):
|
2016-02-13 17:06:36 -06:00
|
|
|
import platform
|
|
|
|
import languageHandler
|
|
|
|
import widgetUtils
|
|
|
|
import paths
|
|
|
|
import config
|
|
|
|
import output
|
|
|
|
import logging
|
|
|
|
import keys
|
|
|
|
import application
|
2019-01-21 04:51:59 -06:00
|
|
|
if hasattr(sys, "frozen"):
|
2021-09-22 09:17:12 -05:00
|
|
|
sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z)))
|
2016-02-13 17:06:36 -06:00
|
|
|
from mysc.thread_utils import call_threaded
|
2019-01-15 16:20:08 -06:00
|
|
|
from wxUI import commonMessages
|
2016-02-13 17:06:36 -06:00
|
|
|
|
|
|
|
log = logging.getLogger("main")
|
|
|
|
|
2019-01-14 04:58:17 -06:00
|
|
|
orig_session_init = None
|
|
|
|
|
2016-02-13 17:06:36 -06:00
|
|
|
def setup():
|
2021-09-22 09:17:12 -05:00
|
|
|
global orig_session_init
|
|
|
|
log.debug("Starting Socializer %s" % (application.version,))
|
|
|
|
config.setup()
|
|
|
|
if config.app["app-settings"]["debug_logging"] == True:
|
|
|
|
logger.app_handler.setLevel(logging.DEBUG)
|
|
|
|
log.info("Using %s %s" % (platform.system(), platform.architecture()[0]))
|
|
|
|
log.debug("Application path is %s" % (paths.app_path(),))
|
|
|
|
log.debug("config path is %s" % (paths.config_path(),))
|
|
|
|
output.setup()
|
|
|
|
languageHandler.setLanguage(config.app["app-settings"]["language"])
|
|
|
|
log.debug("Language set to %s" % (languageHandler.getLanguage()))
|
|
|
|
keys.setup()
|
|
|
|
app = widgetUtils.mainLoopObject()
|
|
|
|
if config.app["app-settings"]["first_start"]:
|
|
|
|
log.debug("Detected first time execution.")
|
|
|
|
proxy_option = commonMessages.proxy_question()
|
|
|
|
if proxy_option == widgetUtils.YES:
|
|
|
|
config.app["app-settings"]["use_proxy"] = True
|
|
|
|
log.debug("User has requested to use proxy for connecting to VK.")
|
|
|
|
config.app["app-settings"]["first_start"] = False
|
|
|
|
config.app.write()
|
|
|
|
if config.app["app-settings"]["use_proxy"]:
|
|
|
|
log.debug("Enabling proxy support... ")
|
|
|
|
import requests
|
|
|
|
orig_session_init=requests.sessions.Session.__init__
|
|
|
|
requests.sessions.Session.__init__=patched_session_init
|
|
|
|
requests.Session.__init__=patched_session_init
|
|
|
|
from controller import mainController
|
|
|
|
from sessionmanager import sessionManager
|
2019-01-15 16:20:08 -06:00
|
|
|
|
2021-09-22 09:17:12 -05:00
|
|
|
log.debug("Created Application mainloop object")
|
|
|
|
sm = sessionManager.sessionManagerController()
|
|
|
|
sm.show()
|
|
|
|
del sm
|
|
|
|
r = mainController.Controller()
|
|
|
|
call_threaded(r.login)
|
|
|
|
app.run()
|
2016-02-13 17:06:36 -06:00
|
|
|
|
2019-01-14 04:58:17 -06:00
|
|
|
def patched_session_init(self):
|
2021-09-22 09:17:12 -05:00
|
|
|
global orig_session_init
|
|
|
|
orig_session_init(self)
|
|
|
|
self.proxies={"http": "http://socializer:socializer@socializer.su:3128",
|
|
|
|
"https": "http://socializer:socializer@socializer.su:3128"}
|
2019-01-14 04:58:17 -06:00
|
|
|
|
2017-03-13 02:16:34 -06:00
|
|
|
setup()
|