本文整理汇总了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
示例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
示例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()
示例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
示例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
示例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
示例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
示例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)
示例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 []
示例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)
示例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()
示例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)
示例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
示例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'