mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect-gui.git
synced 2025-06-24 13:14:11 +08:00
fixed
This commit is contained in:
parent
0f3eb3aa7b
commit
b033ec5c0c
@ -1,6 +1,7 @@
|
||||
import cv2
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap, QImage, QTextCursor
|
||||
from PyQt5.QtGui import QPixmap, QImage, QTextCursor, QTextCharFormat, QBrush, QColor
|
||||
from PyQt5.QtMultimedia import QCameraInfo
|
||||
from PyQt5.QtWidgets import QDialog, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QScrollArea, QPushButton, \
|
||||
QSpacerItem, QSizePolicy, QLabel, QMessageBox, QPlainTextEdit
|
||||
|
||||
@ -64,9 +65,9 @@ class TaskRunDialog(QDialog):
|
||||
dd = 0
|
||||
elif msg.msg_type == MSG_DETECTION_RECORD:
|
||||
# 显示日志
|
||||
self.log_text.appendPlainText(get_msg_info(msg.record.code).decode('utf-8'))
|
||||
|
||||
# self.log_text.appendPlainText(get_msg_info(msg.record.code).decode('utf-8'))
|
||||
if msg.record.code < 0:
|
||||
self.insert_text(get_msg_info(msg.record.code).decode('utf-8'), QColor("red"))
|
||||
QMessageBox.warning(self, '错误信息', get_msg_info(msg.record.code).decode('utf-8'))
|
||||
self.set_button_default()
|
||||
AppContext.get_edge_context().get_component('image-framework').start_location()
|
||||
@ -76,11 +77,12 @@ class TaskRunDialog(QDialog):
|
||||
self.stop_check_button.setEnabled(True)
|
||||
self.stop_task_button.setEnabled(False)
|
||||
elif msg.record.code == 1012:
|
||||
self.insert_text(get_msg_info(msg.record.code).decode('utf-8'), QColor("green"))
|
||||
QMessageBox.warning(self, '成功信息', "检测结束")
|
||||
self.set_button_default()
|
||||
AppContext.get_edge_context().get_component('image-framework').start_location()
|
||||
else:
|
||||
dddd = 0
|
||||
self.insert_text(get_msg_info(msg.record.code).decode('utf-8'), QColor("white"))
|
||||
|
||||
if qt_image is None:
|
||||
return
|
||||
@ -92,6 +94,33 @@ class TaskRunDialog(QDialog):
|
||||
else:
|
||||
ddd = 0
|
||||
|
||||
def insert_text(self, text, font_color):
|
||||
fmt = QTextCharFormat()
|
||||
fmt.setForeground(QBrush(font_color))
|
||||
self.log_text.mergeCurrentCharFormat(fmt)
|
||||
self.log_text.appendPlainText(text)
|
||||
# InsertText(QString
|
||||
# text, QPlainTextEdit * plainTextEdit, int
|
||||
# fontSize, QColor
|
||||
# fontColor, QColor
|
||||
# backColor)
|
||||
# {
|
||||
# QTextCharFormat
|
||||
# fmt;
|
||||
# // 字体色
|
||||
# fmt.setForeground(QBrush(fontColor));
|
||||
# // fmt.setUnderlineColor("red");
|
||||
#
|
||||
# // 背景色
|
||||
# fmt.setBackground(QBrush(backColor));
|
||||
# // 字体大小
|
||||
# fmt.setFontPointSize(fontSize);
|
||||
# // 文本框使用以上设定
|
||||
# plainTextEdit->mergeCurrentCharFormat(fmt);
|
||||
# // 文本框添加文本
|
||||
# plainTextEdit->appendPlainText(text);
|
||||
# }
|
||||
|
||||
def showEvent(self, e):
|
||||
AppContext.get_edge_context().get_component('image-framework').start_location()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user