Пример #1
0
 def mostrarAlerta(self, texto):
     msg = QMessageBox()
     msg.setWindowTitle("Notificacion")
     msg.setText(texto)
     msg.setIcon(QMessageBox.Information)
     # msg.setIcon(QMessageBox.Critical)
     # msg.setIcon(QMessageBox.Warning)
     msg.exec_()
Пример #2
0
def convert_evernote():
    makefolder()
    recursive()
    dial = QMessageBox()
    dial.setText("Finished Converting!")
    dial.setWindowTitle("Success!")
    dial.addButton(QMessageBox.Ok)
    dial.exec_()
Пример #3
0
 def on_failed(exc_info):
     msg = QMessageBox(
         QMessageBox.Critical,
         "Fail to add application",
         f"Failed to add application: \n\n{exc_info[0].__name__}: {exc_info[1]}",
     )
     msg.setDetailedText("".join(traceback.format_exception(*exc_info)))
     msg.exec_()
Пример #4
0
 def error(error_message):
     error_msgbox = QMessageBox()
     error_msgbox.setIcon(QMessageBox.Information)
     error_msgbox.setWindowTitle("Oh no!")
     error_msgbox.setText("Error!")
     error_msgbox.setInformativeText(error_message)
     error_msgbox.setStandardButtons(QMessageBox.Close)
     error_msgbox.exec_()
Пример #5
0
 def handleActionAboutClicked(self):
     aboutBox = QMessageBox()
     aboutBox.setIcon(QMessageBox.Information)
     aboutBox.setStandardButtons(QMessageBox.Ok)
     aboutBox.setWindowTitle("About the Software")
     aboutBox.setText(utils.license_text)
     aboutBox.setWindowIcon(self.appIcon)
     aboutBox.exec_()
Пример #6
0
    def about_version(self):
        """Message with current version info"""

        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setText(f"💻 Version installed: {VERSION}")
        msg.setWindowTitle("Current Version")
        msg.exec_()
 def message_box_erreur(self, text):
     '''Fenetre Pop-Up affichant un message d'erreur'''
     message = QMessageBox()
     message.setText(text)
     message.setWindowTitle('Erreur')
     icon = (QtGui.QPixmap('091-notification.png'))
     message.setWindowIcon(icon)
     message.exec_()
Пример #8
0
 def _show_confirm(self):
     dialog = QMessageBox()
     dialog.setWindowTitle('Conferma Prenotazione')
     msg = 'Registrato prenotazione per i seguenti libri:\n{}'
     dialog.setText(
         msg.format('\n'.join(
             ['{} x {}'.format(k, v) for k, v in self.books.items()])))
     dialog.exec_()
Пример #9
0
 def showNoCurrentProjectMessage(self, action: str):
     msg = QMessageBox()
     msg.setStyleSheet("background-color: #2D2D30; color: white;")
     msg.setModal(True)
     msg.setIcon(QMessageBox.Critical)
     msg.setText("You have to select a project first.")
     msg.setWindowTitle("{} error".format(action.capitalize()))
     msg.exec_()
Пример #10
0
def show_errors_message(errors: List[str]):
    msgBox = QMessageBox()
    msgBox.setIcon(QMessageBox.Critical)
    msgBox.setText(
        "Could not save file as structure invalid, see below for details")
    msgBox.setStandardButtons(QMessageBox.Ok)
    msgBox.setDetailedText("\n\n".join([f"- {err}" for err in errors]))
    msgBox.exec_()
Пример #11
0
 def about(self):
     aboutMsg = QMessageBox()
     aboutMsg.setIcon(QMessageBox.Information)
     aboutMsg.setWindowTitle("About")
     aboutMsg.setText("<h2>Game Collection Manager</h2>")
     aboutMsg.setInformativeText(f"Version {_VERSION}\n")
     aboutMsg.exec_()
     self.search()
Пример #12
0
    def open_existing(self, create=False, restrict=None):
        if self.annotation.modified and not self._discard_dialog():
            return
        dlg = QFileDialog(self, 'Select directory')
        if restrict:
            dlg.setDirectory(restrict)

            def check(d, restrict):
                print(d)
                d = os.path.normpath(d)
                restrict = os.path.normpath(restrict)
                if not d.startswith(restrict):
                    dlg.setDirectory(restrict)

            dlg.directoryEntered.connect(lambda t: check(t, restrict))
        dlg.setOptions(QFileDialog.ShowDirsOnly
                       | QFileDialog.DontUseNativeDialog)
        dlg.setFileMode(dlg.DirectoryOnly)
        if dlg.exec_():
            path = dlg.selectedFiles()[0]
            if create:
                t = os.path.join(path, 'transcripts')
                t = os.path.normpath(t)
                os.mkdir(t)
                m = os.path.join(path, 'annotations')
                m = os.path.normpath(m)
                os.mkdir(m)
                m = os.path.join(path, 'minutes')
                m = os.path.normpath(m)
                os.mkdir(m)
                io.open(os.path.join(m, 'minutes.txt'), 'w').write('')
                io.open(os.path.join(t, 'transcript.txt'), 'w').write('')
            if self._check_path(path):
                self.annotation.set_path(path)
                self.transcripts.setEnabled(True)
                self.minutes.setEnabled(True)
                self.problems.setEnabled(True)
                self.evaluation.setEnabled(True)
                self.evaluation.open_evaluation(self.annotation)
                exts = ['wav', 'mp3', 'flac', 'mp4']
                self.player.open_audio(None)
                for e in exts:
                    for f in glob.glob(
                            os.path.normpath(os.path.join(path, '*.' + e))):
                        if os.path.isfile(
                                os.path.normpath(os.path.join(path, f))):
                            if self.player.open_audio(
                                    os.path.normpath(os.path.join(path, f))):
                                break
                self.is_git = False
                return True
            else:
                msg = QMessageBox()
                msg.setText('Invalid directory!')
                msg.setIcon(QMessageBox.Critical)
                msg.setWindowTitle("Error")
                msg.exec_()
        return False
Пример #13
0
def popup_msg(text='text', icon=QMessageBox.Information, info_text='info_text', window_title='window_title'):
    msg = QMessageBox()
    msg.setIcon(icon)
    msg.setText(text)
    msg.setInformativeText(info_text)
    # msg.setDetailedText("The details are as follows:")
    msg.setWindowTitle(window_title)
    msg.setStandardButtons(QMessageBox.Ok)
    msg.exec_()
Пример #14
0
 def save(self):
     msg_box = QMessageBox()
     msg_box.setText("This form has been modified.")
     msg_box.setInformativeText("Do you want to save your changes?")
     msg_box.setStandardButtons(QMessageBox.Save | QMessageBox.Discard
                                | QMessageBox.Cancel)
     msg_box.setDefaultButton(QMessageBox.Save)
     msg_box.buttonClicked.connect(self.msgBtn)
     msg_box.exec_()
Пример #15
0
    def on_async_error(self, t):
        # In case the progress dialog is open...
        self.accept_progress()

        exctype, value, traceback = t
        msg = f'An ERROR occurred: {exctype}: {value}.'
        msg_box = QMessageBox(QMessageBox.Critical, 'Error', msg)
        msg_box.setDetailedText(traceback)
        msg_box.exec_()
Пример #16
0
    def action_apply(self):
        """
        Apply parameters to relevant .nif files
        """
        if self.nif_files_list_widget.count() == 0:
            QMessageBox.warning(self, "No .nif files loaded",
                                "Don't forget to load .nif files !")
            return

        if self.nif_files_list_widget.count() >= get_config().getint(
                "DEFAULT", "softLimit"):
            box = QMessageBox()
            box.setIcon(QMessageBox.Question)
            box.setWindowTitle('Are you sure ?')
            box.setText(
                "The tool may struggle with more than 100 .nif files at once. We advise you to process small batches.\n\nAre you sure you wish to continue ?"
            )
            box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
            buttonY = box.button(QMessageBox.Yes)
            buttonY.setText('Yes')
            buttonN = box.button(QMessageBox.No)
            buttonN.setText('No')
            box.exec_()

            if box.clickedButton() == buttonN:
                return

        log.info("Applying parameters to " +
                 str(self.nif_files_list_widget.count()) + " files ...")
        self.toggle(False)
        self.progress_bar.setValue(0)
        self.processed_files = itertools.count()

        CONFIG.set("NIF", "Glossiness", str(self.spin_box_glossiness.value())),
        CONFIG.set("NIF", "SpecularStrength",
                   str(self.spin_box_specular_strength.value())),
        save_config()

        QMessageBox.warning(
            self, "Attention !",
            "The process is quite slow.\n\nThe gui will be mostly unresponsive to your input. Don't close the application, unless the completion pourcentage has not been updated in a long time (several minutes).\nIt took me 13 minutes to process 100 files for example."
        )

        #for indices in chunkify(range(self.nif_files_list_widget.count()), QThreadPool.globalInstance().maxThreadCount()-1):
        QThreadPool.globalInstance().setExpiryTimeout(-1)
        for index in range(self.nif_files_list_widget.count()):
            item = self.nif_files_list_widget.item(index)
            worker = NifProcessWorker(
                index=index,
                path=item.text(),
                keywords=self.keywords,
                glossiness=self.spin_box_glossiness.value(),
                specular_strength=self.spin_box_specular_strength.value())
            worker.signals.start.connect(self.start_apply_action)
            worker.signals.result.connect(self.result_apply_action)
            worker.signals.finished.connect(self.finish_apply_action)
            QThreadPool.globalInstance().start(worker)
Пример #17
0
 def solve(self):
     sudoku = [c.value() for c in self.cells]
     if not solver.solve(sudoku, self.cells):
         msg_box = QMessageBox()
         msg_box.setText('Not solvable')
         msg_box.setWindowTitle('Sudoku is:')
         msg_box.exec_()
         for cell in self.cells:
             cell.set_mode('display')
Пример #18
0
    def start(self):
        if self.start_state == False:
            try:
                if self.target_device is not None:

                    selete_interface = self.ui.comboBox_Interface.currentText()
                    if (selete_interface == 'JTAG'):
                        device_interface = pylink.enums.JLinkInterfaces.JTAG
                    elif (selete_interface == 'SWD'):
                        device_interface = pylink.enums.JLinkInterfaces.SWD
                    elif (selete_interface == 'cJTAG'):
                        device_interface = None
                    elif (selete_interface == 'FINE'):
                        device_interface = pylink.enums.JLinkInterfaces.FINE

                    self.rtt2uart = rtt_to_serial(self.target_device, self.ui.comboBox_Port.currentText(
                    ), self.ui.comboBox_baudrate.currentText(), device_interface, speed_list[self.ui.comboBox_Speed.currentIndex()])
                    self.rtt2uart.start()

                    # 启动后不能再进行配置
                    self.ui.comboBox_Device.setEnabled(False)
                    self.ui.pushButton_Selete_Device.setEnabled(False)
                    self.ui.comboBox_Interface.setEnabled(False)
                    self.ui.comboBox_Speed.setEnabled(False)
                    self.ui.comboBox_Port.setEnabled(False)
                    self.ui.comboBox_baudrate.setEnabled(False)
                    self.ui.pushButton_scan.setEnabled(False)
                else:
                    raise Exception("Please selete the target device !")

            except Exception as errors:
                msgBox = QMessageBox()
                msgBox.setIcon(QMessageBox.Warning)
                msgBox.setText(str(errors))
                msgBox.setWindowTitle('Error')
                msgBox.exec_()
            else:
                self.start_state = True
                self.ui.pushButton_Start.setText("Stop")
        else:
            try:
                # 停止后才能再次配置
                self.ui.comboBox_Device.setEnabled(True)
                self.ui.pushButton_Selete_Device.setEnabled(True)
                self.ui.comboBox_Interface.setEnabled(True)
                self.ui.comboBox_Speed.setEnabled(True)
                self.ui.comboBox_Port.setEnabled(True)
                self.ui.comboBox_baudrate.setEnabled(True)
                self.ui.pushButton_scan.setEnabled(True)

                self.rtt2uart.stop()

                self.start_state = False
                self.ui.pushButton_Start.setText("Start")
            except:
                logger.error('Stop rtt2uart failed', exc_info=True)
                pass
Пример #19
0
 def enterCheckMsg(self):
     """Warning message for when the user enters nothing or the dictionary already exists."""
     msg = QMessageBox(self)
     msg.setWindowTitle("Empty Entry")
     msg.setText(
         "No dictionary name was entered or the name already exists.")
     msg.setIcon(msg.Warning)
     msg.setStandardButtons(msg.Ok)
     msg.exec_()
Пример #20
0
 def aboutDialog(self):
     icon = QIcon(r'icons/sobre.png')
     text = "O Petro-Explorer é um software desenvolvido no Laboratório de Exploração e Produção de Petróleo (" \
            "LENEP) da UENF para análises petrofísicas e estatísticas de dados de rocha. "
     msg = QMessageBox()
     msg.setWindowTitle('Sobre Petro-Explorer')
     msg.setWindowIcon(icon)
     msg.setText(text)
     msg.exec_()
Пример #21
0
 def set_default(self, attr, attr_name):
     msg = QMessageBox()
     msg.setIcon(QMessageBox.Critical)
     msg.setText(
         "Material " + attr_name +
         " property is None.\nDefault values set. Please check values.")
     msg.setWindowTitle("Warning")
     msg.exec_()
     setattr(self.mat, attr, type(getattr(Material(), attr))())
Пример #22
0
 def initialize(self):
     """Initializes a Deburr Controller instance which establishes a
     connection with the motor controller"""
     self.main_controller = MainControl()
     error = self.main_controller.startup()
     if error is not None:
         msg_box = QMessageBox()
         msg_box.setText(error.__str__())
         msg_box.exec_()
Пример #23
0
def infoMessage(message, title=bdstr.information):
    """Uses `QMessageBox` to show a simple message.

    Parameters:
        message: the question to be displayed
        title: the window title
    """
    mbox = QMessageBox(QMessageBox.Information, title, message)
    mbox.exec_()
Пример #24
0
 def error_money(self):
     msg = QMessageBox()
     msg.setIcon(QMessageBox.Information)
     msg.setText("Not enough money to buy these units !")
     msg.setWindowTitle("Not enough money")
     msg.setStandardButtons(QMessageBox.Ok)
     msg.setWindowFlags(Qt.WindowStaysOnTopHint)
     msg.exec_()
     self.close()
Пример #25
0
            def handleAddToCartButtonClicked():
                print(self.currentOrderReferenceItems)
                print(self.itemInHand)
                if self.itemInHand not in self.currentOrderReferenceItems:
                    QMessageBox(
                        QMessageBox.Critical, "Error adding item to cart",
                        "You can only add items that exists in the reference order"
                    ).exec_()
                    return
                elif self.itemInHand in self.itemsInCart:
                    QMessageBox(QMessageBox.Critical,
                                "Error adding item to cart",
                                "This item is already in the cart").exec_()
                    return
                self.referenceItemsLabels[self.itemInHand].setFlat(True)
                self.itemsInCart.append(self.itemInHand)
                currentCartItems.addItem(product_id_to_name[self.itemInHand])
                if self.itemInHand in self.previousRecommendations:
                    self.numberOfGoodRecommendations += 1
                    self.referenceItemsLabels[self.itemInHand].setStyleSheet(
                        "Text-align:left; background-color:green;")
                    self.referenceItemsLabels[self.itemInHand].setFlat(False)

                #update recommendations
                result = self._sendCommand(
                    "PROCESS_PROJECT_GROUP_2", ";".join([
                        str(self.currentOrderUserId),
                        ",".join([str(x) for x in self.itemsInCart]),
                        ",".join([
                            str(x) for x in set(self.previousRecommendations)
                        ])
                    ]))
                if result == FAILURE_CODE:
                    self.log(
                        "Processing Failed, error getting recommendations from the RPi"
                    )
                    return
                else:
                    try:
                        recommendations = [int(id) for id in result.split(',')]
                    except:
                        recommendations = []

                updateCurrentRecommendations(recommendations)
                if len(self.itemsInCart) == len(
                        self.currentOrderReferenceItems):
                    completionMessage = QMessageBox(
                        QMessageBox.Information, "Order Completed",
                        f"Order Completed with {self.numberOfGoodRecommendations} Good Recommendation(s)\nPress New Order to start a new order"
                    )
                    if self.numberOfGoodRecommendations == 0:
                        completionMessage.setIconPixmap(
                            QPixmap('images/this_is_fine.jpg'))
                    completionMessage.setWindowIcon(appIcon)
                    completionMessage.exec_()
                    newOrderButton.setFocus()
Пример #26
0
    def __info(self, message: str):
        """__info will show a message with a given message

        Arguments:
            message {str} -- Message to show
        """
        msgbox = QMessageBox(self.parent())
        msgbox.setWindowTitle('Flix')
        msgbox.setText(message)
        msgbox.exec_()
Пример #27
0
    def send_message(self, message):
        if self.isConnected:
            self.BTsocket.send(message)

        else:
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Critical)
            msg.setText("You are not connected to any device!")
            msg.setWindowTitle("Warning!")
            msg.exec_()
Пример #28
0
 def protoclo_get(self):
     protoclo_list = []
     if self.ui.checkBox.checkState():
         protoclo_list.append(str(self.ui.checkBox.text()))
     elif self.ui.checkBox_2.checkState():
         protoclo_list.append(str(self.ui.checkBox_2.text()))
     else:
         message_window = QMessageBox(QMessageBox.Warning, 'Warning', 'Pleas Choose one Protocol')
         message_window.exec_()
     return protoclo_list
Пример #29
0
def showExceptionBox(logMessage):
    if QApplication.instance() is not None:
        errorBox = QMessageBox()
        errorBox.setWindowTitle('Error')
        errorBox.setText("Oops. An unexpected error occurred:\n{0}".format(logMessage))
        errorBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Close)
        buttonCopy = errorBox.button(QMessageBox.Ok)
        buttonCopy.setText('Copy exception log...')
        buttonCopy.clicked.connect(lambda: pyperclip.copy(logMessage))
        errorBox.exec_()
Пример #30
0
 def spider_info(self):
     text=self.comboBox_2.currentText()
     college = self.session.query(Seed).filter(Seed.college == text).first()
     self.spider.university_spider(college)
     MESSAGE = "更新/爬取学术信息完成"
     msgBox = QMessageBox(QMessageBox.Question,
                          "提示", MESSAGE,
                          QMessageBox.NoButton, self)
     msgBox.addButton("确定", QMessageBox.AcceptRole)
     msgBox.exec_()
Пример #31
0
from PySide2.QtCore import QCoreApplication, Signal, SIGNAL, SLOT, Qt, QSize, QPoint
from PySide2.QtGui import (QVector3D, QOpenGLFunctions, QOpenGLVertexArrayObject, QOpenGLBuffer,
    QOpenGLShaderProgram, QMatrix4x4, QOpenGLShader, QOpenGLContext, QSurfaceFormat)
from PySide2.QtWidgets import (QApplication, QWidget, QMessageBox, QHBoxLayout, QSlider,
    QOpenGLWidget)
from PySide2.shiboken2 import VoidPtr

try:
    from OpenGL import GL
except ImportError:
    app = QApplication(sys.argv)
    messageBox = QMessageBox(QMessageBox.Critical, "OpenGL hellogl",
                                         "PyOpenGL must be installed to run this example.",
                                         QMessageBox.Close)
    messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
    messageBox.exec_()
    sys.exit(1)


class Window(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.glWidget = GLWidget()

        self.xSlider = self.createSlider(SIGNAL("xRotationChanged(int)"),
                                         self.glWidget.setXRotation)
        self.ySlider = self.createSlider(SIGNAL("yRotationChanged(int)"),
                                         self.glWidget.setYRotation)
        self.zSlider = self.createSlider(SIGNAL("zRotationChanged(int)"),
                                         self.glWidget.setZRotation)