本文整理汇总了Python中PyQt5.QtWidgets.QMessageBox.warning方法的典型用法代码示例。如果您正苦于以下问题:Python QMessageBox.warning方法的具体用法?Python QMessageBox.warning怎么用?Python QMessageBox.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QMessageBox
的用法示例。
在下文中一共展示了QMessageBox.warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _open_img
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def _open_img(self):
'''
打开图片
'''
self.path_img,_=QFileDialog.getOpenFileName(self.centralWidget,'打开图片文件','./','Image Files(*.png *.jpg *.bmp)')
if self.path_img and os.path.exists(self.path_img):
print(self.path_img)
self.im_bgr,self.temp_bgr,self.faces=self.mu.read_and_mark(self.path_img)
self.im_ori,self.previous_bgr=self.im_bgr.copy(),self.im_bgr.copy()
self._set_statu(self.bg_edit,True)
self._set_statu(self.bg_op,True)
self._set_statu(self.bg_result,True)
self._set_statu(self.sls,True)
self._set_img()
else:
QMessageBox.warning(self.centralWidget,'无效路径','无效路径,请重新选择!')
示例2: add_bars
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def add_bars(win):
if len(win.edges) == 0:
QMessageBox.warning(win, "Внимание!", "Не введен отсекатель!")
return
win.pen.setColor(red)
w.lines.append([[win.edges[0].x() - 15, win.edges[0].y() - 15],
[win.edges[1].x() - 15, win.edges[1].y() - 15]])
add_row(w.table_bars)
i = w.table_bars.rowCount() - 1
item_b = QTableWidgetItem("[{0}, {1}]".format(win.edges[0].x() - 15 , win.edges[0].y() - 15))
item_e = QTableWidgetItem("[{0}, {1}]".format(win.edges[1].x() - 15, win.edges[1].y() - 15))
w.table_bars.setItem(i, 0, item_b)
w.table_bars.setItem(i, 1, item_e)
w.scene.addLine(win.edges[0].x() - 15, win.edges[0].y() - 15, win.edges[1].x() - 15, win.edges[1].y() - 15, w.pen)
win.pen.setColor(red)
w.lines.append([[win.edges[0].x() + 15, win.edges[0].y() + 15],
[win.edges[1].x() + 15, win.edges[1].y() + 15]])
add_row(w.table_bars)
i = w.table_bars.rowCount() - 1
item_b = QTableWidgetItem("[{0}, {1}]".format(win.edges[0].x() + 15, win.edges[0].y() + 15))
item_e = QTableWidgetItem("[{0}, {1}]".format(win.edges[1].x() + 15, win.edges[1].y() + 15))
w.table_bars.setItem(i, 0, item_b)
w.table_bars.setItem(i, 1, item_e)
w.scene.addLine(win.edges[0].x() + 15, win.edges[0].y() + 15, win.edges[1].x() + 15, win.edges[1].y() + 15, w.pen)
示例3: clipping
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def clipping(win):
if len(win.clip) <= 1:
QMessageBox.warning(win, "Ошибка!", "Отсекатель не задан!")
if len(win.pol) <= 1:
QMessageBox.warning(win, "Ошибка!", "Многоугольник не задан!")
if len(win.pol) > 1 and len(win.clip) > 1:
norm = isConvex(win.clip)
if not norm:
QMessageBox.warning(win, "Ошибка!", "Отсекатель не выпуклый!Операция не может быть проведена!")
else:
p = sutherland_hodgman(win.clip, win.pol, norm)
if p:
win.pen.setWidth(2)
win.pen.setColor(red)
win.scene.addPolygon(p, win.pen)
win.pen.setWidth(1)
示例4: _ok
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def _ok(self):
try:
if self._codeLabel.text() != self._tick.code:
QMessageBox.warning(self, '错误', '没有指定代码的Tick数据!')
return
except Exception:
QMessageBox.warning(self, '错误', '没有指定代码的Tick数据!')
return
event = DyEvent(DyEventType.stockStrategyManualSell)
event.data['class'] = self._strategyCls
event.data['tick'] = self._tick
event.data['volume'] = float(self._sellVolumeLineEdit.text()) * 100
# 不指定价格,则根据tick买入
price = self._sellPriceLineEdit.text()
event.data['price'] = float(price) if price else None
self._eventEngine.put(event)
self._unregisterEvent()
self._posWidget.close()
self.accept()
示例5: _ok
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def _ok(self):
try:
if self._codeLabel.text() != self._tick.code:
QMessageBox.warning(self, '错误', '没有指定代码的Tick数据!')
return
except Exception:
QMessageBox.warning(self, '错误', '没有指定代码的Tick数据!')
return
event = DyEvent(DyEventType.stockStrategyManualBuy)
event.data['class'] = self._strategyCls
event.data['tick'] = self._tick
event.data['volume'] = float(self._buyVolumeLineEdit.text()) * 100
# 不指定价格,则根据tick买入
price = self._buyPriceLineEdit.text()
event.data['price'] = float(price) if price else None
self._eventEngine.put(event)
self._unregisterEvent()
self.accept()
示例6: connect
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def connect(self):
userName = str(self.userName.text()).strip()
password = str(self.password.toPlainText()).strip()
if len(userName) <= 0 or len(password) <= 0:
QMessageBox.warning(self, u'获取策略', u'输入用户名和密码')
else:
strategyList = self.gateway.getStrategyList(userName, password)
if strategyList is not None and len(strategyList) > 0:
self.comboStrategy.clear()
strategyList_sl = []
for strategy in strategyList:
strategyList_sl.append(str(strategy))
strategyList_sl.sort()
self.comboStrategy.addItems(strategyList_sl)
self.userName.setEnabled(False)
self.password.setEnabled(False)
else:
QMessageBox.warning(self, u'获取策略', u'无法获取相关策略')
self.comboStrategy.clear()
self.comboStrategy.setFocus()
示例7: assert_installed
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def assert_installed(win=None, modules=[], binaries=[]):
missing = defaultdict(list)
for items, what, func in ((modules, 'modules', find_spec),
(binaries, 'binaries', which)):
for item in items:
if not func(item):
missing[what].append(item)
if missing:
msg = []
for subject, names in missing.items():
if len(names) == 1:
subject = {'modules': 'module', 'binaries': 'binary'}[subject]
msg.append('%s "%s"' % (subject, '", "'.join(names)))
msg = 'You are missing the %s for this.' % ' and '.join(msg)
if win:
from PyQt5.QtWidgets import QMessageBox
QMessageBox.warning(win, ' ', msg)
else:
raise ImportError(msg)
return not missing
示例8: extraction_done
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def extraction_done(self, outputs):
nb_written_all, wrote_endpoints = 0, False
for folder, output in outputs.items():
nb_written, wrote_endpoints = extractor_save(BASE_PATH, folder, output)
nb_written_all += nb_written
if wrote_endpoints:
self.set_view(self.welcome)
QMessageBox.information(self.view, ' ', '%d endpoints and their <i>.proto</i> structures have been extracted! You can now reuse the <i>.proto</i>s or fuzz the endpoints.' % nb_written_all)
elif nb_written_all:
self.set_view(self.welcome)
QMessageBox.information(self.view, ' ', '%d <i>.proto</i> structures have been extracted! You can now reuse the <i>.protos</i> or define endpoints for them to fuzz.' % nb_written_all)
else:
self.set_view(self.choose_extractor)
QMessageBox.warning(self.view, ' ', 'This extractor did not find Protobuf structures in the corresponding format for specified files.')
示例9: emit
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def emit(self, record):
try:
item = QListWidgetItem(self.format(record))
if record.levelno > logging.INFO:
item.setIcon(QIcon.fromTheme("dialog-warning"))
item.setForeground(QBrush(Qt.red))
else:
item.setIcon(QIcon.fromTheme("dialog-information"))
self.app.exec_in_main(self._add_item, item)
except (KeyboardInterrupt, SystemExit):
raise
except:
self.handleError(record)
示例10: dzialanie
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def dzialanie(self):
nadawca = self.sender()
try:
liczba1 = float(self.liczba1Edt.text())
liczba2 = float(self.liczba2Edt.text())
wynik = ""
if nadawca.text() == "&Dodaj":
wynik = liczba1 + liczba2
else:
pass
self.wynikEdt.setText(str(wynik))
except ValueError:
QMessageBox.warning(self, "Błąd", "Błędne dane", QMessageBox.Ok)
示例11: loguj
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def loguj(self):
login, haslo, ok = LoginDialog.getLoginHaslo(self)
if not ok:
return
if not login or not haslo:
QMessageBox.warning(self, 'Błąd',
'Pusty login lub hasło!', QMessageBox.Ok)
return
self.osoba = baza.loguj(login, haslo)
if self.osoba is None:
QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
return
zadania = baza.czytajDane(self.osoba)
model.aktualizuj(zadania)
model.layoutChanged.emit()
self.odswiezWidok()
self.dodajBtn.setEnabled(True)
self.zapiszBtn.setEnabled(True)
示例12: loguj
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def loguj(self):
login, haslo, ok = LoginDialog.getLoginHaslo(self)
if not ok:
return
if not login or not haslo:
QMessageBox.warning(self, 'Błąd',
'Pusty login lub hasło!', QMessageBox.Ok)
return
self.osoba = baza.loguj(login, haslo)
if self.osoba is None:
QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
return
zadania = baza.czytajDane(self.osoba)
model.aktualizuj(zadania)
model.layoutChanged.emit()
self.odswiezWidok()
self.dodajBtn.setEnabled(True)
示例13: loguj
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def loguj(self):
""" Logowanie użytkownika """
login, haslo, ok = LoginDialog.getLoginHaslo(self)
if not ok:
return
if not login or not haslo:
QMessageBox.warning(self, 'Błąd',
'Pusty login lub hasło!', QMessageBox.Ok)
return
self.osoba = baza.loguj(login, haslo)
if self.osoba is None:
QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
return
zadania = baza.czytajDane(self.osoba)
model.aktualizuj(zadania)
model.layoutChanged.emit()
self.odswiezWidok()
示例14: loguj
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def loguj(self):
""" Logowanie użytkownika """
login, haslo, ok = LoginDialog.getLoginHaslo(self)
if not ok:
return
if not login or not haslo:
QMessageBox.warning(self, 'Błąd',
'Pusty login lub hasło!', QMessageBox.Ok)
return
self.osoba = baza.loguj(login, haslo)
if self.osoba is None:
QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
return
QMessageBox.information(self,
'Dane logowania', 'Podano: ' + login + ' ' + haslo, QMessageBox.Ok)
示例15: generateReportReq
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import warning [as 别名]
def generateReportReq(self, strategyIdList):
"""发送生成报告请求"""
# 量化启动时的恢复策略列表中的策略没有回测数据
# 策略停止之后的报告数据从本地获取,不发送请求
# 策略启动时查看数据发送报告请求,从engine获取数据
# 查看策略的投资报告(不支持查看多个)
if len(strategyIdList) >= 1:
id = strategyIdList[0]
status = self.strategyManager.queryStrategyStatus(id)
strategyData = self.strategyManager.getSingleStrategy(id)
if status == ST_STATUS_QUIT: # 策略已停止,从本地获取数据
if "ResultData" not in strategyData: # 程序启动时恢复的策略没有回测数据
QMessageBox.warning(None, '警告', '策略未启动,报告数据不存在')
return
reportData = strategyData["ResultData"]
self.app.reportDisplay(reportData, id)
return
self._request.reportRequest(id)