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


Python Gaffer.lazyImport方法代码示例

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


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

示例1: _qtImport

# 需要导入模块: import Gaffer [as 别名]
# 或者: from Gaffer import lazyImport [as 别名]
def _qtImport( name, lazy=False ) :

	# decide which qt bindings to use, and apply any fix-ups we need
	# to shield us from PyQt/PySide differences.
	global __qtModuleName
	if __qtModuleName is None :
		import os
		if "GAFFERUI_QT_BINDINGS" in os.environ :
			__qtModuleName = os.environ["GAFFERUI_QT_BINDINGS"]
		else :
			# no preference stated via environment - see what we shipped with
			if os.path.exists( os.environ["GAFFER_ROOT"] + "/python/PySide" ) :
				__qtModuleName = "PySide"
			else :
				__qtModuleName = "PyQt4"

		# PyQt unfortunately uses an implementation-specific
		# naming scheme for its new-style signal and slot classes.
		# We use this to make it compatible with PySide, according to :
		#
		#     http://qt-project.org/wiki/Differences_Between_PySide_and_PyQt
		if "PyQt" in __qtModuleName :
			QtCore = __import__( __qtModuleName + ".QtCore" ).QtCore
			QtCore.Signal = QtCore.pyqtSignal

	# import the submodule from those bindings and return it
	if lazy :
		import Gaffer
		return Gaffer.lazyImport( __qtModuleName + "." + name )
	else :
		qtModule = __import__( __qtModuleName + "." + name )
		return getattr( qtModule, name )
开发者ID:cwmartin,项目名称:gaffer,代码行数:34,代码来源:__init__.py

示例2: test

# 需要导入模块: import Gaffer [as 别名]
# 或者: from Gaffer import lazyImport [as 别名]
	def test( self ) :

		# lazy loading something already loaded should just return the module
		# directly.
		ut = Gaffer.lazyImport( "unittest" )
		self.failUnless( ut is unittest )
		self.failUnless( type( ut ) is types.ModuleType )

		# lazy loading something not yet loaded should give us a nice
		# lazy module. hopefully nobody is loading the dummy_threading
		# module for any other purpose.

		self.failIf( "dummy_threading" in sys.modules )

		lazyDT = Gaffer.lazyImport( "dummy_threading" )
		self.failUnless( "dummy_threading" in sys.modules )
		self.failUnless( isinstance( lazyDT, Gaffer.LazyModule ) )

		# check we can still get stuff out

		t = lazyDT.Thread()
		s = lazyDT.Semaphore()
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:24,代码来源:LazyModuleTest.py

示例3: TORT

# 需要导入模块: import Gaffer [as 别名]
# 或者: from Gaffer import lazyImport [as 别名]
#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
##########################################################################

import functools
import collections

import IECore

import Gaffer
import GafferUI

# import lazily to improve startup of apps which don't use GL functionality
IECoreGL = Gaffer.lazyImport( "IECoreGL" )

##########################################################################
# Viewer implementation
##########################################################################

## The Viewer provides the primary means of visualising the output
# of Nodes. It defers responsibility for the generation of content to
# the View classes, which are registered against specific types of
# Plug.
## \todo Support split screening two Views together and overlaying
# them etc. Hopefully we can support that entirely within the Viewer
# without modifying the Views themselves.
class Viewer( GafferUI.NodeSetEditor ) :

	def __init__( self, scriptNode, **kw ) :
开发者ID:ImageEngine,项目名称:gaffer,代码行数:33,代码来源:Viewer.py

示例4: GLWidget

# 需要导入模块: import Gaffer [as 别名]
# 或者: from Gaffer import lazyImport [as 别名]
import os
import ctypes
import logging

# the OpenGL module loves spewing things into logs, and for some reason
# when running in maya 2012 the default log level allows info messages through.
# so we set a specific log level on the OpenGL logger to keep it quiet.
logging.getLogger("OpenGL").setLevel(logging.WARNING)

import IECore

import Gaffer
import GafferUI

# import lazily to improve startup of apps which don't use GL functionality
GL = Gaffer.lazyImport("OpenGL.GL")
IECoreGL = Gaffer.lazyImport("IECoreGL")

QtCore = GafferUI._qtImport("QtCore")
QtGui = GafferUI._qtImport("QtGui")
QtOpenGL = GafferUI._qtImport("QtOpenGL", lazy=True)

## The GLWidget is a base class for all widgets which wish to draw using OpenGL.
# Derived classes override the _draw() method to achieve this.
class GLWidget(GafferUI.Widget):

    ## This enum defines the optional elements of the GL buffer used
    # for display.
    BufferOptions = IECore.Enum.create("Alpha", "Depth", "Double")

    ## Note that you won't always get the buffer options you ask for - a best fit is found
开发者ID:RDQ-Bender,项目名称:gaffer,代码行数:33,代码来源:GLWidget.py


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