本文整理汇总了Python中PyQt4.QtCore.QPropertyAnimation.startValue方法的典型用法代码示例。如果您正苦于以下问题:Python QPropertyAnimation.startValue方法的具体用法?Python QPropertyAnimation.startValue怎么用?Python QPropertyAnimation.startValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation.startValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CImprovedButton
# 需要导入模块: from PyQt4.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt4.QtCore.QPropertyAnimation import startValue [as 别名]
#.........这里部分代码省略.........
if self.__opacity <= 1.0:
self.__opacity += self.__opacity_fading_coefficient
self.__opacity_effect.setOpacity(self.__opacity)
self.setGraphicsEffect(self.__opacity_effect)
else:
self.__fading_timer.stop()
# FUNZIONI PER GROW\SHRINK
def __on_growed(self):
self.__animationShrink.setStartValue(QSize(self.iconSize().width(), self.iconSize().height()))
self.__animationShrink.setEndValue(
QSize(self.iconSize().width() - self.__iconGrowsBy, self.iconSize().height() - self.__iconGrowsBy))
self.__animationShrink.start()
def __on_shrinked(self):
self.__animationGrow.setStartValue(QSize(self.iconSize().width(), self.iconSize().height()))
self.__animationGrow.setEndValue(
QSize(self.iconSize().width() + self.__iconGrowsBy, self.iconSize().height() + self.__iconGrowsBy))
self.__animationGrow.start()
def startGrow(self):
"""
Button ICON starts to grow and shrink to standard value when maximum size (configured) is reached
"""
if self.__growing:
return
self.__animationGrow.setStartValue(QSize(self.iconSize().width(), self.iconSize().height()))
self.__animationGrow.setEndValue(
QSize(self.iconSize().width() + self.__iconGrowsBy, self.iconSize().height() + self.__iconGrowsBy))
self.__animationGrow.start()
self.__growing = True
def stopGrow(self):
if self.__animationGrow.startValue().toSize() != QSize(0,
0) and self.__animationShrink.startValue().toSize() != QPoint(
0, 0):
self.__animationGrow.stop()
self.__animationShrink.stop()
self.setIconSize(QSize(self.__defaultIconDimension, self.__defaultIconDimension))
self.__growing = False
#FUNZIONI PER BOUNCE
def startBounce(self):
"""
Button starts to bounce requiring attention.
"""
if self.__bouncing:
return
self.__startPos = QPoint(self.pos().x(), self.pos().y())
self.__animationUp.setStartValue(QPoint(self.__startPos.x(), self.__startPos.y()))
self.__animationUp.setEndValue(QPoint(self.__startPos.x(), self.__startPos.y() - self.geometry().height()))
self.__animationUp.start()
self.__bouncing = True
def stopBounce(self):
if self.__animationUp.startValue().toPoint() != QPoint(0,0) and self.__animationBounce.startValue().toPoint() != QPoint(0,0):
self.__animationBounce.stop()
self.__animationUp.stop()
self.setGeometry(self.__startPos.x(), self.__startPos.y(), self.geometry().width(), self.geometry().height())
self.__bouncing = False
def __on_top_reached(self):
self.__animationBounce.setStartValue(QPoint(self.pos().x(), self.pos().y()))
self.__animationBounce.setEndValue(QPoint(self.__startPos.x(), self.__startPos.y()))
self.__animationBounce.start()
示例2: ScreensharingToolbox
# 需要导入模块: from PyQt4.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt4.QtCore.QPropertyAnimation import startValue [as 别名]
#.........这里部分代码省略.........
self.setupUi()
parent.installEventFilter(self)
self.animation = QPropertyAnimation(self, 'pos')
self.animation.setDuration(250)
self.animation.setDirection(QPropertyAnimation.Forward)
self.animation.setEasingCurve(QEasingCurve.Linear) # or OutCirc with 300ms
self.retract_timer = QTimer(self)
self.retract_timer.setInterval(3000)
self.retract_timer.setSingleShot(True)
self.retract_timer.timeout.connect(self.retract)
self.resize(self.size().expandedTo(self.toolbox_layout.minimumSize()))
def setupUi(self):
super(ScreensharingToolbox, self).setupUi(self)
# fix the SVG icons, as the generated code loads them as pixmaps, losing their ability to scale -Dan
scale_icon = QIcon()
scale_icon.addFile(Resources.get('icons/scale.svg'), mode=QIcon.Normal, state=QIcon.Off)
viewonly_icon = QIcon()
viewonly_icon.addFile(Resources.get('icons/viewonly.svg'), mode=QIcon.Normal, state=QIcon.Off)
screenshot_icon = QIcon()
screenshot_icon.addFile(Resources.get('icons/screenshot.svg'), mode=QIcon.Normal, state=QIcon.Off)
fullscreen_icon = QIcon()
fullscreen_icon.addFile(Resources.get('icons/fullscreen.svg'), mode=QIcon.Normal, state=QIcon.Off)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Normal, state=QIcon.On)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Active, state=QIcon.On)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Disabled, state=QIcon.On)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Selected, state=QIcon.On)
minimize_icon = QIcon()
minimize_icon.addFile(Resources.get('icons/minimize.svg'), mode=QIcon.Normal, state=QIcon.Off)
minimize_icon.addFile(Resources.get('icons/minimize-active.svg'), mode=QIcon.Active, state=QIcon.Off)
close_icon = QIcon()
close_icon.addFile(Resources.get('icons/close.svg'), mode=QIcon.Normal, state=QIcon.Off)
close_icon.addFile(Resources.get('icons/close-active.svg'), mode=QIcon.Active, state=QIcon.Off)
self.scale_action.setIcon(scale_icon)
self.viewonly_action.setIcon(viewonly_icon)
self.screenshot_action.setIcon(screenshot_icon)
self.fullscreen_action.setIcon(fullscreen_icon)
self.minimize_action.setIcon(minimize_icon)
self.close_action.setIcon(close_icon)
self.scale_button.setIcon(scale_icon)
self.viewonly_button.setIcon(viewonly_icon)
self.screenshot_button.setIcon(screenshot_icon)
self.fullscreen_button.setIcon(fullscreen_icon)
self.minimize_button.setIcon(minimize_icon)
self.close_button.setIcon(close_icon)
self.scale_button.setDefaultAction(self.scale_action)
self.viewonly_button.setDefaultAction(self.viewonly_action)
self.screenshot_button.setDefaultAction(self.screenshot_action)
self.fullscreen_button.setDefaultAction(self.fullscreen_action)
self.minimize_button.setDefaultAction(self.minimize_action)
self.close_button.setDefaultAction(self.close_action)
self.color_depth_button.clear()
self.color_depth_button.addItem('Default Color Depth', ServerDefault)
self.color_depth_button.addItem('TrueColor (24 bits)', TrueColor)
self.color_depth_button.addItem('HighColor (16 bits)', HighColor)
self.color_depth_button.addItem('LowColor (8 bits)', LowColor)
def eventFilter(self, watched, event):
if watched is self.parent() and event.type() == QEvent.Resize:
new_x = (watched.width() - self.width()) / 2
self.move(new_x, self.y())
self.animation.setStartValue(QPoint(new_x, -self.height() + self.exposedPixels))
self.animation.setEndValue(QPoint(new_x, 0))
return False
def enterEvent(self, event):
super(ScreensharingToolbox, self).enterEvent(event)
self.retract_timer.stop()
self.expose()
def leaveEvent(self, event):
super(ScreensharingToolbox, self).leaveEvent(event)
self.retract_timer.start()
def paintEvent(self, event): # make the widget style aware
option = QStyleOption()
option.init(self)
painter = QStylePainter(self)
painter.drawPrimitive(QStyle.PE_Widget, option)
def expose(self):
if self.animation.state() == QPropertyAnimation.Running and self.animation.direction() == QPropertyAnimation.Forward:
return
elif self.animation.state() == QPropertyAnimation.Stopped and self.pos() == self.animation.endValue():
return
self.animation.setDirection(QPropertyAnimation.Forward)
self.animation.start()
def retract(self):
if self.animation.state() == QPropertyAnimation.Running and self.animation.direction() == QPropertyAnimation.Backward:
return
elif self.animation.state() == QPropertyAnimation.Stopped and self.pos() == self.animation.startValue():
return
self.animation.setDirection(QPropertyAnimation.Backward)
self.animation.start()