當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。