2021-08-17 17:01:19 +00:00
|
|
|
import sys
|
2021-08-24 07:32:57 +00:00
|
|
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox
|
2021-12-21 08:16:10 +00:00
|
|
|
from PyQt5.QtGui import QTextCursor
|
2021-08-17 17:01:19 +00:00
|
|
|
from main_ui import *
|
|
|
|
from wifi_udp import *
|
|
|
|
import threading #引入并行
|
|
|
|
import numpy as np
|
|
|
|
import pyqtgraph as pg
|
2021-09-16 03:04:28 +00:00
|
|
|
import re
|
2021-09-17 06:36:57 +00:00
|
|
|
from sharedcomponets import GUIToolKit
|
2021-12-21 08:16:10 +00:00
|
|
|
import copy
|
2021-08-25 08:23:23 +00:00
|
|
|
|
2021-08-17 17:01:19 +00:00
|
|
|
class MyWindow(QMainWindow, Ui_MainWindow):
|
2021-09-17 06:36:57 +00:00
|
|
|
signalColors = [GUIToolKit.RED_COLOR, GUIToolKit.BLUE_COLOR, GUIToolKit.PURPLE_COLOR, GUIToolKit.YELLOW_COLOR,
|
|
|
|
GUIToolKit.MAROON_COLOR, GUIToolKit.ORANGE_COLOR, GUIToolKit.GREEN_COLOR]
|
|
|
|
signalIcons = ['reddot', 'bluedot', 'purpledot', 'yellowdot', 'maroondot', 'orangedot', 'greendot']
|
2021-12-21 08:16:10 +00:00
|
|
|
textColors = ['FF5C5C','398AD9','5BEC8D','FD42AC','FF33FF','4B8200','DE87B8']
|
2021-12-30 09:00:39 +00:00
|
|
|
slider_lab = ['horizontalSlider_1', 'horizontalSlider_2','horizontalSlider_3','horizontalSlider_4','horizontalSlider_5']
|
|
|
|
|
2021-08-17 17:01:19 +00:00
|
|
|
def __init__(self, parent=None):
|
|
|
|
super(MyWindow, self).__init__(parent)
|
|
|
|
self.setupUi(self)
|
2021-08-24 07:32:57 +00:00
|
|
|
# 变量初始化
|
2021-11-01 12:19:30 +00:00
|
|
|
self.wifi_open_flag = 0
|
2021-12-30 09:00:39 +00:00
|
|
|
self.test_flag = 0
|
2021-11-01 12:19:30 +00:00
|
|
|
# self.variable_init()
|
2021-08-24 07:32:57 +00:00
|
|
|
# 设置实例
|
2021-11-01 12:19:30 +00:00
|
|
|
# self.CreateItems()
|
2021-08-24 07:32:57 +00:00
|
|
|
# 设置信号与槽
|
|
|
|
self.CreateSignalSlot()
|
|
|
|
# 设置信号与槽
|
|
|
|
def CreateSignalSlot(self):
|
2021-12-30 09:00:39 +00:00
|
|
|
self.horizontalSlider_1.valueChanged.connect(lambda: self.horizontalSlider_valueChanged(self.horizontalSlider_1))
|
|
|
|
self.horizontalSlider_2.valueChanged.connect(lambda: self.horizontalSlider_valueChanged(self.horizontalSlider_2))
|
|
|
|
self.horizontalSlider_3.valueChanged.connect(lambda: self.horizontalSlider_valueChanged(self.horizontalSlider_3))
|
|
|
|
self.horizontalSlider_4.valueChanged.connect(lambda: self.horizontalSlider_valueChanged(self.horizontalSlider_4))
|
|
|
|
self.horizontalSlider_5.valueChanged.connect(lambda: self.horizontalSlider_valueChanged(self.horizontalSlider_5))
|
|
|
|
|
2021-08-24 07:32:57 +00:00
|
|
|
self.wifi_config_pushButton.clicked.connect(self.wifi_config_pushButton_clicked)
|
2021-10-13 14:57:39 +00:00
|
|
|
self.wifi_command_pushButton_1.clicked.connect(self.wifi_command_pushButton_1_clicked)
|
|
|
|
self.wifi_command_pushButton_2.clicked.connect(self.wifi_command_pushButton_2_clicked)
|
|
|
|
self.wifi_command_pushButton_3.clicked.connect(self.wifi_command_pushButton_3_clicked)
|
2021-12-14 12:10:47 +00:00
|
|
|
self.TA_pushButton.clicked.connect(self.TA_pushButton_clicked)
|
|
|
|
self.SA_pushButton.clicked.connect(self.SA_pushButton_clicked)
|
|
|
|
self.SV_pushButton.clicked.connect(self.SV_pushButton_clicked)
|
|
|
|
self.VP1_pushButton.clicked.connect(self.VP1_pushButton_clicked)
|
|
|
|
self.VI1_pushButton.clicked.connect(self.VI1_pushButton_clicked)
|
|
|
|
self.VP2_pushButton.clicked.connect(self.VP2_pushButton_clicked)
|
|
|
|
self.VI2_pushButton.clicked.connect(self.VI2_pushButton_clicked)
|
2021-12-21 08:16:10 +00:00
|
|
|
|
|
|
|
self.raw_pushButton.clicked.connect(self.raw_pushButton_clicked)
|
|
|
|
self.wave_pushButton.clicked.connect(self.wave_pushButton_clicked)
|
2021-12-30 09:00:39 +00:00
|
|
|
|
|
|
|
self.test_pushButton_voltage.clicked.connect(self.test_pushButton_voltage_clicked)
|
|
|
|
self.test_pushButton_velocity.clicked.connect(self.test_pushButton_velocity_clicked)
|
2021-12-21 08:16:10 +00:00
|
|
|
def raw_pushButton_clicked(self):
|
|
|
|
self.change_state = 1
|
|
|
|
self.stackedWidget.setCurrentIndex(1)
|
|
|
|
|
|
|
|
def wave_pushButton_clicked(self):
|
|
|
|
self.change_state = 0
|
|
|
|
self.stackedWidget.setCurrentIndex(0)
|
|
|
|
|
2021-12-30 09:00:39 +00:00
|
|
|
def test_pushButton_voltage_clicked(self):
|
|
|
|
self.udp.send_message("TVQ")
|
|
|
|
if self.test_flag == 1:
|
|
|
|
self.test_pushButton_voltage.setText("电压测试打开")
|
|
|
|
self.test_pushButton_velocity.setText("速度测试打开")
|
|
|
|
self.test_flag = 0
|
|
|
|
else:
|
|
|
|
self.test_pushButton_voltage.setText("电压测试关闭")
|
|
|
|
self.test_pushButton_velocity.setText("速度测试打开")
|
|
|
|
self.test_flag = 1
|
|
|
|
|
|
|
|
def test_pushButton_velocity_clicked(self):
|
|
|
|
self.udp.send_message("TVV")
|
|
|
|
if self.test_flag == 2:
|
|
|
|
self.test_pushButton_voltage.setText("电压测试打开")
|
|
|
|
self.test_pushButton_velocity.setText("速度测试打开")
|
|
|
|
self.test_flag = 0
|
|
|
|
else:
|
|
|
|
self.test_pushButton_voltage.setText("电压测试打开")
|
|
|
|
self.test_pushButton_velocity.setText("速度测试关闭")
|
|
|
|
self.test_flag = 2
|
2021-08-24 07:32:57 +00:00
|
|
|
# 设置实例
|
|
|
|
def CreateItems(self):
|
|
|
|
# 定时器-绘图刷新
|
|
|
|
self.timer = QtCore.QTimer()
|
|
|
|
self.timer.timeout.connect(self.update_plot)
|
2021-08-25 08:23:23 +00:00
|
|
|
self.timer.start(20)
|
2021-08-17 17:01:19 +00:00
|
|
|
# wifi udp
|
|
|
|
self.udp = udp()
|
2021-12-30 09:00:39 +00:00
|
|
|
# self.wifi_IP_lineEdit.setText(self.udp.user_ip)#设置为当前本机ID
|
2021-08-24 07:32:57 +00:00
|
|
|
def variable_init(self):
|
2021-11-01 12:19:30 +00:00
|
|
|
# wifi变量
|
2021-08-24 07:32:57 +00:00
|
|
|
self.wifi_recv_flag = 0
|
2021-08-24 15:35:12 +00:00
|
|
|
self.close_flag = 1
|
2021-12-21 08:16:10 +00:00
|
|
|
self.change_state = 0
|
2021-09-16 03:04:28 +00:00
|
|
|
self.re_item = []
|
2021-12-21 08:16:10 +00:00
|
|
|
self.raw_roll = 0
|
2021-08-24 07:32:57 +00:00
|
|
|
def plot_init(self):
|
2021-08-17 17:01:19 +00:00
|
|
|
# 绘图对象
|
2021-09-17 08:15:51 +00:00
|
|
|
pg.setConfigOptions(antialias=True)
|
2021-08-25 08:23:23 +00:00
|
|
|
self.plotWidget = pg.PlotWidget()
|
|
|
|
self.plotWidget.showGrid(x=True, y=True, alpha=0.5)
|
2021-09-17 08:15:51 +00:00
|
|
|
self.plotWidget.addLegend()
|
2021-09-17 06:36:57 +00:00
|
|
|
self.controlPlotWidget = ControlPlotPanel(controllerPlotWidget=self)
|
2021-08-25 08:23:23 +00:00
|
|
|
# 图表可视化数组
|
|
|
|
self.numberOfSamples = 300
|
|
|
|
self.signalDataArrays = []
|
|
|
|
self.signalPlots = []
|
|
|
|
self.signalPlotFlags = []
|
|
|
|
self.timeArray = np.arange(-self.numberOfSamples, 0, 1)
|
2021-09-17 06:36:57 +00:00
|
|
|
for (sig, sigColor, checkBox,tooltip) in zip(self.re_item, self.signalColors, self.controlPlotWidget.signalCheckBox,self.re_item):
|
2021-08-25 08:23:23 +00:00
|
|
|
# define signal plot data array
|
|
|
|
self.signalDataArrays.append(np.zeros(self.numberOfSamples))
|
|
|
|
# configure signal plot parameters
|
|
|
|
signalPen = pg.mkPen(color=sigColor, width=1.5)
|
|
|
|
self.signalPlots.append(pg.PlotDataItem(self.timeArray,
|
|
|
|
self.signalDataArrays[-1],
|
|
|
|
pen=signalPen, name=tooltip))
|
|
|
|
self.plotWidget.addItem(self.signalPlots[-1])
|
|
|
|
# is plotted flag
|
|
|
|
self.signalPlotFlags.append(True)
|
2021-11-01 07:29:33 +00:00
|
|
|
# add callback
|
|
|
|
checkBox.stateChanged.connect(self.signalPlotFlagUpdate)
|
2021-12-21 08:16:10 +00:00
|
|
|
self.stackedWidget = QtWidgets.QStackedWidget()
|
|
|
|
self.gridLayout.addWidget(self.stackedWidget)
|
|
|
|
self.raw_line = QtWidgets.QTextEdit()
|
|
|
|
self.raw_line.setStyleSheet('background: rgb(0, 0, 0)')
|
|
|
|
self.stackedWidget.addWidget(self.plotWidget)
|
|
|
|
self.stackedWidget.addWidget(self.raw_line)
|
2021-09-17 06:36:57 +00:00
|
|
|
self.tool_layout.addWidget(self.controlPlotWidget)
|
2021-12-21 08:16:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-01 07:29:33 +00:00
|
|
|
# checkbox
|
|
|
|
def signalPlotFlagUpdate(self):
|
|
|
|
for i, (checkBox, plotFlag) in enumerate(zip(self.controlPlotWidget.signalCheckBox, self.signalPlotFlags)):
|
|
|
|
if checkBox.isChecked() and (not plotFlag):
|
|
|
|
self.signalPlotFlags[i] = True
|
|
|
|
self.plotWidget.addItem( self.signalPlots[i] )
|
|
|
|
elif (not checkBox.isChecked()) and plotFlag:
|
|
|
|
self.signalPlotFlags[i] = False
|
|
|
|
self.plotWidget.removeItem( self.signalPlots[i] )
|
2021-08-24 07:32:57 +00:00
|
|
|
# 滑条绑定
|
2021-12-30 09:00:39 +00:00
|
|
|
def horizontalSlider_valueChanged(self,slider):
|
|
|
|
i = self.slider_lab.index(slider.objectName())
|
|
|
|
layout = getattr(self, 'horizontalLayout_{}'.format(i+4))
|
|
|
|
value = layout.itemAt(1).widget().value()
|
|
|
|
value = float(layout.itemAt(0).widget().text()) + (value + 100) * (
|
|
|
|
float(layout.itemAt(2).widget().text()) - float(layout.itemAt(0).widget().text())) / 200
|
|
|
|
layout.itemAt(6).widget().setText(str(value))
|
|
|
|
value = layout.itemAt(4).widget().text() + str(value)
|
2021-10-15 01:27:26 +00:00
|
|
|
self.udp.send_message(str(value))
|
2021-12-30 09:00:39 +00:00
|
|
|
|
2021-10-13 07:20:52 +00:00
|
|
|
# command命令发送事件
|
2021-10-13 14:57:39 +00:00
|
|
|
def wifi_command_pushButton_1_clicked(self):
|
|
|
|
self.udp.send_message(self.wifi_command_lineEdit_1.text())
|
|
|
|
def wifi_command_pushButton_2_clicked(self):
|
|
|
|
self.udp.send_message(self.wifi_command_lineEdit_2.text())
|
|
|
|
def wifi_command_pushButton_3_clicked(self):
|
|
|
|
self.udp.send_message(self.wifi_command_lineEdit_3.text())
|
2021-12-14 12:10:47 +00:00
|
|
|
def TA_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("TA"+self.TA_doubleSpinBox.text())
|
|
|
|
def SA_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("SA"+self.SA_doubleSpinBox.text())
|
|
|
|
def SV_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("SV"+self.SV_doubleSpinBox.text())
|
|
|
|
def VP1_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("VP1"+self.VP1_doubleSpinBox.text())
|
|
|
|
def VI1_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("VI1"+self.VI1_doubleSpinBox.text())
|
|
|
|
def VP2_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("VP2"+self.VP2_doubleSpinBox.text())
|
|
|
|
def VI2_pushButton_clicked(self):
|
|
|
|
self.udp.send_message("VI2"+self.VI2_doubleSpinBox.text())
|
|
|
|
|
|
|
|
# WIFI设置点击后判断有无接收到esp32发来的数据
|
2021-08-24 07:32:57 +00:00
|
|
|
def wifi_config_pushButton_clicked(self):
|
2021-11-01 07:29:33 +00:00
|
|
|
if self.wifi_open_flag == 0:
|
|
|
|
try:
|
2021-11-01 12:19:30 +00:00
|
|
|
self.variable_init()
|
|
|
|
self.CreateItems()
|
|
|
|
print(self.wifi_IP_lineEdit.text(),type(self.wifi_IP_lineEdit.text()))
|
|
|
|
self.udp.udpClientSocket.bind((self.wifi_IP_lineEdit.text(), 2333))
|
|
|
|
self.udp.udpClientSocket.settimeout(1)
|
|
|
|
# 第一次接受数据,用于判断项目数,
|
|
|
|
self.udp.send_message("START")
|
|
|
|
recv_data = self.udp.udpClientSocket.recv(1024)
|
|
|
|
recv_data = recv_data.decode('utf-8')
|
|
|
|
recv_data = recv_data[:-1]
|
|
|
|
recv_data = recv_data.split(',')
|
|
|
|
"""处理接受的信息"""
|
|
|
|
for i, data in enumerate(recv_data):
|
|
|
|
self.re_item.append(''.join(re.split(r'[^A-Za-z]', data)))
|
|
|
|
print(self.re_item)
|
|
|
|
# 图表初始化
|
|
|
|
self.plot_init()
|
|
|
|
t1 = threading.Thread(target=self.udp_recv)
|
|
|
|
t1.start()
|
2021-11-01 07:29:33 +00:00
|
|
|
self.wifi_open_flag = 1
|
|
|
|
self.wifi_config_pushButton.setText("断开连接")
|
|
|
|
self.wifi_config_pushButton.setStyleSheet("QPushButton{color:rgb(255,0,0,255);}")
|
|
|
|
except Exception as e:
|
|
|
|
print(e)
|
2021-11-01 12:19:30 +00:00
|
|
|
QMessageBox.critical(self, "错误", str(e))
|
2021-11-01 07:29:33 +00:00
|
|
|
else:
|
2021-11-01 12:19:30 +00:00
|
|
|
self.udp.send_message("START")
|
|
|
|
del self.udp
|
2021-11-01 07:29:33 +00:00
|
|
|
self.wifi_open_flag = 0
|
|
|
|
self.tool_layout.itemAt(0).widget().deleteLater()
|
|
|
|
self.gridLayout.itemAt(0).widget().deleteLater()
|
|
|
|
self.wifi_config_pushButton.setText("设置")
|
2021-11-01 12:19:30 +00:00
|
|
|
self.variable_init()
|
2021-08-17 17:01:19 +00:00
|
|
|
def udp_recv(self):
|
2021-08-24 15:35:12 +00:00
|
|
|
while self.close_flag:
|
2021-08-17 17:01:19 +00:00
|
|
|
recv_data = self.udp.udpClientSocket.recv(1024)
|
|
|
|
recv_data = recv_data.decode('utf-8')
|
2021-09-15 06:02:01 +00:00
|
|
|
recv_data = recv_data[:-1]
|
2021-09-16 03:04:28 +00:00
|
|
|
recv_data = recv_data.split(',')
|
2021-09-15 06:02:01 +00:00
|
|
|
"""处理接受的信息"""
|
2021-09-26 16:35:15 +00:00
|
|
|
# print(recv_data)
|
2021-12-21 08:16:10 +00:00
|
|
|
self.re_text = ''
|
2021-09-16 03:04:28 +00:00
|
|
|
for i, data in enumerate(recv_data):
|
2021-11-01 07:29:33 +00:00
|
|
|
if self.signalPlotFlags[i]:
|
2021-12-21 08:16:10 +00:00
|
|
|
# self.re_item.append(''.join(re.split(r'[^A-Za-z]', data)))
|
2021-11-01 07:29:33 +00:00
|
|
|
data = data.replace(self.re_item[i],'')
|
2021-12-21 08:16:10 +00:00
|
|
|
if self.change_state:
|
|
|
|
self.re_text += '<font color=\"#{1}\">{0}\t</font>'.format(data,self.textColors[i])
|
|
|
|
else:
|
|
|
|
self.signalDataArrays[i] = np.roll(self.signalDataArrays[i], -1)
|
|
|
|
self.signalDataArrays[i][-1] = data
|
2021-08-17 17:01:19 +00:00
|
|
|
def update_plot(self):
|
2021-09-16 03:04:28 +00:00
|
|
|
if self.wifi_recv_flag:
|
2021-12-21 08:16:10 +00:00
|
|
|
if self.change_state:
|
|
|
|
self.raw_line.append(self.re_text)
|
|
|
|
if self.raw_roll:
|
|
|
|
self.raw_line.moveCursor(QTextCursor.End)
|
|
|
|
else:
|
|
|
|
for i, plotFlag in enumerate(self.signalPlotFlags):
|
|
|
|
if plotFlag:
|
|
|
|
self.signalPlots[i].setData(self.timeArray, self.signalDataArrays[i])
|
|
|
|
self.signalPlots[i].updateItems()
|
|
|
|
self.signalPlots[i].sigPlotChanged.emit(self.signalPlots[i])
|
2021-08-24 15:35:12 +00:00
|
|
|
|
|
|
|
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
|
2021-11-01 07:29:33 +00:00
|
|
|
print("关闭")
|
2021-12-21 08:16:10 +00:00
|
|
|
self.udp.send_message('START')
|
2021-08-24 15:35:12 +00:00
|
|
|
self.close_flag = 0
|
2021-11-01 12:19:30 +00:00
|
|
|
self.udp.udpClientSocket.close()
|
2021-09-17 06:36:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ControlPlotPanel(QtWidgets.QWidget):
|
|
|
|
|
|
|
|
def __init__(self, parent=None, controllerPlotWidget=None):
|
|
|
|
'''Constructor for ToolsWidget'''
|
|
|
|
super().__init__(parent)
|
2021-10-15 01:27:26 +00:00
|
|
|
# 变量
|
|
|
|
self.MotorEnable_flag = 0
|
|
|
|
|
|
|
|
# 继承主窗口对象
|
2021-09-17 06:36:57 +00:00
|
|
|
self.controlledPlot = controllerPlotWidget
|
|
|
|
|
|
|
|
self.horizontalLayout1 = QtWidgets.QHBoxLayout()
|
|
|
|
self.horizontalLayout1.setObjectName('horizontalLayout')
|
|
|
|
self.setLayout(self.horizontalLayout1)
|
|
|
|
|
|
|
|
self.startStopButton = QtWidgets.QPushButton(self)
|
|
|
|
self.startStopButton.setText('Start')
|
|
|
|
self.startStopButton.setObjectName('Start')
|
|
|
|
self.startStopButton.clicked.connect(self.wifi_recv_open_pushButton_clicked)
|
|
|
|
self.startStopButton.setIcon(GUIToolKit.getIconByName('start'))
|
|
|
|
self.horizontalLayout1.addWidget(self.startStopButton)
|
|
|
|
|
2021-10-15 01:27:26 +00:00
|
|
|
self.MotorEnableButton = QtWidgets.QPushButton(self)
|
|
|
|
self.MotorEnableButton.setText('Disable')
|
|
|
|
self.MotorEnableButton.setObjectName('Disable')
|
|
|
|
self.MotorEnableButton.clicked.connect(self.MotorEnableButton_clicked)
|
|
|
|
self.MotorEnableButton.setIcon(GUIToolKit.getIconByName('stop'))
|
|
|
|
self.horizontalLayout1.addWidget(self.MotorEnableButton)
|
|
|
|
|
2021-09-17 06:36:57 +00:00
|
|
|
self.zoomAllButton = QtWidgets.QPushButton(self)
|
|
|
|
self.zoomAllButton.setObjectName('zoomAllButton')
|
|
|
|
self.zoomAllButton.setText('View all')
|
|
|
|
self.zoomAllButton.setIcon(GUIToolKit.getIconByName('zoomall'))
|
|
|
|
self.zoomAllButton.clicked.connect(self.zoomAllPlot)
|
|
|
|
self.horizontalLayout1.addWidget(self.zoomAllButton)
|
|
|
|
|
|
|
|
self.signalCheckBox = []
|
|
|
|
for i in range(len(self.controlledPlot.re_item)):
|
|
|
|
checkBox = QtWidgets.QCheckBox(self)
|
|
|
|
checkBox.setObjectName('signalCheckBox' + str(i))
|
|
|
|
checkBox.setToolTip(self.controlledPlot.re_item[i])
|
|
|
|
checkBox.setText(self.controlledPlot.re_item[i])
|
|
|
|
checkBox.setIcon(GUIToolKit.getIconByName(self.controlledPlot.signalIcons[i]))
|
|
|
|
checkBox.setChecked(True)
|
|
|
|
self.signalCheckBox.append(checkBox)
|
|
|
|
self.horizontalLayout1.addWidget(checkBox)
|
|
|
|
def zoomAllPlot(self):
|
2021-12-21 08:16:10 +00:00
|
|
|
if self.controlledPlot.change_state:
|
|
|
|
self.controlledPlot.raw_roll = ~self.controlledPlot.raw_roll
|
|
|
|
else:
|
|
|
|
self.controlledPlot.plotWidget.enableAutoRange()
|
2021-09-17 06:36:57 +00:00
|
|
|
def wifi_recv_open_pushButton_clicked(self):
|
|
|
|
if self.controlledPlot.wifi_recv_flag == 0:
|
|
|
|
# 打开wifi接收
|
|
|
|
self.controlledPlot.wifi_recv_flag = 1
|
|
|
|
self.startStopButton.setText('Stop')
|
|
|
|
else:
|
|
|
|
self.controlledPlot.wifi_recv_flag = 0
|
|
|
|
self.startStopButton.setText('Start')
|
2021-10-15 01:27:26 +00:00
|
|
|
def MotorEnableButton_clicked(self):
|
|
|
|
if self.MotorEnable_flag == 0:
|
|
|
|
# Motor关闭
|
|
|
|
self.MotorEnable_flag = 1
|
|
|
|
self.MotorEnableButton.setText('Enable')
|
|
|
|
self.controlledPlot.udp.send_message("MOTOR")
|
|
|
|
else:
|
|
|
|
self.MotorEnable_flag = 0
|
|
|
|
self.MotorEnableButton.setText('Disable')
|
|
|
|
self.controlledPlot.udp.send_message("MOTOR")
|
2021-08-17 17:01:19 +00:00
|
|
|
if __name__ == '__main__':
|
2022-03-20 15:57:26 +00:00
|
|
|
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
|
2021-08-17 17:01:19 +00:00
|
|
|
app = QApplication(sys.argv)
|
|
|
|
myWin = MyWindow()
|
|
|
|
myWin.show()
|
|
|
|
sys.exit(app.exec_())
|