# coding: utf-8
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
from MenuLabel import MenuLabel
from PannelWidget import PannelWidget
from NotifyWidget import NotifyWedget
class MainWidget(QtGui.QWidget):
    """
    主窗口，用来显示主界面
    """
    def __init__(self,parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setWindowFlags(QtCore.Qt.Dialog and QtCore.Qt.CustomizeWindowHint and QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_NoSystemBackground,False)
        self.setWindowState(QtCore.Qt.WindowFullScreen)
#         self.pixmap=Qt.QPixmap("images/test-background.png")
        self.desktop=QtGui.QApplication.desktop() 
        self.backLabel=QtGui.QLabel(self)
        self.backLabel.setGeometry(0,0,self.desktop.width(),self.desktop.height())
        self.backLabel.setStyleSheet('QLabel{border-image: url(images/test-background.png);}')
        self.menuLabel=MenuLabel(self.backLabel)
        self.pannelWidget=PannelWidget(self.backLabel) 
        self.notifyWidget=NotifyWedget(self) 
        self.notifyWidget.hide()
#         self.NotifyShow('msg')      
#         self.okButton=QtGui.QPushButton(''.decode('utf-8'),self.backLabel)    
# #         okButton=QtGui.QPushButton('确定'.decode('utf-8'),backLabel)
#         btnRect=QtCore.QRect(0,0,70,20)
#         self.okButton.setGeometry((self.desktop.width()-btnRect.width())//2,(self.desktop.height()-btnRect.height())//2,btnRect.width(),btnRect.height())
#         self.okButton.setStyleSheet("""QPushButton{border-image: url(images/set-button-sure.png);}""")
#         self.connect(self.okButton, QtCore.SIGNAL('clicked()'), QtGui.qApp,QtCore.SLOT('quit()'))

#     @QtCore.pyqtSlot()
    def NotifyShow(self,msg):
        self.notifyWidget.showMessage(msg)
#     def paintEvent(self,event):
#         painter=QtGui.QPainter(self)
#         painter.drawPixmap(0,0,self.desktop.width(),self.desktop.height() ,self.pixmap)
#         pass
if __name__ == '__main__':
    import os
    path=os.getcwd()
    path=os.path.dirname(path)
    parent_path = os.path.dirname(path)
    os.chdir(parent_path)
    app = QtGui.QApplication(sys.argv)
    mainWindow=MainWidget()
    mainWindow.show()
#     notify.showMessage('通知')  
    sys.exit(app.exec_())    