本文整理汇总了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)
示例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())
)
示例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())
)
示例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)
示例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
示例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__)
示例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__)
示例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__)
示例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__)