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


Python Qt.__binding__方法代码示例

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


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

示例1: load_ui_type

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def load_ui_type(ui_file):
    if "PySide" in Qt.__binding__:
        import pysideuic
        parsed = xml.parse(ui_file)
        widget_class = parsed.find('widget').get('class')
        form_class = parsed.find('class').text

        with open(ui_file, 'r') as f:
            o = StringIO()
            frame = {}

            pysideuic.compileUi(f, o, indent=0)
            pyc = compile(o.getvalue(), '<string>', 'exec')
            exec pyc in frame

            # Fetch the base_class and form class based on their type in the xml from designer
            form_class = frame['Ui_%s' % form_class]
            base_class = getattr(QtGui, widget_class)
        return form_class, base_class
    elif Qt.__binding__ == "PyQt4":
        import PyQt4.uic
        return PyQt4.uic.loadUiType(ui_file) 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:24,代码来源:load_ui_type.py

示例2: test_membership

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def test_membership():
    """Common members of Qt.py exist in all bindings, excl exceptions"""
    import Qt

    common_members = Qt._common_members.copy()

    if os.environ.get('VFXPLATFORM') == '2017':
        # For CY2017, skip the following
        common_members['QtGui'].remove('QDesktopServices')
        common_members.pop('QtOpenGL', None)
        common_members.pop('QtMultimedia', None)

    missing = list()
    for module, members in common_members.items():
        missing.extend(
            member for member in members
            if not hasattr(getattr(Qt, module), member)
        )

    binding = Qt.__binding__
    assert not missing, (
        "Some members did not exist in {binding}\n{missing}".format(
            **locals())
    ) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:26,代码来源:tests.py

示例3: test_missing

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def test_missing():
    """Missing members of Qt.py have been defined with placeholders"""
    import Qt

    missing_members = Qt._missing_members.copy()

    missing = list()
    for module, members in missing_members.items():

        mod = getattr(Qt, module)
        missing.extend(
            member for member in members
            if not hasattr(mod, member) or
            not isinstance(getattr(mod, member), Qt.MissingMember)
        )

    binding = Qt.__binding__
    assert not missing, (
        "Some members did not exist in {binding} as "
        "a Qt.MissingMember type\n{missing}".format(**locals())
    ) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:23,代码来源:tests.py

示例4: load_ui_wrapper

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def load_ui_wrapper(uifile, base_instance=None):
    """Load a Qt Designer .ui file and returns an instance of the user interface

    Args:
        uifile (str): Absolute path to .ui file
        base_instance (QWidget): The widget into which UI widgets are loaded

    Returns:
        function: pyside_load_ui or uic.loadUi

    """
    if 'PySide' in __binding__:
        return pyside_load_ui(uifile, base_instance)
    elif 'PyQt' in __binding__:
        uic = __import__(__binding__ + ".uic").uic
        return uic.loadUi(uifile, base_instance) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:18,代码来源:baseinstance2.py

示例5: setData

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def setData(self, index, value, role):
        if role == QtCore.Qt.EditRole:
            if index.column() == 1:
                item = index.internalPointer()
                item.value = value

                if __binding__ in ("PySide", "PyQt4"):
                    self.dataChanged.emit(index, index)
                else:
                    self.dataChanged.emit(index, index, [QtCore.Qt.EditRole])

                return True

        return False 
开发者ID:mgear-dev,项目名称:mgear_dist,代码行数:16,代码来源:qjsonmodel.py

示例6: test_preferred_pyqt4

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def test_preferred_pyqt4():
        """QT_PREFERRED_BINDING = PyQt4 properly forces the binding"""
        import Qt
        assert Qt.__binding__ == "PyQt4", (
            "PyQt4 should have been picked, "
            "instead got %s" % Qt.__binding__) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:8,代码来源:tests.py

示例7: test_preferred_pyqt5

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def test_preferred_pyqt5():
        """QT_PREFERRED_BINDING = PyQt5 properly forces the binding"""
        import Qt
        assert Qt.__binding__ == "PyQt5", (
            "PyQt5 should have been picked, "
            "instead got %s" % Qt.__binding__) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:8,代码来源:tests.py

示例8: test_preferred_pyside

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def test_preferred_pyside():
        """QT_PREFERRED_BINDING = PySide properly forces the binding"""
        import Qt
        assert Qt.__binding__ == "PySide", (
            "PySide should have been picked, "
            "instead got %s" % Qt.__binding__) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:8,代码来源:tests.py

示例9: test_multiple_preferred

# 需要导入模块: import Qt [as 别名]
# 或者: from Qt import __binding__ [as 别名]
def test_multiple_preferred():
        """QT_PREFERRED_BINDING = more than one binding excludes others"""

        # PySide is the more desirable binding
        os.environ["QT_PREFERRED_BINDING"] = os.pathsep.join(
            ["PyQt4", "PyQt5"])

        import Qt
        assert Qt.__binding__ == "PyQt4", (
            "PyQt4 should have been picked, "
            "instead got %s" % Qt.__binding__) 
开发者ID:mottosso,项目名称:Qt.py,代码行数:13,代码来源:tests.py


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