#coding:utf-8
'''
Created on 2016��4��20��

@author: guowu
'''
from PyQt4.QtGui import QWidget, QApplication, QPainter, QBrush, QColor,\
    QHBoxLayout, QLabel, QFont
from PyQt4.QtCore import Qt, QTranslator, QCoreApplication
import sys
from storeinfoparser import StoreInfoParser

class BlackScreen(QWidget):
    def __init__(self,parent=None):
        super(BlackScreen,self).__init__(parent)
        self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)
        self.setStyleSheet("QLabel{color:white;font-size:45px;}")
        language = StoreInfoParser.instance().getLanguage()
        m_pTranslator = QTranslator()
        exePath = "./"
        if language == "chinese":
            QmName = "zh_CN.qm"
        else:
            QmName = "en_US.qm"
        
        if(m_pTranslator.load(QmName, exePath)):
            QCoreApplication.instance().installTranslator(m_pTranslator)
        
        self.textLabel = QLabel()
        self.textLabel.setText(self.tr("blackscreen"))
        self.textLabel.setAlignment(Qt.AlignCenter)
        self.mainlayout = QHBoxLayout(self)
        self.mainlayout.addWidget(self.textLabel)
    def updateWindow(self):
        language = StoreInfoParser.instance().getLanguage()
        m_pTranslator = QTranslator()
        exePath = "./"
        if language == "chinese":
            QmName = "zh_CN.qm"
        else:
            QmName = "en_US.qm"
        
        if(m_pTranslator.load(QmName, exePath)):
            QCoreApplication.instance().installTranslator(m_pTranslator)
        self.textLabel.setText(self.tr("blackscreen"))
        
    def paintEvent(self,event):
        painter = QPainter(self)
        painter.setBrush(QBrush(QColor(0,0,0)))
        painter.drawRect(self.rect())
        
if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = BlackScreen()
    window.show()
    app.exec_()
    