update 日志模块初见
This commit is contained in:
24
app.py
24
app.py
@ -1,5 +1,6 @@
|
||||
import configparser
|
||||
import json
|
||||
import logging
|
||||
import queue
|
||||
import sys
|
||||
from multiprocessing import Process
|
||||
@ -14,6 +15,7 @@ from Util.util_ini import writeFeedLine_to_ini
|
||||
import Constant
|
||||
from CU.Command import FeedCommand
|
||||
from CU.Feeding import FeedLine, FeedingConfig, Feeding, FeedStatus
|
||||
from Util.util_log import QTextEditLogger
|
||||
#from Vision.camera_coordinate_dete import Detection
|
||||
from ui_untitled import Ui_MainWindow
|
||||
from COM.COM_Robot import RobotClient
|
||||
@ -37,9 +39,18 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
||||
self.init_Run()
|
||||
self.init_robot_info()
|
||||
self.init_FeedLine()
|
||||
|
||||
self.start_Runing()
|
||||
self.init_log()
|
||||
|
||||
def init_log(self):
|
||||
|
||||
self.logger_textEdit = logging.getLogger("QTextEditLogger")
|
||||
self.logger_textEdit.setLevel(logging.DEBUG)
|
||||
|
||||
text_edit_handler = QTextEditLogger(self.textEdit_log_info)
|
||||
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
||||
text_edit_handler.setFormatter(formatter)
|
||||
self.logger_textEdit.addHandler(text_edit_handler)
|
||||
|
||||
def init_UI(self):
|
||||
self.pushButton_num1.clicked.connect(self.send_num_button_click)
|
||||
@ -275,8 +286,6 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
||||
self.main_threading = Thread(target=self.run)
|
||||
self.robot_connect_threading = Thread(target=self.robotClient.run)
|
||||
self.main_threading.start()
|
||||
|
||||
|
||||
self.robot_connect_threading.start()
|
||||
pass
|
||||
|
||||
@ -366,6 +375,7 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
||||
self.label_maxNum.setText(self.lineEdit_num.text())
|
||||
|
||||
def send_stack_feedSet_button_click(self,index):
|
||||
self.logger.info("This is an info message")
|
||||
self.stackedWidget_feed.setCurrentIndex(index)
|
||||
|
||||
|
||||
@ -413,6 +423,14 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
||||
instruction_command.instructions.append(position_instruction)
|
||||
request_command = instruction_command.toString()
|
||||
print(request_command)
|
||||
log_str = f'移动到位置:{"自由路径" if move_type==MoveType.AXIS else "姿势直线"}:' \
|
||||
f'm0:{position_instruction.m0}-' \
|
||||
f'm2:{position_instruction.m1}-' \
|
||||
f'm3:{position_instruction.m2}-' \
|
||||
f'm4:{position_instruction.m3}-' \
|
||||
f'm5:{position_instruction.m4}-' \
|
||||
f'm6:{position_instruction.m5}'
|
||||
self.logger_textEdit.info(log_str)
|
||||
self.robotClient.add_sendQuene(request_command)
|
||||
|
||||
def send_get_safe_position_button_click(self):
|
||||
|
||||
Reference in New Issue
Block a user