当前位置: 首页>>代码示例>>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;未经允许,请勿转载。