#!/usr/bin/python
#coding=utf8

from PyQt4.QtGui import QDialog,QDesktopWidget,QApplication
from PyQt4.QtCore import SIGNAL


from ui_qss.messageDialogQss import MessageDialogQss

class MessageDialog (MessageDialogQss):

    def __init__(self, message="",parent=None):
        super(MessageDialog, self).__init__(parent)
        self.setModal(True)
        self.label_message.setText(message)
        self.connect(self.btn_ok,SIGNAL("clicked()"),self.close)

    def exec_(self):
        self.moveWidgetToScreenCenter()
        super(MessageDialog,self).exec_()

    def moveWidgetToScreenCenter(self):
        desktopWidget = QApplication.desktop()
        clientRect = desktopWidget.availableGeometry()
        width = clientRect.width()
        height = clientRect.height()
        self.move((width - self.width())/2,  (height - self.height())/2)


if __name__ == "__main__":
    from PyQt4 import QtGui
    from os import environ
    environ["WIN_UI_IMAGES_PATH"]="../../../images"
    app = QtGui.QApplication([])
    win = MessageDialog()
    win.show()
    app.exec_()

