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


Python shiboken2.wrapInstance方法代码示例

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


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

示例1: get_nav_layout

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def get_nav_layout():

    def find_first_frame_layout(layout):
        """ recursivley get all child layout until we find the first framelayout """

        children = cmds.layout(layout, ca=True, q=True)
        for child in children:

            if child.startswith('frameLayout'):
                return child

            else:
                return find_first_frame_layout(child)


    nav_layout = find_first_frame_layout('AttrEdsporeNodeFormLayout')
    return wrapInstance(long(omui.MQtUtil.findControl(nav_layout)), QWidget) 
开发者ID:wiremas,项目名称:spore,代码行数:19,代码来源:AEsporeNodeTemplate.py

示例2: mayaToQT

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def mayaToQT(name):
    """
    Maya -> QWidget

    :param str name: Maya name of an ui object
    :return: QWidget of parsed Maya name
    :rtype: QWidget
    """
    ptr = OpenMayaUI.MQtUtil.findControl(name)
    if ptr is None:         
        ptr = OpenMayaUI.MQtUtil.findLayout(name)    
    if ptr is None:         
        ptr = OpenMayaUI.MQtUtil.findMenuItem(name)
    if ptr is not None:     
        return shiboken.wrapInstance(long(ptr), QWidget)

        
# ---------------------------------------------------------------------------- 
开发者ID:robertjoosten,项目名称:maya-timeline-marker,代码行数:20,代码来源:utils.py

示例3: qt_import

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def qt_import(shi=False, cui=False):
    """
    import pyside/pyQt

    Returns:
        multi: QtGui, QtCore, QtWidgets, wrapInstance

    """
    lookup = ["PySide2", "PySide", "PyQt4"]

    preferredBinding = os.environ.get("MGEAR_PYTHON_QT_BINDING", None)
    if preferredBinding is not None and preferredBinding in lookup:
        lookup.remove(preferredBinding)
        lookup.insert(0, preferredBinding)

    for binding in lookup:
        try:
            return _qt_import(binding, shi, cui)
        except Exception:
            pass

    raise _qt_import("ThisBindingSurelyDoesNotExist", False, False) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:24,代码来源:pyqt.py

示例4: testAdresses

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def testAdresses(self):
        q = QtCore.QObject()
        ptr = wrapper.getCppPointer(q)
        print("CppPointer to an instance of PySide.QtCore.QObject = 0x%016X" % ptr[0])

        # None of the following is expected to raise an
        # OverflowError on 64-bit systems

        # largest 32-bit address
        wrapper.wrapInstance(0xFFFFFFFF, QtCore.QObject)

        # a regular, slightly smaller 32-bit address
        wrapper.wrapInstance(0xFFFFFFF, QtCore.QObject)

        # an actual 64-bit address (> 4 GB, the first non 32-bit address)
        wrapper.wrapInstance(0x100000000, QtCore.QObject)

        # largest 64-bit address
        wrapper.wrapInstance(0xFFFFFFFFFFFFFFFF, QtCore.QObject) 
开发者ID:coin3d,项目名称:pivy,代码行数:21,代码来源:pyside_test.py

示例5: getMayaMainWindow

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def getMayaMainWindow():
    if hasattr(Qt, "IsPySide2"):
        if Qt.IsPySide2:
            import shiboken2 as shiboken
        else:
            import shiboken

    # Qt version less than 1.0.0
    elif hasattr(Qt, "__version_info__"):
        if Qt.__version_info__[0] >= 2:
            import shiboken2 as shiboken
        else:
            import shiboken

    else:
        try:
            import shiboken2 as shiboken
        except:
            import shiboken

    return shiboken.wrapInstance(long(OpenMayaUI.MQtUtil_mainWindow()), QtWidgets.QMainWindow) 
开发者ID:sol-ansano-kim,项目名称:medic,代码行数:23,代码来源:functions.py

示例6: get_maya_main_window

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def get_maya_main_window():
    """Get the main Maya window as a QtGui.QMainWindow instance
    @return: QtGui.QMainWindow instance of the top level Maya windows

    ref: https://stackoverflow.com/questions/22331337/how-to-get-maya-main-window-pointer-using-pyside
    """
    from anima.ui.lib import QtWidgets, QtCore
    from maya import OpenMayaUI

    ptr = OpenMayaUI.MQtUtil.mainWindow()
    if ptr is not None:
        from anima.ui.lib import IS_PYSIDE, IS_PYSIDE2, IS_PYQT4, IS_QTPY
        if IS_PYSIDE():
            import shiboken
            return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
        elif IS_PYSIDE2():
            import shiboken2
            return shiboken2.wrapInstance(long(ptr), QtWidgets.QWidget)
        elif IS_PYQT4():
            import sip
            return sip.wrapinstance(long(ptr), QtCore.QObject) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:23,代码来源:__init__.py

示例7: getDock

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def getDock(name='LightingManagerDock'):
    """
    This function creates a dock with the given name.
    It's an example of how we can mix Maya's UI elements with Qt elements
    Args:
        name: The name of the dock to create

    Returns:
        QtWidget.QWidget: The dock's widget
    """
    # First lets delete any conflicting docks
    deleteDock(name)
    # Then we create a workspaceControl dock using Maya's UI tools
    # This gives us back the name of the dock created
    ctrl = pm.workspaceControl(name, dockToMainWindow=('right', 1), label="Lighting Manager")

    # We can use the OpenMayaUI API to get the actual Qt widget associated with the name
    qtCtrl = omui.MQtUtil_findControl(ctrl)

    # Finally we use wrapInstance to convert it to something Python can understand, in this case a QWidget
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)

    # And we return that QWidget back to whoever wants it.
    return ptr 
开发者ID:dgovil,项目名称:PythonForMayaSamples,代码行数:26,代码来源:lightManager.py

示例8: mayaWindow

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def mayaWindow():
    """
    Get Maya's main window.
    
    :rtype: QMainWindow
    """
    window = OpenMayaUI.MQtUtil.mainWindow()
    window = shiboken.wrapInstance(long(window), QMainWindow)
    
    return window 
开发者ID:robertjoosten,项目名称:maya-command-search,代码行数:12,代码来源:utils.py

示例9: mayaToQT

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def mayaToQT(name):
    """
    Maya -> QWidget

    :param str name: Maya name of an ui object
    :return: QWidget of parsed Maya name
    :rtype: QWidget
    """
    ptr = OpenMayaUI.MQtUtil.findControl(name)
    if ptr is None:         
        ptr = OpenMayaUI.MQtUtil.findLayout(name)    
    if ptr is None:         
        ptr = OpenMayaUI.MQtUtil.findMenuItem(name)
    if ptr is not None:     
        return shiboken.wrapInstance(long(ptr), QWidget) 
开发者ID:robertjoosten,项目名称:maya-command-search,代码行数:17,代码来源:utils.py

示例10: mayaWindow

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def mayaWindow():
    """
    Get Maya's main window.
    
    :rtype: QMainWindow
    """
    window = OpenMayaUI.MQtUtil.mainWindow()
    window = shiboken.wrapInstance(long(window), QMainWindow)
    
    return window  


# ---------------------------------------------------------------------------- 
开发者ID:robertjoosten,项目名称:maya-spline-ik,代码行数:15,代码来源:ui.py

示例11: active_view_wdg

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def active_view_wdg():
    """ return the active 3d view wrapped in a QWidget """
    view = active_view()
    active_view_widget = shiboken2.wrapInstance(long(view.widget()), QWidget)
    return active_view_widget 
开发者ID:wiremas,项目名称:spore,代码行数:7,代码来源:window_utils.py

示例12: maya_main_window

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def maya_main_window():
    """ return maya's main window wrapped in a QWidget """
    pointer_main_window = omui.MQtUtil.mainWindow()
    if pointer_main_window:
        return shiboken2.wrapInstance(long(pointer_main_window), QWidget) 
开发者ID:wiremas,项目名称:spore,代码行数:7,代码来源:window_utils.py

示例13: get_layout

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def get_layout(layout):
    """ return a layout wraped as QObject """
    ptr = omui.MQtUtil.findLayout(layout)
    return shiboken2.wrapInstance(long(ptr), QWidget) #.layout() 
开发者ID:wiremas,项目名称:spore,代码行数:6,代码来源:window_utils.py

示例14: mayaWindow

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def mayaWindow():
    """
    Get Maya's main window.

    :rtype: QMainWindow
    """
    window = OpenMayaUI.MQtUtil.mainWindow()
    window = shiboken.wrapInstance(long(window), QMainWindow)

    return window


# ---------------------------------------------------------------------------- 
开发者ID:robertjoosten,项目名称:maya-retarget-blendshape,代码行数:15,代码来源:ui.py

示例15: get_maya_window

# 需要导入模块: import shiboken2 [as 别名]
# 或者: from shiboken2 import wrapInstance [as 别名]
def get_maya_window():
    try:
        return shiboken.wrapInstance(long(OpenMayaUI.MQtUtil.mainWindow()), QWidget)
    except:
        return None 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:7,代码来源:qt.py


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