解决updata 关闭时串口没有正常关闭的问题
修改服务器文件列表显示 添加.jwt文件解析
This commit is contained in:
@@ -102,5 +102,7 @@
|
|||||||
prottcp 方案生成字节数据添加减少内存占用的转化函数,与此日期之前的MCU程序不兼容
|
prottcp 方案生成字节数据添加减少内存占用的转化函数,与此日期之前的MCU程序不兼容
|
||||||
2023.10.31
|
2023.10.31
|
||||||
注码工具添加忽略接触异常按钮
|
注码工具添加忽略接触异常按钮
|
||||||
|
2023.11.1
|
||||||
|
解决updata 关闭时串口没有正常关闭的问题
|
||||||
|
修改服务器文件列表显示
|
||||||
|
添加.jwt文件解析
|
||||||
|
@@ -101,13 +101,22 @@ def _detail_pkt(name:str):
|
|||||||
ret.append(" |主机接口:{d}".format(d=_bytes_to_str(data[40:40+8])))
|
ret.append(" |主机接口:{d}".format(d=_bytes_to_str(data[40:40+8])))
|
||||||
ret.append(" |设备类型:{d}".format(d=_bytes_to_str(data[48:48+12])))
|
ret.append(" |设备类型:{d}".format(d=_bytes_to_str(data[48:48+12])))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _detail_py(name:str):
|
def _detail_py(name:str):
|
||||||
return ["暂未实现"]
|
return ["暂未实现"]
|
||||||
def _detail_service(name:str):
|
def _detail_service(name:str):
|
||||||
return ["暂未实现"]
|
return ["暂未实现"]
|
||||||
def _detail_dtb(name:str):
|
def _detail_dtb(name:str):
|
||||||
return ["暂未实现"]
|
return ["暂未实现"]
|
||||||
|
def _detail_jwt(name:str):
|
||||||
|
ret=[" |文件类型:杰华特电子模块芯片程序"]
|
||||||
|
with open(name,"rb") as f:
|
||||||
|
data=f.read()
|
||||||
|
data=data[16*1024:]
|
||||||
|
ret.append(" |全固件CRC32:{d}".format(d=hex(_bytes_to_int(data[0:4]))))
|
||||||
|
ret.append(" |APP部分CRC32:{d}".format(d=hex(_bytes_to_int(data[4:8]))))
|
||||||
|
ret.append(" |文件名称:{d}".format(d=_bytes_to_str(data[8:])))
|
||||||
|
return ret
|
||||||
|
|
||||||
_fun_table={
|
_fun_table={
|
||||||
".elf":_detail_elf,
|
".elf":_detail_elf,
|
||||||
@@ -119,7 +128,8 @@ _fun_table={
|
|||||||
".pkt":_detail_pkt,
|
".pkt":_detail_pkt,
|
||||||
".py":_detail_py,
|
".py":_detail_py,
|
||||||
".service":_detail_service,
|
".service":_detail_service,
|
||||||
".dtb":_detail_dtb
|
".dtb":_detail_dtb,
|
||||||
|
".jwt":_detail_jwt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from PyQt5.QtCore import *
|
from PyQt5.QtCore import *
|
||||||
from PyQt5.QtGui import *
|
from PyQt5.QtGui import *
|
||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -71,6 +71,83 @@ class select_list(QObject):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class file_list(QDialog):
|
||||||
|
|
||||||
|
def __init__(self,father:QDialog,title:str,str_list:list):
|
||||||
|
QDialog.__init__(self,father)
|
||||||
|
self.resize(1000,400)
|
||||||
|
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
||||||
|
self.setWindowTitle(title)
|
||||||
|
self.code_list=QTableWidget(self)
|
||||||
|
self.code_list.setObjectName(u"code_list")
|
||||||
|
self.code_list.setGeometry(QRect(5, 5, 990, 390))
|
||||||
|
self.code_list.setColumnCount(4)
|
||||||
|
self.code_list.setHorizontalHeaderLabels(list(["ID","上传时间","文件名","描述"]))
|
||||||
|
self.code_list.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
|
||||||
|
self.code_list.horizontalHeader().setSectionResizeMode(0,QHeaderView.ResizeMode.Fixed)
|
||||||
|
self.code_list.setColumnWidth(0,50)
|
||||||
|
self.code_list.horizontalHeader().setSectionResizeMode(1,QHeaderView.ResizeMode.Fixed)
|
||||||
|
self.code_list.setColumnWidth(1,200)
|
||||||
|
self.code_list.horizontalHeader().setSectionResizeMode(2,QHeaderView.ResizeMode.Fixed)
|
||||||
|
self.code_list.setColumnWidth(2,200)
|
||||||
|
self.code_list.setSelectionBehavior( QAbstractItemView.SelectionBehavior.SelectRows)
|
||||||
|
self.code_list.cellDoubleClicked.connect(self.cell_clicked)
|
||||||
|
self.backcolor=True
|
||||||
|
for i in str_list:
|
||||||
|
self.list_add(i[0])
|
||||||
|
# 添加数据
|
||||||
|
def list_add(self,text:str):
|
||||||
|
stat=self.backcolor
|
||||||
|
self.backcolor=not self.backcolor
|
||||||
|
if(stat==True):
|
||||||
|
bkcolor=QColor()
|
||||||
|
bkcolor.setRgb(230,230,230,255)
|
||||||
|
else:
|
||||||
|
bkcolor=QColor()
|
||||||
|
bkcolor.setRgb(255,255,255,255)
|
||||||
|
code_strs=text.split("|")
|
||||||
|
if(len(code_strs)>=4):
|
||||||
|
code_strs[3],line=self.split_line(code_strs[3])
|
||||||
|
else:
|
||||||
|
code_strs.append("")
|
||||||
|
line=1
|
||||||
|
RowCont=self.code_list.rowCount()
|
||||||
|
self.code_list.insertRow(RowCont)
|
||||||
|
for i in range(len(code_strs)):
|
||||||
|
self.code_list.setItem(RowCont,i,QTableWidgetItem(code_strs[i]))
|
||||||
|
self.code_list.item(RowCont,i).setBackground(bkcolor)
|
||||||
|
self.code_list.setRowHeight(RowCont,line*30)
|
||||||
|
# self.code_list.resizeRowsToContents()
|
||||||
|
def split_line(self,text:str):
|
||||||
|
s=''
|
||||||
|
line=(len(text)+29)//30
|
||||||
|
for i in range(line):
|
||||||
|
s+=text[i*30:(i+1)*30]
|
||||||
|
s+='\n'
|
||||||
|
return s.strip(),line
|
||||||
|
def cell_clicked(self,x:int,y:int ):
|
||||||
|
print("cell_clicked",x,y)
|
||||||
|
str_list=[]
|
||||||
|
for i in range(3):
|
||||||
|
str_list.append(self.code_list.item(x,i).text())
|
||||||
|
self.select_item='|'.join(str_list)
|
||||||
|
self.done(QDialog.DialogCode.Accepted)
|
||||||
|
self.close()
|
||||||
|
def show(self):
|
||||||
|
if(self.exec()==QDialog.DialogCode.Accepted):
|
||||||
|
print(self.select_item)
|
||||||
|
return self.select_item
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if __name__=='__main__':
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
l=[
|
||||||
|
'1|2023-11-01 11:11:00|dddddddd|测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字,测试文字, 测试文字,测试文字,测试文字,',
|
||||||
|
'2|sssssss|dddddddd|sssssssss',
|
||||||
|
'3|sssssss|dddddddd|sssssssss',
|
||||||
|
'4|sssssss|dddddddd|sssssssss',
|
||||||
|
]
|
||||||
|
dlg=file_list(father=None, title="测试窗口",str_list=l)
|
||||||
|
dlg.show()
|
||||||
|
# app.exec()
|
||||||
|
|
||||||
|
@@ -34,11 +34,11 @@ class updata_dlg(QWidget):
|
|||||||
self.tab_widget=QTabWidget(self)
|
self.tab_widget=QTabWidget(self)
|
||||||
self.setWindowTitle("设备软件升级维护工具")
|
self.setWindowTitle("设备软件升级维护工具")
|
||||||
self.tab_widget.setGeometry(QRect(0,0,870,430))
|
self.tab_widget.setGeometry(QRect(0,0,870,430))
|
||||||
widget_ssh=updata_ssh.updata_dlg()
|
self.widget_ssh=updata_ssh.updata_dlg()
|
||||||
widget_uart=updata_uart.updata_dlg()
|
self.widget_uart=updata_uart.updata_dlg()
|
||||||
self.tab_widget.setTabPosition(QTabWidget.TabPosition.North)
|
self.tab_widget.setTabPosition(QTabWidget.TabPosition.North)
|
||||||
self.tab_widget.addTab(widget_ssh,"批检仪/赋码仪主板(SSH)")
|
self.tab_widget.addTab(self.widget_ssh,"批检仪/赋码仪主板(SSH)")
|
||||||
self.tab_widget.addTab(widget_uart,"MCU串口升级")
|
self.tab_widget.addTab(self.widget_uart,"MCU串口升级")
|
||||||
# self.tab_widget.setTabShape(QTabWidget.TabShape.Triangular)
|
# self.tab_widget.setTabShape(QTabWidget.TabShape.Triangular)
|
||||||
self.setWindowFlags(self.windowFlags() &(~ Qt.WindowType.WindowMaximizeButtonHint))
|
self.setWindowFlags(self.windowFlags() &(~ Qt.WindowType.WindowMaximizeButtonHint))
|
||||||
self.setFixedSize(self.width(), self.height())
|
self.setFixedSize(self.width(), self.height())
|
||||||
@@ -48,9 +48,11 @@ class updata_dlg(QWidget):
|
|||||||
icon = QIcon()
|
icon = QIcon()
|
||||||
icon.addPixmap(Logo, QIcon.Mode.Normal, QIcon.State.Off)
|
icon.addPixmap(Logo, QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
self.setWindowIcon(icon)
|
self.setWindowIcon(icon)
|
||||||
|
|
||||||
def closeEvent(self,e:QCloseEvent):
|
def closeEvent(self,e:QCloseEvent):
|
||||||
print("close clicked.")
|
print("close clicked.")
|
||||||
QWidget.closeEvent(self,e)
|
self.widget_ssh.quit()
|
||||||
|
self.widget_uart.quit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@@ -679,7 +679,7 @@ class updata_dlg(QWidget):
|
|||||||
s=str(i[0])+"|"+i[1]+"|"+item_name
|
s=str(i[0])+"|"+i[1]+"|"+item_name
|
||||||
# print(s)
|
# print(s)
|
||||||
str_list.append((s,))
|
str_list.append((s,))
|
||||||
sel=select_list.select_list(self.widget,"选择文件",str_list)
|
sel=select_list.file_list(self.widget,"选择文件",str_list)
|
||||||
item=sel.show()
|
item=sel.show()
|
||||||
# print("item:",item)
|
# print("item:",item)
|
||||||
if(len(item)<=0):
|
if(len(item)<=0):
|
||||||
|
@@ -438,7 +438,7 @@ class updata_dlg(QWidget):
|
|||||||
s=str(i[0])+"|"+i[1]+"|"+item_name
|
s=str(i[0])+"|"+i[1]+"|"+item_name
|
||||||
# print(s)
|
# print(s)
|
||||||
str_list.append((s,))
|
str_list.append((s,))
|
||||||
sel=select_list.select_list(self.widget,"选择文件",str_list)
|
sel=select_list.file_list(self.widget,"选择文件",str_list)
|
||||||
item=sel.show()
|
item=sel.show()
|
||||||
# print("item:",item)
|
# print("item:",item)
|
||||||
if(len(item)<=0):
|
if(len(item)<=0):
|
||||||
|
Reference in New Issue
Block a user