本文整理汇总了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
示例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
示例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
示例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
示例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
#=======================================
示例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
#------------------------------
示例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
#############################################
示例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
# --------------------
示例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
示例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
示例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
示例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)
示例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))
示例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")
示例15: getPathForWidget
# 需要导入模块: import sip [as 别名]
# 或者: from sip import unwrapinstance [as 别名]
def getPathForWidget(widget):
return sip.unwrapinstance(widget)