[update] 增加arr write功能
-
This commit is contained in:
parent
70951cc4e2
commit
dcf1116207
@ -12,6 +12,7 @@ a = Analysis(
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
@ -21,14 +22,14 @@ exe = EXE(
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='Brisonus_Params_2.0.4.exe',
|
||||
name='Brisonus_Params_2.0.5',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
@ -1,37 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['main.py'],
|
||||
pathex=['.\\venv\\Lib\\site-packages\\'],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='HuaYan_Params_2.0.3.exe',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
@ -1,37 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['main.py'],
|
||||
pathex=['.\\venv\\Lib\\site-packages\\'],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='HuaYan_Params_2.0.4.exe',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
@ -1,37 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['main.py'],
|
||||
pathex=['.\\venv\\Lib\\site-packages\\'],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='HuaYan_Params_2.0.exe',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
@ -1,2 +0,0 @@
|
||||
|
||||
|
@ -7,21 +7,34 @@ from br_widget_basic_plot import BrWidgetBasicPlot
|
||||
|
||||
class BrWidgetArrDetails(QWidget, Ui_Widget):
|
||||
signal_read: SignalInstance = Signal(list)
|
||||
signal_write: SignalInstance = Signal(list)
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.param_data: ParamDataArr = None
|
||||
# self.tableWidget_val.setRowCount(10)
|
||||
|
||||
self.updating = False
|
||||
self.tableWidget_val.setColumnCount(2)
|
||||
self.tableWidget_val.setHorizontalHeaderLabels(['Addr', 'Value'])
|
||||
|
||||
# self.tableWidget_setval.setRowCount(10)
|
||||
self.tableWidget_setval.setColumnCount(2)
|
||||
self.tableWidget_setval.setHorizontalHeaderLabels(['Addr', 'Value'])
|
||||
|
||||
self.tableWidget_setval.itemChanged.connect(self.on_table_setval_itemChanged)
|
||||
|
||||
|
||||
def on_table_setval_itemChanged(self, item: QTableWidgetItem):
|
||||
if self.updating:
|
||||
return
|
||||
# 获取编辑的行index,获取输入的值
|
||||
row_index = item.row()
|
||||
input_val = item.text()
|
||||
self.param_data.setval_list[row_index] = float(input_val)
|
||||
print('item changed', row_index, input_val)
|
||||
|
||||
|
||||
def update_param_info(self, p_data: ParamDataArr):
|
||||
self.param_data = p_data
|
||||
print(self.param_data.getval_list)
|
||||
self.label_addr.setText(str(p_data.addr))
|
||||
self.label_name.setText(str(p_data.name))
|
||||
self.label_length.setText(str(p_data.size))
|
||||
@ -29,6 +42,7 @@ class BrWidgetArrDetails(QWidget, Ui_Widget):
|
||||
self.update_table()
|
||||
|
||||
def update_table(self):
|
||||
self.updating = True
|
||||
self.tableWidget_val.setRowCount(self.param_data.size)
|
||||
for row in range(0, self.param_data.size):
|
||||
self.tableWidget_val.setItem(
|
||||
@ -41,7 +55,22 @@ class BrWidgetArrDetails(QWidget, Ui_Widget):
|
||||
str(self.param_data.getval_list[row]))
|
||||
)
|
||||
|
||||
self.tableWidget_setval.setRowCount(self.param_data.size)
|
||||
# 增加table写功能
|
||||
for row in range(0, self.param_data.size):
|
||||
self.tableWidget_setval.setItem(
|
||||
row, 0, QTableWidgetItem(
|
||||
str(self.param_data.addr + row)
|
||||
)
|
||||
)
|
||||
self.tableWidget_setval.setItem(
|
||||
row, 1, QTableWidgetItem(
|
||||
str(self.param_data.getval_list[row]))
|
||||
)
|
||||
|
||||
# 把设定值设置为获取到的值
|
||||
self.param_data.setval_list = self.param_data.getval_list
|
||||
self.updating = False
|
||||
|
||||
def update_val_list(self):
|
||||
|
||||
@ -52,10 +81,6 @@ class BrWidgetArrDetails(QWidget, Ui_Widget):
|
||||
for i in range(0, len(self.param_data.setval_list)):
|
||||
self.tableWidget_setval.setItem(0, i, QTableWidgetItem(str(self.param_data.setval_list[i])))
|
||||
|
||||
@Slot()
|
||||
def on_pushButton_write_clicked(self):
|
||||
print('[write] button clicked!')
|
||||
|
||||
@Slot()
|
||||
def on_pushButton_read_clicked(self):
|
||||
print('[read] button clicked!')
|
||||
@ -70,6 +95,21 @@ class BrWidgetArrDetails(QWidget, Ui_Widget):
|
||||
)
|
||||
self.signal_read.emit(_cmd_list)
|
||||
|
||||
@Slot()
|
||||
def on_pushButton_write_clicked(self):
|
||||
print('[write] button clicked!')
|
||||
|
||||
_cmd_list = []
|
||||
for i in range(0, self.param_data.size):
|
||||
_cmd_list.append(
|
||||
BrComMessage(
|
||||
BrComMessage.OP_WRITE,
|
||||
self.param_data.addr + i,
|
||||
self.param_data.getval_list[i]
|
||||
)
|
||||
)
|
||||
self.signal_write.emit(_cmd_list)
|
||||
|
||||
@Slot()
|
||||
def on_pushButton_valplot_clicked(self):
|
||||
print('[valpolt] button clicked!')
|
||||
|
16
main.py
16
main.py
@ -83,6 +83,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
|
||||
# 定义widget_page_arr的slot
|
||||
self.widget_page_arr.signal_read.connect(self.on_arr_read)
|
||||
self.widget_page_arr.signal_write.connect(self.on_arr_write)
|
||||
|
||||
# var arr 两个页面都处于隐藏状态
|
||||
self.widget_page_arr.hide()
|
||||
@ -119,6 +120,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
for _cmd_item in p_cmd_list:
|
||||
self.cmd_server.cmd_queue.put(_cmd_item)
|
||||
print('arr widget signal/callback on_read has been called!')
|
||||
|
||||
def on_arr_write(self, p_cmd_list):
|
||||
print('--------------------1')
|
||||
if not self.com.isOpen():
|
||||
# 弹出对话框提示用户serial port未处于open状态
|
||||
self.show_msgbox('系统提示', '未打开端口!')
|
||||
return
|
||||
for _cmd_item in p_cmd_list:
|
||||
self.cmd_server.cmd_queue.put(_cmd_item)
|
||||
print('arr widget signal/callback on_read has been called!')
|
||||
|
||||
def init_comports(self):
|
||||
self.lineEdit_baudrate.setText(str(default_config['baud_rate']))
|
||||
self.lineEdit_pollingInterval.setText(str(default_config['polling_interval']))
|
||||
@ -136,6 +148,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
# 设置不能编辑
|
||||
self.tableView.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||
|
||||
|
||||
|
||||
self.tableView.clicked.connect(self.on_tableview_clicked)
|
||||
|
||||
def tableview_load_data(self, filepath):
|
||||
@ -172,6 +186,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
if _param.type == ParamData.VAR_TYPE_ARR:
|
||||
_param.item = QStandardItem(str('/'))
|
||||
self.model.setItem(i, 2, _param.item)
|
||||
# 设置列宽
|
||||
self.tableView.resizeColumnsToContents()
|
||||
|
||||
def switch_page(self, page_name):
|
||||
if page_name == 'var':
|
||||
|
37
main.spec
37
main.spec
@ -1,37 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['main.py'],
|
||||
pathex=['.\\venv\\Lib\\site-packages\\'],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='main',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
@ -19,7 +19,7 @@ class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
if not MainWindow.objectName():
|
||||
MainWindow.setObjectName(u"MainWindow")
|
||||
MainWindow.resize(743, 524)
|
||||
MainWindow.resize(600, 800)
|
||||
self.centralwidget = QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName(u"centralwidget")
|
||||
self.gridLayout = QGridLayout(self.centralwidget)
|
||||
@ -147,12 +147,12 @@ class Ui_MainWindow(object):
|
||||
|
||||
self.verticalLayout_2.addWidget(self.textEdit)
|
||||
|
||||
self.verticalLayout_2.setStretch(1, 4)
|
||||
self.verticalLayout_2.setStretch(2, 1)
|
||||
self.verticalLayout_2.setStretch(0, 3)
|
||||
self.verticalLayout_2.setStretch(1, 1)
|
||||
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_2)
|
||||
|
||||
self.horizontalLayout.setStretch(0, 1)
|
||||
self.horizontalLayout.setStretch(0, 2)
|
||||
self.horizontalLayout.setStretch(1, 3)
|
||||
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -110,10 +110,10 @@ class Ui_Widget(object):
|
||||
|
||||
self.verticalLayout_3 = QVBoxLayout()
|
||||
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
||||
self.pushButton_4 = QPushButton(Widget)
|
||||
self.pushButton_4.setObjectName(u"pushButton_4")
|
||||
self.pushButton_write = QPushButton(Widget)
|
||||
self.pushButton_write.setObjectName(u"pushButton_write")
|
||||
|
||||
self.verticalLayout_3.addWidget(self.pushButton_4)
|
||||
self.verticalLayout_3.addWidget(self.pushButton_write)
|
||||
|
||||
self.pushButton_setvalplot = QPushButton(Widget)
|
||||
self.pushButton_setvalplot.setObjectName(u"pushButton_setvalplot")
|
||||
@ -140,6 +140,7 @@ class Ui_Widget(object):
|
||||
self.formLayout.setWidget(3, QFormLayout.FieldRole, self.label_details)
|
||||
|
||||
|
||||
|
||||
self.verticalLayout.addLayout(self.formLayout)
|
||||
|
||||
|
||||
@ -164,7 +165,7 @@ class Ui_Widget(object):
|
||||
self.pushButton_read.setText(QCoreApplication.translate("Widget", u"Read", None))
|
||||
self.pushButton_valplot.setText(QCoreApplication.translate("Widget", u"Plot", None))
|
||||
self.label_6.setText(QCoreApplication.translate("Widget", u"\u8bbe\u5b9a\u503c", None))
|
||||
self.pushButton_4.setText(QCoreApplication.translate("Widget", u"Write", None))
|
||||
self.pushButton_write.setText(QCoreApplication.translate("Widget", u"Write", None))
|
||||
self.pushButton_setvalplot.setText(QCoreApplication.translate("Widget", u"Plot", None))
|
||||
self.label_details.setText(QCoreApplication.translate("Widget", u"\u7a7a", None))
|
||||
# retranslateUi
|
||||
|
@ -42,6 +42,8 @@ class Ui_Dialog(object):
|
||||
|
||||
self.verticalLayout.addWidget(self.listView)
|
||||
|
||||
self.verticalLayout.setStretch()
|
||||
|
||||
|
||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user