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


Python QApplication.instance方法代码示例

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


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

示例1: init_qt_clipboard

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def init_qt_clipboard():
    # $DISPLAY should exist

    # Try to import from qtpy, but if that fails try PyQt5 then PyQt4
    try:
        from qtpy.QtWidgets import QApplication
    except ImportError:
        try:
            from PyQt5.QtWidgets import QApplication
        except ImportError:
            from PyQt4.QtGui import QApplication

    app = QApplication.instance()
    if app is None:
        app = QApplication([])

    def copy_qt(text):
        cb = app.clipboard()
        cb.setText(text)

    def paste_qt():
        cb = app.clipboard()
        return text_type(cb.text())

    return copy_qt, paste_qt 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:27,代码来源:clipboards.py

示例2: init_qt_clipboard

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def init_qt_clipboard():
    # $DISPLAY should exist
    from PyQt4.QtGui import QApplication

    # use the global instance if it exists
    app = QApplication.instance() or QApplication([])

    def copy_qt(text):
        cb = app.clipboard()
        cb.setText(text)

    def paste_qt():
        cb = app.clipboard()
        return text_type(cb.text())

    return copy_qt, paste_qt 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:18,代码来源:clipboards.py

示例3: on_change

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def on_change(self):
        """Call when a change is detected."""
        self._log.debug('Change detected...')

        # If a QApplication event loop has not been started
        # call compile_and_dispatch in the current thread.
        if not QApplication.instance():
            return super(PollingWatcher, self).compile_and_dispatch()

        # Create and use a QtDispatcher to ensure compile and any
        # connected callbacks get executed in the main gui thread.
        self.qtdispatcher.signal.emit() 
开发者ID:spyder-ide,项目名称:qtsass,代码行数:14,代码来源:qt.py

示例4: init_qt_clipboard

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def init_qt_clipboard():
    global QApplication
    # $DISPLAY should exist

    # Try to import from qtpy, but if that fails try PyQt5 then PyQt4
    try:
        from qtpy.QtWidgets import QApplication
    except:
        try:
            from PyQt5.QtWidgets import QApplication
        except:
            from PyQt4.QtGui import QApplication

    app = QApplication.instance()
    if app is None:
        app = QApplication([])

    def copy_qt(text):
        text = _stringifyText(text) # Converts non-str values to str.
        cb = app.clipboard()
        cb.setText(text)

    def paste_qt():
        cb = app.clipboard()
        return STR_OR_UNICODE(cb.text())

    return copy_qt, paste_qt 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:29,代码来源:__init__.py

示例5: _currentNativeRenderer

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def _currentNativeRenderer(self):
		"""
			\remarks	return the current native renderer for this scene instance
			\return		<variant> nativeRenderer || None
		"""
		return None 
开发者ID:blurstudio,项目名称:cross3d,代码行数:8,代码来源:abstractscene.py

示例6: _NativeAtmospheric

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def _NativeAtmospheric(self, name='', uniqueId=0):
		"""
			\remarks	look up the native atmospheric from this scene instance
			\param		name	<str>
			\return		<variant> nativeAtmospheric || None
		"""
		return None 
开发者ID:blurstudio,项目名称:cross3d,代码行数:9,代码来源:abstractscene.py

示例7: _NativeFx

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def _NativeFx(self, name='', uniqueId=0):
		"""
			\remarks	look up the native fx from this scene instance
			\param		name	<str>
			\return		<variant> nativeFx || None
		"""
		return None 
开发者ID:blurstudio,项目名称:cross3d,代码行数:9,代码来源:abstractscene.py

示例8: applyTimeController

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def applyTimeController(self, controller, cachesFrameRate=None, include='', exclude='', bake=False, rnd=0.0):
		""" Applies a controller to all the time controller found in the scene.

		The expected controller should express time in seconds and will be applied as is to alembic modifiers/controllers.
		Any PC, TMC, XMesh or RayFireCache modifiers/controllers will be wired to the alembic ones through a float script that will both reference the alembic controller
		and the frame rate at which we know these point cache have been made. Unfortunately this information cannot be deduced from parsing the PC or TMC file.

		Args:
			controller(SceneAnimationController|FCurve): The controller we want to use for controlling time.
			cacheFrameRate(float): For TMCs, PCs, RayFireCaches there is currently no way to detect the frame rate at which they have been created.
			So if it happens to differ from the one set for that scene, the user will have to provide one.
			include(str): All the objects which name can be found by that regex will be included.
			exclude(str): All the objects which name can be found byt that regex will be excluded.
			bake(bool): If true the PC, TMC, XMesh and RayFireCache stuff will be baked to a curve instead of referencing the curve that drives alembic.
			rnd(float):

		Return:
			boolean: Wherther or not retime was applied with success.
		"""
		if isinstance(controller, api.FCurve):
			fCurve = controller
			nativeController = api.SceneAnimationController._abstractToNativeTypes.get(constants.ControllerType.BezierFloat)()
			controller = api.SceneAnimationController(self, nativeController)
			controller.setFCurve(fCurve)

		elif not isinstance(controller, api.SceneAnimationController):
			raise Exception('Argument 1 should be an instance of SceneAnimationController or FCurve.')

		return self._applyNativeTimeController(controller.nativePointer(), cachesFrameRate=cachesFrameRate, include=include, exclude=exclude, bake=bake, rnd=rnd) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:31,代码来源:abstractscene.py

示例9: cloneObjects

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def cloneObjects(self, objects, cloneHierarchy=False, cloneType=constants.CloneType.Copy):
		""" Duplicates the provided objects, optionally keeping the heierarchy.
		:param objects: A list of objects to clone
		:param cloneHierarchy: Duplicate parent child structure in clones. Defaults to False
		:param cloneType: Create clones as copy, instance, etc. Defaults to Copy.
		..seealso:: modules `cross3d.constants.CloneType`
		"""
		return [] 
开发者ID:blurstudio,项目名称:cross3d,代码行数:10,代码来源:abstractscene.py

示例10: emitSubmitError

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def emitSubmitError(self, error, progressSection='Submitting Job'):
		"""
			\remarks	emits the submit success signal if the signals are not blocked and cleans the submit process
			\param		error				<str>	resulting error feedback
			\param		progressSection		<str>	the name of the progress section to be updated using emitProgressUpdated
		"""
		from PyQt4.QtCore import Qt
		from PyQt4.QtGui import QApplication

		QApplication.instance().restoreOverrideCursor()

		if (not self.signalsBlocked()):
			self.progressErrored.emit(progressSection, error)
			self.submitError.emit(error) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:16,代码来源:abstractscene.py

示例11: emitSubmitSuccess

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def emitSubmitSuccess(self, progressSection='Submitting Job'):
		"""
			\remarks	emits the submit success signal if the signals are not blocked and cleans the submit process
			\param		progressSection		<str>	the name of the progress section to be updated using emitProgressUpdated
		"""
		from PyQt4.QtGui import QApplication

		QApplication.instance().restoreOverrideCursor()

		if (not self.signalsBlocked()):
			self.emitProgressUpdated(progressSection)
			self.submitSuccess.emit() 
开发者ID:blurstudio,项目名称:cross3d,代码行数:14,代码来源:abstractscene.py

示例12: setCurrentCamera

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def setCurrentCamera(self, camera):
		"""
			\remarks	return a SceneCamera instance containing the currently active camera in the scene
			\param		camera	<cross3d.SceneCamera> || None
			\return		<bool> success
		"""
		nativeCamera = None
		if (camera):
			nativeCamera = camera.nativePointer()

		return self._setCurrentNativeCamera(nativeCamera) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:13,代码来源:abstractscene.py

示例13: instance

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def instance():
		if (not AbstractScene._instance):
			from cross3d import Scene
			AbstractScene._instance = Scene()
		return AbstractScene._instance 
开发者ID:blurstudio,项目名称:cross3d,代码行数:7,代码来源:abstractscene.py

示例14: QPAquit

# 需要导入模块: from PyQt4.QtGui import QApplication [as 别名]
# 或者: from PyQt4.QtGui.QApplication import instance [as 别名]
def QPAquit():
    QApplication.instance().quit()
    os.popen("taskkill /F /IM CAP.exe")
    return 'ok' 
开发者ID:l7dpi,项目名称:openQPA,代码行数:6,代码来源:QPA.py


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