コード例 #1
0
def QuestionDialog(title, text, info=None, dontAsk=False):
    msgBox = QMessageBox()

    buttonYes = msgBox.addButton(_("Yes"), QMessageBox.ActionRole)
    buttonNo = msgBox.addButton(_("No"), QMessageBox.ActionRole)

    answers = {buttonYes: "yes", buttonNo: "no"}
    if dontAsk:
        buttonDontAsk = msgBox.addButton(_("Don't ask again"),
                                         QMessageBox.ActionRole)
        answers[buttonDontAsk] = "dontask"

    msgBox.setText(text)
    if not info:
        info = _("Do you want to continue?")
    msgBox.setInformativeText(info)

    dialog = Dialog(_(title),
                    msgBox,
                    closeButton=False,
                    isDialog=True,
                    icon="question")
    dialog.resize(300, 120)
    dialog.exec_()

    ctx.mainScreen.processEvents()
    if msgBox.clickedButton() in answers.keys():
        return answers[msgBox.clickedButton()]
    return "no"
コード例 #2
0
def step_dialog(parent, title, msg, det_msg=''):
    d = QMessageBox(parent)
    d.setWindowTitle(title)
    d.setText(msg)
    d.setStandardButtons(QMessageBox.StandardButton.Ok
                         | QMessageBox.StandardButton.Cancel)
    return d.exec_() & QMessageBox.StandardButton.Cancel
コード例 #3
0
ファイル: YaliDialog.py プロジェクト: MusaSakizci/yali-family
def QuestionDialog(title, text, info = None, dontAsk = False):
    msgBox = QMessageBox()

    buttonYes = msgBox.addButton(_("Yes"), QMessageBox.ActionRole)
    buttonNo = msgBox.addButton(_("No"), QMessageBox.ActionRole)

    answers = {buttonYes:"yes",
               buttonNo :"no"}
    if dontAsk:
        buttonDontAsk = msgBox.addButton(_("Don't ask again"), QMessageBox.ActionRole)
        answers[buttonDontAsk] = "dontask"

    msgBox.setText(text)
    if not info:
        info = _("Do you want to continue?")
    msgBox.setInformativeText(info)

    dialog = Dialog(_(title), msgBox, closeButton = False, isDialog = True, icon="question")
    dialog.resize(300,120)
    dialog.exec_()

    ctx.mainScreen.processEvents()
    if msgBox.clickedButton() in answers.keys():
        return answers[msgBox.clickedButton()]
    return "no"
コード例 #4
0
    def doStopSubProcess(self, strObjName):
        print('Button {} clicked'.format(strObjName))
        args0 = strObjName.split('_')
        iIndex = int(args0[1])
        strAddress = self.lstTextEditAddress[iIndex].text()
        strPort = self.lstTextEditPort[iIndex].text()

        #todo fix here
        if strAddress != "" and strAddress != 'localhost':
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Information)
            msg.setText("远程程服务进程!😹  ")
            msg.setInformativeText("不是本地localhost本地进程😹 ")
            msg.setWindowTitle("操作提示:")
            msg.setDetailedText("请在远程机器上关闭服务进程")
            retval = msg.exec()
            return

        if strAddress == "":
            strAddress = 'localhost'
        if strPort == "":
            strPort = portNumberStart + iIndex

        mediator = self.getMediator()

        mediator.shutdownEastMoneyZjlxProcess(self, iIndex, strAddress,
                                              strPort)

        # self.lstBntStartSubProcessSocketServer[iIndex].setEnabled(True)
        # self.lstBntStopSubProcessSocketServer[iIndex].setEnabled(False)
        #
        # self.lstTextEditPort[iIndex].setEnabled(True)
        # self.lstTextEditAddress[iIndex].setEnabled(True)
        pass
コード例 #5
0
    def __ask_for_continue_if_unsaved_changes(self):
        if not self.__command_handler.can_undo.get():
            # Continue if there are no unsaved changes
            return True
        else:
            # Ask if there are unsaved changes
            box = QMessageBox()
            box.addButton(QCoreApplication.translate("main_window", "Yes"),
                          box.YesRole)
            no_button = box.addButton(QCoreApplication.translate("main_window",
                                                                 "No"),
                                      box.NoRole)
            box.setDefaultButton(no_button)
            box.setWindowTitle(QCoreApplication.translate("main_window",
                                                          "Unsaved changes"))
            box.setText(QCoreApplication.translate(
                                           "main_window",
                                           "Do you really want to continue "
                                           "without saving changes?"))
            box.setIcon(box.Icon.Question)
            response = box.exec()

            if (response == 1):
                # Do not continue because user wants to stop
                return False
            else:
                return True
コード例 #6
0
def updated(txt):
    msg = QMessageBox()
    msg.setText("             Sucessos              ")
    msg.setInformativeText("Os Dados Foram Atualizados onde: "+txt+"  na base de dados")
    msg.setIcon(QMessageBox.Information)
    msg.setStandardButtons(QMessageBox.Ok)
    msg.exec()
コード例 #7
0
def copy_selection(p_selection,p_with_connections=True):
    """Copy p_selection into a new collection and adds this to
        the selection of """
    global_properties = GlobalProperties.get_instance()
    new_selection = deepcopy(p_selection)
    copy_selection_name = new_selection.name
    copy_selection_name = copy_selection_name + " ( copy )"
    if global_properties.mpdj_data.selection_with_name_exists(copy_selection_name):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setText("Unable to create selection_copy, name exists.")
        msg.setInformativeText(
            "{} can't be created, a selection with this name exists.".format(copy_selection_name))
        msg.setWindowTitle("MessageBox ")
        msg.setDetailedText("The details are as follows:")
    new_selection.set_name(copy_selection_name)
    global_properties.mpdj_data.add_song_selection(new_selection)
    if p_with_connections:
        neighbours = global_properties.mpdj_data.get_neighbours_for_node_name(
            p_selection.get_name())
        for neighbour in neighbours:
            global_properties.mpdj_data.set_connected(copy_selection_name,neighbour,1,False)
        all_selections = global_properties.mpdj_data.get_song_selection_names()
        for selection in all_selections:
            if global_properties.mpdj_data.is_connected(selection,
                                                        p_selection.get_name()):
                global_properties.mpdj_data.set_connected(selection,copy_selection_name,1,False)
    global_properties.inform_update_listener()
コード例 #8
0
def inserted():
    msg = QMessageBox()
    msg.setText("             Sucessos              ")
    msg.setInformativeText("Os Dados Foram inseridos com sucesso na base de dados")
    msg.setIcon(QMessageBox.Information)
    msg.setStandardButtons(QMessageBox.Ok)
    msg.exec()
コード例 #9
0
 def ok_button_clicked(self):
     """Is executed when the OK button is clicked. Merges the two nodes."""
     node_name1 = self.combo_node1.currentText()
     node_name2 = self.combo_node2.currentText()
     if node_name1 == node_name2:
         msg = QMessageBox()
         msg.setIcon(QMessageBox.Information)
         msg.setText("Please select two different nodes")
         msg.setInformativeText(
             "It makes to sense to merge a node with itself")
         msg.setWindowTitle("Cannot merge")
         msg.exec_()
         return
     new_name = self.tf_new_name.text()
     if new_name == '':
         msg = QMessageBox()
         msg.setIcon(QMessageBox.Information)
         msg.setText("Please provide the name for the resulting node.")
         msg.setInformativeText("The resulting node should have a name.")
         msg.setWindowTitle("No new name given")
         msg.exec_()
         return
     connection_mode = ConnectionMergeMode[
         self.combo_connection_transfer_mode.currentText().upper()]
     global_properties = GlobalProperties.get_instance()
     global_properties.mpdj_data.merge_two_nodes_into_one(
         node_name1, node_name2, new_name, connection_mode)
     self.close()
コード例 #10
0
    def new_map(self):  # метод класса Edit_Map, новая карта
        if (not self.input_col.text().isdigit() or not self.input_row.text().isdigit()) or \
                (int(self.input_col.text()) < 14 or int(self.input_row.text()) < 14):
            # проверяем значения x, y. Если не числа, то выводим окно ошибки
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Critical)
            msg.setText("Error")  # текст окна msg
            msg.setWindowTitle("Error")  # название окна msg
            msg.exec_()
            return

        self._col = int(self.input_col.text())  # запоминаем новое значение x
        self._row = int(self.input_row.text())  # запоминаем новое значение y
        self._sp_map = [[0 for i in range(self._col)] for j in range(self._row)
                        ]  # создаем список 0 по размерам x, y

        self.input_col.setVisible(False)  # прячем строку для ввода x
        self.input_row.setVisible(False)  # прячем строку для ввода y
        self.button_new_map.setVisible(False)  # прячем кнопку "СОЗДАТЬ КАРТУ"

        edit_map.move_button(
        )  # Расширяем окно и меняем положение кнопок "ОТКРЫТЬ", "НАЗАД", "СОЗДАТЬ", "СОХРАНИТЬ"

        self.button_back.setVisible(True)  # показываем кнопку "НАЗАД"
        self.button_save.setVisible(True)  # показываем кнопку "СОХРАНИТЬ"
        self.button_open.setVisible(True)  # показываем кнопку "ОТКРЫТЬ"
        self.button_create.setVisible(True)  # показываем кнопку "СОЗДАТЬ"
        self.center()  # отцентровываем окно относительно экрана

        for i in range(
                PIC
        ):  # записываем в elem_map изображения из которых будет состоять карта
            self._elem_map.append(QPixmap())
            self._elem_map[i].load(resource_path("PIC/" + str(i) + "_0.png"))
        self._flag_1 = True
コード例 #11
0
    def doStartSubProcess(self, strObjName):
        print('Button {} clicked'.format(strObjName))

        args0 = strObjName.split('_')
        iIndex = int(args0[1])

        strAddress = self.lstTextEditAddress[iIndex].text()
        strPort = self.lstTextEditPort[iIndex].text()

        #todo fix here
        if strAddress != "" and strAddress != 'localhost':
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Information)
            msg.setText("尝试启动远程服务进程!😹  ")
            msg.setInformativeText("不是本地localhost本地进程😹 ")
            msg.setWindowTitle("操作提示:")
            msg.setDetailedText("请在远程机器上启动本程序启动服务进程")
            retval = msg.exec()
            return

        if strAddress == "":
            strAddress = 'localhost'
        if strPort == "":
            strPort = str(portNumberStart + iIndex)

        mediator = self.getMediator()
        bRetOk = mediator.startUpEastMoneyZjlxProcess(self, iIndex, strAddress,
                                                      strPort)
コード例 #12
0
ファイル: main.py プロジェクト: whtt/HandWritingRecognization
 def btn_recog_clicked(self):
     self.update()
     savePath = "./recog.jpg"
     image = self.__canvas.get_current_image()
     image.save(savePath)
     save_path = os.path.abspath(savePath)
     self.label_log.append("image saved in path:\n{}".format(save_path))
     method_text = self.__box_method.currentText()
     self.label_log.append('method: {}'.format(method_text))
     predict = self.METHOD_KERNEL.set_kernel(savePath, method_text)
     # pic = QTextImageFormat()
     # pic.setName('./feature_map.jpg')
     # pic.setHeight(100)
     # pic.setWidth(100)
     showImage = QImage('./feature_map.jpg').scaled(100, 100)
     self.feature_map.setPixmap(QPixmap.fromImage(showImage))
     # self.label_log.append('feature map:\n')
     # self.label_log.textCursor().insertImage('./feature_map.jpg')
     self.label_log.append("recognition result is: {}".format(predict))
     # self.label_log.moveCursor(QTextCursor.End)
     # self.label_log.textCursor().clearSelection()
     # del pic
     message = QMessageBox()
     message.setText("recognition result is: {}".format(predict))
     # message.addButton()
     message.exec_()
コード例 #13
0
 def _save_dialog(self, parent, title, msg, det_msg=''):
     d = QMessageBox(parent)
     d.setWindowTitle(title)
     d.setText(msg)
     d.setStandardButtons(QMessageBox.Yes | QMessageBox.No
                          | QMessageBox.Cancel)
     return d.exec_()
コード例 #14
0
    def finish_check(self):
        if self.valid_book_ids:
            is_filesize_exceeded = len(self.valid_book_ids) < self.books_count
            is_total_books_exceeded = self.limits[
                'total_books'] and self.books_count > self.limits['total_books']

            if is_filesize_exceeded or is_total_books_exceeded:
                if self.limits['message']:
                    msg_box = QMessageBox(self)
                    msg_box.setWindowTitle('BookFusion Sync')
                    msg_box.addButton(QMessageBox.No)
                    msg_box.addButton(QMessageBox.Yes)
                    msg_box.setText(self.limits['message'])
                    msg_box.setDefaultButton(QMessageBox.Yes)
                    reply = msg_box.exec_()
                    if reply == QMessageBox.Yes:
                        self.start_sync()
                    else:
                        self.in_progress = False
                        self.msg.setText('Canceled.')
                        self.finish_sync()
                else:
                    self.start_sync()
            else:
                self.start_sync()
        else:
            if self.in_progress:
                self.in_progress = False
                self.msg.setText('No supported books selected.')
            self.finish_sync()
コード例 #15
0
    def open_case(self):
        """
        Gives the user a file dialog to find their existing project and opens that.
        :return: None
        """
        open_dialog = QFileDialog()

        user_location = open_dialog.getOpenFileName()[
            0]  # Index 0 because user can't pick more than one file.
        if user_location == '':
            return  # User most likely pressed cancel.

        case = Case.open_from_disk(user_location)

        if case is None:  # Something bad must have happened. Tell the user that the file is corrupt. Or invalid.
            alert = QMessageBox()
            alert.setText("Corrupt case file or invalid file type.")
            alert.setIcon(QMessageBox.Critical)

            alert.exec_()

            return
        else:
            # Successfully open a case!
            case_controller = CaseController(case)

            self.open_window(case_controller)
コード例 #16
0
def aviso(txt):
    msg = QMessageBox()
    msg.setText("              Aviso                ")
    msg.setInformativeText(txt)
    msg.setIcon(QMessageBox.Warning)
    msg.setStandardButtons(QMessageBox.Ok)
    msg.exec_()
コード例 #17
0
ファイル: myomok01.py プロジェクト: eubnaeuu/Python
 def msgBox(self):        
     msgBox = QMessageBox()
     msgBox.setWindowTitle("경고창") # 메세지창의 상단 제목
     msgBox.setText("돌이 이미 있습니다") # 메세지 내용
     msgBox.setStandardButtons(QMessageBox.Yes)
     msgBox.exec_()
     msgBox.show()
コード例 #18
0
    def display_info(self, text: str):
        message_box = QMessageBox()

        message_box.setIcon(QMessageBox.Information)
        message_box.setWindowTitle("Information")
        message_box.setText(text)
        message_box.setStandardButtons(QMessageBox.Ok)
        message_box.exec_()
コード例 #19
0
    def display_error(self, text: str):
        message_box = QMessageBox()

        message_box.setIcon(QMessageBox.Critical)
        message_box.setWindowTitle("Error")
        message_box.setText(text)
        message_box.setStandardButtons(QMessageBox.Ok)
        message_box.exec_()
コード例 #20
0
def Sucessos(txt):
    msg = QMessageBox()
    msg.setWindowTitle("Sucesso")
    msg.setText("             Sucessos              ")
    msg.setInformativeText(txt)
    msg.setIcon(QMessageBox.Information)
    msg.setStandardButtons(QMessageBox.Ok)
    msg.exec()     
コード例 #21
0
ファイル: login.py プロジェクト: JhoLee/BBang-Shuttle
 def show_messagebox(message, title, icon=QMessageBox.Information):
     msg_box = QMessageBox()
     msg_box.setIcon(icon)
     msg_box.setText(message)
     # msg_box.setInformativeText(message)
     msg_box.setWindowTitle(title)
     # msg_box.setDetailedText("The details are as follows:")
     msg_box.setStandardButtons(QMessageBox.Ok)
     retval = msg_box.exec_()
コード例 #22
0
    def display_error(text: str):
        """Displays an error message to the user."""
        message = QMessageBox()

        message.setIcon(QMessageBox.Critical)
        message.setWindowTitle("Error")
        message.setText(text)
        message.setStandardButtons(QMessageBox.Ok)
        message.exec_()
コード例 #23
0
ファイル: utils.py プロジェクト: wordtinker/SimpleBudget
def show_warning(text):
    """
    Shows a simple warning with given text.
    """
    msg_box = QMessageBox()
    msg_box.setText(text)
    msg_box.setStandardButtons(QMessageBox.Ok)
    msg_box.setDefaultButton(QMessageBox.Ok)
    msg_box.exec()
コード例 #24
0
def is2insert(txt="Tem a certaza que gostari de realizar essa operacao?"):
    msg = QMessageBox()
    msg.setText("            Confirmacao            ")
    msg.setInformativeText(txt)
    msg.setIcon(QMessageBox.Question)
    msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
    clicked = msg.exec()
    resp = True if clicked == QMessageBox.Yes else False
    return resp
コード例 #25
0
 def message_box(self, text, informative, icon, buttons=QMessageBox.Ok):
     """Wraps up the QMessageBox"""
     msg = QMessageBox(self)
     msg.setStandardButtons(buttons)
     msg.setDefaultButton(QMessageBox.Ok)
     msg.setText(text)
     msg.setInformativeText(informative)
     msg.setIcon(icon)
     return msg.exec_()
コード例 #26
0
 def lataaja(self, tiedosto):
     '''Hoitaa muuttujien lataamisen annetusta tiedostosta'''
     lataus = False 
     try:
         '''Yrittää avata annetun tiedoston. Ilmoittaa jos tulee virhe'''
         file = open(tiedosto, "r")
         rivi = file.readline()
         rivi = rivi.strip()
         if rivi != "Lujuusanalysaattori":
             '''Kerrotaan käyttäjälle, että tiedosto oli virheellinen''' 
             msgBox = QMessageBox()
             msgBox.setText("Tiedoston lukeminen ei onnistu: Virheellinen tiedosto")
             msgBox.setWindowTitle("Virhe")
             msgBox.setMinimumWidth(50)
             msgBox.addButton(QPushButton('OK'), QMessageBox.NoRole)
             msgBox.exec_() 
             return lataus
     except FileNotFoundError:
         return lataus
     
     try:
         '''Ohitetaan päivämäärä'''
         rivi = file.readline()
         '''Luetaan arvot ja tallennetaan ne ominaisuudet luokan avulla'''
         '''Palkin pituus'''
         rivi = file.readline()
         Ominaisuudet.palkin_pituus(self, int(rivi))
         
         '''Palkin pituuden yksikko'''
         rivi = file.readline()
         Ominaisuudet.yksikko(self, int(rivi))
         
         '''Voiman suuruus'''
         rivi = file.readline()
         Ominaisuudet.voima(self, int(rivi)) 
         
         '''Voiman yksikkö'''
         rivi = file.readline()
         Ominaisuudet.yksikko_voima(self, int(rivi)) 
         
         '''Materiaali'''
         rivi = file.readline()
         Ominaisuudet.materiaali(self, int(rivi)) 
         
         '''Tuen tyyppi'''
         rivi = int(file.readline())
         Ominaisuudet.tuki(self, rivi)
         
         '''Onko ulkoinen voima asetettu 0=ei, 1=kyllä'''
         rivi = file.readline()
         Ominaisuudet.ulkoinen_voima(self, int(rivi)) 
         
         return True 
     
     except AttributeError:
         pass     
コード例 #27
0
    def closeEvent(self, event):
        if self.timeOut == 0:
            event.accept()
        else:
            msg = QMessageBox()
            msg.setText("等待任务完成")
            msg.exec()
            event.ignore()

        pass
コード例 #28
0
 def check(self):
     word = self.infEntry.text().upper()
     if word in self.wordList:
         msgBox = QMessageBox()
         msgBox.setText(word + ' already in dictionary')
         msgBox.exec_()
     else:
         msgBox = QMessageBox()
         msgBox.setText(word + ' not in dictionary yet')
         msgBox.exec_()
コード例 #29
0
    def stopAllThread(self):

        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setText("🤑还未实现,请一个个点击 按钮关闭进程!😹  ")
        msg.setInformativeText("🙄一次关闭,电脑会变得很慢,后期实现😹 ")
        msg.setWindowTitle("操作提示:")
        msg.setDetailedText("🤮笔记本电脑严重发烫")
        retval = msg.exec()
        pass
コード例 #30
0
    def startAllThread(self):

        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setText("😯还未实现,请一个个点击 按钮启动进程!😹  ")
        msg.setInformativeText("🤐一次启动,电脑会变得很慢,后期实现😹 ")
        msg.setWindowTitle("😬操作提示:")
        msg.setDetailedText("🤔笔记本电脑严重发烫")
        retval = msg.exec()
        pass
コード例 #31
0
 def documentIsNotSave(parent):
     msgBox = QMessageBox(parent)
     msgBox.setWindowTitle('The document has been modified')
     msgBox.setText('The document has been modified')
     msgBox.setInformativeText('Do you want to save your change?')
     msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard
                               | QMessageBox.Cancel)
     msgBox.setDefaultButton(QMessageBox.Save)
     msgBox.setIcon(QMessageBox.Warning)
     return msgBox.exec_()
コード例 #32
0
 def __about(self):
     # Create and set about text
     box = QMessageBox()
     box.setWindowTitle("About")
     box.setText("<h1>About</h1>Developed at the University"
                 " of Applied Sciences and Arts Northwestern"
                 " Switzerland (FHNW) by Nicolai Wassermann"
                 " and Simon Näf."
                 "<br><br>Client: Prof. Dr. Hanspeter Schmid"
                 "<br>Supervision: Prof. Dr. Dominik Gruntz")
     box.exec()
コード例 #33
0
ファイル: YaliDialog.py プロジェクト: MusaSakizci/yali-family
def InfoDialog(text, button=None, title=None, icon="info"):
    if not title:
        title = _("Information")
    if not button:
        button = _("OK")

    msgBox = QMessageBox()

    buttonOk = msgBox.addButton(button, QMessageBox.ActionRole)

    msgBox.setText(text)

    dialog = Dialog(_(title), msgBox, closeButton = False, isDialog = True, icon = icon)
    dialog.resize(300,120)
    dialog.exec_()
    ctx.mainScreen.processEvents()
コード例 #34
0
 def _save_dialog(self, parent, title, msg, det_msg=''):
     d = QMessageBox(parent)
     d.setWindowTitle(title)
     d.setText(msg)
     d.setStandardButtons(QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
     return d.exec_()
コード例 #35
0
ファイル: YaliDialog.py プロジェクト: MusaSakizci/yali-family
class MessageWindow:
    def __init__(self, title, text, type="ok", default=None, customButtons =None, customIcon=None, run=True, destroyAfterRun=True, detailed=False, longText=""):
        self.rc = None
        self.dialog = None
        self.msgBox = QMessageBox()
        self.doCustom = False
        self.customButtons = customButtons

        icon  = None
        buttons = None

        if type == 'ok':
            buttons = QMessageBox.Ok
            icon = "question"
        elif type == 'error':
            icon = "error"
            buttons =  QMessageBox.Ok
        elif type == 'warning':
            icon = "warning"
            buttons =  QMessageBox.Ok
        elif type == 'okcancel':
            icon = "question"
            buttons = QMessageBox.Ok | QMessageBox.Cancel
        elif type == 'question':
            icon = "question"
            buttons = QMessageBox.Ok | QMessageBox.Cancel
        elif type == 'yesno':
            icon = "question"
            buttons = QMessageBox.Yes | QMessageBox.No
        elif type == 'custom':
            self.doCustom = True
            if customIcon:
                icon = customIcon
            else:
                icon = "question"

        text = "<qt>%s</qt>" % text.replace("\n", " ")
        self.msgBox.setText(text)
        if detailed:
            self.msgBox.setDetailedText(unicode(longText))

        if self.doCustom:
            button = None
            for index, text in enumerate(self.customButtons):
                button = self.msgBox.addButton(text, QMessageBox.ActionRole)
                if default is not None and default == index:
                    self.msgBox.setDefaultButton(button)
        else:
            self.msgBox.setStandardButtons(buttons)

            if default == "no":
                default = QMessageBox.No
            elif default == "yes":
                default = QMessageBox.Yes
            elif default == "ok":
                default = QMessageBox.Ok
            else:
                default = None

        self.msgBox.setDefaultButton(default)

        self.dialog = Dialog(_(title), self.msgBox, closeButton=False, isDialog=True, icon=icon)
        self.dialog.resize(QSize(0,0))
        if run:
            self.run(destroyAfterRun)

    def run(self, destroyAfterRun=True):
        self.rc = self.dialog.exec_()
        if self.msgBox.clickedButton():
            if not self.doCustom:
                if self.msgBox.clickedButton().text() in [_("Ok"), _("Yes")]:
                    self.rc = 1
                elif self.msgBox.clickedButton().text() in [_("Cancel"), _("No")]:
                    self.rc = 0
            else:
                if self.msgBox.clickedButton().text() in self.customButtons:
                    self.rc = self.customButtons.index(self.msgBox.clickedButton().text())

        if destroyAfterRun:
            self.dialog = None

        return self.rc
コード例 #36
0
def step_dialog(parent, title, msg, det_msg=''):
    d = QMessageBox(parent)
    d.setWindowTitle(title)
    d.setText(msg)
    d.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
    return d.exec_() & QMessageBox.Cancel