Python PyQt5.QtWidgets.QMessageBox 模块,about() 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用PyQt5.QtWidgets.QMessageBox.about()

项目:face    作者:MOluwole    | 项目源码 | 文件源码
def Login(self):
        username = self.txt_username.text()
        password = self.txt_pwd.text()
        if username == "" and password == "":
            QMessageBox.about(self, 'Error', 'Provide a Valid username and password to continue')
        else:
            cursor = connection.cursor()
            sql = "Select * from users where username=%s and pwd=%s"
            cursor.execute(sql, (username, password))
            result = cursor.fetchall()
            if int(len(result)) <= 0:
                QMessageBox.about(self, "Error", "Invalid username and password. "
                                                 "Provide a valid username and password to continue ")
            else:
                self.__dashboard__ = Dashboard()
                self.__dashboard__.show()
                self.close()
项目:face    作者:MOluwole    | 项目源码 | 文件源码
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)

        self.__register__ = None
        self.__attendance____ = None

        self.btn_Register.clicked.connect(self.Register)
        self.btn_Attendance.clicked.connect(self.Attendance)
        self.btnSearch.clicked.connect(self.Search)
        self.report_date.setDate(QtCore.QDate.currentDate())

        cursor = connection.cursor()
        sql = "Select * from attendance"
        cursor.execute(sql)

        result = cursor.fetchall()
        rows = len(result)
        if rows <= 0:
            QMessageBox.about(self, "No Data", "No Attendance has been recorded yet")
        else:
            self.tableWidget.setRowCount(rows)
            self.tableWidget.setColumnCount(3)
            header_labels = ['Matric Number', 'Date', 'Status']
            self.tableWidget.setHorizontalHeaderLabels(header_labels)

            for count in range(0, rows):
                self.tableWidget.setItem(count, 0,
                                         QTableWidgetItem(str(result[count]["matric_num"].encode('ascii', 'ignore'))))
                self.tableWidget.setItem(count, 1, QTableWidgetItem(result[count]["dte"].encode('ascii', 'ignore')))
                self.tableWidget.setItem(count, 2, QTableWidgetItem(result[count]["status"].encode('ascii', 'ignore')))
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def check_plate_width(self, widget):
        loc = self.ui.comboConnLoc.currentText()
        plate_width = widget.text()
        plate_width = float(plate_width)
        if plate_width == 0:
            self.ui.btn_Design.setDisabled(False)
        else:

            dict_column_data = self.fetch_column_param()
            col_D = float(dict_column_data['D'])
            col_T = float(dict_column_data['T'])
            col_R1 = float(dict_column_data['R1'])
            clear_depth = 0.0
            if loc == "Column web-Beam web" or loc == "Column flange-Beam web":
                clear_depth = col_D - 2 * (col_T + col_R1 + 5)

            if clear_depth < plate_width:
                self.ui.btn_Design.setDisabled(True)
                QMessageBox.about(self, 'Information', "Height of the end plate should be less than %s mm" % (int(clear_depth)))
            else:
                self.ui.btn_Design.setDisabled(False)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def check_range(self, widget, lblwidget, min_val, max_val):

        '''(QlineEdit,QLable,Number,Number)---> NoneType
        Validating F_u(ultimate Strength) and F_y (Yeild Strength) textfields
        '''
        text_str = widget.text()
        val = int(text_str)
        if(val < min_val or val > max_val):
            QMessageBox.about(self, 'Error', 'Please Enter a value between %s-%s' % (min_val, max_val))
            widget.clear()
            widget.setFocus()
            palette = QPalette()
            palette.setColor(QPalette.Foreground, Qt.red)
            lblwidget.setPalette(palette)
        else:
            palette = QPalette()
            lblwidget.setPalette(palette)
项目:face    作者:MOluwole    | 项目源码 | 文件源码
def Search(self):
        matric_num = self.report_matric.text()
        search_date = self.report_date.date().toString("yyyy-MM-dd")

        if matric_num == "" and search_date == "":
            QMessageBox.about(self, "Invalid Parameters", "Please Provide a search Query to continue")
        else:
            self.tableWidget.setRowCount(0)
            if matric_num != "":
                sql = "Select * from attendance where matric_num = %s"
                cursor = connection.cursor()
                cursor.execute(sql, matric_num)
                result = cursor.fetchall()

            else:
                sql = "Select * from attendance where dte = %s"
                cursor = connection.cursor()
                cursor.execute(sql, search_date)
                result = cursor.fetchall()

            if len(result) > 0:
                self.tableWidget.setRowCount(len(result))
                self.tableWidget.setColumnCount(3)
                header_labels = ['Matric Number', 'Date', 'Status']
                self.tableWidget.setHorizontalHeaderLabels(header_labels)

                for count in range(0, len(result)):
                    self.tableWidget.setItem(count, 0, QTableWidgetItem(
                        str(result[count]["matric_num"].encode('ascii', 'ignore'))))
                    self.tableWidget.setItem(count, 1,
                                             QTableWidgetItem(result[count]["dte"].encode('ascii', 'ignore')))
                    self.tableWidget.setItem(count, 2,
                                             QTableWidgetItem(result[count]["status"].encode('ascii', 'ignore')))
            else:
                QMessageBox.about(self, "No Data", "No Data has been recorded")
项目:face    作者:MOluwole    | 项目源码 | 文件源码
def classifier(self):
        student_name = self.txt_name.text()
        matric_num = self.txt_matric_num.text()
        address = self.txt_address.toPlainText()
        sex = str(self.cmb_sex.currentText())
        dept = str(self.cmb_dept.currentText())
        dob = self.dte_dob.date()
        dob = dob.toString("MM/dd/yyyy")

        if student_name == "" or matric_num == "" or address == "" or sex == "" or dept == "" or dob == "":
            QMessageBox.about(self, 'Error', 'Provide the student details to continue')
        else:
            sql = "Select * from student_details where matric_num=%s"
            cursor = connection.cursor()
            cursor.execute(sql, matric_num)
            result = cursor.fetchall()
            if int(len(result)) > 0:
                QMessageBox.about(self, 'Error', 'Student Details Exists Already in Database')
            else:
                sql = "Insert into student_details(name, matric_num, address, sex, dept, dob) Values(%s,%s,%s,%s,%s,%s)"
                cursor = connection.cursor()
                cursor.execute(sql, (student_name, matric_num, address, sex, dept, dob))
                connection.commit()
                FaceCapture(matric_num)
                QMessageBox.about(self, 'Success', 'Student Details Registered Successfully')

        # self.__get_face__ = GetFace()
        # self.__get_face__.__init__()
        # self.close()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def on_aboutAction_triggered(self):
        QMessageBox.about(self, "About Style sheet",
                "The <b>Style Sheet</b> example shows how widgets can be "
                "styled using "
                "<a href=\"http://doc.qt.digia.com/4.5/stylesheet.html\">Qt "
                "Style Sheets</a>. Click <b>File|Edit Style Sheet</b> to pop "
                "up the style editor, and either choose an existing style "
                "sheet or design your own.")
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def on_aboutAction_triggered(self):
        QMessageBox.about(self, "About Style sheet",
                "The <b>Style Sheet</b> example shows how widgets can be "
                "styled using "
                "<a href=\"http://doc.qt.digia.com/4.5/stylesheet.html\">Qt "
                "Style Sheets</a>. Click <b>File|Edit Style Sheet</b> to pop "
                "up the style editor, and either choose an existing style "
                "sheet or design your own.")
项目:RTT-Console    作者:dudulung    | 项目源码 | 文件源码
def action_init(self):
        self.ui.actionStart.triggered.connect(self.on_btn_start_clicked)
        self.ui.actionFont.triggered.connect(self.on_btn_font_clicked)
        self.ui.actionClear.triggered.connect(self.on_btn_clear_clicked)
        self.ui.actionSave.triggered.connect(self.onBtnSaveClicked)
        self.ui.actionAbout.triggered.connect(self.about)
        self.ui.plainTextEdit.signal_key.connect(self.on_text_edit_key_pressed)
项目:RTT-Console    作者:dudulung    | 项目源码 | 文件源码
def about(self):
        QMessageBox.about(self, "About Console",
                          "Version 1.1 build at 20170419<br/>"
                          "Copyright @ dudulung<br/>")
项目:ClassifyHub    作者:Top-Ranger    | 项目源码 | 文件源码
def show_about_pyqt(self):
        QMessageBox.about(None, 'About PyQt5', 'PyQt5 provides Python bindings for the Qt framework. PyQt5 is developed by Riverbank Computing Limited and available under the GPL version 3 as well as under a commercial license.')

    ##
    # \brief Shows the 'About ClassifyHub' window.
项目:ClassifyHub    作者:Top-Ranger    | 项目源码 | 文件源码
def show_about_classifyhub(self):
        QMessageBox.about(None, 'About ClassifyHub', 'Copyright (C) 2016,2017 Marcus Soll\nCopyright (C) 2016,2017 Malte Vosgerau\nClassifyHub is an algorithm to tackle the \'GitHub Classification Problem\'. The goal is to classify GitHub (https://github.com/) repositories into different categories.\nClassifyHub is licensed under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.')

    ##
    # \brief Returns if saving is available.
    #
    # \return True if saving is available.
项目:Visualization    作者:nwrush    | 项目源码 | 文件源码
def __init__(self, parent, finished_callback=None):
        super(PreprocessorController, self).__init__(parent=parent)

        self._layout = QVBoxLayout(self)
        self.setLayout(self._layout)

        self._form_widget = QWidget(self)
        self._form_ui = preprocessor_form.Ui_preprocessorForm()
        self._form_ui.setupUi(self._form_widget)
        self._layout.addWidget(self._form_widget)
        self._connect_form_ui()

        self._run_widget = QWidget(self)
        self._run_ui = preprocessor_run.Ui_preprocessorRun()
        self._run_ui.setupUi(self._run_widget)
        self._layout.addWidget(self._run_widget)
        self._connect_run_ui()

        self._timer = QTimer()
        self._timer.setSingleShot(True)
        self._timer.setInterval(500)

        self._preprocessor_thread = None
        self._num_steps = None
        self._message_queue = queue.Queue()
        self._callback = finished_callback

        self.output_name = None

        if not has_preprocessor:
            QMessageBox.about(self, "Missing Preprocessor",
                              "The preprocessor could not be loaded and therefore can't be run\n"
                              "Check the log file for details")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_cadImages(self):
        status = self.resultObj['Bolt']['status']
        if status is True:

            files_types = "PNG (*.png);;JPEG (*.jpeg);;TIFF (*.tiff);;BMP(*.bmp)"
            fileName,_ = QFileDialog.getSaveFileName(self, 'Export', os.path.join(str(self.folder), "untitled.png"), files_types)
            fName = str(fileName)
            file_extension = fName.split(".")[-1]

            if file_extension == 'png' or file_extension == 'jpeg' or file_extension == 'bmp'or file_extension == 'tiff' :
                self.display.ExportToImage(fName)
                QMessageBox.about(self, 'Information', "File saved")
        else:
            self.ui.actionSave_CAD_image.setEnabled(False)
            QMessageBox.about(self,'Information', 'Design Unsafe: CAD image cannot be saved')
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_design(self, popup_summary):
        status = self.resultObj['Bolt']['status']
        if status is True:
            self.call_3d_model("white_bg")
            data = os.path.join(str(self.folder), "images_html", "3D_Model.png")
            self.display.ExportToImage(data)
            self.display.FitAll()
        else:
            pass

        filename = os.path.join(self.folder, "images_html", "Html_Report.html")
        filename = str(filename)
        self.commLogicObj.call_designReport(filename, popup_summary)

        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        wkhtmltopdf_path = config.get('wkhtml_path', 'path1')

        config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path )

        options = {
                   'margin-bottom': '10mm',
                   'footer-right': '[page]'
        }
        file_type = "PDF (*.pdf)"
        fname, _ = QFileDialog.getSaveFileName(self, "Save File As", self.folder + "/", file_type)
        fname = str(fname)
        flag = True
        if fname =='':
            flag = False
            return flag
        else:
            pdfkit.from_file(filename, fname, configuration=config, options=options)
            QMessageBox.about(self, 'Information', "Report Saved")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def unavailable(self):
        QMessageBox.about(self, "INFO", "This module is not available in the current version.")
        # Following code maintain for future coding.
        # self.ui.btn_beamCol.clicked.connect(lambda:self.change_desgin_page(list_of_items['Osdagpage'], list_of_items['tensionpage']))
        # self.ui.btn_compression.clicked.connect(lambda:self.change_desgin_page(list_of_items['Osdagpage'], list_of_items['tensionpage']))
        # self.ui.btn_flexural.clicked.connect(lambda:self.change_desgin_page(list_of_items['Osdagpage'], list_of_items['tensionpage']))
        # self.ui.btn_gantry.clicked.connect(lambda:self.change_desgin_page(list_of_items['Osdagpage'], list_of_items['tensionpage']))
        # self.ui.btn_plate.clicked.connect(lambda:self.change_desgin_page(list_of_items['Osdagpage'], list_of_items['tensionpage']))
        # self.ui.btn_tension.clicked.connect(lambda:self.change_desgin_page(list_of_items['Osdagpage'], list_of_items['tensionpage']))


    # Back up the reference to the exceptionhook
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def on_aboutAction_triggered(self):
        QMessageBox.about(self, "About Style sheet",
                "The <b>Style Sheet</b> example shows how widgets can be "
                "styled using "
                "<a href=\"http://doc.qt.digia.com/4.5/stylesheet.html\">Qt "
                "Style Sheets</a>. Click <b>File|Edit Style Sheet</b> to pop "
                "up the style editor, and either choose an existing style "
                "sheet or design your own.")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_designPref_para(self):
        """
        Save user design preferances.
        Returns: (dictionary) saved_designPref

        """
        '''
        This routine is responsible for saving all design preferences selected by the user
        '''
        self.saved_designPref = {}
        self.saved_designPref["bolt"] = {}
        self.saved_designPref["bolt"]["bolt_hole_type"] = str(self.ui.combo_boltHoleType.currentText())
        self.saved_designPref["bolt"]["bolt_hole_clrnce"] = self.get_clearance()
        self.saved_designPref["bolt"]["bolt_fu"] = int(self.ui.txt_boltFu.text())
        self.saved_designPref["bolt"]["slip_factor"] = float(str(self.ui.combo_slipfactor.currentText()))

        self.saved_designPref["weld"] = {}
        weldType = str(self.ui.combo_weldType.currentText())
        self.saved_designPref["weld"]["typeof_weld"] = weldType

        if weldType == "Shop weld":
            self.saved_designPref["weld"]["safety_factor"] = float(1.25)
        else:
            self.saved_designPref["weld"]["safety_factor"] = float(1.5)
        self.saved_designPref["weld"]["fu_overwrite"] = self.ui.txt_weldFu.text()
        self.saved_designPref["weld"]["weld_fu"] = str(self.ui.txt_weldFu.text())

        self.saved_designPref["detailing"] = {}
        typeOfEdge = str(self.ui.combo_detailingEdgeType.currentText())
        self.saved_designPref["detailing"]["typeof_edge"] = typeOfEdge
        self.saved_designPref["detailing"]["gap"] = float(0)
        if typeOfEdge == "a - Sheared or hand flame cut":
            self.saved_designPref["detailing"]["min_edgend_dist"] = float(1.7)
        else:
            self.saved_designPref["detailing"]["min_edgend_dist"] = float(1.5)

        self.saved_designPref["detailing"]["is_env_corrosive"] = str(self.ui.combo_detailing_memebers.currentText())

        self.saved_designPref["design"] = {}
        self.saved_designPref["design"]["design_method"] = str(self.ui.combo_design_method.currentText())

        self.saved = True

        QMessageBox.about(self, 'Information', "Preferences saved")

        return self.saved_designPref
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def check_plate_height(self, widget, lblwidget):
        '''

        Args:
            widget: QlineEdit
            lblwidget: QLabel

        Returns:
            range of plate height

        '''
        loc = self.ui.comboConnLoc.currentText()
        plate_height = widget.text()
        plate_height = float(plate_height)
        if plate_height == 0:
            self.ui.btn_Design.setDisabled(False)
        else:

            dict_beam_data = self.fetch_beam_param()
            dict_column_data = self.fetch_column_param()
            beam_D = float(dict_beam_data['D'])
            col_T = float(dict_column_data['T'])
            col_R1 = float(dict_column_data['R1'])
            beam_T = float(dict_beam_data['T'])
            beam_R1 = float(dict_beam_data['R1'])
            clear_depth = 0.0
            min_plate_height = 0.6 * beam_D
            if loc == "Column web-Beam web" or loc == "Column flange-Beam web":
                clear_depth = beam_D - 2 * (beam_T + beam_R1 + 5)
            else:
                clear_depth = beam_D - (col_R1 + col_T + beam_R1 + beam_T + 5)
            if clear_depth < plate_height or min_plate_height > plate_height:
                self.ui.btn_Design.setDisabled(True)
                QMessageBox.about(self, 'Information', "Height of the end plate should be in between %s-%s mm" % (int(min_plate_height), int(clear_depth)))
                widget.clear()
                widget.setFocus()
                palette = QPalette()
                palette.setColor(QPalette.Foreground, Qt.red)
                lblwidget.setPalette(palette)
            else:
                self.ui.btn_Design.setDisabled(False)
                palette = QPalette()
                lblwidget.setPalette(palette)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def checkbeam_b(self):
        loc = self.ui.comboConnLoc.currentText()
        check = True
        if loc == "Column web-Beam web":

            if self.ui.combo_Beam.currentText()== "Select section" or self.ui.comboColSec.currentIndex() == -1 or self.ui.comboColSec.currentText()=='Select section':
                return
            dict_beam_data = self.fetch_beam_param()
            dict_col_data = self.fetch_column_param()
            column_D = float(dict_col_data["D"])
            column_T = float(dict_col_data["T"])
            column_R1 = float(dict_col_data["R1"])
            column_web_depth = column_D - 2.0 * (column_T)

            beam_B = float(dict_beam_data["B"])

            if column_web_depth <= beam_B:
                self.ui.btn_Design.setDisabled(True)
                QMessageBox.about(self, 'Information', "Beam flange is wider than clear depth of column web (No provision in Osdag till now)")
                check = False
            else:
                self.ui.btn_Design.setDisabled(False)

        elif loc == "Beam-Beam":

            if self.ui.comboColSec.currentIndex() == -1 or self.ui.comboColSec.currentIndex() == 0 or self.ui.combo_Beam.currentIndex() == 0:
                return

            dict_sec_beam_data = self.fetch_beam_param()
            dict_pri_beam_data = self.fetch_column_param()
            pri_beam_D = float(dict_pri_beam_data["D"])
            pri_beam_T = float(dict_pri_beam_data["T"])
            pri_beam_web_depth = pri_beam_D - 2.0 * (pri_beam_T)

            sec_beam_D = float(dict_sec_beam_data["D"])

            if pri_beam_web_depth <= sec_beam_D:
                self.ui.btn_Design.setDisabled(True)
                QMessageBox.about(self, 'Information',
                "Secondary beam depth is higher than clear depth of primary beam web (No provision in Osdag till now)")
                check = False
            else:
                self.ui.btn_Design.setDisabled(False)

        return check
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_3d_cad_images(self):
        status = self.resultObj['Bolt']['status']
        if status is True:
            if self.fuse_model is None:
                self.fuse_model = self.create2Dcad()
            shape = self.fuse_model

            files_types = "IGS (*.igs);;STEP (*.stp);;STL (*.stl);;BREP(*.brep)"

            fileName, _ = QFileDialog.getSaveFileName(self, 'Export', os.path.join(str(self.folder), "untitled.igs"), files_types)
            fName = str(fileName)

            # if self.connectivity is None:
            #     self.connectivity = self.create_3d_col_web_beam_web()
            # if self.fuse_model is None:
            #     self.fuse_model = self.create_2d_cad(self.connectivity)
            # shape = self.fuse_model
            #
            # files_types = "IGS (*.igs);;STEP (*.stp);;STL (*.stl);;BREP(*.brep)"
            # filename = QFileDialog.getSaveFileName(self, 'Export', str(self.folder) + "/untitled.igs", files_types)
            #
            # filename = str(filename)
            flag = True
            if fName == '':
                flag = False
                return flag
            else:
                file_extension = fName.split(".")[-1]

                if file_extension == 'igs':
                    IGESControl.IGESControl_Controller().Init()
                    iges_writer = IGESControl.IGESControl_Writer()
                    iges_writer.AddShape(shape)
                    iges_writer.Write(fName)

                elif file_extension == 'brep':

                    BRepTools.breptools.Write(shape, fName)

                elif file_extension == 'stp':
                    # initialize the STEP exporter
                    step_writer = STEPControl_Writer()
                    Interface_Static_SetCVal("write.step.schema", "AP203")

                    # transfer shapes and write file
                    step_writer.Transfer(shape, STEPControl_AsIs)
                    status = step_writer.Write(fName)

                    assert(status == IFSelect_RetDone)

                else:
                    stl_writer = StlAPI_Writer()
                    stl_writer.SetASCIIMode(True)
                    stl_writer.Write(shape, fName)

                self.fuse_model = None
                QMessageBox.about(self, 'Information', "File saved")

        else:
            self.ui.actionSave_3D_model.setEnabled(False)
            QMessageBox.about(self,'Information', 'Design Unsafe: 3D Model cannot be saved')
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def show_design_connection(self):

        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        default_workspace_path = config.get('default_workspace', 'path1')
        folder = QFileDialog.getExistingDirectory(self,'Select Folder', default_workspace_path)
        folder = str(folder)
        if not os.path.exists(folder):
            if folder == '':
                pass
            else:
                os.mkdir(folder, 0755)

        root_path = folder
        images_html_folder = ['images_html']
        flag = True
        for create_folder in images_html_folder:
            if root_path == '':
                flag = False
                return flag
            else:
                try:
                    os.mkdir(os.path.join(root_path, create_folder))
                except OSError:
                    shutil.rmtree(os.path.join(folder, create_folder))
                    os.mkdir(os.path.join(root_path, create_folder))

        if self.ui.rdbtn_finplate.isChecked():
            launchFinPlateController(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)

        elif self.ui.rdbtn_cleat.isChecked():
            launch_cleatangle_controller(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)

        elif self.ui.rdbtn_endplate.isChecked():
            launch_endplate_controller(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)
            # QMessageBox.about(self,"INFO","End plate connection design is coming soon!")

        elif self.ui.rdbtn_seat.isChecked():
            launchSeatedAngleController(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)

        else:
            QMessageBox.about(self, "INFO", "Please select appropriate connection")

    # ********************************* Help Action *********************************************************************************************