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


Python QApplication.instance方法代码示例

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


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

示例1: __init__

# 需要导入模块: from spyderlib.qt.QtGui import QApplication [as 别名]
# 或者: from spyderlib.qt.QtGui.QApplication import instance [as 别名]
    def __init__(self, target, executable=None, name=None,
                 extra_args=None, libs=None, cwd=None, env=None):
        super(AsyncClient, self).__init__()
        self.executable = executable or sys.executable
        self.extra_args = extra_args
        self.target = target
        self.name = name or self
        self.libs = libs
        self.cwd = cwd
        self.env = env
        self.is_initialized = False
        self.closing = False
        self.context = zmq.Context()
        QApplication.instance().aboutToQuit.connect(self.close)

        # Set up the heartbeat timer.
        self.timer = QTimer(self)
        self.timer.timeout.connect(self._heartbeat)
        self.timer.start(HEARTBEAT)
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:21,代码来源:plugin_client.py

示例2: qapplication

# 需要导入模块: from spyderlib.qt.QtGui import QApplication [as 别名]
# 或者: from spyderlib.qt.QtGui.QApplication import instance [as 别名]
def qapplication(translate=True):
    """Return QApplication instance
    Creates it if it doesn't already exist"""
    app = QApplication.instance()
    if not app:
        # Set Application name for Gnome 3
        # https://groups.google.com/forum/#!topic/pyside/24qxvwfrRDs
        app = QApplication(['Spyder'])
    if translate:
        install_translator(app)
    return app
开发者ID:jromang,项目名称:retina-old,代码行数:13,代码来源:qthelpers.py

示例3: start

# 需要导入模块: from spyderlib.qt.QtGui import QApplication [as 别名]
# 或者: from spyderlib.qt.QtGui.QApplication import instance [as 别名]
    def start(self):
        """Start a new connection with the plugin.
        """
        self._initialized = False
        plugin_name = self.plugin_name
        self.sock, server_port = connect_to_port()
        self.sock.listen(2)
        QApplication.instance().aboutToQuit.connect(self.close)

        self.process = QProcess(self)
        self.process.setWorkingDirectory(os.path.dirname(__file__))
        processEnvironment = QProcessEnvironment()
        env = self.process.systemEnvironment()
        python_path = imp.find_module('spyderlib')[1]
        # Use the current version of the plugin provider if possible.
        try:
            provider_path = imp.find_module(self.plugin_name)[1]
            python_path = os.sep.join([python_path, provider_path])
        except ImportError:
            pass
        env.append("PYTHONPATH=%s" % python_path)
        for envItem in env:
            envName, separator, envValue = envItem.partition('=')
            processEnvironment.insert(envName, envValue)
        self.process.setProcessEnvironment(processEnvironment)
        p_args = ['-u', 'plugin_server.py', str(server_port), plugin_name]

        self.listener = PluginListener(self.sock)
        self.listener.request_handled.connect(self.request_handled.emit)
        self.listener.initialized.connect(self._on_initialized)
        self.listener.start()

        self.process.start(self.executable, p_args)
        self.process.finished.connect(self._on_finished)
        running = self.process.waitForStarted()
        if not running:
            raise IOError('Could not start plugin %s' % plugin_name)
开发者ID:AungWinnHtut,项目名称:spyder,代码行数:39,代码来源:plugin_client.py


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