本文整理汇总了Python中PyQt4.uic.loadUi方法的典型用法代码示例。如果您正苦于以下问题:Python uic.loadUi方法的具体用法?Python uic.loadUi怎么用?Python uic.loadUi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.uic
的用法示例。
在下文中一共展示了uic.loadUi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doSettings
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def doSettings(millisecWait, depth, fontSize):
global ui
Dialog = QtGui.QDialog()
settings = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/settings.ui"), baseinstance=Dialog)
ui = settings
Dialog.setModal(True)
QtCore.QObject.connect(settings.lineEditNfSamples, QtCore.SIGNAL('textChanged (const QString&)'), onChange)
QtCore.QObject.connect(settings.lineEditTimesSecond, QtCore.SIGNAL('textChanged (const QString&)'), onChange)
ui.lineEditTimesSecond.setText(str(float(1000.0 / (millisecWait * 1.0))))
ui.lineEditNfSamples.setText(str(depth))
ui.lineEditFontSize.setText(str(fontSize))
Dialog.exec_()
millisecWait = int(1000.0 / float(str(ui.lineEditTimesSecond.displayText())))
depth = int(str(ui.lineEditNfSamples.displayText()))
fontSize = int(str(ui.lineEditFontSize.displayText()))
return(millisecWait, depth, fontSize)
示例2: loadUi
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def loadUi(uifile, baseinstance=None, custom_widgets=None):
"""
@type uifile: str
@param uifile: Absolute path of .ui file
@type baseinstance: QWidget
@param baseinstance: the optional instance of the Qt base class.
If specified then the user interface is created in
it. Otherwise a new instance of the base class is
automatically created.
@type custom_widgets: dict of {str:QWidget}
@param custom_widgets: Class name and type of the custom classes used
in uifile if any. This can be None if no custom
class is in use. (Note: this is only necessary
for PySide, see
http://answers.ros.org/question/56382/what-does-python_qt_bindingloaduis-3rd-arg-do-in-pyqt-binding/
for more information)
"""
return _loadUi(uifile, baseinstance, custom_widgets)
示例3: __init__
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [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: _pyqt5
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def _pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, QtWidgets, uic
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_add(PyQt5, "__binding__", PyQt5.__name__)
_add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, n)))
_add(PyQt5,
"setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PyQt5)
return PyQt5
示例5: QtLoadUI
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def QtLoadUI(uifile):
from PyQt4 import uic
return uic.loadUi(uifile)
示例6: doColorHelpLegend
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def doColorHelpLegend():
"""Make a color legend window"""
dialog = QtGui.QDialog()
myui = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/helplegend.ui"), baseinstance=dialog)
dialog.setModal(True)
dialog.exec_()
示例7: createDialog
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def createDialog(self):
'''Create and show dialog window.'''
if not self._dialog:
self._dialog = QDialog()
self._log_ui = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/log.ui"), baseinstance=self._dialog)
self._dialog.show()
示例8: doAboutWindow
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def doAboutWindow():
"""Make an about window"""
icon = os.path.dirname(__file__) + "/ui/icon.png"
dialog = QtGui.QDialog()
about = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/about.ui"), baseinstance=dialog)
about.label.setPixmap(QtGui.QPixmap(icon))
dialog.exec_()
示例9: doMessageWindow
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def doMessageWindow(msg):
"""Make a message window"""
_loadMsgSettings()
if g_settings.has_key(msg):
return
global dialog
dialog = QtGui.QDialog()
msgDialog = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/message.ui"), baseinstance=dialog)
msgDialog.messageLabel.setText(msg)
dialog.exec_()
if msgDialog.showAgainCheckBox.isChecked():
g_settings[msg] = True
_saveMsgSettings()
示例10: _pyqt5_load_ui
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def _pyqt5_load_ui(fyle, parent=None):
from PyQt5 import uic
return uic.loadUi(fyle, parent)
示例11: _pyqt4_load_ui
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def _pyqt4_load_ui(fyle, parent=None):
from PyQt4 import uic
return uic.loadUi(fyle, parent)
# Imports favor PySide over PyQt, and Qt5 over Qt4.
# as this is the most future forward set of options currently.
示例12: _pyqt5
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def _pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, QtWidgets, uic
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_add(QtCompat, "__binding__", PyQt5.__name__)
_add(QtCompat, "__binding_version__", PyQt5.QtCore.PYQT_VERSION_STR)
_add(QtCompat, "__qt_version__", PyQt5.QtCore.QT_VERSION_STR)
_add(QtCompat, "load_ui", lambda fname: uic.loadUi(fname))
_add(QtCompat, "translate", QtCore.QCoreApplication.translate)
_add(QtCompat, "setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PyQt5)
return PyQt5
示例13: initialize_window
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def initialize_window(self):
uic.loadUi('resources/ui/add_s_line.ui', self)
for stdLineType in pp.std_types.available_std_types(self.net).index:
self.standard_type.addItem(stdLineType)
for availableBus in self.net.bus.index:
self.from_bus.addItem(str(availableBus))
self.to_bus.addItem(str(availableBus))
示例14: __init__
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def __init__(self, net, parent=None):
super(runppOptions, self).__init__(parent=parent)
uic.loadUi('resources/ui/runpp_options.ui', self)
self.net = net
self.inits = {"flat": self.InitFlat, "dc": self.InitDC, "results": self.InitResults,
"auto":self.InitAuto}
self.algos = {"nr": self.NewtonRaphson, "bf": self.BackwardForward}
self.voltage_angles = {True: self.VoltageAnglesTrue, False: self.VoltageAnglesFalse,
"auto": self.VoltageAnglesAuto}
self.set_parameters(**self.net._runpp_options)
self.ok_button.clicked.connect(partial(self.exit_window, True, False))
self.cancel_button.clicked.connect(partial(self.exit_window, False, False))
self.run_button.clicked.connect(partial(self.exit_window, True, True))
self.show()
示例15: _load_pyqt
# 需要导入模块: from PyQt4 import uic [as 别名]
# 或者: from PyQt4.uic import loadUi [as 别名]
def _load_pyqt(required_modules, optional_modules):
# set environment variable QT_API for matplotlib
os.environ['QT_API'] = 'pyqt'
# select PyQt4 API, see http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html
import sip
try:
sip.setapi('QDate', 2)
sip.setapi('QDateTime', 2)
sip.setapi('QString', 2)
sip.setapi('QTextStream', 2)
sip.setapi('QTime', 2)
sip.setapi('QUrl', 2)
sip.setapi('QVariant', 2)
except ValueError as e:
raise RuntimeError('Could not set API version (%s): did you import PyQt4 directly?' % e)
# register required and optional PyQt4 modules
for module_name in required_modules:
_named_import('PyQt4.%s' % module_name)
for module_name in optional_modules:
_named_optional_import('PyQt4.%s' % module_name)
# set some names for compatibility with PySide
sys.modules['QtCore'].Signal = sys.modules['QtCore'].pyqtSignal
sys.modules['QtCore'].Slot = sys.modules['QtCore'].pyqtSlot
sys.modules['QtCore'].Property = sys.modules['QtCore'].pyqtProperty
# try to register PyQt4.Qwt5 module
try:
import PyQt4.Qwt5
_register_binding_module('Qwt', PyQt4.Qwt5)
except ImportError:
pass
global _loadUi
def _loadUi(uifile, baseinstance=None, custom_widgets_=None):
from PyQt4 import uic
return uic.loadUi(uifile, baseinstance=baseinstance)
# override specific function to improve compatibility between different bindings
from QtGui import QFileDialog
QFileDialog.getOpenFileName = QFileDialog.getOpenFileNameAndFilter
QFileDialog.getSaveFileName = QFileDialog.getSaveFileNameAndFilter
import PyQt4.QtCore
return PyQt4.QtCore.PYQT_VERSION_STR