#coding:utf-8
from PyQt4 import QtGui
from PyQt4 import QtCore
from AppPannel import AppPannel
from AppFloat import AppFloat
class AppPannelBackground(QtGui.QLabel):
    """

    """
    def __init__(self,parent=None,appUser=None):
        QtGui.QLabel.__init__(self,parent)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.__width=parent.geometry().width()
        self.__height=parent.geometry().height()
        self.setGeometry(0,0,self.__width,self.__height)
        self.pannel=AppPannel(self,appUser)
        if self.pannel.geometry().height() > self.__height:
            self.__height=self.pannel.geometry().height()
        # print self.pannel.geometry()
        self.setStyleSheet('QLabel{border-image: url();background:transparent;}')
        self.setGeometry(0,0,self.__width,self.__height)
        self.enableFloatSignal=QtCore.pyqtSignal()
        self.connect(self,QtCore.SIGNAL('enableFloatSignal'),parent,QtCore.SIGNAL('enableFloatSignal'))
        self.showFloatLabel=QtCore.pyqtSignal()
        self.connect(self,QtCore.SIGNAL('showFloatLabel'),parent.showFloatLabel)
        self.hideFloatLabel=QtCore.pyqtSignal()
        self.connect(self,QtCore.SIGNAL('hideFloatLabel'),parent.hideFloatLabel)
        self.backInfoSignal=QtCore.pyqtSignal()
        self.connect(self,QtCore.SIGNAL('backInfoSignal'),parent,QtCore.SIGNAL('backInfoSignal'))
        # self.floatLeft=self.__width-174
        # self.floatTop=20
        # self.floatWnd=AppFloat(self,self.floatLeft,self.floatTop)

    def showFloatLabel(self,activDic={}):
        self.emit(QtCore.SIGNAL('showFloatLabel'),activDic)

    def hideFloatLabel(self):
        self.emit(QtCore.SIGNAL('hideFloatLabel'))

    # @QtCore.pyqtSlot()
    # def floatMoved(self,x_move=0,y_move=0):
    #     self.floatLeft+=x_move
    #     self.floatTop+=y_move
    #     pass
