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