当前位置: 首页>>代码示例>>Python>>正文


Python QApplication.instance方法代码示例

本文整理汇总了Python中enaml.qt.QtGui.QApplication.instance方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.instance方法的具体用法?Python QApplication.instance怎么用?Python QApplication.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在enaml.qt.QtGui.QApplication的用法示例。


在下文中一共展示了QApplication.instance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clearAlert

# 需要导入模块: from enaml.qt.QtGui import QApplication [as 别名]
# 或者: from enaml.qt.QtGui.QApplication import instance [as 别名]
    def clearAlert(self):
        """ Clear the current alert level, if any.

        """
        if self._alert_data is not None:
            self._alert_data.timer.stop()
            self._alert_data = None
            app = QApplication.instance()
            app.focusChanged.disconnect(self._onAppFocusChanged)
            self.alerted.emit(u'')
开发者ID:MatthieuDartiailh,项目名称:enaml,代码行数:12,代码来源:q_dock_item.py

示例2: setUp

# 需要导入模块: from enaml.qt.QtGui import QApplication [as 别名]
# 或者: from enaml.qt.QtGui.QApplication import instance [as 别名]
 def setUp(self):
     qt_app = QApplication.instance()
     if qt_app is None:
         qt_app = QApplication([])
     self.qt_app = qt_app
     enaml_app = QtApplication.instance()
     if enaml_app is None:
         enaml_app = QtApplication()
     self.enaml_app = enaml_app
     self.event_loop_helper = EventLoopHelper(qt_app=self.qt_app)
开发者ID:JuergenNeubauer,项目名称:traits-enaml,代码行数:12,代码来源:gui_test_assistant.py

示例3: alert

# 需要导入模块: from enaml.qt.QtGui import QApplication [as 别名]
# 或者: from enaml.qt.QtGui.QApplication import instance [as 别名]
    def alert(self, level, on=250, off=250, repeat=4, persist=False):
        """ Set the alert level on the dock item.

        This will override any currently applied alert level.

        Parameters
        ----------
        level : unicode
            The alert level token to apply to the dock item.

        on : int
            The duration of the 'on' cycle, in ms. A value of -1 means
            always on.

        off : int
            The duration of the 'off' cycle, in ms. If 'on' is -1, this
            value is ignored.

        repeat : int
            The number of times to repeat the on-off cycle. If 'on' is
            -1, this value is ignored.

        persist : bool
            Whether to leave the alert in the 'on' state when the cycles
            finish. If 'on' is -1, this value is ignored.

        """
        if self._alert_data is not None:
            self.clearAlert()
        app = QApplication.instance()
        app.focusChanged.connect(self._onAppFocusChanged)
        timer = QTimer()
        timer.setSingleShot(True)
        timer.timeout.connect(self._onAlertTimer)
        on, off, repeat = max(-1, on), max(0, off), max(1, repeat)
        self._alert_data = _AlertData(timer, level, on, off, repeat, persist)
        if on < 0:
            self.alerted.emit(level)
        else:
            self._onAlertTimer()
开发者ID:MatthieuDartiailh,项目名称:enaml,代码行数:42,代码来源:q_dock_item.py


注:本文中的enaml.qt.QtGui.QApplication.instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。