# coding=utf-8

from PyQt4.QtCore import QTranslator, QFile, QString
from PyQt4.QtGui import QApplication
from controller.desktop.mainwindow import MainWindow 
from common import globalfun
import sys, os

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

if __name__ == '__main__':
    
    #屏保，多屏幕和分辨率的设置
    globalfun.setResolution()
    globalfun.setScreenGuard()
    globalfun.setMultiMonitor()
    
    app = QApplication([])

    #添加中文包
    translator = QTranslator()
    translator.load("qm/qt_zh_CN.qm")
    app.installTranslator(translator)
     
    #开启小键盘
    os.system("numlockx on")
    
    #加载QSS样式表
    qss= QFile("openstackclient.qss")
    qss.open(QFile.ReadOnly)
    app.setStyleSheet(QString(qss.readAll()))
    qss.close()
    
    #配置系统网卡文件
    globalfun.configNetEthFile()
    
    #全屏显示主窗口
    mainwindow = MainWindow()
    mainwindow.setObjectName("MainWindow")
    mainwindow.showFullScreen()
    mainwindow.checkAutoLogin()
    
    app.exec_()

