本文整理匯總了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)