Example #1
0
class Notification(QtGui.QMainWindow):
    closed = QtCore.pyqtSignal()

    def __init__(self, mssg, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.parent = parent
        global MSSG
        MSSG = mssg
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.ui = Ui_Notification()
        self.ui.setupUi(self)

        self.createNotification(MSSG)

    def closeEvent(self, event):
        self.close.emit()

    def createNotification(self, mssg):
        global OS
        if (OS != 1):
            user32 = windll.user32
            # Get X coordinate of screen
            self.x = user32.GetSystemMetrics(0)
        else:
            cp = QtGui.QDesktopWidget().availableGeometry()
            self.x = cp.width()

        # Set the opacity
        self.f = 1.0

        # Set the message
        self.ui.lbl_mssg.setText(mssg)

        # Start Worker
        self.workThread = WorkThread()
        self.connect(self.workThread, QtCore.SIGNAL("update(QString)"),
                     self.animate)
        self.connect(self.workThread, QtCore.SIGNAL("vanish(QString)"),
                     self.disappear)
        self.connect(self.workThread, QtCore.SIGNAL("finished()"), self.done)

        self.workThread.start()
        return

    # Quit when done
    def done(self):
        self.hide()
        return

    # Reduce opacity of the window
    def disappear(self):
        self.f -= 0.02
        self.setWindowOpacity(self.f)
        return

    # Move in animation
    def animate(self):
        self.move(self.x, 0)
        self.x -= 1
        return
class Notification(QtGui.QMainWindow):
    closed = QtCore.pyqtSignal()
    
    def __init__(self,mssg,parent=None):
        QtGui.QWidget.__init__(self,parent)
        self.parent = parent
        global MSSG
        MSSG = mssg
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.ui = Ui_Notification()
        self.ui.setupUi(self)
        
        self.createNotification(MSSG)
        
    def closeEvent(self,event):
        self.close.emit()
        
    def createNotification(self,mssg):
        global OS
        if (OS!= 1):
            user32 = windll.user32
            #Get X coordinate of screen
            self.x = user32.GetSystemMetrics(0)
        else:
            cp = QtGui.QDesktopWidget().availableGeometry()
            self.x = cp.width()

        #Set the opacity
        self.f = 1.0

        #Set the message 
        self.ui.lbl_mssg.setText(mssg)

        #Start Worker
        self.workThread = WorkThread()
        self.connect( self.workThread, QtCore.SIGNAL("update(QString)"), self.animate )
        self.connect( self.workThread, QtCore.SIGNAL("vanish(QString)"), self.disappear)
        self.connect( self.workThread, QtCore.SIGNAL("finished()"), self.done)
        
        self.workThread.start()
        return

    #Quit when done
    def done(self):
        self.hide()
        return

    #Reduce opacity of the window
    def disappear(self):
        self.f -= 0.02
        self.setWindowOpacity(self.f)
        return
        
        
    #Move in animation
    def animate(self):
        self.move(self.x,0)
        self.x -= 1
        return
Example #3
0
    def __init__(self, mssg, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.parent = parent
        global MSSG
        MSSG = mssg
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.ui = Ui_Notification()
        self.ui.setupUi(self)

        self.createNotification(MSSG)
Example #4
0
class Notification(QtGui.QMainWindow):
    closed = QtCore.pyqtSignal()
    
    def __init__(self,mssg,parent=None):
        QtGui.QWidget.__init__(self,parent,QtCore.Qt.WindowStaysOnTopHint)
        self.parent = parent
        global MSSG
        MSSG = mssg
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.ui = Ui_Notification()
        self.ui.setupUi(self)
        
        self.createNotification(MSSG)
        
    def createNotification(self,mssg):
        
        cp = QtGui.QDesktopWidget().availableGeometry()
        self.x = cp.width()
        self.y = cp.height()

        #Set the opacity
        self.f = 1.0

        #Set the message 
        self.ui.lbl_mssg.setText(mssg)

        #Start Worker
        self.workThread = WorkThread()
        self.connect( self.workThread, QtCore.SIGNAL("update(QString)"), self.animate )
        self.connect( self.workThread, QtCore.SIGNAL("vanish(QString)"), self.disappear)
        self.connect( self.workThread, QtCore.SIGNAL("finished()"), self.done)
        
        self.workThread.start()
        return

    #Quit when done
    def done(self):
        self.hide()
        return

    #Reduce opacity of the window
    def disappear(self):
        self.f -= 0.01
        self.setWindowOpacity(self.f)
        return
        
        
    #Move in animation
    def animate(self):
        self.move(self.x,self.y)
        self.x -= 1
        self.y -= 0.17
        return
 def __init__(self,mssg,parent=None):
     QtGui.QWidget.__init__(self,parent)
     self.parent = parent
     global MSSG
     MSSG = mssg
     self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
     self.ui = Ui_Notification()
     self.ui.setupUi(self)
     
     self.createNotification(MSSG)