本文整理汇总了Python中PyQt4.QtCore.QMetaObject类的典型用法代码示例。如果您正苦于以下问题:Python QMetaObject类的具体用法?Python QMetaObject怎么用?Python QMetaObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMetaObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _show_backup_decision
def _show_backup_decision(self, error=None):
text = '<p>{0}</p><p>{1}</p>'.format(
self.BACKUP_INTRO_TEXT if error is None else error,
self.BACKUP_PROMPT_TEXT,
)
dialog = QMessageBox(
QMessageBox.Question if error is None else QMessageBox.Critical,
self.BACKUP_DIALOG_CAPTION if error is None else self.BACKUP_DIALOG_ERROR_CAPTION,
text,
)
revert_button = dialog.addButton(self.REVERT_BACKUP_BUTTON_TEXT, QMessageBox.AcceptRole)
delete_button = dialog.addButton(self.DELETE_BACKUP_BUTTON_TEXT, QMessageBox.DestructiveRole)
examine_button = dialog.addButton(self.EXAMINE_BACKUP_BUTTON_TEXT, QMessageBox.ActionRole)
dialog.addButton(self.QUIT_BUTTON_TEXT, QMessageBox.RejectRole)
dialog.exec()
clicked_button = dialog.clickedButton()
if clicked_button == examine_button:
QMetaObject.invokeMethod(self, '_examine_backup', Qt.QueuedConnection)
elif clicked_button == revert_button:
self._progress_dialog = QProgressDialog(None)
self._progress_dialog.setLabelText(self.REVERT_BACKUP_PROGRESS_TEXT)
self._progress_dialog.setCancelButton(None)
self._progress_dialog.setRange(0, 0)
self._progress_dialog.forceShow()
self.request_revert_backup.emit()
elif clicked_button == delete_button:
self.request_delete_backup.emit()
else:
self.quit()
示例2: setupUi
def setupUi(self):
self.valueItems = {}
self.dependentItems = {}
self.resize(650, 450)
self.buttonBox = QDialogButtonBox()
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
| QDialogButtonBox.Ok)
self.infoText = QTextEdit()
numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber)
text = self.tr('You can refer to model values in your formula, using '
'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog')
ichar = 97
if numbers:
for number in numbers:
text += chr(ichar) + '->' + self.resolveValueDescription(number) + '\n'
ichar += 1
else:
text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog')
self.infoText.setText(text)
self.infoText.setEnabled(False)
self.formulaText = QLineEdit()
if hasattr(self.formulaText, 'setPlaceholderText'):
self.formulaText.setPlaceholderText(self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog'))
self.setWindowTitle(self.tr('Calculator', 'CalculatorModelerParametersDialog'))
self.verticalLayout = QVBoxLayout()
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.verticalLayout.addWidget(self.infoText)
self.verticalLayout.addWidget(self.formulaText)
self.verticalLayout.addWidget(self.buttonBox)
self.setLayout(self.verticalLayout)
QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.okPressed)
QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.cancelPressed)
QMetaObject.connectSlotsByName(self)
示例3: setupUi
def setupUi(self, dialog, nepomukType=None, excludeList=None):
self.dialog = dialog
dialog.setObjectName("dialog")
dialog.resize(500, 300)
self.gridlayout = QGridLayout(dialog)
self.gridlayout.setMargin(9)
self.gridlayout.setSpacing(6)
self.gridlayout.setObjectName("gridlayout")
self.table = ResourcesByTypeTable(mainWindow=dialog.parent(), nepomukType=nepomukType, excludeList=excludeList, dialog=self)
self.table.table.setColumnWidth(0,250)
self.gridlayout.addWidget(self.table, 0, 0, 1, 1)
self.buttonBox = QDialogButtonBox(dialog)
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1)
self.retranslateUi(dialog)
self.table.table.activated.connect(self.activated)
self.buttonBox.accepted.connect(dialog.accept)
self.buttonBox.rejected.connect(dialog.reject)
QMetaObject.connectSlotsByName(dialog)
示例4: run
def run(self):
"""
Reimplemented from `QRunnable.run`
"""
self.eventLoop = QEventLoop()
self.eventLoop.processEvents()
# Move the task to the current thread so it's events, signals, slots
# are triggered from this thread.
assert isinstance(self.task.thread(), _TaskDepotThread)
QMetaObject.invokeMethod(
self.task.thread(), "transfer", Qt.BlockingQueuedConnection,
Q_ARG(object, self.task),
Q_ARG(object, QThread.currentThread())
)
self.eventLoop.processEvents()
# Schedule task.run from the event loop.
self.task.start()
# Quit the loop and exit when task finishes or is cancelled.
# TODO: If the task encounters an critical error it might not emit
# these signals and this Runnable will never complete.
self.task.finished.connect(self.eventLoop.quit)
self.task.cancelled.connect(self.eventLoop.quit)
self.eventLoop.exec_()
示例5: setupUi
def setupUi(self, SLim):
SLim.setObjectName(_fromUtf8("SLim"))
SLim.resize(800, 601)
self.centralwidget = QWidget(SLim)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
SLim.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(SLim)
self.menubar.setGeometry(QRect(0, 0, 800, 20))
self.menubar.setObjectName(_fromUtf8("menubar"))
SLim.setMenuBar(self.menubar)
self.statusbar = QStatusBar(SLim)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
SLim.setStatusBar(self.statusbar)
ui_settings = slimUISettings()
QMetaObject.connectSlotsByName(SLim)
self.loopers = []
self.loopers.append(LooperWidget(self.centralwidget, 0, ui_settings.looper))
self.loopers.append(LooperWidget(self.centralwidget, 1, ui_settings.looper))
for looper in self.loopers:
self.verticalLayout.addWidget(looper)
self.retranslateUi(SLim)
示例6: run
def run(self):
"""
Reimplemented from `QRunnable.run`
"""
self.eventLoop = QEventLoop()
self.eventLoop.processEvents()
# Move the task to the current thread so it's events, signals, slots
# are triggered from this thread.
assert self.task.thread() is _TaskDepotThread.instance()
QMetaObject.invokeMethod(
self.task.thread(), "transfer", Qt.BlockingQueuedConnection,
Q_ARG(object, self.task),
Q_ARG(object, QThread.currentThread())
)
self.eventLoop.processEvents()
# Schedule task.run from the event loop.
self.task.start()
# Quit the loop and exit when task finishes or is cancelled.
self.task.finished.connect(self.eventLoop.quit)
self.task.cancelled.connect(self.eventLoop.quit)
self.eventLoop.exec_()
示例7: __createLayout
def __createLayout( self ):
""" Creates the dialog layout """
self.resize( 579, 297 )
self.setSizeGripEnabled( True )
self.gridlayout = QGridLayout( self )
self.descriptionLabel = QLabel( self )
self.descriptionLabel.setText( "Description:" )
self.gridlayout.addWidget( self.descriptionLabel, 0, 0, 1, 1 )
self.descriptionEdit = QLineEdit( self )
self.gridlayout.addWidget( self.descriptionEdit, 0, 1, 1, 3 )
sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred )
sizePolicy.setHorizontalStretch( 0 )
sizePolicy.setVerticalStretch( 0 )
self.completedCheckBox = QCheckBox( self )
self.completedCheckBox.setText( "Completed" )
sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
sizePolicy.setHorizontalStretch( 0 )
sizePolicy.setVerticalStretch( 0 )
sizePolicy.setHeightForWidth( self.completedCheckBox.sizePolicy().hasHeightForWidth() )
self.completedCheckBox.setSizePolicy( sizePolicy )
self.gridlayout.addWidget( self.completedCheckBox, 3, 3, 1, 1 )
self.filenameLabel = QLabel( self )
self.filenameLabel.setText( "File name:" )
self.gridlayout.addWidget( self.filenameLabel, 4, 0, 1, 1 )
self.filenameEdit = QLineEdit( self )
self.filenameEdit.setFocusPolicy( Qt.NoFocus )
self.filenameEdit.setReadOnly( True )
self.gridlayout.addWidget( self.filenameEdit, 4, 1, 1, 3 )
self.lineLabel = QLabel( self )
self.lineLabel.setText( "Line:" )
self.gridlayout.addWidget( self.lineLabel, 5, 0, 1, 1 )
self.linenoEdit = QLineEdit( self )
self.linenoEdit.setFocusPolicy( Qt.NoFocus )
self.linenoEdit.setReadOnly( True )
self.gridlayout.addWidget( self.linenoEdit, 5, 1, 1, 3 )
self.buttonBox = QDialogButtonBox( self )
self.buttonBox.setOrientation( Qt.Horizontal )
self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel | \
QDialogButtonBox.Ok )
self.gridlayout.addWidget( self.buttonBox, 6, 0, 1, 4 )
self.descriptionLabel.setBuddy( self.descriptionEdit )
self.buttonBox.accepted.connect( self.accept )
self.buttonBox.rejected.connect( self.reject )
QMetaObject.connectSlotsByName( self )
self.setTabOrder( self.completedCheckBox, self.buttonBox )
return
示例8: run
def run(self):
ret = None
try:
if self.object is not None and self.method is not None:
# TODO Get return value.
QMetaObject.invokeMethod(self.object, self.method, self.connection)
except Exception, e:
self.error.emit(e, traceback.format_exc())
示例9: done
def done(self):
self.timer.stop()
self.popup.hide()
self.editor.setFocus()
item = self.popup.currentItem()
if item:
self.editor.setText(item.text(0))
QMetaObject.invokeMethod(self.editor, "returnPressed")
示例10: setupUi
def setupUi(self):
self.setObjectName(u'splash_screen')
self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
self.setContextMenuPolicy(Qt.PreventContextMenu)
splash_image = QPixmap(u':/icons/128/luma')
self.setPixmap(splash_image)
self.setMask(splash_image.mask())
self.resize(128, 128)
QMetaObject.connectSlotsByName(self)
示例11: setupUi
def setupUi(self, TestLayout):
TestLayout.setObjectName("ListEdit")
TestLayout.resize(440,240)
self.centralwidget = QtGui.QWidget(TestLayout)
self.centralwidget.setObjectName("centralwidget")
self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.editBox = QtGui.QLineEdit(self.centralwidget)
self.editBox.setObjectName("editBox")
self.verticalLayout.addWidget(self.editBox)
self.listBox = QtGui.QListWidget(self.centralwidget)
self.listBox.setObjectName("listBox")
self.verticalLayout.addWidget(self.listBox)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.addButton = QtGui.QPushButton(self.centralwidget)
self.addButton.setObjectName("addButton")
self.addButton.setText("Add")
self.verticalLayout_2.addWidget(self.addButton)
self.removeButton = QtGui.QPushButton(self.centralwidget)
self.removeButton.setObjectName("removeButton")
self.removeButton.setText("Remove")
self.verticalLayout_2.addWidget(self.removeButton)
self.clearButton = QtGui.QPushButton(self.centralwidget)
self.clearButton.setObjectName("clearButton")
self.clearButton.setText("Clear")
self.loadButton = QtGui.QPushButton(self.centralwidget)
self.loadButton.setObjectName("clearButton")
self.loadButton.setText("Load File")
self.verticalLayout_2.addWidget(self.loadButton)
self.verticalLayout_2.addWidget(self.clearButton)
spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.okButton = QtGui.QPushButton(self.centralwidget)
self.okButton.setText("OK")
self.cancelButton = QtGui.QPushButton(self.centralwidget)
self.cancelButton.setText("Cancel")
self.horizontalLayout_2.addWidget(self.okButton)
self.horizontalLayout_2.addWidget(self.cancelButton)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout.addLayout(self.verticalLayout_2)
QMetaObject.connectSlotsByName(TestLayout)
# connect buttons
self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addToList)
self.connect(self.removeButton, QtCore.SIGNAL("clicked()"), self.removeFromList)
self.connect(self.clearButton, QtCore.SIGNAL("clicked()"), self.clearList)
self.connect(self.loadButton, QtCore.SIGNAL("clicked()"), self.loadListFile)
self.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.ListUpdate)
self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.cancelListUpdate)
示例12: doneCompletion
def doneCompletion(self):
self.timer.stop()
self.ui.popup.hide()
self.ui.editor.setFocus()
item = self.ui.popup.currentItem()
if item != None:
self.currentItem = self.ui.popup.currentItem().data(0,0)
self.ui.editor.setText(item.text(self.textplacetoeditor))
QMetaObject.invokeMethod(self.ui.editor, "returnPressed");
示例13: setupUi
def setupUi (self, MainWindow):
'''sets up the Maya UI.
@param MainWindow
'''
MainWindow.setObjectName ('MainWindow')
MainWindow.resize (800, 1396)
sizePolicy = QSizePolicy (QSizePolicy.Preferred, QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch (0)
sizePolicy.setVerticalStretch (0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
font = QFont ()
font.setPointSize (11)
MainWindow.setFont (font)
MainWindow.setWindowTitle (QApplication.translate("MainWindow", "Location Tool", None, QApplication.UnicodeUTF8))
MainWindow.setTabShape (QTabWidget.Rounded)
MainWindow.setDockOptions (QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks)
self.scrollAreaWidgetContents_3 = QWidget (MainWindow)
self.scrollAreaWidgetContents_3.setGeometry (QRect(10, 10, 900, 940))
self.scrollAreaWidgetContents_3.setObjectName ('scrollAreaWidgetContents_3')
self._view = View0.View ("JADEview", self.graph_view, self.scene, self.scrollAreaWidgetContents_3)
self._view.setObjectName ('JADEview') # real ui name
self._view.graphicsView.setObjectName ('JADEInnerView')
self.connect (self.scene, SIGNAL("selectionChanged()"), self._view.selectionChanged)
self._view.wireViewItemsUp ()
self._view.getGraphicsView().setScene (self.scene)
self._view.setToolboxCSSColorScheme ('background-color: rgb(68,68,68);color: rgb(200,200,200)') # this needs to be done since the toolbox's background didn't have a uniform colour otherwise.
#self._view.setGraphicsViewCSSBackground () # the CSS background doesn't seem to work in Maya as there seems to be a problem with cleaning QGraphicsLineItems when they move, that doesn't happen when there's no CSS applied to the background.
self.graphicsView = self._view.getGraphicsView ()
self.node_coords = QPoint (0,0)
layout = QHBoxLayout (self.scrollAreaWidgetContents_3)
layout.setContentsMargins (QMargins(0,0,0,0));
layout.addWidget (self._view)
QMetaObject.connectSlotsByName (MainWindow)
"""
cmds.control('JADEInnerView', edit=True, ebg=True, bgc=[.5,.5,.9])
print cmds.control('JADEInnerView', query=True, p=True)
"""
# wiring the Maya Contextual pop-up Menus - yes, in Maya we've split the pop-up menu definition in three pop-up menus although only one will be present at any time.
self.menu = cmds.popupMenu ('JADEmenu', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenu()', aob=True)
self.menuAddOuts = cmds.popupMenu ('JADEmenuAddOuts', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenuAddOuts()', aob=True, alt=True)
self.menuAddIns = cmds.popupMenu ('JADEmenuAddIns', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenuAddIns()', aob=True, ctl=True)
# this class property is used to keep track of the mouse position.
self._mouse = QCursor
# self._view's zoom slider (we need this to correct the bias added to sort the mouse position when the zoom changes - ONLY in Maya)
self._zoom_slider = self._view.getZoomSlider()
示例14: run
def run(self):
self.eventLoop = QEventLoop()
self.eventLoop.processEvents()
QObject.connect(self._call, SIGNAL("finished(QString)"),
lambda str: self.eventLoop.quit())
QMetaObject.invokeMethod(self._call, "moveToAndInit",
Qt.QueuedConnection,
Q_ARG("PyQt_PyObject",
QThread.currentThread()))
self.eventLoop.processEvents()
self.eventLoop.exec_()
示例15: func
def func():
try:
QMetaObject.invokeMethod(self, "_on_start", Qt.QueuedConnection)
if allow_partial_results:
kwargs['should_break'] = should_break
res = method(self, *args, on_progress=on_progress, **kwargs)
except StopExecution:
res = None
QMetaObject.invokeMethod(self, "_on_result", Qt.QueuedConnection,
Q_ARG(object, res))
self.running = False