當前位置: 首頁>>代碼示例>>Python>>正文


Python Qt.QMessageBox類代碼示例

本文整理匯總了Python中PyQt5.Qt.QMessageBox的典型用法代碼示例。如果您正苦於以下問題:Python QMessageBox類的具體用法?Python QMessageBox怎麽用?Python QMessageBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了QMessageBox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: saveXML

 def saveXML(self):
     if len(self.tools.framemenu.getAllFrames()) > 1:
         result = QFileDialog.getSaveFileName(self, 'Choose the destination for the animation file!', '.', 'Animation File (*.armo)')
         if result[0] != "":
             XML().toXML(self.tools.framemenu.getAllFrames(), result[0])
     else:
         QMessageBox.information(self, "Stickman Message", "You need at least 2 frames to save the animation!")
開發者ID:artemmoskalev,項目名稱:stickman_animator,代碼行數:7,代碼來源:AnimationTools.py

示例2: importGraph

    def importGraph(self, text):
        '''Init text after an import.

        Argument(s):
        text (str): Textual representation of the graph
        '''
        self.acceptUpdate = False
        self.setPlainText(text)

        pydotGraph = graph_from_dot_data(text)

        # Check that attributes are in valid form
        message = self.checkItemsAttributes(pydotGraph.get_nodes(),
                                            pydotGraph.get_edges())
        if not message:
            self.rebuildTextModel(text, pydotGraph)

            # Send every elements to the model to build him
            for id, args in self.nodes.items():
                self.controller.onCreateNode(id, args)
            for id, args in self.edges.items():
                self.controller.onCreateEdge(args[EdgeArgs.sourceId],
                                             args[EdgeArgs.destId])

        # Some attributes are in invalid form
        else:
            QMessageBox.warning(self, "Syntax error", message)

        self.acceptUpdate = True
開發者ID:pydoted,項目名稱:dotEd,代碼行數:29,代碼來源:TextGraphView.py

示例3: QuestionDialog

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"
開發者ID:MusaSakizci,項目名稱:yali-family,代碼行數:25,代碼來源:YaliDialog.py

示例4: _validate_monkeys

 def _validate_monkeys(self):
     first_month = Monkey.unslash(self.ui.firstMonthEdit.text())
     last_month = Monkey.unslash(self.ui.lastMonthEdit.text())
     if not Monkey.is_valid_pair(first_month, last_month):
         msg = 'Invalid time frame: invalid month or first month after last month!'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.firstMonthEdit.setFocus()
         return None
     return TimeInterval(first_month=first_month, last_month=last_month)
開發者ID:joegillon,項目名稱:allocat_effort,代碼行數:9,代碼來源:project_window.py

示例5: fromXML

 def fromXML(self):
     file = QFileDialog.getOpenFileName(self, "Load Animation", ".", "Animation Files (*.armo)")
     if file[0] != "":
         try:
             frames = XML().fromXML(file[0])
             self.tools.framemenu.removeAllFrames()
             for frame in frames:
                 self.tools.framemenu.addNewFrame(frame)
             if len(frames) > 0:
                 getWorld().setWorldFrom(frames[0])
         except:
             QMessageBox.information(self, "Stickman Message", "The animation file is not valid!")
開發者ID:artemmoskalev,項目名稱:stickman_animator,代碼行數:12,代碼來源:AnimationTools.py

示例6: _save_clicked

 def _save_clicked(self):
     rec = self._valid_emp()
     if rec:
         try:
             rec.save()
         except AllocatException as e:
             QMessageBox.critical(QMessageBox(), 'Input Error', e.msg)
             self.ui.nameEdit.setFocus()
             return
         Dataset.employees = Employee.get_all()
         self._load_list(Dataset.employees.keys(), rec.name)
     self.ui.addBtn.setEnabled(True)
開發者ID:joegillon,項目名稱:allocat_effort,代碼行數:12,代碼來源:employee_window.py

示例7: show_warning

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()
開發者ID:wordtinker,項目名稱:SimpleBudget,代碼行數:9,代碼來源:utils.py

示例8: about

 def about(self):
     # Get the about text from a file inside the plugin zip file
     # The get_resources function is a builtin function defined for all your
     # plugin code. It loads files from the plugin zip file. It returns
     # the bytes from the specified file.
     #
     # Note that if you are loading more than one file, for performance, you
     # should pass a list of names to get_resources. In this case,
     # get_resources will return a dictionary mapping names to bytes. Names that
     # are not found in the zip file will not be in the returned dictionary.
     text = get_resources('about.txt')
     QMessageBox.about(self, 'About the Interface Plugin Demo',
             text.decode('utf-8'))
開發者ID:Aliminator666,項目名稱:calibre,代碼行數:13,代碼來源:main.py

示例9: msgbox

 def msgbox(cls, typename, text, button0, button1=None, button2=None, title=None, form=None):
     if form:
         logger.warn("MessageBox: Se intentó usar form, y no está implementado.")
     icon = QMessageBox.NoIcon
     if not title:
         title = "Pineboo"
     if typename == "question":
         icon = QMessageBox.Question
         if not title:
             title = "Question"
     elif typename == "information":
         icon = QMessageBox.Information
         if not title:
             title = "Information"
     elif typename == "warning":
         icon = QMessageBox.Warning
         if not title:
             title = "Warning"
     elif typename == "critical":
         icon = QMessageBox.Critical
         if not title:
             title = "Critical"
     # title = unicode(title,"UTF-8")
     # text = unicode(text,"UTF-8")
     msg = QMessageBox(icon, title, text)
     msg.addButton(button0)
     if button1:
         msg.addButton(button1)
     if button2:
         msg.addButton(button2)
     return msg.exec_()
開發者ID:deavid,項目名稱:pineboo,代碼行數:31,代碼來源:dgi_qt.py

示例10: makeDatabase

    def makeDatabase(self):
        '''Runs recollindex outside calibre like in a terminal. 
        Look for recollindex for more information about the flags and options'''
        self.cmd = [prefs['pathToRecoll'] + '/recollindex', '-c', prefs['pathToCofig'] + '/plugins/recollFullTextSearchPlugin']
        #TODO: Fix for Linux
        #self.cmd = 'LD_LIBRARY_PATH="" ' + prefs['pathToRecoll'] + '/recollindex -c ' + prefs['pathToCofig'] + '/plugins/recollFullTextSearchPlugin'
        if self.replaceDatabase == True :
            self.cmd += [' -z']
        self.p = Popen(self.cmd,  shell=False)
        # TODO: Was close_fds nessesary? check it on linux
        #self.p = Popen(self.cmd,  shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

        box = QMessageBox()
        box.about(self, 'Please read! \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t','Depending on you library size this operation can take a lot of time.\nThe process runs outside calibre so you can use or close it, but do not use this plugin.\nFor now there is no information about when recoll finishs,\nso look up, whether a recoll of recollindex process is running on you system.')
開發者ID:idealist1508,項目名稱:Recoll-Full-Text-Search-For-Calibre,代碼行數:14,代碼來源:main.py

示例11: buttonExportClicked

 def buttonExportClicked(self):
     (filePaths, filter) = QFileDialog.getOpenFileNames(
         parent=self,
         caption="轉換數據庫文件為文本格式",
         directory=QApplication.applicationDirPath() + "/../data",
         filter="Database file (*.db * mdb)",
     )
     if not filePaths:
         return
     #
     if DatabaseMgr().convertToText(filePaths):
         QMessageBox.information(self, "格式轉換", "轉換成功!")
     else:
         QMessageBox.warning(self, "格式轉換", "轉換失敗!")
開發者ID:iclosure,項目名稱:carmonitor,代碼行數:14,代碼來源:history_widget.py

示例12: InfoDialog

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()
開發者ID:MusaSakizci,項目名稱:yali-family,代碼行數:16,代碼來源:YaliDialog.py

示例13: show_font_face_rule_for_font_file

def show_font_face_rule_for_font_file(file_data, added_name, parent=None):
    try:
        fm = FontMetadata(BytesIO(file_data)).to_dict()
    except UnsupportedFont:
        return
    pp = _('Change this to the relative path to: %s') % added_name
    rule = '''@font-face {{
  src: url({pp});
  font-family: "{ff}";
  font-weight: {w};
  font-style: {sy};
  font-stretch: {st};
  }}'''.format(pp=pp, ff=fm['font-family'], w=fm['font-weight'], sy=fm['font-style'], st=fm['font-stretch'])
    QApplication.clipboard().setText(rule)
    QMessageBox.information(parent, _('Font file added'), _(
        'The font file <b>{}</b> has been added. The text for the CSS @font-face rule for this file has been copied'
        ' to the clipboard. You should paste it into whichever CSS file you want to add this font to.').format(added_name))
開發者ID:JimmXinu,項目名稱:calibre,代碼行數:17,代碼來源:manage_fonts.py

示例14: _monkey_clicked

 def _monkey_clicked(self, row, col):
     employee = self.tbl.item(row, 0).text()
     monkey = self.monkeys[col - 2]
     hdr = '%s\n%s' % (employee, Monkey.prettify(monkey))
     lines = []
     total = 0
     for asn in self.efforts[employee].assignments:
         interval = TimeInterval(
             first_month=asn.first_month,
             last_month=asn.last_month
         )
         asn_monkeys = Monkey.monkey_list(interval)
         if monkey in asn_monkeys:
             lines.append('%s: %d' % (asn.project_name, asn.effort))
             total += asn.effort
     msg = hdr + '\n\n' + '\n'.join(lines) + ('\n\nTotal: %d' % total)
     QMessageBox.information(QMessageBox(), 'Effort Breakdown', msg)
開發者ID:joegillon,項目名稱:allocat_effort,代碼行數:17,代碼來源:effort_window.py

示例15: _remove_clicked

 def _remove_clicked(self):
     nickname = self.ui.nicknameEdit.text()
     msg = 'Are you sure you want to remove project ' + nickname + '?'
     reply = QMessageBox.question(QMessageBox(), 'Double check', msg)
     if reply == QMessageBox.Yes:
         rec = Dataset.projects[nickname]
         rec.remove()
         del Dataset.projects[nickname]
         self._load_list(Dataset.projects.keys())
開發者ID:joegillon,項目名稱:allocat_effort,代碼行數:9,代碼來源:project_window.py


注:本文中的PyQt5.Qt.QMessageBox類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。