#coding=utf-8

from PyQt4.QtGui import QDialog
from PyQt4.QtCore import Qt,QString,QUrl,SIGNAL
from view.setting.helpdialog import Ui_Dialog

class HelpDialog(QDialog,Ui_Dialog):
    def __init__(self):
        super(HelpDialog,self).__init__()
        self.setupUi(self)
        
        flags = Qt.FramelessWindowHint;
        self.setWindowFlags(flags);
        self.frame.setStyleSheet(QString("QWidget#frame{border-image: url(../images/help.png);}"))
        self.frame.setAttribute(Qt.WA_TransparentForMouseEvents)
        self.mousePressed = False
        self.webView.setUrl(QUrl("../document/openstackHelp.htm"))
        self.connect(self.pushButtonQuit,SIGNAL("clicked()"),self.close)
        
    def mouseMoveEvent(self,event):
        if self.mousePressed:
            self.move(self.pos() + event.pos() - self.currentPos)   
        self.default = QString()
    def mousePressEvent(self,event):
        if event.buttons() == Qt.LeftButton:
            self.currentPos = event.pos()
            self.mousePressed = True
    def mouseReleaseEvent(self,event):
        if event.buttons() == Qt.LeftButton:
            self.mousePressed = False