# coding=utf-8

from PyQt4.QtGui import QApplication
from controller.desktop.mainwindow import MainWindow
from PyQt4.QtCore import QFile,QString
from common.logrecord import LogRecord
from common.commondata import STYLE_PATH, EXE_FILEPATH
import sys, os

reload(sys)
sys.setdefaultencoding('utf-8')

if __name__ == '__main__':

    app = QApplication([])
    os.chdir(EXE_FILEPATH)
    #加载QSS样式表-top
    LogRecord.instance().recordLog(u"********************** begin working ****************************")
    LogRecord.instance().recordLog(STYLE_PATH)
    LogRecord.instance().recordLog(sys.argv[0])
    qss= QFile(STYLE_PATH)
    qss.open(QFile.ReadOnly)
    app.setStyleSheet(QString(qss.readAll()))
    qss.close()
    #加载QSS样式表-end

    mainwindow = MainWindow()
    mainwindow.setObjectName("MainWindow")
    mainwindow.checkAutoLogin()

    app.exec_()