#coding:utf-8

from PyQt4.QtCore import SIGNAL
from PyQt4.QtGui import QVBoxLayout, QHBoxLayout, QPushButton

from infohintdialog import InfoHintDialog


class MessageBox(InfoHintDialog):
        
    def __init__(self,hintInfo, parent = None):
        InfoHintDialog.__init__(self, hintInfo, parent)
        self.setWindowTitle(u'提示信息')
        #self.setStyleSheet("font-size : 16px")
        self.setStyleSheet("QPushButton{background:url(../images/button.png);font-size: 10pt;border:2px;}")
        self.setTitle(u'提示信息')
        
        self.ensureBtn = QPushButton(u'确定')
        self.ensureBtn.setFixedSize(75,27)
        self.ensureBtn.setFlat(True)
        self.cancelBtn = QPushButton(u'取消')
        self.cancelBtn.setFixedSize(75,27)
        self.cancelBtn.setFlat(True)
        self.cancelBtn.setDefault(True)
        
        bottomHLayout = QHBoxLayout()
        bottomHLayout.addStretch()
        bottomHLayout.addWidget(self.ensureBtn)
        bottomHLayout.addSpacing(10)
        bottomHLayout.addWidget(self.cancelBtn)
        bottomHLayout.addStretch()
        
        mainVLayout = QVBoxLayout()
        mainVLayout.addStretch()
        mainVLayout.addStretch()
        mainVLayout.addLayout(bottomHLayout)
        self.setLayout(mainVLayout)
        self.okBtn.hide()
        self.connect(self.ensureBtn, SIGNAL("clicked()"),self.slotOk)
        self.connect(self.cancelBtn, SIGNAL("clicked()"),self.slotCancel)
        
    def slotOk(self):
        self.accept()
        
    def slotCancel(self):
        self.reject()
        
        
        
        
        