Ejemplo n.º 1
0
    def slideInWidget(self, widget, direction=Automatic):
        if self.indexOf(widget) == -1 or widget is self.currentWidget():
            return

        if self._active:
            return

        self._active = True

        prev_widget = self.currentWidget()
        next_widget = widget

        if direction == self.Automatic:
            if self.indexOf(prev_widget) < self.indexOf(next_widget):
                direction = self.BottomToTop if self.verticalMode else self.RightToLeft
            else:
                direction = self.TopToBottom if self.verticalMode else self.LeftToRight

        width = self.frameRect().width()
        height = self.frameRect().height()

        # the following is important, to ensure that the new widget has correct geometry information when sliding in the first time
        next_widget.setGeometry(0, 0, width, height)

        if direction in (self.TopToBottom, self.BottomToTop):
            offset = QPoint(
                0, height if direction == self.TopToBottom else -height)
        elif direction in (self.LeftToRight, self.RightToLeft):
            offset = QPoint(width if direction == self.LeftToRight else -width,
                            0)

        # re-position the next widget outside of the display area
        prev_widget_position = prev_widget.pos()
        next_widget_position = next_widget.pos()

        next_widget.move(next_widget_position - offset)
        next_widget.show()
        next_widget.raise_()

        prev_widget_animation = QPropertyAnimation(prev_widget, "pos")
        prev_widget_animation.setDuration(self.animationDuration)
        prev_widget_animation.setEasingCurve(
            QEasingCurve(self.animationEasingCurve))
        prev_widget_animation.setStartValue(prev_widget_position)
        prev_widget_animation.setEndValue(prev_widget_position + offset)

        next_widget_animation = QPropertyAnimation(next_widget, "pos")
        next_widget_animation.setDuration(self.animationDuration)
        next_widget_animation.setEasingCurve(
            QEasingCurve(self.animationEasingCurve))
        next_widget_animation.setStartValue(next_widget_position - offset)
        next_widget_animation.setEndValue(next_widget_position)

        self._animation_group.clear()
        self._animation_group.addAnimation(prev_widget_animation)
        self._animation_group.addAnimation(next_widget_animation)
        self._animation_group.start()
Ejemplo n.º 2
0
    def trigger(self, ui):
        """
        Trigger this animation
        """
        damage_counter = DamageCounter(damage=str(self.damage),
                                       colour=self.colour,
                                       parent=ui)
        ui.view.scene().addItem(damage_counter)
        damage_counter.setZValue(zorder_counter)

        bounds = damage_counter.boundingRect()
        width = bounds.width()

        rand = Random()

        damage_counter.setPos((self.location[0] * 32
                               + 16 - (width / 2)
                               + rand.randint(-16, 16)) + self.offset[0],
                              self.location[1] * 32 + self.offset[1])

        animation = QSequentialAnimationGroup()

        moving = QPropertyAnimation(damage_counter.adapter,
                                    'y_location')
        moving.setDuration(750)
        moving.setStartValue(self.location[1] * 32 + self.offset[1])
        moving.setEndValue(self.location[1] * 32 - 32 + self.offset[1])
        curve = QEasingCurve(QEasingCurve.OutElastic)
        moving.setEasingCurve(curve)
        animation.addAnimation(moving)

        fading = QPropertyAnimation(damage_counter.adapter,
                                    'opacity')
        fading.setDuration(750)
        fading.setStartValue(1.0)
        fading.setEndValue(0.0)
        animation.addAnimation(fading)

        def clean_up():
            animation.stop()
            ui.animations.remove(animation)
            ui.view.items().remove(damage_counter)
            ui.remove_finished_animation()

        animation.finished.connect(clean_up)
        ui.animations.append(animation)

        animation.start()
Ejemplo n.º 3
0
    def trigger(self, ui):
        """
        Trigger this animation
        """
        glyph = [
            glyph for glyph in ui.scene.items()
            if hasattr(glyph, 'entity') and glyph.entity == self.mover
        ][0]

        if self.direction in (2, 3, 4):
            self.flipped = True
            self.offset = 32

        if self.direction in (6, 7, 8):
            self.flipped = False
            self.offset = 0

        if self.flipped:
            glyph.flipped = True
            glyph.setTransform(QTransform.fromScale(-1, 1))
        else:
            glyph.flipped = False
            glyph.setTransform(QTransform.fromScale(1, 1))

        if glyph.entity.artificial_intelligence:
            adapter = MapGlyphAdapter(ui, glyph)
        else:
            adapter = MapGlyphAdapter(ui, glyph, True)

        animation = QParallelAnimationGroup()

        move_y = QPropertyAnimation(adapter, 'y_location')
        move_y.setDuration(100)
        move_y.setStartValue(self.start[1] * 32)
        move_y.setEndValue(self.destination[1] * 32)

        move_x = QPropertyAnimation(adapter, 'x_location')
        move_x.setDuration(100)
        move_x.setStartValue(self.start[0] * 32 + self.offset)
        move_x.setEndValue(self.destination[0] * 32 + self.offset)

        animation.addAnimation(move_y)
        animation.addAnimation(move_x)

        ui.animations.append(animation)
        animation.finished.connect(ui.remove_finished_animation)

        animation.start()
Ejemplo n.º 4
0
    def __init__(self, parent):
        super(MiniMap, self).__init__(parent)
        self.setWordWrapMode(QTextOption.NoWrap)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setReadOnly(True)
        self.setCenterOnScroll(True)
        self.setMouseTracking(True)
        self.viewport().setCursor(Qt.PointingHandCursor)
        self.setTextInteractionFlags(Qt.NoTextInteraction)

        self._parent = parent
        self.highlighter = None
        self.lines_count = 0

        self.connect(self._parent, SIGNAL("updateRequest(const QRect&, int)"),
                     self.update_visible_area)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")

        self.slider = SliderArea(self)
        self.slider.show()
Ejemplo n.º 5
0
    def __init__(self, parent):
        super(HtmlViewerWidget, self).__init__(parent)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.view = QWebView()
        self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.frame = QFrame()
        self.frame.setLayout(QGridLayout())
        self.frame.layout().setContentsMargins(0, 0, 0, 0)

        self.toolbar = QToolBar()
        self.spacer = QWidget()
        self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"),
                                                 "Copy Text")
        self.label = QLabel()
        self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"),
                                                  "Close")
        self.spaceraction = self.toolbar.insertWidget(self.closeAction,
                                                      self.spacer)
        self.labelaction = self.toolbar.insertWidget(self.spaceraction,
                                                     self.label)
        self.closeAction.triggered.connect(self.close)
        self.copyAction.triggered.connect(self.copy_text)
        self.layout().addWidget(self.frame)
        self.frame.layout().addWidget(self.toolbar)
        self.frame.layout().addWidget(self.view)

        self.effect = QGraphicsOpacityEffect()
        self.label.setGraphicsEffect(self.effect)
        self.anim = QPropertyAnimation(self.effect, "opacity")
        self.anim.setDuration(2000)
        self.anim.setStartValue(1.0)
        self.anim.setEndValue(0.0)
        self.anim.setEasingCurve(QEasingCurve.OutQuad)
Ejemplo n.º 6
0
 def anim_right(self):
     animation = QPropertyAnimation(self.label_icon, "geometry")
     animation.setDuration(250)
     animation.setStartValue(QRect(20, 0, 20, 20))
     animation.setEndValue(QRect(0, 0, 20, 20))
     animation.start()
     self.animation = animation
Ejemplo n.º 7
0
 def move(self, pos):
     ''' A simple animation to move the letter '''
     self.animation = QPropertyAnimation(self, 'pos')
     self.animation.setDuration(100)
     self.animation.setStartValue(self.scenePos())
     self.animation.setEndValue(pos)
     self.animation.start()
Ejemplo n.º 8
0
    def __init__(self, parent):
        super(MiniMap, self).__init__(parent)
        #self.setWordWrapMode(QTextOption.NoWrap)
        #self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        #self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setReadOnly(True)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
        self.setMarginWidth(1, 0)
        self.setFolding(self.NoFoldStyle, 2)
        #self.setCenterOnScroll(True)
        self.setMouseTracking(True)
        #self.viewport().setCursor(Qt.PointingHandCursor)
        #self.setTextInteractionFlags(Qt.NoTextInteraction)

        self._parent = parent
        #self.highlighter = None
        #self.lines_count = 0

        self.connect(self._parent, SIGNAL("updateRequest(const QRect&, int)"),
                     self.update_visible_area)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")
Ejemplo n.º 9
0
    def __init__(self, parent=None, animationEnabled=True):
        QFrame.__init__(self, parent)
        self.__animationEnabled = animationEnabled

        layout = StackLayout()

        self.__fadeWidget = CrossFadePixmapWidget(self)

        self.transitionAnimation = \
            QPropertyAnimation(self.__fadeWidget, "blendingFactor_", self)
        self.transitionAnimation.setStartValue(0.0)
        self.transitionAnimation.setEndValue(1.0)
        self.transitionAnimation.setDuration(100 if animationEnabled else 0)
        self.transitionAnimation.finished.connect(
            self.__onTransitionFinished
        )

        layout.addWidget(self.__fadeWidget)
        layout.currentChanged.connect(self.__onLayoutCurrentChanged)

        self.setLayout(layout)

        self.__widgets = []
        self.__currentIndex = -1
        self.__nextCurrentIndex = -1
Ejemplo n.º 10
0
    def __init__(self, parent=None):
        super(FileSelector, self).__init__(parent,
                                           Qt.Dialog | Qt.FramelessWindowHint)
        self.setObjectName("file-selector")
        self._files = {}
        self.effect = QGraphicsOpacityEffect()
        self.setGraphicsEffect(self.effect)
        self.animation = QPropertyAnimation(self.effect, "opacity")
        self.animation.setDuration(1500)
        box = QVBoxLayout(self)
        box.setSpacing(30)
        self.list_of_files = QListWidget()
        self.list_of_files.setObjectName("list-selector")
        box.addWidget(self.list_of_files)
        self.label_path = QLabel()
        box.addWidget(self.label_path)
        self._load_files()

        self.connect(self.list_of_files,
                     SIGNAL("itemSelectionChanged()"),
                     self._update_label)
        self.connect(self.list_of_files,
                     SIGNAL("itemActivated(QListWidgetItem*)"),
                     self._open_file)
        self.connect(self.list_of_files,
                     SIGNAL("itemEntered(QListWidgetItem*)"),
                     self._open_file)
Ejemplo n.º 11
0
	def createAnimationFromToFor(widget, fromValue, toValue, duration, propName, curve = QEasingCurve.InOutCubic):
		anim = QPropertyAnimation(widget, propName)
		anim.setDuration(duration)
		anim.setStartValue(fromValue)
		anim.setEndValue(toValue)
		anim.setEasingCurve(curve)
		return anim
Ejemplo n.º 12
0
    def __init__(self, editor):
        super(MiniMap, self).__init__(editor)
        self._editor = editor
        self.SendScintilla(QsciScintilla.SCI_SETCARETSTYLE, 0)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETZOOM, -10)
        self.SendScintilla(QsciScintilla.SCI_SETREADONLY, 1)
        self.SendScintilla(QsciScintilla.SCI_HIDESELECTION, 1)
        self.SendScintilla(QsciScintilla.SCI_SETCURSOR, 8)
        # Hide markers
        for i in range(1, 5):
            self.SendScintilla(QsciScintilla.SCI_MARKERDEFINE, i,
                               QsciScintilla.SC_MARK_EMPTY)
        self.SendScintilla(QsciScintilla.SCI_SETMARGINWIDTHN, 1, 0)

        self.setMouseTracking(True)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")
            self.animation.setDuration(300)

        self.slider = SliderArea(self)
        self.slider.show()
Ejemplo n.º 13
0
 def __init__(self, cid, data, cons=None, props=None):
     Cell.__init__(self, cid, data, cons, props)
     self.skin = None
     self.old_brush = None
     self.old_pen = None
     self.loaded = False
     self.initialMove = True
     self.animation = QPropertyAnimation()
 def __init__(self, parent=None):
     """ Inizializza il componente"""
     QStackedWidget.__init__(self, parent)
     self.__m_vertical = False
     self.__m_speed = 500
     self.__m_animationtype = QEasingCurve.OutQuint  #QEasingCurve.OutBack
     self.__m_now = 0
     self.__m_next = 0
     self.__m_pnow = QPoint(0, 0)
     self.__m_active = False
     self.__direction = self.__SLIDE_TYPE.RIGHT2LEFT
     self.__animgroup = QtCore.QParallelAnimationGroup()
     self.__animgroup.finished.connect(self.__animationDone)
     self.__animnext = QPropertyAnimation(None, "pos")
     self.__animnow = QPropertyAnimation(None, "pos")
     #self.setMinimumSize(300, 300)
     self.setStyleSheet("background-color: rgb(184, 184, 184);")
Ejemplo n.º 15
0
 def doAanim_fade(self, isBecomeVisible, duration=400, doStart=True):
     self.anim_fade = QPropertyAnimation(self, "opacity")
     self.anim_fade.setDuration(duration)
     self.anim_fade.setStartValue(0.0 if isBecomeVisible else 1.0)
     self.anim_fade.setEndValue(1.0 if isBecomeVisible else 0.0)
     self.anim_fade.setEasingCurve(QtCore.QEasingCurve.InCirc)
     if doStart:
         self.anim_fade.start()
     return self.anim_fade
Ejemplo n.º 16
0
 def doAanim_tilt(self, isTilted, duration=400, doStart=True):
     self.anim_tilt = QPropertyAnimation(self, "rotation")
     self.anim_tilt.setDuration(duration)
     self.anim_tilt.setStartValue(-30 if isTilted else 0)
     self.anim_tilt.setEndValue(0 if isTilted else -30)
     self.anim_tilt.setEasingCurve(QtCore.QEasingCurve.OutBack)
     if doStart:
         self.anim_tilt.start()
     return self.anim_tilt
Ejemplo n.º 17
0
    def __init__(self, id_, ad, nm, ip, ms='', gw='', dns='', parent=None):
        super(NetConfigTile, self).__init__(parent)
        self.animation = QPropertyAnimation(self, "size")
        self.setObjectName('tile')
        self.setCursor(QCursor(Qt.PointingHandCursor))

        effect = QGraphicsDropShadowEffect(self)
        effect.setOffset(0, 0)
        effect.setBlurRadius(20)
        self.setGraphicsEffect(effect)

        # self.setContextMenuPolicy(Qt.ActionsContextMenu)
        # action = QAction('edit', self)
        # self.addAction(action)
        self.setToolTip(
            'interfaz:  %s\nnombre: %s\nip:            %s\nmascara: %s\ngateway: %s\ndns:         %s'
            % (ad, nm, ip, ms, gw, dns))

        self.setFixedWidth(300)
        self.setMinimumHeight(90)
        self.ID = id_

        self.lbl_nm = QLabel(nm)
        self.lbl_nm.setObjectName('lbl_nm')
        self.lbl_ad = QLabel(ad)
        self.lbl_ad.setObjectName('lbl_ad')
        self.lbl_ip = QLabel(ip)
        self.lbl_ip.setObjectName('lbl_ip')
        self.lbl_ms = QLabel(ms)
        self.lbl_ms.setObjectName('lbl_ms')
        self.lbl_gw = QLabel(gw)
        self.lbl_gw.setObjectName('lbl_gw')
        self.lbl_dns = QLabel(dns)
        self.lbl_dns.setObjectName('lbl_dns')

        layout_left = QVBoxLayout()
        layout_left.addWidget(self.lbl_ad)
        layout_left.addWidget(self.lbl_nm)
        layout_left.addWidget(self.lbl_ip)

        layout_lbl = QHBoxLayout()
        layout_lbl.addLayout(layout_left)

        self.btn_remove = QPushButton()
        self.btn_remove.setFixedSize(QSize(60, 60))
        self.btn_remove.setObjectName('btn_remove')
        self.btn_remove.setCursor(QCursor(Qt.ArrowCursor))

        self.grid_layout = QGridLayout()
        self.grid_layout.addWidget(self.btn_remove, 1, 0)
        self.grid_layout.addLayout(layout_lbl, 1, 1, 1, 2)

        self.setLayout(self.grid_layout)
        self.setStyleSheet(self.load_style_sheet())

        self.connect(self.btn_remove, SIGNAL('released()'), self.remove_tile)
Ejemplo n.º 18
0
 def animation_geometry(self, widget, init=(35, 250, 250, 200), end=(35, 250, 250, 200), finish=None, duration=2000):
     init_rect = QRect(init[0], init[1], init[2], init[3])
     end_rect = QRect(end[0], end[1], end[2], end[3])
     self.animation = QPropertyAnimation(widget, "geometry")
     self.animation.setStartValue(init_rect)
     self.animation.setEndValue(end_rect)
     self.animation.setDuration(duration)
     self.animation.start()
     if finish:
         self.connect(self.animation, SIGNAL('finished()'), finish)
Ejemplo n.º 19
0
 def fade(self):
     if self.animation:
         self.animation.stop()
     self.deleted = True
     self.animation = QPropertyAnimation(self, 'opacity')
     self.animation.setDuration(250)
     self.animation.setStartValue(self.opacity())
     self.animation.setEndValue(0)
     self.animation.finished.connect(self.remove)
     self.animation.start()
Ejemplo n.º 20
0
 def returnToOriginalPoint(self):
     """ Label returns to its original position. The original position is stored when calling moveTo() method.
     """
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(
         QPoint(self.pos().x(),
                self.pos().y()))
     self.__moveAnimation.setEndValue(self.__starting_position)
     self.__moveAnimation.start()
Ejemplo n.º 21
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        self.__splitter = None
        self.__widget = None
        self.__animationEnabled = True
        self.__size = -1
        self.__expanded = False
        self.__animation = QPropertyAnimation(self, b"size_", self)

        self.__action = QAction("toogle-expanded", self, checkable=True)
        self.__action.triggered[bool].connect(self.setExpanded)
Ejemplo n.º 22
0
 def __init__(self, canvas):
     super(CurrentSelection, self).__init__(canvas)
     self.outline = QgsRubberBand(canvas)
     self.outline.setBrushStyle(Qt.NoBrush)
     self.outline.setWidth(5)
     self.outline.setIconSize(30)
     self.aniobject = CurrentSelection.AniObject(self)
     self.anim = QPropertyAnimation(self.aniobject, "alpha")
     self.anim.setDuration(500)
     self.anim.setStartValue(50)
     self.anim.setEndValue(100)
     self.anim.valueChanged.connect(self.value_changed)
Ejemplo n.º 23
0
 def __init__(self, minimap):
     QFrame.__init__(self, minimap)
     self._minimap = minimap
     self.setStyleSheet("background: gray; border-radius: 3px;")
     # Opacity
     self.effect = QGraphicsOpacityEffect()
     self.setGraphicsEffect(self.effect)
     self.effect.setOpacity(0.2)
     # Animación
     self.animation = QPropertyAnimation(self.effect, "opacity")
     self.animation.setDuration(150)
     # Cursor
     self.setCursor(Qt.OpenHandCursor)
Ejemplo n.º 24
0
def animated_resize(widget, width=0, height=0):
    """ Perform an animated resize on the given widget to the given width and height.

        :param widget: The widget to resize.
        :param width: The width to resize too.
        :param height: The height to resize too.
        :return: The QPropertyAnimation object that was created and started.
    """
    animation = QPropertyAnimation(widget, 'size')
    animation.setEndValue(QSize(width, height))
    animation.start()

    return animation
Ejemplo n.º 25
0
 def __init__(self, parent=None):
     '''
     Constructor
     '''
     QSlider.__init__(self, parent)
     self.setOrientation(QtCore.Qt.Horizontal)
     self.animationType = QEasingCurve.OutExpo
     self.animation = QPropertyAnimation(self, "value")
     self.animation.setDuration(250)
     self.animation.finished.connect(self.animationDone)
     self.resize(85, 50)
     self.clicked.connect(self.changeValue)
     self.setStyleSheet(self.styleKnob + self.styleBkgOFF)
Ejemplo n.º 26
0
 def returnToOriginalPoint(self):
     """ Panel returns in its original position. The original position is stored when calling moveTo() method.
     """
     if self.__is_moving:
         return
     self.__is_moving = True
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.finished.connect(self.__on_finished_moving)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(QPoint(self.pos().x(), self.pos().y()))
     self.__moveAnimation.setEndValue(self.__starting_position)
     self.__moveAnimation.start()
Ejemplo n.º 27
0
    def __init__(self, parent=None):
        GraphicsPathObject.__init__(self, parent)
        assert (isinstance(parent, NodeItem))

        self.__processingState = 0
        self.__progress = -1
        self.__animationEnabled = False
        self.__isSelected = False
        self.__hasFocus = False
        self.__hover = False
        self.__shapeRect = QRectF(-10, -10, 20, 20)

        self.setAcceptHoverEvents(True)

        self.setFlag(QGraphicsItem.ItemSendsScenePositionChanges, True)
        self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)

        self.setPen(QPen(Qt.NoPen))

        self.setPalette(default_palette())

        self.shadow = QGraphicsDropShadowEffect(
            blurRadius=3,
            color=QColor(SHADOW_COLOR),
            offset=QPointF(0, 0),
        )

        self.setGraphicsEffect(self.shadow)
        self.shadow.setEnabled(True)

        self.__blurAnimation = QPropertyAnimation(self.shadow, "blurRadius",
                                                  self)
        self.__blurAnimation.setDuration(100)
        self.__blurAnimation.finished.connect(self.__on_finished)

        self.__pingAnimation = QPropertyAnimation(self, "scale", self)
        self.__pingAnimation.setDuration(250)
        self.__pingAnimation.setKeyValues([(0.0, 1.0), (0.5, 1.1), (1.0, 1.0)])
Ejemplo n.º 28
0
 def moveTo(self, x, y):
     """ Move itself to a given point with the given animation in the given duration.
     @param x: X point coordinate
     @type x: int
     @param y: Y point coordinate
     @type y: int
     """
     self.__starting_position = QPoint(self.pos())
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(self.__starting_position)
     self.__moveAnimation.setEndValue(QPoint(x, y))
     self.__moveAnimation.start()
Ejemplo n.º 29
0
 def set_pos_animated(self, pos):
     if (self.pos() -
             pos).manhattanLength() < 6 or not self.graph.animate_plot:
         self.setPos(pos)
     else:
         t = 250
         if self._floating_animation and self._floating_animation.state(
         ) == QPropertyAnimation.Running:
             t = t - self._floating_animation.currentTime()
             self._floating_animation.stop()
         self._floating_animation = QPropertyAnimation(self, 'pos')
         self._floating_animation.setEndValue(pos)
         self._floating_animation.setDuration(t)
         self._floating_animation.start(QPropertyAnimation.KeepWhenStopped)
Ejemplo n.º 30
0
 def doAnim_slide(self, to_widget, duration=200, doStart=True):
     if to_widget is None:
         self.anim_slide = None
         return
     posGlobal = self.fields_widget.mapToGlobal(
         to_widget.geometry().center())
     posLocal = self.table_widget.mapFromGlobal(posGlobal)
     self.anim_slide = QPropertyAnimation(self, "pos")
     self.anim_slide.setDuration(duration)
     self.anim_slide.setStartValue(self.pos())
     self.anim_slide.setEndValue(posLocal)
     self.anim_slide.setEasingCurve(QtCore.QEasingCurve.InOutQuint)
     if doStart:
         self.anim_slide.start()
     return self.anim_slide