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


Python sip.unwrapinstance方法代码示例

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


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

示例1: getViewWidget

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def getViewWidget(self):
        return self.views()[0]
    
    #def getViewWidget(self, widget):
        ### same pyqt bug -- mouseEvent.widget() doesn't give us the original python object.
        ### [[doesn't seem to work correctly]]
        #if HAVE_SIP and isinstance(self, sip.wrapper):
            #addr = sip.unwrapinstance(sip.cast(widget, QtGui.QWidget))
            ##print "convert", widget, addr
            #for v in self.views():
                #addr2 = sip.unwrapinstance(sip.cast(v, QtGui.QWidget))
                ##print "   check:", v, addr2
                #if addr2 == addr:
                    #return v
        #else:
            #return widget 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:18,代码来源:GraphicsScene.py

示例2: showChannelBox

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def showChannelBox(cls):
		"""
		showChannelBox() -> (str dockLayout, ChannelBox widget)

		Creates a ChannelBox widget inside of a Maya dockControl. 
		Returns the dockControl path, and the ChannelBox widget.
		"""
		win = cls(parent=getMainWindow())
		size = win.size()

		name = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))

		dock = cmds.dockControl(
			allowedArea='all', 
			area='right', 
			floating=True, 
			content=name, 
			width=size.width(),
			height=size.height(),
			label='Custom ChannelBox')

		return dock, win 
开发者ID:justinfx,项目名称:tutorials,代码行数:24,代码来源:channelBox.py

示例3: showOutliner

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def showOutliner(cls):
		"""
		showOutliner() -> (str dockLayout, Outliner widget)

		Creates a Outliner widget inside of a Maya dockControl. 
		Returns the dockControl path, and the Outliner widget.
		"""
		win = cls(parent=getMainWindow())
		size = win.size()

		name = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))

		dock = cmds.dockControl(
			allowedArea='all', 
			area='left', 
			floating=True, 
			content=name, 
			width=size.width(),
			height=size.height(),
			label='Custom Outliner')

		return dock, win 
开发者ID:justinfx,项目名称:tutorials,代码行数:24,代码来源:outliner3.py

示例4: showOutliner

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def showOutliner(cls):
		"""
		showOutliner() -> (str dockLayout, Outliner widget)

		Creates a Outliner widget inside of a Maya dockControl. 
		Returns the dockControl path, and the Outliner widget.
		"""
		win = cls(parent=getMainWindow())
		size = win.size()

		name = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))

		dock = cmds.dockControl(
			allowedArea='all', 
			area='left', 
			floating=False, 
			content=name, 
			width=size.width(),
			height=size.height(),
			label='Custom Outliner')

		return dock, win 
开发者ID:justinfx,项目名称:tutorials,代码行数:24,代码来源:outliner2.py

示例5: qt_to_mui

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def qt_to_mui(self, qt_obj):
        if hostMode != "maya":
            return
        ref = None
        if qtMode in (0,2):
            # ==== for pyside ====
            ref = long(shiboken.getCppPointer(qt_obj)[0])
        elif qtMode in (1,3):
            # ==== for PyQt====
            ref = long(sip.unwrapinstance(qt_obj))
        if ref is not None:
            return mui.MQtUtil.fullName(ref)
            
    #=======================================
    # widget specific functions
    #======================================= 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:universal_tool_template_1116.py

示例6: qt_to_mui

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def qt_to_mui(self, qt_obj):
        if hostMode != "maya":
            return
        ref = None
        if qtMode in (0,2):
            # ==== for pyside ====
            ref = long(shiboken.getCppPointer(qt_obj)[0])
        elif qtMode in (1,3):
            # ==== for PyQt====
            ref = long(sip.unwrapinstance(qt_obj))
        if ref is not None:
            return mui.MQtUtil.fullName(ref)
            
    #------------------------------
    # TreeWidget Process Functions
    #------------------------------ 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:GearBox_template_1010.py

示例7: qt_to_mui

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def qt_to_mui(self, qt_obj):
        if hostMode != "maya":
            return
        ref = None
        if qtMode in (0,2):
            # ==== for pyside ====
            ref = long(shiboken.getCppPointer(qt_obj)[0])
        elif qtMode in (1,3):
            # ==== for PyQt====
            ref = long(sip.unwrapinstance(qt_obj))
        if ref is not None:
            return mui.MQtUtil.fullName(ref)

#############################################
# window instance creation
############################################# 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:UITranslator.py

示例8: qt_to_mui

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def qt_to_mui(self, qt_obj):
        if hostMode != "maya":
            return
        ref = None
        if qtMode in (0,2):
            # ==== for pyside ====
            ref = long(shiboken.getCppPointer(qt_obj)[0])
        elif qtMode in (1,3):
            # ==== for PyQt====
            ref = long(sip.unwrapinstance(qt_obj))
        if ref is not None:
            return mui.MQtUtil.fullName(ref)

#############################################
# User Class creation
#############################################

# --------------------
#  user module list
# -------------------- 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:22,代码来源:universal_tool_template_0903.py

示例9: registerObject

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def registerObject(cls, obj):
        """
        Workaround for PyQt bug in qgraphicsscene.items()
        All subclasses of QGraphicsObject must register themselves with this function.
        (otherwise, mouse interaction with those objects will likely fail)
        """
        if HAVE_SIP and isinstance(obj, sip.wrapper):
            cls._addressCache[sip.unwrapinstance(sip.cast(obj, QtGui.QGraphicsItem))] = obj 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:10,代码来源:GraphicsScene.py

示例10: items

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def items(self, *args):
        #print 'args:', args
        items = QtGui.QGraphicsScene.items(self, *args)
        ## PyQt bug: items() returns a list of QGraphicsItem instances. If the item is subclassed from QGraphicsObject,
        ## then the object returned will be different than the actual item that was originally added to the scene
        items2 = list(map(self.translateGraphicsItem, items))
        #if HAVE_SIP and isinstance(self, sip.wrapper):
            #items2 = []
            #for i in items:
                #addr = sip.unwrapinstance(sip.cast(i, QtGui.QGraphicsItem))
                #i2 = GraphicsScene._addressCache.get(addr, i)
                ##print i, "==>", i2
                #items2.append(i2)
        #print 'items:', items
        return items2 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:17,代码来源:GraphicsScene.py

示例11: selectedItems

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def selectedItems(self, *args):
        items = QtGui.QGraphicsScene.selectedItems(self, *args)
        ## PyQt bug: items() returns a list of QGraphicsItem instances. If the item is subclassed from QGraphicsObject,
        ## then the object returned will be different than the actual item that was originally added to the scene
        #if HAVE_SIP and isinstance(self, sip.wrapper):
            #items2 = []
            #for i in items:
                #addr = sip.unwrapinstance(sip.cast(i, QtGui.QGraphicsItem))
                #i2 = GraphicsScene._addressCache.get(addr, i)
                ##print i, "==>", i2
                #items2.append(i2)
        items2 = list(map(self.translateGraphicsItem, items))

        #print 'items:', items
        return items2 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:17,代码来源:GraphicsScene.py

示例12: itemAt

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def itemAt(self, *args):
        item = QtGui.QGraphicsScene.itemAt(self, *args)
        
        ## PyQt bug: items() returns a list of QGraphicsItem instances. If the item is subclassed from QGraphicsObject,
        ## then the object returned will be different than the actual item that was originally added to the scene
        #if HAVE_SIP and isinstance(self, sip.wrapper):
            #addr = sip.unwrapinstance(sip.cast(item, QtGui.QGraphicsItem))
            #item = GraphicsScene._addressCache.get(addr, item)
        #return item
        return self.translateGraphicsItem(item) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:12,代码来源:GraphicsScene.py

示例13: listQThreads

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def listQThreads():
    """Prints Thread IDs (Qt's, not OS's) for all QThreads."""
    thr = findObj('[Tt]hread')
    thr = [t for t in thr if isinstance(t, QtCore.QThread)]
    import sip
    for t in thr:
        print("--> ", t)
        print("     Qt ID: 0x%x" % sip.unwrapinstance(t)) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:10,代码来源:debug.py

示例14: _pyqt5

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def _pyqt5():
    """Initialise PyQt5"""

    import PyQt5 as module
    _setup(module, ["uic"])

    try:
        import sip
        Qt.QtCompat.wrapInstance = (
            lambda ptr, base=None: _wrapinstance(
                sip.wrapinstance, ptr, base)
        )
        Qt.QtCompat.getCppPointer = lambda object: \
            sip.unwrapinstance(object)

    except ImportError:
        pass  # Optional

    if hasattr(Qt, "_uic"):
        Qt.QtCompat.loadUi = _loadUi

    if hasattr(Qt, "_QtCore"):
        Qt.__binding_version__ = Qt._QtCore.PYQT_VERSION_STR
        Qt.__qt_version__ = Qt._QtCore.QT_VERSION_STR
        Qt.QtCompat.translate = Qt._QtCore.QCoreApplication.translate

    if hasattr(Qt, "_QtWidgets"):
        Qt.QtCompat.setSectionResizeMode = \
            Qt._QtWidgets.QHeaderView.setSectionResizeMode

    _reassign_misplaced_members("pyqt5") 
开发者ID:weijer,项目名称:NukeToolSet,代码行数:33,代码来源:Qt.py

示例15: getPathForWidget

# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def getPathForWidget(widget):
	return sip.unwrapinstance(widget) 
开发者ID:justinfx,项目名称:tutorials,代码行数:4,代码来源:mqtutil.py


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