本文整理汇总了Python中PySide.QtUiTools.QUiLoader方法的典型用法代码示例。如果您正苦于以下问题:Python QtUiTools.QUiLoader方法的具体用法?Python QtUiTools.QUiLoader怎么用?Python QtUiTools.QUiLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtUiTools
的用法示例。
在下文中一共展示了QtUiTools.QUiLoader方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _pyside2
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside2():
import PySide2
from PySide2 import QtGui, QtWidgets, QtCore, QtUiTools
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_add(QtCompat, "__binding__", PySide2.__name__)
_add(QtCompat, "__binding_version__", PySide2.__version__)
_add(QtCompat, "__qt_version__", PySide2.QtCore.qVersion())
_add(QtCompat, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(QtCompat, "setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_add(QtCompat, "translate", QtCore.QCoreApplication.translate)
_maintain_backwards_compatibility(PySide2)
return PySide2
示例2: _pyside2
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside2():
import PySide2
from PySide2 import QtGui, QtWidgets, QtCore, QtUiTools
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_add(PySide2, "__binding__", PySide2.__name__)
_add(PySide2, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(PySide2, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PySide2,
"setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PySide2)
return PySide2
示例3: __init__
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def __init__( self, parent = BT_GetMayaWindow() ):
super(BT_UIForm, self).__init__(parent)
uicPath = BT_FindUIFile()
if not uicPath:
return None
self.ui = None
if BT_MayaVersionNumber < 2014:
self.ui = uic.loadUi(uicPath, self)
else:
loader = QtUiTools.QUiLoader()
self.ui = loader.load(uicPath, self)
self.ui.loadSelectedButton.clicked.connect(self.loadSelectedSet)
self.ui.connectButton.clicked.connect(self.connectSetup)
self.ui.disconnectButton.clicked.connect(self.disconnectSetup)
self.ui.setToBaseButton.clicked.connect(self.setToBasePose)
self.ui.setToSelectedButton.clicked.connect(self.setToPose)
self.ui.addPoseButton.clicked.connect(self.addPose)
self.ui.deletePoseButton.clicked.connect(self.deletePose)
self.ui.updateSelectedButton.clicked.connect(self.updatePose)
unitResult = BT_SetUnits()
if unitResult:
QtGui.QMessageBox.warning(self, "Blend Transforms", "Units set to centimetres.", "Okay")
self.ui.show()
示例4: _pyside_loadui
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside_loadui(fname):
'''
this function is for PySide load_ui bug when there are custom widgets in the ui file
'''
import PySide.QtUiTools as QtUiTools
import importlib
loader = QtUiTools.QUiLoader()
# get custom_widget
with open(fname) as ui_file:
all_xml = ui_file.read()
custom_wgt_xmls = re.findall(r'<customwidget>.*?</customwidget>', all_xml, re.S)
for cus_wgt_xml in custom_wgt_xmls:
class_search = re.search(r"<class>(.*?)</class>", cus_wgt_xml, re.S)
class_name = class_search.group(1)
module_search = re.search(r"<header.*>(.*?)</header>", cus_wgt_xml, re.S)
module_name = module_search.group(1).replace("/", ".")
# import and register
module = importlib.import_module(module_name)
loader.registerCustomWidget(getattr(module, class_name))
return loader.load(fname)
示例5: QtLoadUI
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def QtLoadUI(uifile):
from PySide import QtUiTools
loader = QtUiTools.QUiLoader()
uif = QtCore.QFile(uifile)
uif.open(QtCore.QFile.ReadOnly)
result = loader.load(uif)
uif.close()
return result
示例6: _pyside
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside():
import PySide
from PySide import QtGui, QtCore, QtUiTools
_remap(PySide, "QtWidgets", QtGui)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PySide import QtWebKit
_remap(PySide, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt, therefore might not be available
pass
_add(PySide, "__binding__", PySide.__name__)
_add(PySide, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(PySide, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PySide, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PySide)
return PySide
示例7: __init__
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def __init__(self, parent=None):
super(BaseTab, self).__init__(parent)
#self.parent = parent
#loader = QUiLoader()
#f = QFile(uifile)
#f.open(QFile.ReadOnly)
#widget = loader.load(f, self)
#f.close()
#layout = QVBoxLayout()
#layout.addWidget(widget)
#self.setLayout(layout)
#utils.loadUi(uifile)
#----------------------------------------------------------------------
示例8: __init__
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def __init__(self, cb_ok, cb_fail):
super(IDASynergyConfigUI, self).__init__()
self.loader = QUiLoader()
self.initUI()
self.ui.buttonBox.accepted.connect(cb_ok)
self.ui.buttonBox.rejected.connect(cb_fail)
示例9: _pyside2_load_ui
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside2_load_ui(fyle, parent=None):
from PySide2.QtUiTools import QUiLoader
loader = QUiLoader()
return loader.load(fyle, parent)
示例10: _pyside_load_ui
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside_load_ui(fyle, parent=None):
from PySide.QtUiTools import QUiLoader
loader = QUiLoader()
return loader.load(fyle, parent)
示例11: _pyside
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def _pyside():
import PySide
from PySide import QtGui, QtCore, QtUiTools
_remap(PySide, "QtWidgets", QtGui)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PySide import QtWebKit
_remap(PySide, "QtWebKitWidgets", QtWebKit)
except ImportError:
"QtWebkit is optional in Qt, therefore might not be available"
_add(QtCompat, "__binding__", PySide.__name__)
_add(QtCompat, "__binding_version__", PySide.__version__)
_add(QtCompat, "__qt_version__", PySide.QtCore.qVersion())
_add(QtCompat, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(QtCompat, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_add(QtCompat, "translate",
lambda context, sourceText, disambiguation, n:
QtCore.QCoreApplication.translate(context,
sourceText,
disambiguation,
QtCore.QCoreApplication.CodecForTr,
n))
_maintain_backwards_compatibility(PySide)
return PySide
示例12: widgetFromUIFile
# 需要导入模块: from PySide import QtUiTools [as 别名]
# 或者: from PySide.QtUiTools import QUiLoader [as 别名]
def widgetFromUIFile(filePath):
"""
Reads an ``.ui`` file and creates a new widget object from it.
:param filePath: Where to find the ``.ui`` file
:return: The new created widget
"""
loader = QUiLoader()
UIFile = QFile(filePath)
UIFile.open(QFile.ReadOnly)
widget = loader.load(UIFile)
UIFile.close()
return widget