当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QMessageBox方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QMessageBox方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QMessageBox方法的具体用法?Python QtWidgets.QMessageBox怎么用?Python QtWidgets.QMessageBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QMessageBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onAllDrivesClicked

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def onAllDrivesClicked(self):
        """
        Include fixed drives to available USB devices.
        :return:
        """
        if self.ui.checkbox_all_drives.isChecked() is False:
            self.onRefreshClick()
            return

        if getattr(config, 'protected_drives', []):
            reply = QtWidgets.QMessageBox.Yes
        else:
            reply = QtWidgets.QMessageBox.warning(
                self, "WARNING!",
                "This option enables working with fixed drives\n"
                "and is potentially VERY DANGEROUS\n\n"
                "Are you SURE you want to enable it?",
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                QtWidgets.QMessageBox.No)

        if reply == QtWidgets.QMessageBox.No:
            self.ui.checkbox_all_drives.setChecked(False)
        elif reply == QtWidgets.QMessageBox.Yes:
            self.ui.checkbox_all_drives.setChecked(True)
            self.onRefreshClick() 
开发者ID:mbusb,项目名称:multibootusb,代码行数:27,代码来源:mbusb_gui.py

示例2: install_syslinux

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def install_syslinux(self):
        try:
            try:
                self.install_syslinux_impl()
            finally:
                config.process_exist = None
                self.ui_enable_controls()
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            uninstall_distro.do_uninstall_distro(
                config.distro, iso_basename(config.image_path))
            o = io.StringIO()
            traceback.print_exc(None, o)
            QtWidgets.QMessageBox.information(
                self, 'install_syslinux() failed',
                o.getvalue())
            log("install_syslinux() failed.")
            log(o.getvalue()) 
开发者ID:mbusb,项目名称:multibootusb,代码行数:21,代码来源:mbusb_gui.py

示例3: install_syslinux_impl

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def install_syslinux_impl(self):
        """
        Function to install syslinux on distro directory and on selected USB disks.
        :return:
        """
        self.ui.statusbar.showMessage(str("Status: Installing Syslinux..."))
        syslinux_distro_dir(config.usb_disk, config.image_path, config.distro)
        syslinux_default(config.usb_disk)
        replace_grub_binary()
        update_distro_cfg_files(config.image_path, config.usb_disk,
                    config.distro, config.persistence)
        self.update_list_box(config.usb_disk)
        self.ui.statusbar.showMessage("Status: Idle")
        self.ui_disable_persistence()
        log(iso_name(config.image_path) + ' has been successfully installed.')
        QtWidgets.QMessageBox.information(self, 'Finished...',
                                          iso_name(config.image_path) + ' has been successfully installed.') 
开发者ID:mbusb,项目名称:multibootusb,代码行数:19,代码来源:mbusb_gui.py

示例4: onFsckClick_impl

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def onFsckClick_impl(self, fsck_func):
        if not config.usb_disk:
            QtWidgets.QMessageBox.information(
                self, 'No partition is selected',
                'Please select the partition to check.')
            return
        if not config.usb_disk[-1:].isdigit():
            QtWidgets.QMessageBox.information(
                self, 'Selected device is not partition',
                'Please select a partition not a disk.')
            return
        output = []
        with usb.UnmountedContext(config.usb_disk, self.update_usb_mount):
            fsck_func(config.usb_disk, output)
        for resultcode, msgout, cmd in output:
            QtWidgets.QMessageBox.information(
                self, 'Integrity Check',
                 cmd + ' said:\n' + str(msgout[0], 'utf-8')) 
开发者ID:mbusb,项目名称:multibootusb,代码行数:20,代码来源:mbusb_gui.py

示例5: dd_finished

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def dd_finished(self):
        """
        Re-enable the blocked widgets for newer use.
        :return:
        """
        self.ui.progressbar.setValue(0)
        self.ui.statusbar.showMessage("Status: Idle")
        config.process_exist = None

        msgBox = QtWidgets.QMessageBox()
        if self.progress_thread_dd.error:
            title = "Failed to write the iso image to the USB disk."
            msg = self.progress_thread_dd.error
        else:
            title = "Image succesfully written to USB disk."
            msg = "Reboot to boot from USB or test it from " \
              "<b>Boot ISO/USB</b> tab."
        msgBox.setText(title)
        msgBox.setInformativeText(msg);
        msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok)
        msgBox.setIcon(QtWidgets.QMessageBox.Information)
        msgBox.exec_()

        self.ui_enable_controls() 
开发者ID:mbusb,项目名称:multibootusb,代码行数:26,代码来源:mbusb_gui.py

示例6: check_remount

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def check_remount(self):
        if config.usb_details['file_system'] != 'vfat':
            return True
        try:
            with UnmountedContext(config.usb_disk,
                                  self.update_usb_mount) as m:
                pass
            return True
        except usb.RemountError:
            QtWidgets.QMessageBox.critical(
                self,"Remount failed.",
                "Could not remount '{0}'. "
                "Please make sure no process has open "
                "handle(s) to previously mounted filesystem."
                .format(config.usb_disk))
            return False 
开发者ID:mbusb,项目名称:multibootusb,代码行数:18,代码来源:mbusb_gui.py

示例7: closeEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def closeEvent(self, event):
        """
        To capture the main close event.
        :param event: Close event.
        :return:
        """
        if config.process_exist == None:
            event.accept()
        else:
            reply = QtWidgets.QMessageBox.question(self, 'Exit MultiBootUSB...',
                                                   "A process is still running.\n"
                                                   "Do you really want to quit multibootusb?",
                                                   QtWidgets.QMessageBox.Yes,
                                                   QtWidgets.QMessageBox.No)
            if reply == QtWidgets.QMessageBox.Yes:
                log("Closing multibootusb...")
                event.accept()
                sys.exit(0)
            else:
                log("Close event cancelled.")
                event.ignore() 
开发者ID:mbusb,项目名称:multibootusb,代码行数:23,代码来源:mbusb_gui.py

示例8: definePosition

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def definePosition(self, row):
         pos_gui = Position_GUI(self.table_rows[row].p1, self.table_rows[row].p2,
                                str(self.table_rows[row].name_item.text()),
                                self.glHeadModel)
         pos_gui.show()
         p1, p2, name, ok = pos_gui.GetPositions()

         #to make sure the reference is given
         while ok and p2 == [0.0,0.0,0.0]:
            QtWidgets.QMessageBox.critical(self, "Warning",
                'You must select a direction by checking the box and clicking the head model')
            p1, p2, name, ok = pos_gui.GetPositions()

         if ok:
             self.table_rows[row].p1 = p1
             self.table_rows[row].p2 = p2
             scalp_surf = self.glHeadModel.getSurface('Scalp')
             self.writeOnPosColumn(row, p1)
             self.table_rows[row].name_item.setText(name)
             self.updateStimulatorModels() 
开发者ID:simnibs,项目名称:simnibs,代码行数:22,代码来源:main_gui.py

示例9: show_message

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def show_message(message="Message",
                 title="Title"):
    """Simple message box.

       :param message: message string
       :param title: window title

       >>> import easygui_qt as easy
       >>> easy.show_message()

       .. image:: ../docs/images/show_message.png
    """
    app = SimpleApp()
    box = qt_widgets.QMessageBox(None)
    box.setWindowTitle(title)
    box.setText(message)
    box.show()
    box.raise_()
    box.exec_()
    app.quit() 
开发者ID:aroberge,项目名称:easygui_qt,代码行数:22,代码来源:easygui_qt.py

示例10: get_abort

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def get_abort(message="Major problem - or at least we think there is one...",
              title="Major problem encountered!"):
    '''Displays a message about a problem.
       If the user clicks on "abort", sys.exit() is called and the
       program ends.  If the user clicks on "ignore", the program
       resumes its execution.

       :param title: the window title
       :param message: the message to display

       >>> import easygui_qt as easy
       >>> easy.get_abort()

       .. image:: ../docs/images/get_abort.png
    '''

    app = SimpleApp()
    reply = qt_widgets.QMessageBox.critical(None, title, message,
            qt_widgets.QMessageBox.Abort | qt_widgets.QMessageBox.Ignore)
    if reply == qt_widgets.QMessageBox.Abort:
        sys.exit()
    else:
        pass
    app.quit() 
开发者ID:aroberge,项目名称:easygui_qt,代码行数:26,代码来源:easygui_qt.py

示例11: delete_database

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def delete_database(self):
        def ifcontinue(box_button):
            if box_button.text() != '&Yes':
                return

            database_filename = os.path.join(
                self.main_window.database_path, 'Lector.db')
            os.remove(database_filename)
            QtWidgets.qApp.exit()

        # Generate a message box to confirm deletion
        confirm_deletion = QtWidgets.QMessageBox()
        deletion_prompt = self._translate(
            'SettingsUI', f'Delete database and exit?')
        confirm_deletion.setText(deletion_prompt)
        confirm_deletion.setIcon(QtWidgets.QMessageBox.Critical)
        confirm_deletion.setWindowTitle(self._translate('SettingsUI', 'Confirm'))
        confirm_deletion.setStandardButtons(
            QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
        confirm_deletion.buttonClicked.connect(ifcontinue)
        confirm_deletion.show()
        confirm_deletion.exec_() 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:24,代码来源:settingsdialog.py

示例12: create_message_box

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def create_message_box(title, text, icon="information", width=150):
    msg = QMessageBox()
    msg.setWindowTitle(title)
    lineCnt = len(text.split('\n'))
    if lineCnt > 15:
        scroll = QtWidgets.QScrollArea()
        scroll.setWidgetResizable(1)
        content = QtWidgets.QWidget()
        scroll.setWidget(content)
        layout = QtWidgets.QVBoxLayout(content)
        tmpLabel = QtWidgets.QLabel(text)
        tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        layout.addWidget(tmpLabel)
        msg.layout().addWidget(scroll, 12, 10, 1, msg.layout().columnCount())
        msg.setStyleSheet("QScrollArea{min-width:550 px; min-height: 400px}")
    else:
        msg.setText(text)
        if icon == "warning":
            msg.setIcon(QtWidgets.QMessageBox.Warning)
            msg.setStyleSheet("QMessageBox Warning{min-width: 50 px;}")
        else:
            msg.setIcon(QtWidgets.QMessageBox.Information)
            msg.setStyleSheet("QMessageBox Information{min-width: 50 px;}")
        msg.setStyleSheet("QmessageBox QLabel{min-width: "+str(width)+"px;}")
    msg.exec_() 
开发者ID:frappe,项目名称:biometric-attendance-sync-tool,代码行数:27,代码来源:gui.py

示例13: get_mem

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def get_mem(addr):
        dialog = IDAngrAddMemDialog()
        dialog.set_addr(addr)
        r = dialog.exec_()
        if r == QtWidgets.QDialog.Accepted:
            addr = dialog.ui.addrTextEdit.displayText()
            try:
                addr = int(addr, 16)
            except:
                QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, 'Error', "Address not in hex format").exec_()
                return None
            length = dialog.ui.lenTextEdit.displayText()
            try:
                length = int(length)
            except:
                QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, 'Error', "Length not in dec format").exec_()
                return None
            return (addr, length)
        return None 
开发者ID:andreafioraldi,项目名称:IDAngr,代码行数:21,代码来源:main_gui.py

示例14: insertImage

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def insertImage(self):

        # Get image file name
        filename = QtWidgets.QFileDialog.getOpenFileName(self, 'Insert image',".","Images (*.png *.xpm *.jpg *.bmp *.gif)")

        if filename:
            
            # Create image object
            image = QtGui.QImage(filename)

            # Error if unloadable
            if image.isNull():

                popup = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical,
                                          "Image load error",
                                          "Could not load image file!",
                                          QtWidgets.QMessageBox.Ok,
                                          self)
                popup.show()

            else:

                cursor = self.text.textCursor()

                cursor.insertImage(image,filename) 
开发者ID:goldsborough,项目名称:Writer-Tutorial,代码行数:27,代码来源:part-3.py

示例15: zipdb

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMessageBox [as 别名]
def zipdb(self):
        filename_tuple = widgets.QFileDialog.getSaveFileName(self, _("Save database (keep '.zip' extension)"),
                                                   "./ecu.zip", "*.zip")
        if qt5:
            filename = str(filename_tuple[0])
        else:
            filename = str(filename_tuple)
        
        if not filename.endswith(".zip"):
            filename += ".zip"

        if not isWritable(str(os.path.dirname(filename))):
            mbox = widgets.QMessageBox()
            mbox.setText("Cannot write to directory " + os.path.dirname(filename))
            mbox.exec_()
            return

        self.logview.append(_("Zipping XML database... (this can take a few minutes"))
        core.QCoreApplication.processEvents()
        parameters.zipConvertXML(filename)
        self.logview.append(_("Zip job finished")) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:23,代码来源:ddt4all.py


注:本文中的PyQt5.QtWidgets.QMessageBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。