本文整理汇总了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
示例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, "格式转换", "转换失败!")
示例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
示例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
示例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)
示例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()