本文整理汇总了Python中PyQt5.QtCore.QMetaObject类的典型用法代码示例。如果您正苦于以下问题:Python QMetaObject类的具体用法?Python QMetaObject怎么用?Python QMetaObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMetaObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
super(MainWindow, self).__init__()
self.dbm_obj = Dbm()
self.curFile = ''
self.textEdit = QTextEdit()
self.sectionTreeWidget = QTreeWidget()
self.notesListWidget = QListWidget()
self.createHorizontalGroupBox()
self.setCentralWidget(self.horizontalGroupBox)
self.createActions()
self.createMenus()
# self.createToolBars()
self.createStatusBar()
self.readSettings()
[self.hierarchy_dict, self.notebook_dict, self.section_dict, self.page_dict] = [{}, {}, {}, {}]
self.setCurrentFile('')
# For binding slots and signals
self.fetchPageThread = FetchPage()
self.fetchPageThread.setObjectName('fetchPageThread')
self.syncAllThread = SyncAllThread()
self.syncAllThread.setObjectName('syncAllThread')
self.textEdit.document().contentsChanged.connect(self.documentWasModified)
self.sectionTreeWidget.setObjectName("sectionTreeWidget")
self.notesListWidget.setObjectName("notesListWidget")
QMetaObject.connectSlotsByName(self)
self.readDB()
示例2: _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()
示例3: Render
def Render(self, frame=None):
""" Render an images sequence of the current template using Blender 2.62+ and the
Blender Python API. """
# Enable the Render button again
self.disable_interface()
# Init blender paths
blend_file_path = os.path.join(info.PATH, "blender", "blend", self.selected_template)
source_script = os.path.join(info.PATH, "blender", "scripts", self.selected_template.replace(".blend", ".py"))
target_script = os.path.join(info.BLENDER_PATH, self.unique_folder_name,
self.selected_template.replace(".blend", ".py"))
# Copy the .py script associated with this template to the temp folder. This will allow
# OpenShot to inject the user-entered params into the Python script.
shutil.copy(source_script, target_script)
# Open new temp .py file, and inject the user parameters
self.inject_params(target_script, frame)
# Create new thread to launch the Blender executable (and read the output)
if frame:
# preview mode
QMetaObject.invokeMethod(self.worker, 'Render', Qt.QueuedConnection,
Q_ARG(str, blend_file_path),
Q_ARG(str, target_script),
Q_ARG(bool, True))
else:
# render mode
# self.my_blender = BlenderCommand(self, blend_file_path, target_script, False)
QMetaObject.invokeMethod(self.worker, 'Render', Qt.QueuedConnection,
Q_ARG(str, blend_file_path),
Q_ARG(str, target_script),
Q_ARG(bool, False))
示例4: processFrame
def processFrame(self, frame):
if self.m_isBusy:
return
self.m_isBusy = True
QMetaObject.invokeMethod(self.m_processor, 'processFrame',
Qt.QueuedConnection, Q_ARG(QVideoFrame, frame),
Q_ARG(int, self.m_levels))
示例5: resizeEvent
def resizeEvent(self, event):
super().resizeEvent(event)
win_w = event.size().width() * self.devicePixelRatio()
win_h = event.size().height() * self.devicePixelRatio()
self._updateViewportGeometry(win_w, win_h)
QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
示例6: resizeEvent
def resizeEvent(self, event):
super().resizeEvent(event)
w = event.size().width() * self.devicePixelRatio()
h = event.size().height() * self.devicePixelRatio()
for camera in self._app.getController().getScene().getAllCameras():
camera.setViewportSize(w, h)
proj = Matrix()
if camera.isPerspective():
proj.setPerspective(30, w/h, 1, 500)
else:
proj.setOrtho(-w / 2, w / 2, -h / 2, h / 2, -500, 500)
camera.setProjectionMatrix(proj)
self._app.getRenderer().setViewportSize(w, h)
QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
示例7: __init__
def __init__(self, title, widget=None, closeButton=True, keySequence=None, isDialog=False, icon=None):
QDialog.__init__(self, ctx.mainScreen)
self.setObjectName("dialog")
self.isDialog = isDialog
self.layout = QVBoxLayout()
self.setLayout(self.layout)
self.wlayout= QHBoxLayout()
if icon:
self.setStyleSheet("""QDialog QLabel{ margin-left:16px;margin-right:10px}
QDialog#dialog {background-image:url(':/images/%s.png');
background-repeat:no-repeat;
background-position: top left; padding-left:500px;} """ % icon)
self.windowTitle = windowTitle(self, closeButton)
self.setTitle(title)
#self.layout.setMargin(0)
self.layout.addWidget(self.windowTitle)
if widget:
self.addWidget(widget)
try:
widget.finished[int].connect(self.reject)
except:
pass
finally:
try:
widget.resizeDialog[int,int].connect(self.resize)
except:
pass
if closeButton:
self.windowTitle.pushButton.clicked.connect(self.reject)
if keySequence:
shortCut = QShortcut(keySequence, self)
shortCut.activated.connect(self.reject)
QMetaObject.connectSlotsByName(self)
self.resize(10,10)
示例8: setupUi
def setupUi(self):
self.setObjectName("Dialog")
self.setFixedSize(464, 257)
icon = QIcon()
icon.addPixmap(QPixmap("./resource/weather-thunder.png"), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)
self.setSizeGripEnabled(False)
self.setModal(True)
self.textBrowser = QTextBrowser(self)
self.textBrowser.setGeometry(QRect(0, 130, 491, 192))
self.textBrowser.setObjectName("textBrowser")
self.label = QLabel(self)
self.label.setGeometry(QRect(0, 0, 641, 131))
self.label.setText("")
self.label.setPixmap(QPixmap("./resource/about.jpg"))
self.label.setScaledContents(True)
self.label.setObjectName("label")
self.retranslateUi()
QMetaObject.connectSlotsByName(self)
self.show()
示例9: __init__
def __init__(self):
super(Widget, self).__init__()
layout = QVBoxLayout(self)
self.gif = GifWidget(self, "../images/yin.gif")
startBtn = QPushButton("开始", self)
startBtn.setObjectName("startBtn")
stopBtn = QPushButton("停止", self)
stopBtn.setObjectName("stopBtn")
changeBtn = QPushButton("改变第二个图", self)
changeBtn.setObjectName("changeBtn")
layout.addWidget(self.gif)
layout.addWidget(startBtn)
layout.addWidget(stopBtn)
layout.addWidget(changeBtn)
QMetaObject.connectSlotsByName(self) # 通过objectname注册信号
示例10: __init__
def __init__(self):
super(TestNinePatchLabel, self).__init__()
self.resize(400, 600)
self.listWidget = QListWidget(self)
self.listWidget.setObjectName("listWidget")
self.listWidget.setStyleSheet("""
QListWidget::item:selected {
background: rgba(0,0,0,0);
}
QListWidget::item:hover {
background: rgba(0,0,0,0);
}
""")
self.textEdit = QTextEdit(self)
self.textEdit.setMaximumHeight(100)
self.textEdit.setObjectName("textEdit")
self.sendBtn = QPushButton("发送", self)
self.sendBtn.setObjectName("sendBtn")
hlayout = QHBoxLayout()
hlayout.setContentsMargins(0, 0, 0, 0)
hlayout.setSpacing(0)
hlayout.addWidget(self.textEdit)
hlayout.addWidget(self.sendBtn)
vlayout = QVBoxLayout(self)
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.setSpacing(0)
vlayout.addWidget(self.listWidget)
vlayout.addItem(hlayout)
QMetaObject.connectSlotsByName(self) # 通过objectname注册信号
self.init()
self.setStyleSheet(SCROLLBARSTYLE)
示例11: wrapper
def wrapper(obj, *args):
# XXX: support kwargs?
qargs = [Q_ARG(t, v) for t, v in zip(self.args, args)]
invoke_args = [obj._instance, self.name]
invoke_args.append(Qt.DirectConnection)
rtype = self.returnType
if rtype:
invoke_args.append(Q_RETURN_ARG(rtype))
invoke_args.extend(qargs)
try:
result = QMetaObject.invokeMethod(*invoke_args)
error_msg = str(qApp.property("MIKRO_EXCEPTION").toString())
if error_msg:
# clear message
qApp.setProperty("MIKRO_EXCEPTION", "") # TODO: "" was QVariant(): check that it's correct (ale/20141002)
raise Exception(error_msg)
except RuntimeError as e:
raise TypeError(
"%s.%s(%r) call failed: %s" % (obj, self.name, args, e))
return wrap(result)
示例12: __signatures
def __signatures(self):
"""
Private slot to get the signatures.
@return list of signatures (list of strings)
"""
if self.__module is None:
return []
signatures = []
clsName = self.classNameCombo.currentText()
if clsName:
cls = self.__module.classes[clsName]
for meth in list(cls.methods.values()):
if meth.name.startswith("on_"):
if meth.pyqtSignature is not None:
sig = ", ".join(
[bytes(QMetaObject.normalizedType(t)).decode()
for t in meth.pyqtSignature.split(",")])
signatures.append("{0}({1})".format(meth.name, sig))
else:
signatures.append(meth.name)
return signatures
示例13: asyncSetStudyLabelText
def asyncSetStudyLabelText(self, text):
QMetaObject.invokeMethod(self.studyLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, text))
示例14: __init__
def __init__(self, parent=None, arguments=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.ctimer = QTimer()
#self.stimer = QTimer()
self.null_extra_arg = False
if arguments.title:
self.setWindowTitle(arguments.title)
if arguments.icon:
icon = QIcon(arguments.icon)
self.setWindowIcon(icon)
if not arguments.progressbar:
self.progressBar.hide()
else:
self.constant()
self.ctimer.timeout.connect(self.constantUpdate)
QMetaObject.connectSlotsByName(self)
self.button_ids = ["details_button", "ok_button", "yes_button", "no_button", "continue_button", "cancel_button"]
self.button_names = {
"details_button":_("Details"),
"ok_button":_("Ok"),
"yes_button":_("Yes"),
"no_button":_("No"),
"continue_button":_("Continue"),
"cancel_button":_("Cancel")
}
self.active_buttons = dict((e, False) for e in self.button_names)
self.null_extra_arg = True
if arguments.yesno or arguments.warningyesno:
self.enable_buttons(["yes_button", "no_button"])
if arguments.yesno:
self.label.setText(arguments.yesno)
else:
self.label.setText(arguments.warningyesno)
elif arguments.yesnocancel or arguments.warningyesnocancel:
self.enable_buttons(["yes_button", "no_button", "cancel_button"])
if arguments.yesnocancel:
self.label.setText(arguments.yesnocancel)
else:
self.label.setText(arguments.warningyesnocancel)
elif arguments.sorry or arguments.error or arguments.msgbox:
self.enable_buttons(["ok_button"])
if arguments.sorry:
self.label.setText(arguments.sorry)
elif arguments.error:
self.label.setText(arguments.error)
else:
self.label.setText(arguments.msgbox)
elif arguments.detailedsorry or arguments.detailederror:
self.enable_buttons(["details_button", "ok_button"])
if arguments.detailedsorry:
self.label.setText(arguments.detailedsorry[0])
self.details = arguments.detailedsorry[1]
else:
self.label.setText(arguments.detailederror[0])
self.details = arguments.detailederror[1]
elif arguments.warningcontinuecancel:
self.enable_buttons(["continue_button", "cancel_button"])
self.label.setText(arguments.warningcontinuecancel)
elif arguments.progressbar:
self.label.setText(arguments.progressbar[0])
if not self.null_extra_arg:
if not arguments.extra_arguments:
sys.exit(_("There is no extra argument!"))
self.create_buttons()
if arguments.yeslabel and self.active_buttons["yes_button"]:
self.buttons["yes_button"].setText(arguments.yeslabel)
if arguments.nolabel and self.active_buttons["no_button"]:
self.buttons["no_button"].setText(arguments.nolabel)
if arguments.cancellabel and self.active_buttons["cancel_button"]:
self.buttons["cancel_button"].setText(arguments.cancellabel)
if arguments.continuelabel and self.active_buttons["continue_button"]:
self.buttons["continue_button"].setText(arguments.continuelabel)
示例15: login_result
def login_result(self, string):
# print("got result", string)
obj = self.engine.rootObjects()[0]
myObj = obj.findChild(QObject, "loginHandle")
QMetaObject.invokeMethod(myObj, "loginResult", Qt.QueuedConnection, Q_ARG(QVariant, string))