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


Python QMessageBox.warning方法代碼示例

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


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

示例1: importGraph

# 需要導入模塊: from PyQt5.Qt import QMessageBox [as 別名]
# 或者: from PyQt5.Qt.QMessageBox import warning [as 別名]
    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,代碼行數:31,代碼來源:TextGraphView.py

示例2: buttonExportClicked

# 需要導入模塊: from PyQt5.Qt import QMessageBox [as 別名]
# 或者: from PyQt5.Qt.QMessageBox import warning [as 別名]
 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,代碼行數:16,代碼來源:history_widget.py

示例3: maybeSave

# 需要導入模塊: from PyQt5.Qt import QMessageBox [as 別名]
# 或者: from PyQt5.Qt.QMessageBox import warning [as 別名]
    def maybeSave(self):
        if not self.textPane.document().isModified():
            return True

        ret = QMessageBox.warning(self, 'GuiScannos',
                'The document has been modified.\n'
                'Do you want to save your changes?',
                QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)

        if ret == QMessageBox.Save:
            return self.fileSave()

        if ret == QMessageBox.Cancel:
            return False

        return True
開發者ID:TwoManyHats,項目名稱:GuiScannos,代碼行數:18,代碼來源:mainwin.py

示例4: focusOutEvent

# 需要導入模塊: from PyQt5.Qt import QMessageBox [as 別名]
# 或者: from PyQt5.Qt.QMessageBox import warning [as 別名]
    def focusOutEvent(self, event):
        '''Handle focus out event.

        Argument(s):
        event (QFocusEvent): Focus event
        '''
        self.acceptUpdate = False

        # Create pydot graph from text
        pydotGraph = graph_from_dot_data(self.toPlainText())

        # If the pydot graph is valid we can rewrite the text and check changes
        if pydotGraph:
            # If attributes are in valid form
            message = self.checkItemsAttributes(pydotGraph.get_nodes(),
                                                pydotGraph.get_edges())
            if not message:
                oldNodes = self.nodes
                oldEdges = self.edges
                self.nodes = {}
                self.edges = {}
                self.rebuildTextModel(self.toPlainText(), pydotGraph)

                # Compare old and new text and send changes to the model
                # Add nodes added
                added = self.nodes.keys() - oldNodes.keys()
                for idNode in added:
                    self.controller.onCreateNode(idNode, self.nodes[idNode])

                # Edit nodes changed
                intersect = set(self.nodes.keys()).intersection(
                    set(oldNodes.keys()))
                for idNode in intersect:
                    if self.nodes[idNode] != oldNodes[idNode]:
                        self.controller.onEditNode(idNode, self.nodes[idNode])

                # Remove nodes deleted
                removed = oldNodes.keys() - self.nodes.keys()
                for idNode in removed:
                    self.controller.onRemoveNode(idNode)

                    # Delete edges which contain the node
                    edgeToRemove = []
                    for edge in self.edges:
                        if (idNode == self.edges[edge][EdgeArgs.sourceId] or
                                idNode == self.edges[edge][EdgeArgs.destId]):
                            edgeToRemove.append(edge)
                    self.acceptUpdate = True
                    for edge in edgeToRemove:
                        self.removeEdge({
                            EdgeArgs.id: edge,
                            EdgeArgs.sourceId:
                            self.edges[edge][EdgeArgs.sourceId],
                            EdgeArgs.destId:
                            self.edges[edge][EdgeArgs.destId]
                        })
                    self.acceptUpdate = False

                # Remove edges deleted
                removed = oldEdges.keys() - self.edges.keys()
                for idEdge in removed:
                    self.controller.onRemoveEdge(
                        oldEdges[idEdge][EdgeArgs.sourceId],
                        oldEdges[idEdge][EdgeArgs.destId])

                # Add edges added
                added = self.edges.keys() - oldEdges.keys()
                for idEdge in added:
                    nodeSource = self.edges[idEdge][EdgeArgs.sourceId]
                    nodeDest = self.edges[idEdge][EdgeArgs.destId]
                    self.controller.onCreateEdge(nodeSource, nodeDest)

                QTextEdit.focusOutEvent(self, event)

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

        # Pydot graph invalid: show an error window
        else:
            QMessageBox.warning(self, "Syntax error",
                                "The dot structure is invalid.")
            self.setFocus()

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

示例5: _investigator_clicked

# 需要導入模塊: from PyQt5.Qt import QMessageBox [as 別名]
# 或者: from PyQt5.Qt.QMessageBox import warning [as 別名]
 def _investigator_clicked(self, checked):
     grade = self.ui.gradeEdit.text()
     if (checked and grade < 13) or \
             (not checked and grade > 12):
         msg = 'Investigator with grade %d?' % (grade,)
         QMessageBox.warning(QMessageBox(), 'Input Warning', msg)
開發者ID:joegillon,項目名稱:allocat_effort,代碼行數:8,代碼來源:employee_window.py

示例6: onButtonQuitClicked

# 需要導入模塊: from PyQt5.Qt import QMessageBox [as 別名]
# 或者: from PyQt5.Qt.QMessageBox import warning [as 別名]
 def onButtonQuitClicked(self):
     if QMessageBox.warning(self, '警告', '你確定要退出軟件嗎?',
                            QMessageBox.Ok | QMessageBox.No) == QMessageBox.Ok:
         self.close()
開發者ID:iclosure,項目名稱:carmonitor,代碼行數:6,代碼來源:main_widget.py


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