9.17.1
|
@ -6,16 +6,13 @@ import threading #引入并行
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
import re
|
import re
|
||||||
|
from sharedcomponets import GUIToolKit
|
||||||
RED_COLOR = (255, 92, 92)
|
|
||||||
GREEN_COLOR = (57, 217, 138)
|
|
||||||
BLUE_COLOR = (91, 141, 236)
|
|
||||||
ORANGE_COLOR = (253, 172, 66)
|
|
||||||
YELLOW_COLOR = (255,255,51)
|
|
||||||
PURPLE_COLOR = (75,0,130)
|
|
||||||
MAROON_COLOR = (222,184,135)
|
|
||||||
|
|
||||||
class MyWindow(QMainWindow, Ui_MainWindow):
|
class MyWindow(QMainWindow, Ui_MainWindow):
|
||||||
|
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']
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(MyWindow, self).__init__(parent)
|
super(MyWindow, self).__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
@ -29,7 +26,6 @@ class MyWindow(QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
# 设置信号与槽
|
# 设置信号与槽
|
||||||
def CreateSignalSlot(self):
|
def CreateSignalSlot(self):
|
||||||
self.wifi_recv_open_pushButton.clicked.connect(self.wifi_recv_open_pushButton_clicked)
|
|
||||||
self.velocity_horizontalSlider.valueChanged.connect(self.velocity_horizontalSlider_valueChanged)
|
self.velocity_horizontalSlider.valueChanged.connect(self.velocity_horizontalSlider_valueChanged)
|
||||||
self.wifi_config_pushButton.clicked.connect(self.wifi_config_pushButton_clicked)
|
self.wifi_config_pushButton.clicked.connect(self.wifi_config_pushButton_clicked)
|
||||||
|
|
||||||
|
@ -54,16 +50,14 @@ class MyWindow(QMainWindow, Ui_MainWindow):
|
||||||
# 绘图对象
|
# 绘图对象
|
||||||
self.plotWidget = pg.PlotWidget()
|
self.plotWidget = pg.PlotWidget()
|
||||||
self.plotWidget.showGrid(x=True, y=True, alpha=0.5)
|
self.plotWidget.showGrid(x=True, y=True, alpha=0.5)
|
||||||
|
self.controlPlotWidget = ControlPlotPanel(controllerPlotWidget=self)
|
||||||
# 图表可视化数组
|
# 图表可视化数组
|
||||||
signalColors = [RED_COLOR, BLUE_COLOR, PURPLE_COLOR, YELLOW_COLOR,
|
|
||||||
MAROON_COLOR, ORANGE_COLOR, GREEN_COLOR]
|
|
||||||
signalIcons = ['reddot', 'bluedot', 'purpledot', 'yellowdot', 'maroondot', 'orangedot', 'greendot']
|
|
||||||
self.numberOfSamples = 300
|
self.numberOfSamples = 300
|
||||||
self.signalDataArrays = []
|
self.signalDataArrays = []
|
||||||
self.signalPlots = []
|
self.signalPlots = []
|
||||||
self.signalPlotFlags = []
|
self.signalPlotFlags = []
|
||||||
self.timeArray = np.arange(-self.numberOfSamples, 0, 1)
|
self.timeArray = np.arange(-self.numberOfSamples, 0, 1)
|
||||||
for (sig, sigColor, tooltip) in zip(self.re_item, signalColors, self.re_item):
|
for (sig, sigColor, checkBox,tooltip) in zip(self.re_item, self.signalColors, self.controlPlotWidget.signalCheckBox,self.re_item):
|
||||||
# define signal plot data array
|
# define signal plot data array
|
||||||
self.signalDataArrays.append(np.zeros(self.numberOfSamples))
|
self.signalDataArrays.append(np.zeros(self.numberOfSamples))
|
||||||
# configure signal plot parameters
|
# configure signal plot parameters
|
||||||
|
@ -76,7 +70,7 @@ class MyWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.signalPlotFlags.append(True)
|
self.signalPlotFlags.append(True)
|
||||||
|
|
||||||
self.gridLayout.addWidget(self.plotWidget)
|
self.gridLayout.addWidget(self.plotWidget)
|
||||||
|
self.tool_layout.addWidget(self.controlPlotWidget)
|
||||||
# 滑条绑定
|
# 滑条绑定
|
||||||
def velocity_horizontalSlider_valueChanged(self):
|
def velocity_horizontalSlider_valueChanged(self):
|
||||||
self.target_velocity = self.velocity_horizontalSlider.value()
|
self.target_velocity = self.velocity_horizontalSlider.value()
|
||||||
|
@ -85,32 +79,27 @@ class MyWindow(QMainWindow, Ui_MainWindow):
|
||||||
print(str(self.target_velocity))
|
print(str(self.target_velocity))
|
||||||
def wifi_config_pushButton_clicked(self):
|
def wifi_config_pushButton_clicked(self):
|
||||||
try:
|
try:
|
||||||
print(self.wifi_IP_lineEdit.text(),type(self.wifi_IP_lineEdit.text()))
|
self.re_item = ['k','g','l','t']
|
||||||
self.udp.udpClientSocket.bind((self.wifi_IP_lineEdit.text(), 2333))
|
|
||||||
# 第一次接受数据,用于判断项目数,
|
|
||||||
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()
|
self.plot_init()
|
||||||
t1 = threading.Thread(target=self.udp_recv)
|
# print(self.wifi_IP_lineEdit.text(),type(self.wifi_IP_lineEdit.text()))
|
||||||
t1.start()
|
# self.udp.udpClientSocket.bind((self.wifi_IP_lineEdit.text(), 2333))
|
||||||
self.wifi_recv_open_pushButton.setEnabled(True)
|
# # 第一次接受数据,用于判断项目数,
|
||||||
except:
|
# 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()
|
||||||
|
# self.wifi_recv_open_pushButton.setEnabled(True)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
QMessageBox.critical(self, "错误", '该请求的地址无效')
|
QMessageBox.critical(self, "错误", '该请求的地址无效')
|
||||||
def wifi_recv_open_pushButton_clicked(self):
|
|
||||||
if self.wifi_recv_flag == 0:
|
|
||||||
# 打开wifi接收
|
|
||||||
self.wifi_recv_flag = 1
|
|
||||||
self.wifi_recv_open_pushButton.setText('关闭')
|
|
||||||
else:
|
|
||||||
self.wifi_recv_flag = 0
|
|
||||||
self.wifi_recv_open_pushButton.setText('打开')
|
|
||||||
def udp_recv(self):
|
def udp_recv(self):
|
||||||
while self.close_flag:
|
while self.close_flag:
|
||||||
recv_data = self.udp.udpClientSocket.recv(1024)
|
recv_data = self.udp.udpClientSocket.recv(1024)
|
||||||
|
@ -136,6 +125,53 @@ class MyWindow(QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
|
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
|
||||||
self.close_flag = 0
|
self.close_flag = 0
|
||||||
|
|
||||||
|
|
||||||
|
class ControlPlotPanel(QtWidgets.QWidget):
|
||||||
|
|
||||||
|
def __init__(self, parent=None, controllerPlotWidget=None):
|
||||||
|
'''Constructor for ToolsWidget'''
|
||||||
|
super().__init__(parent)
|
||||||
|
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)
|
||||||
|
|
||||||
|
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):
|
||||||
|
self.controlledPlot.plotWidget.enableAutoRange()
|
||||||
|
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')
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
myWin = MyWindow()
|
myWin = MyWindow()
|
||||||
|
|
|
@ -14,11 +14,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
MainWindow.setObjectName("MainWindow")
|
MainWindow.setObjectName("MainWindow")
|
||||||
MainWindow.resize(800, 749)
|
MainWindow.resize(1187, 707)
|
||||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
self.centralwidget.setObjectName("centralwidget")
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
self.groupBox = QtWidgets.QGroupBox(self.centralwidget)
|
self.groupBox = QtWidgets.QGroupBox(self.centralwidget)
|
||||||
self.groupBox.setGeometry(QtCore.QRect(20, 420, 241, 61))
|
self.groupBox.setGeometry(QtCore.QRect(20, 460, 241, 61))
|
||||||
self.groupBox.setObjectName("groupBox")
|
self.groupBox.setObjectName("groupBox")
|
||||||
self.horizontalLayoutWidget = QtWidgets.QWidget(self.groupBox)
|
self.horizontalLayoutWidget = QtWidgets.QWidget(self.groupBox)
|
||||||
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 31))
|
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 31))
|
||||||
|
@ -34,7 +34,7 @@ class Ui_MainWindow(object):
|
||||||
self.wifi_config_pushButton.setObjectName("wifi_config_pushButton")
|
self.wifi_config_pushButton.setObjectName("wifi_config_pushButton")
|
||||||
self.horizontalLayout.addWidget(self.wifi_config_pushButton)
|
self.horizontalLayout.addWidget(self.wifi_config_pushButton)
|
||||||
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
|
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
|
||||||
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(570, 440, 104, 31))
|
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(590, 480, 104, 31))
|
||||||
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
|
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
|
||||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
|
||||||
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
@ -46,7 +46,7 @@ class Ui_MainWindow(object):
|
||||||
self.velocity_lineEdit.setObjectName("velocity_lineEdit")
|
self.velocity_lineEdit.setObjectName("velocity_lineEdit")
|
||||||
self.horizontalLayout_2.addWidget(self.velocity_lineEdit)
|
self.horizontalLayout_2.addWidget(self.velocity_lineEdit)
|
||||||
self.velocity_horizontalSlider = QtWidgets.QSlider(self.centralwidget)
|
self.velocity_horizontalSlider = QtWidgets.QSlider(self.centralwidget)
|
||||||
self.velocity_horizontalSlider.setGeometry(QtCore.QRect(410, 420, 261, 22))
|
self.velocity_horizontalSlider.setGeometry(QtCore.QRect(430, 460, 261, 22))
|
||||||
self.velocity_horizontalSlider.setMinimum(-150)
|
self.velocity_horizontalSlider.setMinimum(-150)
|
||||||
self.velocity_horizontalSlider.setMaximum(150)
|
self.velocity_horizontalSlider.setMaximum(150)
|
||||||
self.velocity_horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
|
self.velocity_horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
@ -54,7 +54,7 @@ class Ui_MainWindow(object):
|
||||||
self.velocity_horizontalSlider.setTickInterval(10)
|
self.velocity_horizontalSlider.setTickInterval(10)
|
||||||
self.velocity_horizontalSlider.setObjectName("velocity_horizontalSlider")
|
self.velocity_horizontalSlider.setObjectName("velocity_horizontalSlider")
|
||||||
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
|
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
|
||||||
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(400, 440, 134, 31))
|
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(420, 480, 134, 31))
|
||||||
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
|
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
|
||||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
|
||||||
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
|
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
@ -66,21 +66,23 @@ class Ui_MainWindow(object):
|
||||||
self.angle_lineEdit.setObjectName("angle_lineEdit")
|
self.angle_lineEdit.setObjectName("angle_lineEdit")
|
||||||
self.horizontalLayout_3.addWidget(self.angle_lineEdit)
|
self.horizontalLayout_3.addWidget(self.angle_lineEdit)
|
||||||
self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget)
|
self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget)
|
||||||
self.groupBox_2.setGeometry(QtCore.QRect(190, 0, 601, 391))
|
self.groupBox_2.setGeometry(QtCore.QRect(370, 10, 811, 431))
|
||||||
self.groupBox_2.setObjectName("groupBox_2")
|
self.groupBox_2.setObjectName("groupBox_2")
|
||||||
self.gridLayoutWidget = QtWidgets.QWidget(self.groupBox_2)
|
self.gridLayoutWidget = QtWidgets.QWidget(self.groupBox_2)
|
||||||
self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 20, 581, 361))
|
self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 20, 791, 361))
|
||||||
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
||||||
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
||||||
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.wifi_recv_open_pushButton = QtWidgets.QPushButton(self.centralwidget)
|
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(self.groupBox_2)
|
||||||
self.wifi_recv_open_pushButton.setEnabled(False)
|
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(10, 370, 791, 51))
|
||||||
self.wifi_recv_open_pushButton.setGeometry(QtCore.QRect(190, 390, 93, 28))
|
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
|
||||||
self.wifi_recv_open_pushButton.setObjectName("wifi_recv_open_pushButton")
|
self.tool_layout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
|
||||||
|
self.tool_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.tool_layout.setObjectName("tool_layout")
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 1187, 26))
|
||||||
self.menubar.setObjectName("menubar")
|
self.menubar.setObjectName("menubar")
|
||||||
MainWindow.setMenuBar(self.menubar)
|
MainWindow.setMenuBar(self.menubar)
|
||||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||||
|
@ -101,4 +103,3 @@ class Ui_MainWindow(object):
|
||||||
self.label_2.setText(_translate("MainWindow", "目标角度:"))
|
self.label_2.setText(_translate("MainWindow", "目标角度:"))
|
||||||
self.angle_lineEdit.setText(_translate("MainWindow", "149"))
|
self.angle_lineEdit.setText(_translate("MainWindow", "149"))
|
||||||
self.groupBox_2.setTitle(_translate("MainWindow", "GroupBox"))
|
self.groupBox_2.setTitle(_translate("MainWindow", "GroupBox"))
|
||||||
self.wifi_recv_open_pushButton.setText(_translate("MainWindow", "打开"))
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>1187</width>
|
||||||
<height>749</height>
|
<height>707</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>420</y>
|
<y>460</y>
|
||||||
<width>241</width>
|
<width>241</width>
|
||||||
<height>61</height>
|
<height>61</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>570</x>
|
<x>590</x>
|
||||||
<y>440</y>
|
<y>480</y>
|
||||||
<width>104</width>
|
<width>104</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -85,8 +85,8 @@
|
||||||
<widget class="QSlider" name="velocity_horizontalSlider">
|
<widget class="QSlider" name="velocity_horizontalSlider">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>410</x>
|
<x>430</x>
|
||||||
<y>420</y>
|
<y>460</y>
|
||||||
<width>261</width>
|
<width>261</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -110,8 +110,8 @@
|
||||||
<widget class="QWidget" name="horizontalLayoutWidget_3">
|
<widget class="QWidget" name="horizontalLayoutWidget_3">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>400</x>
|
<x>420</x>
|
||||||
<y>440</y>
|
<y>480</y>
|
||||||
<width>134</width>
|
<width>134</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -136,10 +136,10 @@
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>190</x>
|
<x>370</x>
|
||||||
<y>0</y>
|
<y>10</y>
|
||||||
<width>601</width>
|
<width>811</width>
|
||||||
<height>391</height>
|
<height>431</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -150,28 +150,23 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>581</width>
|
<width>791</width>
|
||||||
<height>361</height>
|
<height>361</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout"/>
|
<layout class="QGridLayout" name="gridLayout"/>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
<widget class="QWidget" name="horizontalLayoutWidget_4">
|
||||||
<widget class="QPushButton" name="wifi_recv_open_pushButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>190</x>
|
<x>10</x>
|
||||||
<y>390</y>
|
<y>370</y>
|
||||||
<width>93</width>
|
<width>791</width>
|
||||||
<height>28</height>
|
<height>51</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<layout class="QHBoxLayout" name="tool_layout"/>
|
||||||
<string>打开</string>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
@ -179,7 +174,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>1187</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
After Width: | Height: | Size: 838 B |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 713 B |
After Width: | Height: | Size: 584 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 823 B |
After Width: | Height: | Size: 934 B |
After Width: | Height: | Size: 829 B |
After Width: | Height: | Size: 501 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 802 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 356 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 818 B |
After Width: | Height: | Size: 907 B |
After Width: | Height: | Size: 997 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 999 B |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 806 B |
After Width: | Height: | Size: 554 B |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,74 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from PyQt5 import QtGui, QtWidgets, QtCore
|
||||||
|
|
||||||
|
class GUIToolKit(object):
|
||||||
|
''' This class is used to provide icons for the rest of the application
|
||||||
|
hiding the location of the resources
|
||||||
|
'''
|
||||||
|
RED_COLOR = (255, 92, 92)
|
||||||
|
GREEN_COLOR = (57, 217, 138)
|
||||||
|
BLUE_COLOR = (91, 141, 236)
|
||||||
|
ORANGE_COLOR = (253, 172, 66)
|
||||||
|
YELLOW_COLOR = (255,255,51)
|
||||||
|
PURPLE_COLOR = (75,0,130)
|
||||||
|
MAROON_COLOR = (222,184,135)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getIconByName(icoName):
|
||||||
|
|
||||||
|
file_index = {
|
||||||
|
'add': 'add.png',
|
||||||
|
'add_motor': 'add_motor.png',
|
||||||
|
'tree': 'tree.png',
|
||||||
|
'gen': 'gen.png',
|
||||||
|
'home': 'home.png',
|
||||||
|
'form': 'form.png',
|
||||||
|
'edit': 'edit.png',
|
||||||
|
'delete': 'delete.png',
|
||||||
|
'statistics': 'statistics.png',
|
||||||
|
'reddot': 'reddot.png',
|
||||||
|
'orangedot': 'orangedot.png',
|
||||||
|
'greendot': 'greendot.png',
|
||||||
|
'bluedot': 'bluedot.png',
|
||||||
|
'purpledot': 'purpledot.png',
|
||||||
|
'yellowdot': 'yellowdot.png',
|
||||||
|
'maroondot': 'maroondot.png',
|
||||||
|
'send': 'send.png',
|
||||||
|
'zoomall': 'zoomall.png',
|
||||||
|
'connect': 'connect.png',
|
||||||
|
'continue': 'continue.png',
|
||||||
|
'alert': 'alert.png',
|
||||||
|
'gear': 'gear.png',
|
||||||
|
'generalsettings': 'generalsettings.png',
|
||||||
|
'open': 'open.png',
|
||||||
|
'loop': 'loop.png',
|
||||||
|
'save': 'save.png',
|
||||||
|
'stop': 'stop.png',
|
||||||
|
'restart': 'continue.png',
|
||||||
|
'res': 'res.png',
|
||||||
|
'sensor': 'sensor.png',
|
||||||
|
'start': 'start.png',
|
||||||
|
'motor': 'motor.png',
|
||||||
|
'pause': 'pause.png',
|
||||||
|
'pull': 'pull.png',
|
||||||
|
'push': 'push.png',
|
||||||
|
'list': 'list.png',
|
||||||
|
'disconnect': 'disconnect.png',
|
||||||
|
'configure': 'configure.png',
|
||||||
|
'pidconfig': 'pidconfig.png',
|
||||||
|
'consoletool': 'consoletool.png',
|
||||||
|
'fordward': 'fordward.png',
|
||||||
|
'fastbackward': 'fastbackward.png',
|
||||||
|
'backward': 'backward.png',
|
||||||
|
'stopjogging': 'stopjogging.png',
|
||||||
|
'fastfordward': 'fastfordward.png',
|
||||||
|
'customcommands':'customcommands.png'
|
||||||
|
}
|
||||||
|
currentDir = os.path.dirname(__file__)
|
||||||
|
icon_path = os.path.join(currentDir, './resources', file_index[icoName])
|
||||||
|
print(icon_path)
|
||||||
|
icon = QtGui.QIcon()
|
||||||
|
icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal,
|
||||||
|
QtGui.QIcon.Off)
|
||||||
|
return icon
|