Ejemplo n.º 1
0
    def __init__(self, parent, card, size=QtCore.QSize(70, 105), visible=True):
        # QtGui.QGraphicsItem.__init__(self, parent)
        QtGui.QGraphicsObject.__init__(self, parent)
        # self.parentItem() = parent
        self.set_visible(visible)
        self.raised = False
        self.moved = None
        self.animation = True

        self.card = card

        # self.box = QtCore.QRect(QtCore.QPoint(-size.width()/2, -size.height()/2), size)
        self.setSize(size)

        # self.setFlag(QtGui.QGraphicsObject.ItemIsMovable)


        # image = self.parentItem().sett.resources['playing_cards']
        # image = image.copy((3-color)*image.width()/4,
        #                   (14-name)*image.height()/13,
        #                   image.width()/4,
        #                   image.height()/13)
        # self.graphic = image


        self.POSanim = QtCore.QPropertyAnimation(self, 'pos', parent=self.scene())
        self.ROTanim = QtCore.QPropertyAnimation(self, 'rotation', parent=self.scene())
    def __init__(self, text, title, link=None, timeout=None):
        QtGui.QLabel.__init__(self)
        self.link = link
        self.setAutoFillBackground(True)
        self.timeoutTimer = QtCore.QTimer(self)
        self.timeoutTimer.setSingleShot(True)
        self.effect = QtGui.QGraphicsOpacityEffect(self)
        self.setGraphicsEffect(self.effect)
        self.setText(self.decoretorText(text, title))

        # Fade in
        self.animationIn = QtCore.QPropertyAnimation(self.effect, 'opacity')
        self.animationIn.setDuration(300)
        self.animationIn.setStartValue(0)
        self.animationIn.setEndValue(1.0)

        # Fade out
        self.animationOut = QtCore.QPropertyAnimation(self.effect, 'opacity')
        self.animationOut.setDuration(300)
        self.animationOut.setStartValue(1.0)
        self.animationOut.setEndValue(0)
        if timeout is not None:
            self.timeoutTimer.setInterval(timeout)
            self.animationIn.finished.connect(self.timeoutTimer.start)
            self.timeoutTimer.timeout.connect(self.close)
        self.setstylelabel()
        self.linkActivated.connect(self.linkHandler)
        self.setFixedHeight(50)
        self.animationIn.start()
Ejemplo n.º 3
0
 def loginResult(self):
     if self.connected:
         self.bot_thread.started.disconnect()
         self.bot_thread.finished.disconnect()
         bot.signalUserData.connect(self.bot_thread.quit)
         self.bot_thread.started.connect(bot.userData)
         self.bot_thread.finished.connect(LoginDialog.close)
         bot.signalUserData.connect(ui_mw.setUserData)
         LoginDialog.finished.connect(MainWindow.show)
         self.bot_thread.start()
     else:
         self.loginEdit.setText(_fromUtf8(""))
         self.passEdit.setText(_fromUtf8(""))
         self.loginEdit.setEnabled(True)
         self.passEdit.setEnabled(True)
         self.btnLogin.setEnabled(True)
         self.animation = QtCore.QPropertyAnimation(self.label, "geometry")
         self.animation.setDuration(75)
         self.animation.setStartValue(QtCore.QRect(30, 20, 191, 61))
         self.animation.setEndValue(QtCore.QRect(75, 20, 191, 61))
         self.animation1 = QtCore.QPropertyAnimation(self.label, "geometry")
         self.animation1.setDuration(75)
         self.animation1.setStartValue(QtCore.QRect(75, 20, 191, 61))
         self.animation1.setEndValue(QtCore.QRect(35, 20, 191, 61))
         self.animation2 = QtCore.QPropertyAnimation(self.label, "geometry")
         self.animation2.setDuration(75)
         self.animation2.setStartValue(QtCore.QRect(35, 20, 191, 61))
         self.animation2.setEndValue(QtCore.QRect(70, 20, 191, 61))
         self.secuentialAnimation = QtCore.QSequentialAnimationGroup()
         self.secuentialAnimation.addAnimation(self.animation)
         self.secuentialAnimation.addAnimation(self.animation1)
         self.secuentialAnimation.addAnimation(self.animation2)
         self.secuentialAnimation.start()
         self.labelBGSpinner.setVisible(False)
         self.labelSpinner.setVisible(False)
Ejemplo n.º 4
0
    def change_current(self, index):
        logger.debug('setting current navpane index to %s' % index)

        self._animation.stop()
        self._animation.clear()
        
        if self._current_tree_widget is not None:
            current_index = self._dock_widget.layout().indexOf(self._current_tree_widget) - 1
            if index == current_index:
                return
            self._dock_widget.layout().itemAt(current_index).widget().toggle_bold()
            hide = QtCore.QPropertyAnimation(self._current_tree_widget, 'maximumHeight')
            hide.setDuration( 150 )
            hide.setStartValue( self._current_tree_widget.height() )
            hide.setEndValue( 0 )
            self._animation.addAnimation( hide )
                    
        self._dock_widget.layout().itemAt(index).widget().toggle_bold()
        tree_widget = self._dock_widget.layout().itemAt(index+1).widget()
        tree_widget.show()
        show = QtCore.QPropertyAnimation(tree_widget, 'maximumHeight')
        show.setDuration( 150 )
        show.setStartValue( 0 )
        show.setEndValue( 1000 )
        self._animation.addAnimation( show )
        self._animation.start()
        self._current_tree_widget = tree_widget
Ejemplo n.º 5
0
    def __init__(self, parent=None):
        super(MaterialCheckBox, self).__init__(parent)
        self._is_checked = False

        checkedIcon = MaterialIcon(
            self, os.path.join(icons_path, "baseline-check_box-24px.svg"))
        uncheckedIcon = MaterialIcon(
            self,
            os.path.join(icons_path,
                         "baseline-check_box_outline_blank-24px.svg"),
        )

        stateMachine = QtCore.QStateMachine(self)

        checkedState = QtCore.QState()
        checkedState.assignProperty(self, b"checked", True)
        checkedState.assignProperty(checkedIcon, b"opacity", 1.0)
        checkedState.assignProperty(uncheckedIcon, b"opacity", 0.0)

        uncheckedState = QtCore.QState()
        uncheckedState.assignProperty(self, b"checked", False)
        uncheckedState.assignProperty(checkedIcon, b"opacity", 0.0)
        uncheckedState.assignProperty(uncheckedIcon, b"opacity", 1.0)

        stateMachine.addState(checkedState)
        stateMachine.addState(uncheckedState)
        stateMachine.setInitialState(uncheckedState)

        duration = 2000

        transition1 = checkedState.addTransition(self.clicked, uncheckedState)
        animation1 = QtCore.QPropertyAnimation(checkedIcon,
                                               b"opacity",
                                               self,
                                               duration=duration)
        transition1.addAnimation(animation1)
        animation2 = QtCore.QPropertyAnimation(uncheckedIcon,
                                               b"opacity",
                                               self,
                                               duration=duration)
        transition1.addAnimation(animation2)

        transition2 = uncheckedState.addTransition(self.clicked, checkedState)
        animation3 = QtCore.QPropertyAnimation(checkedIcon,
                                               b"opacity",
                                               self,
                                               duration=duration)
        transition2.addAnimation(animation3)
        animation4 = QtCore.QPropertyAnimation(uncheckedIcon,
                                               b"opacity",
                                               self,
                                               duration=duration)
        transition2.addAnimation(animation4)

        stateMachine.start()
Ejemplo n.º 6
0
    def _animation_expand(self, value):
        size_animation = qc.QPropertyAnimation(self, 'geometry')
        opacity_anim = qc.QPropertyAnimation(self.main_widget_proxy, 'opacity')

        # Animation Opacity
        opacity_anim.setStartValue(not (value))
        opacity_anim.setEndValue(value)
        opacity_anim.setDuration(200)
        opacity_anim_curve = qc.QEasingCurve()
        if value:
            opacity_anim_curve.setType(qc.QEasingCurve.InQuad)
        else:
            opacity_anim_curve.setType(qc.QEasingCurve.OutQuad)
        opacity_anim.setEasingCurve(opacity_anim_curve)

        # def size of the geometry
        geometry = self.geometry()
        width = geometry.width()
        x, y, _, _ = geometry.getCoords()
        size_start = qc.QRect(x, y, width, int(not (value)) * 150)
        size_end = qc.QRect(x, y, width, int(value) * 150)

        # Animation for geometry
        size_animation.setStartValue(size_start)
        size_animation.setEndValue(size_end)
        size_animation.setDuration(300)
        anim_curve = qc.QEasingCurve()
        if value:
            anim_curve.setType(qc.QEasingCurve.InQuad)
        else:
            anim_curve.setType(qc.QEasingCurve.OutQuad)
        size_animation.setEasingCurve(anim_curve)

        # Animation sequence
        self._animation = qc.QSequentialAnimationGroup()

        if value:
            self.main_widget_proxy.setOpacity(0)
            self._animation.addAnimation(size_animation)
            self._animation.addAnimation(opacity_anim)
            self._animation.finished.connect(self._animation.clear)

        else:
            self.main_widget_proxy.setOpacity(1)
            self._animation.addAnimation(opacity_anim)
            self._animation.addAnimation(size_animation)
            self._animation.finished.connect(self._animation.clear)
            self._animation.finished.connect(self.delete_widget)

        size_animation.valueChanged.connect(self._force_resize)

        self._animation.start(qc.QAbstractAnimation.DeleteWhenStopped)
Ejemplo n.º 7
0
    def _animateExpand(self, value):
        opacity_anim = qc.QPropertyAnimation(self.main_widget_proxy, "opacity")
        opacity_anim.setStartValue(not(value));
        opacity_anim.setEndValue(value)
        opacity_anim.setDuration(200)
        opacity_anim_curve = qc.QEasingCurve()
        if value is True:
            opacity_anim_curve.setType(qc.QEasingCurve.InQuad)
        else:
            opacity_anim_curve.setType(qc.QEasingCurve.OutQuad)
        opacity_anim.setEasingCurve(opacity_anim_curve)

        size_anim = qc.QPropertyAnimation(self, "geometry")

        geometry = self.geometry()
        width    = geometry.width()
        x, y, _, _ = geometry.getCoords()

        size_start = qc.QRect(x, y, width, int(not(value)) * 150)
        size_end   = qc.QRect(x, y, width, value * 150)

        size_anim.setStartValue(size_start)
        size_anim.setEndValue(size_end)
        size_anim.setDuration(300)

        size_anim_curve = qc.QEasingCurve()
        if value:
            size_anim_curve.setType(qc.QEasingCurve.InQuad)
        else:
            size_anim_curve.setType(qc.QEasingCurve.OutQuad)
        size_anim.setEasingCurve(size_anim_curve)

        self._animation = qc.QSequentialAnimationGroup()
        if value:
            self.main_widget_proxy.setOpacity(0)
            self._animation.addAnimation(size_anim)
            self._animation.addAnimation(opacity_anim)
        else:
            self.main_widget_proxy.setOpacity(1)
            self._animation.addAnimation(opacity_anim)
            self._animation.addAnimation(size_anim)

        size_anim.valueChanged.connect(self._forceResize)
        self._animation.finished.connect(self._animation.clear)

        if not value:
            self._animation.finished.connect(self.deleteWidget)

        self._animation.start(qc.QAbstractAnimation.DeleteWhenStopped)
Ejemplo n.º 8
0
    def __init_graphic_effects(self):
        """ Initializes graphic effects. """
        # Opacity effect for fade in/out.
        # self.opacityEffect = QtWidgets.QGraphicsOpacityEffect(self)
        self.opacityEffect = QtGui.QGraphicsOpacityEffect(self)

        # Fade in animation.
        self.fadeInAnimation = QtCore.QPropertyAnimation(self.opacityEffect, safe_encode("opacity"))
        self.fadeInAnimation.setStartValue(0.0)
        self.fadeInAnimation.setEndValue(1.0)

        # Fade out animation
        self.fadeOutAnimation = QtCore.QPropertyAnimation(self.opacityEffect, safe_encode("opacity"))
        self.fadeOutAnimation.setStartValue(1.0)
        self.fadeOutAnimation.setEndValue(0.0)
Ejemplo n.º 9
0
 def showEvent(self, event):
     self.PlotWidget.show()
     self.animation = QtCore.QPropertyAnimation(self, "windowOpacity")
     self.animation.setDuration(100)
     self.animation.setStartValue(0)
     self.animation.setEndValue(1)
     self.animation.start()
Ejemplo n.º 10
0
 def animateClose(self):
     animation = QtCore.QPropertyAnimation(self, 'windowOpacity', self)
     animation.setDuration(500)
     animation.setStartValue(1)
     animation.setEndValue(0)
     animation.start()
     animation.finished.connect(self.close)
Ejemplo n.º 11
0
 def __init__(self, image, pos, parent=None):
     super(Piece, self).__init__(parent)
     self.image     = image
     self.setPos(pos.x(), pos.y())
     self.animation = QtCore.QPropertyAnimation(self, "geometry")
     self.animation.setDuration(500)
     self.connect(self.animation, QtCore.SIGNAL("valueChanged(const QVariant)"), self.bravo)
Ejemplo n.º 12
0
    def set_sections(self, sections):
        logger.debug('setting navpane sections')

        animation = QtCore.QPropertyAnimation(self._dock_widget, 'minimumWidth', self)
        animation.setDuration( 500 )
        animation.setStartValue( 10 )
        animation.setEndValue( 220 )
        animation.start()
        
        self._sections = sections
        self._buttons = [(
            index,
            section.get_verbose_name(),
            section.get_icon().getQPixmap(),
        ) for index, section in enumerate(sections)]

        for index, name, pixmap in self._buttons:
            tree_widget = self.get_tree_widget()
            if index!=0:
                tree_widget.setMaximumHeight(0)

            pane_button = PaneButton(name, pixmap)
            pane_button.pressed.connect(self.change_current)

            self._dock_widget.layout().addWidget(pane_button)
            self._dock_widget.layout().addWidget(tree_widget)

            last_tree_index = self._dock_widget.layout().count() - 1

            def get_models_for_tree():
                return (last_tree_index, self._sections[index].get_items())

            post(get_models_for_tree, self.set_models_for_tree)

        self.change_current(0)
Ejemplo n.º 13
0
    def set_sections(self, sections):
        logger.debug('setting navpane sections')
        toolbox = self.findChild(QtGui.QWidget, 'toolbox')
        animation = QtCore.QPropertyAnimation(toolbox, 'minimumWidth', self)
        animation.setDuration(500)
        animation.setStartValue(0)
        animation.setEndValue(220)
        animation.start()

        # performs QToolBox clean up
        # QToolbox won't delete items we have to do it explicitly
        count = toolbox.count()
        while count:
            item = toolbox.widget(count - 1)
            toolbox.removeItem(count - 1)
            item.deleteLater()
            count -= 1

        for section in sections:
            # TODO: old navpane used translation here
            name = unicode(section.get_verbose_name())
            icon = section.get_icon().getQIcon()
            pwdg = PaneSection(toolbox, section, self._workspace)
            toolbox.addItem(pwdg, icon, name)

        toolbox.setCurrentIndex(0)
Ejemplo n.º 14
0
def uiAddWidgetSizeAnim(widget, onoff, size, size_offset=0):
    size_anim = None
    try:
        print widget
        size_anim = QtCore.QPropertyAnimation(widget, 'geometry')
    except:
        pm.warning('Failed to create QPropertyAnimation ')
    geometry = widget.geometry()
    width = geometry.width()
    x, y, _, _ = geometry.getCoords()
    size_start = QtCore.QRect(x, y, width,
                              int(not (onoff)) * size + size_offset)
    size_end = QtCore.QRect(x, y, width, onoff * size + size_offset)

    size_anim.setStartValue(size_start)
    size_anim.setEndValue(size_end)
    size_anim.setDuration(200)

    size_anim_curve = QtCore.QEasingCurve()
    if onoff:
        size_anim_curve.setType(QtCore.QEasingCurve.InQuad)
    else:
        size_anim_curve.setType(QtCore.QEasingCurve.OutQuad)

    size_anim.setEasingCurve(size_anim_curve)

    return size_anim
Ejemplo n.º 15
0
 def closeIt(self):
     self.animation = QtCore.QPropertyAnimation(self,"windowOpacity")
     self.animation.finished.connect(QtCore.QCoreApplication.instance().quit)
     self.animation.setDuration(300)
     self.animation.setStartValue(1)
     self.animation.setEndValue(0)
     self.animation.start()
Ejemplo n.º 16
0
 def hideIt(self):
     self.animation = QtCore.QPropertyAnimation(self,"windowOpacity")
     self.animation.finished.connect(self.showMinimized2)
     self.animation.setDuration(300)
     self.animation.setStartValue(1)
     self.animation.setEndValue(0)
     self.animation.start()
Ejemplo n.º 17
0
    def set_state(self, state):
        AbstractActionWidget.set_state(self, state)
        if state.icon:
            self.setPixmap(state.icon.getQPixmap())
            self.resize(self.pixmap().width(), self.pixmap().height())
        if state.notification:
            # Shake animation #
            notificationAnimationPart1 = QtCore.QPropertyAnimation(self, 'pos')
            notificationAnimationPart1.setObjectName(
                'notificationAnimationPart1')
            notificationAnimationPart1.setDuration(50)
            notificationAnimationPart1.setEasingCurve(
                QtCore.QEasingCurve.Linear)

            notificationAnimationPart2 = QtCore.QPropertyAnimation(self, 'pos')
            notificationAnimationPart2.setObjectName(
                'notificationAnimationPart2')
            notificationAnimationPart2.setDuration(50)
            notificationAnimationPart2.setEasingCurve(
                QtCore.QEasingCurve.Linear)

            notificationAnimationPart3 = QtCore.QPropertyAnimation(self, 'pos')
            notificationAnimationPart3.setObjectName(
                'notificationAnimationPart3')
            notificationAnimationPart3.setDuration(50)
            notificationAnimationPart3.setEasingCurve(
                QtCore.QEasingCurve.Linear)

            notificationAnimation = QtCore.QSequentialAnimationGroup(
                parent=self)
            notificationAnimation.setObjectName('notificationAnimation')
            notificationAnimation.setLoopCount(10)
            notificationAnimation.addAnimation(notificationAnimationPart1)
            notificationAnimation.addAnimation(notificationAnimationPart2)
            notificationAnimation.addAnimation(notificationAnimationPart3)

            # Timer is used to simulate a pausing effect of the animation.
            notificationAnimationTimer = QtCore.QTimer(parent=self)
            notificationAnimationTimer.setObjectName(
                'notificationAnimationTimer')
            notificationAnimationTimer.setInterval(1500)
            notificationAnimationTimer.setSingleShot(True)
            notificationAnimationTimer.timeout.connect(
                notificationAnimation.start)
            notificationAnimation.finished.connect(
                notificationAnimationTimer.start)
        self.resetLayout()
Ejemplo n.º 18
0
 def resizeDialog(self):
     self.animation = QtCore.QPropertyAnimation(self, "size")
     if self.size().width() == 200:
         self.animation.setEndValue(QtCore.QSize(600, 300))
     else:
         print(3)
         self.animation.setEndValue(QtCore.QSize(400, 100))
     self.animation.start()
Ejemplo n.º 19
0
 def closeFunc(self, name):
     '''窗口关闭函数'''
     self.closeAnimation = QtCore.QPropertyAnimation(self, "windowOpacity")
     self.closeAnimation.setDuration(200)
     self.closeAnimation.setStartValue(1)
     self.closeAnimation.setEndValue(0)
     self.closeAnimation.finished.connect(self.exitFunc)
     self.closeAnimation.start()
Ejemplo n.º 20
0
	def resizeDialog(self):
		self.animation = QtCore.QPropertyAnimation(self, "size")
		self.animation.setDuration(1000) #Default 250ms
		if self.size().width()==200:
			self.animation.setEndValue(QtCore.QSize(600,300))
		else:
			self.animation.setEndValue(QtCore.QSize(200,100))
		self.animation.start()
Ejemplo n.º 21
0
    def onClick(self):
        r = self.geometry()
        end = r.adjusted(0, 0, 0, 75)

        self.anim = QtCore.QPropertyAnimation(self, 'geometry')
        self.anim.setDuration(600)
        self.anim.setStartValue(r)
        self.anim.setEndValue(end)
        self.anim.start()
Ejemplo n.º 22
0
    def _init_fade_out(self, duration):

        fade_out = QtCore.QPropertyAnimation(self._effect, "opacity")
        fade_out.setDuration(duration)
        fade_out.setStartValue(1.0)
        fade_out.setEndValue(0.0)
        fade_out.setEasingCurve(QtCore.QEasingCurve.OutQuad)

        return fade_out
Ejemplo n.º 23
0
    def __init__(self, stickMan, keyReceiver):
        self.m_stickMan = stickMan
        self.m_keyReceiver = keyReceiver

        # Create animation group to be used for all transitions.
        self.m_animationGroup = QtCore.QParallelAnimationGroup()
        stickManNodeCount = self.m_stickMan.nodeCount()
        self._pas = []
        for i in range(stickManNodeCount):
            pa = QtCore.QPropertyAnimation(self.m_stickMan.node(i), 'pos')
            self._pas.append(pa)
            self.m_animationGroup.addAnimation(pa)

        # Set up intial state graph.
        self.m_machine = QtCore.QStateMachine()
        self.m_machine.addDefaultAnimation(self.m_animationGroup)

        self.m_alive = QtCore.QState(self.m_machine)
        self.m_alive.setObjectName('alive')

        # Make it blink when lightning strikes before entering dead animation.
        lightningBlink = QtCore.QState(self.m_machine)
        lightningBlink.assignProperty(self.m_stickMan.scene(),
                                      'backgroundBrush', QtCore.Qt.white)
        lightningBlink.assignProperty(self.m_stickMan, 'penColor',
                                      QtCore.Qt.black)
        lightningBlink.assignProperty(self.m_stickMan, 'fillColor',
                                      QtCore.Qt.white)
        lightningBlink.assignProperty(self.m_stickMan, 'isDead', True)

        timer = QtCore.QTimer(lightningBlink)
        timer.setSingleShot(True)
        timer.setInterval(100)
        lightningBlink.entered.connect(timer.start)
        lightningBlink.exited.connect(timer.stop)

        self.m_dead = QtCore.QState(self.m_machine)
        self.m_dead.assignProperty(self.m_stickMan.scene(), 'backgroundBrush',
                                   QtCore.Qt.black)
        self.m_dead.assignProperty(self.m_stickMan, 'penColor',
                                   QtCore.Qt.white)
        self.m_dead.assignProperty(self.m_stickMan, 'fillColor',
                                   QtCore.Qt.black)
        self.m_dead.setObjectName('dead')

        # Idle state (sets no properties).
        self.m_idle = QtCore.QState(self.m_alive)
        self.m_idle.setObjectName('idle')

        self.m_alive.setInitialState(self.m_idle)

        # Lightning strikes at random.
        self.m_alive.addTransition(LightningStrikesTransition(lightningBlink))
        lightningBlink.addTransition(timer.timeout, self.m_dead)

        self.m_machine.setInitialState(self.m_alive)
Ejemplo n.º 24
0
 def minFunc(self, name):
     '''最小化函数'''
     self.PlotWidget.hide()
     # self.minPushButton.setPixmap(QtGui.QPixmap(r'./minNormal.png'))
     self.minAnimation = QtCore.QPropertyAnimation(self, "windowOpacity")
     self.minAnimation.finished.connect(self.showMinimized2)
     self.minAnimation.setDuration(200)
     self.minAnimation.setStartValue(1)
     self.minAnimation.setEndValue(0)
     self.minAnimation.start()
Ejemplo n.º 25
0
 def toggle(self):
     self.hideAnimation = QtCore.QPropertyAnimation(self.dashboard, "geometry")
     self.parentHideAnimation = QtCore.QPropertyAnimation(self, "geometry")
     self.hideAnimation.setDuration(300)
     self.parentHideAnimation.setDuration(300)
     self.dashboard.startGeometry = QtCore.QRect(self.dashboard.geometry())
     self.startGeometry = QtCore.QRect(self.geometry())
     self.dashboard.endGeometry = QtCore.QRect(0, self.dashboard.geometry().height(),
                                               self.dashboard.geometry().width(), 0)
     self.endGeometry = QtCore.QRect(self.geometry().x(),
                                     self.geometry().y() + self.dashboard.geometry().height(),
                                     self.dashboard.width(),
                                     self.toggleButton.geometry().height())
     self.hideAnimation.setStartValue(self.dashboard.startGeometry)
     self.parentHideAnimation.setStartValue(self.startGeometry)
     self.hideAnimation.setEndValue(self.dashboard.endGeometry)
     self.parentHideAnimation.setEndValue(self.endGeometry)
     self.hideAnimation.start()
     self.parentHideAnimation.start()
Ejemplo n.º 26
0
 def showFullScreen3(self):
     if not self.isFullScreen():
         self.main_layout.setContentsMargins(0,0,0,0)
         self.animation = QtCore.QPropertyAnimation(self,"geometry")
         self.animation.setDuration(180)
         self.animation.setStartValue(self.geometry())
         self.animation.setEndValue(self.desktop.availableGeometry(self.desktop.screenNumber(self.widget)))
         self.animation.finished.connect(self.showFullScreen2)
         self.animationEndFlag = 0
         self.animation.start()
Ejemplo n.º 27
0
    def __init__(self, maxValue=5, parent=None):
        super(SelectionGauge, self).__init__(parent=parent)
        self.setWindowFlags(QtCore.Qt.Tool)
        self.resize(400,400)

        # Don't allow anything less than 1 for the maxValue
        self.maxValue = max(maxValue, 1)

        self.layout = QtGui.QVBoxLayout(self)
        self.layout.setSpacing(20)

        self.text = QtGui.QLabel()
        self.text.setObjectName("statusText")
        self.text.setAlignment(QtCore.Qt.AlignCenter)
        self.layout.addWidget(self.text)

        self.gauge = GaugeWidget()

        sizePolicy = QtGui.QSizePolicy()
        sizePolicy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding)
        sizePolicy.setVerticalPolicy(QtGui.QSizePolicy.Expanding)

        self.gauge.setSizePolicy(sizePolicy)
        self.layout.addWidget(self.gauge)

        # Qt Stylesheet Reference:
        #   http://qt-project.org/doc/qt-4.7/stylesheet-reference.html
        # Selector Syntax: 
        #   http://doc.qt.digia.com/4.7-snapshot/stylesheet-syntax.html
        self.setStyleSheet("""
            #statusText {
                font-size   : 18px;
                color       : rgb(200,200,220);
            }
        """)

        # Notify us when the scene selection changes
        self._sel_cbk_id = om.MEventMessage.addEventCallback(
                            'SelectionChanged',
                            self.updateGauge)

        # Safely delete the previous callback if this widget gets
        # deleted. Otherwise you will see a bunch of errors when it 
        # tries to fire the callback and the widget is gone.
        cbk = partial(om.MMessage.removeCallback, self._sel_cbk_id)
        self.destroyed.connect(cbk)

        # set up an animation object
        self._value_animator = QtCore.QPropertyAnimation(self, "value")
        self._value_animator.setDuration(500)
        self._value_animator.setStartValue(0.0)
        self._value_animator.setEndValue(1.0)

        # initialize the gauge to the current scene selection, if any
        self.updateGauge()
Ejemplo n.º 28
0
    def __init__(self, target_widget, *args, **kwargs):
        """ Constructor

        :param target_widget: QtWidgets.QWidget The widget to project the notifications on
        :param useGlobalCSS: bool (default: False) Flag which indicates whether global style sheets should be used
                             (which have been set at app-level). If False, the default style sheets stored at
                             self.default_notification_styles will be loaded.
        :param useQueue: bool (default: True) Indicates whether a message queue should be implemented.
                         This will only show *maxMessages* at the same time and will put all other messages in a queue.
                         Once a message disappears, the next one in the queue will be shown
                         (up to maxMessages at the same time)
        :param: maxMessages: int (default: 2) The number of messages to display at the same time.

        :raises: TypeError if targetWidget is not an object that inherits QWidget.
        """
        if not isinstance(target_widget, QtGui.QWidget):  # QtWidgets.QWidget
            raise TypeError('targetWidget is not a QWidget (or child of it')

        # Get some variables from kwargs.
        useGlobalCSS = kwargs.get(u'useGlobalCSS', False)
        self.useQueue = kwargs.get(u'useQueue', True)
        self.maxMessages = kwargs.get(u'maxMessages', 2)

        super(QNotificationArea, self).__init__(*args, **kwargs)

        if not useGlobalCSS:
            self.setStyleSheet(self.default_notification_styles)

        if self.useQueue:
            self.queue = Queue()

        self.setParent(target_widget)
        self.targetWidget = target_widget
        self.setContentsMargins(0, 0, 0, 0)

        notification_area_layout = QtGui.QVBoxLayout()  # QtWidgets.QVBoxLayout()
        self.setLayout(notification_area_layout)

        # Init effects to None
        self.entryEffect = None
        self.entryEffectDuration = None
        self.exitEffect = None
        self.exitEffectDuration = None

        # Notifications area geometry animation.
        self.slideAnimation = QtCore.QPropertyAnimation(self, safe_encode("geometry"))
        self._slide_right_limit = None

        # Store original target classes resizeEvent to be called in our own function.
        self.target_resize_event = target_widget.resizeEvent
        # Overwrite resizeEvent function of targetWidget to capture it our-self
        # (parent's resizeEvent will be called in our function too).
        self.targetWidget.resizeEvent = self.resizeEvent
        self.hide()
Ejemplo n.º 29
0
 def showNormal3(self):
     if self.isFullScreen():
         self.main_layout.setContentsMargins(10,7,10,7)
         self.animation = QtCore.QPropertyAnimation(self,"geometry")
         self.animation.setDuration(180)
         self.animation.setEndValue(self.normalGeometry2)
         self.animation.setStartValue(self.desktop.availableGeometry(self.desktop.screenNumber(self.widget)))
         self.animation.finished.connect(self.showNormal2)
         self.animationEndFlag = 0
         self.animation.start()
         return 0
     return 1
Ejemplo n.º 30
0
 def initUI(self, parent):
     self.parent = parent
     self.label = QtGui.QLabel(self)
     self.image = QtGui.QPixmap('pix/logo.png')
     self.label.setPixmap(self.image)
     self.label.setGeometry(0, 0, 160 * self.parent.parent.cte,
                            30 * self.parent.parent.cte)
     self.label.animate = QtCore.QPropertyAnimation(self, "geometry")
     self.label.animate.setDuration(1770)
     self.label.animate.setStartValue(QtCore.QRect(0, -60, 160, 144))
     self.label.animate.setEndValue(QtCore.QRect(0, 55, 160, 144))
     self.label.animate.start()