本文整理汇总了Python中demoitemanimation.DemoItemAnimation.stop方法的典型用法代码示例。如果您正苦于以下问题:Python DemoItemAnimation.stop方法的具体用法?Python DemoItemAnimation.stop怎么用?Python DemoItemAnimation.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类demoitemanimation.DemoItemAnimation
的用法示例。
在下文中一共展示了DemoItemAnimation.stop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TextButton
# 需要导入模块: from demoitemanimation import DemoItemAnimation [as 别名]
# 或者: from demoitemanimation.DemoItemAnimation import stop [as 别名]
class TextButton(DemoItem):
BUTTON_WIDTH = 180
BUTTON_HEIGHT = 19
LEFT, RIGHT = range(2)
SIDEBAR, PANEL, UP, DOWN = range(4)
ON, OFF, HIGHLIGHT, DISABLED = range(4)
def __init__(self, text, align=LEFT, userCode=0, parent=None, type=SIDEBAR):
super(TextButton, self).__init__(parent)
# Prevent a circular import.
from menumanager import MenuManager
self._menu_manager = MenuManager.instance()
self.menuString = text
self.buttonLabel = text
self.alignment = align
self.buttonType = type
self.userCode = userCode
self.scanAnim = None
self.bgOn = None
self.bgOff = None
self.bgHighlight = None
self.bgDisabled = None
self.state = TextButton.OFF
self.setAcceptHoverEvents(True)
self.setCursor(Qt.PointingHandCursor)
# Calculate the button size.
if type in (TextButton.SIDEBAR, TextButton.PANEL):
self.logicalSize = QSize(TextButton.BUTTON_WIDTH, TextButton.BUTTON_HEIGHT)
else:
self.logicalSize = QSize(int((TextButton.BUTTON_WIDTH / 2.0) - 5), int(TextButton.BUTTON_HEIGHT * 1.5))
self._prepared = False
def setMenuString(self, menu):
self.menuString = menu
def prepare(self):
if not self._prepared:
self.setupHoverText()
self.setupScanItem()
self.setupButtonBg()
self._prepared = True
def boundingRect(self):
return QRectF(0, 0, self.logicalSize.width(),
self.logicalSize.height())
def setupHoverText(self):
if not self.buttonLabel:
return
textItem = DemoTextItem(self.buttonLabel, Colors.buttonFont(),
Colors.buttonText, -1, self)
textItem.setZValue(self.zValue() + 2)
textItem.setPos(16, 0)
def setupScanItem(self):
if Colors.useButtonBalls:
scanItem = ScanItem(self)
scanItem.setZValue(self.zValue() + 1)
self.scanAnim = DemoItemAnimation(scanItem)
x = 1.0
y = 1.5
stop = TextButton.BUTTON_WIDTH - scanItem.boundingRect().width() - x
if self.alignment == TextButton.LEFT:
self.scanAnim.setDuration(2500)
self.scanAnim.setKeyValueAt(0.0, QPointF(x, y))
self.scanAnim.setKeyValueAt(0.5, QPointF(x, y))
self.scanAnim.setKeyValueAt(0.7, QPointF(stop, y))
self.scanAnim.setKeyValueAt(1.0, QPointF(x, y))
scanItem.setPos(QPointF(x, y))
else:
self.scanAnim.setKeyValueAt(0.0, QPointF(stop, y))
self.scanAnim.setKeyValueAt(0.5, QPointF(x, y))
self.scanAnim.setKeyValueAt(1.0, QPointF(stop, y))
scanItem.setPos(QPointF(stop, y))
def setState(self, state):
self.state = state
self.bgOn.setRecursiveVisible(state == TextButton.ON)
self.bgOff.setRecursiveVisible(state == TextButton.OFF)
self.bgHighlight.setRecursiveVisible(state == TextButton.HIGHLIGHT)
self.bgDisabled.setRecursiveVisible(state == TextButton.DISABLED)
if state == TextButton.DISABLED:
self.setCursor(Qt.ArrowCursor)
else:
self.setCursor(Qt.PointingHandCursor)
def setupButtonBg(self):
self.bgOn = ButtonBackground(self.buttonType, True, True,
self.logicalSize, self)
#.........这里部分代码省略.........