-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsamplingStudioUI.py
263 lines (251 loc) · 14 KB
/
samplingStudioUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
from PyQt5 import QtCore, QtGui, QtWidgets
from pyqtgraph import PlotWidget
from samplingStudioBackend import SignalProcessor
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1107, 695)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout_6 = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout_6.setObjectName("gridLayout_6")
self.frame = QtWidgets.QFrame(self.centralwidget)
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.gridLayout_5 = QtWidgets.QGridLayout(self.frame)
self.gridLayout_5.setObjectName("gridLayout_5")
self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
self.horizontalLayout_8.setObjectName("horizontalLayout_8")
self.groupBox = QtWidgets.QGroupBox(self.frame)
self.groupBox.setMinimumSize(QtCore.QSize(200, 0))
self.groupBox.setMaximumSize(QtCore.QSize(300, 16777215))
self.groupBox.setObjectName("groupBox")
self.gridLayout = QtWidgets.QGridLayout(self.groupBox)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.noise_label = QtWidgets.QLabel(self.groupBox)
self.noise_label.setObjectName("noise_label")
self.verticalLayout_2.addWidget(self.noise_label)
self.noise_slider = QtWidgets.QSlider(self.groupBox)
self.noise_slider.setOrientation(QtCore.Qt.Horizontal)
self.noise_slider.setObjectName("noise_slider")
self.verticalLayout_2.addWidget(self.noise_slider)
spacerItem = QtWidgets.QSpacerItem(
20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding
)
self.verticalLayout_2.addItem(spacerItem)
self.gridLayout.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.fmax_ratio_label = QtWidgets.QLabel(self.groupBox)
self.fmax_ratio_label.setObjectName("fmax_ratio_label")
self.horizontalLayout_2.addWidget(self.fmax_ratio_label)
self.fmax_label = QtWidgets.QLabel(self.groupBox)
self.fmax_label.setObjectName("fmax_label")
self.horizontalLayout_2.addWidget(self.fmax_label)
spacerItem1 = QtWidgets.QSpacerItem(
40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum
)
self.horizontalLayout_2.addItem(spacerItem1)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.fmax_ratio_slider = QtWidgets.QSlider(self.groupBox)
self.fmax_ratio_slider.setOrientation(QtCore.Qt.Horizontal)
self.fmax_ratio_slider.setObjectName("fmax_ratio_slider")
self.verticalLayout.addWidget(self.fmax_ratio_slider)
spacerItem2 = QtWidgets.QSpacerItem(
20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding
)
self.verticalLayout.addItem(spacerItem2)
self.gridLayout.addLayout(self.verticalLayout, 1, 0, 1, 1)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.fs_label = QtWidgets.QLabel(self.groupBox)
self.fs_label.setObjectName("fs_label")
self.horizontalLayout.addWidget(self.fs_label)
self.fs_number_label = QtWidgets.QLabel(self.groupBox)
self.fs_number_label.setMinimumSize(QtCore.QSize(20, 0))
self.fs_number_label.setText("")
self.fs_number_label.setObjectName("fs_number_label")
self.horizontalLayout.addWidget(self.fs_number_label)
spacerItem3 = QtWidgets.QSpacerItem(
40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum
)
self.horizontalLayout.addItem(spacerItem3)
self.verticalLayout_3.addLayout(self.horizontalLayout)
self.gridLayout.addLayout(self.verticalLayout_3, 2, 0, 1, 1)
spacerItem4 = QtWidgets.QSpacerItem(
20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding
)
self.gridLayout.addItem(spacerItem4, 3, 0, 1, 1)
self.horizontalLayout_8.addWidget(self.groupBox)
self.frame_2 = QtWidgets.QFrame(self.frame)
self.frame_2.setMinimumSize(QtCore.QSize(600, 600))
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_2.setObjectName("frame_2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.frame_2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.graph_1 = PlotWidget(self.frame_2)
self.graph_1.setObjectName("graph_1")
self.verticalLayout_4.addWidget(self.graph_1)
self.graph_2 = PlotWidget(self.frame_2)
self.graph_2.setObjectName("graph_2")
self.verticalLayout_4.addWidget(self.graph_2)
self.graph_3 = PlotWidget(self.frame_2)
self.graph_3.setObjectName("graph_3")
self.verticalLayout_4.addWidget(self.graph_3)
self.gridLayout_2.addLayout(self.verticalLayout_4, 0, 0, 1, 1)
self.horizontalLayout_8.addWidget(self.frame_2)
self.verticalLayout_7 = QtWidgets.QVBoxLayout()
self.verticalLayout_7.setObjectName("verticalLayout_7")
self.groupBox_2 = QtWidgets.QGroupBox(self.frame)
self.groupBox_2.setMinimumSize(QtCore.QSize(250, 200))
self.groupBox_2.setMaximumSize(QtCore.QSize(300, 16777215))
self.groupBox_2.setObjectName("groupBox_2")
self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox_2)
self.gridLayout_3.setObjectName("gridLayout_3")
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.Amplitude_label = QtWidgets.QLabel(self.groupBox_2)
self.Amplitude_label.setObjectName("Amplitude_label")
self.horizontalLayout_3.addWidget(self.Amplitude_label)
self.amp_spinBox = QtWidgets.QDoubleSpinBox(self.groupBox_2)
self.amp_spinBox.setObjectName("amp_spinBox")
self.horizontalLayout_3.addWidget(self.amp_spinBox)
self.verticalLayout_5.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.frequency_label = QtWidgets.QLabel(self.groupBox_2)
self.frequency_label.setObjectName("frequency_label")
self.horizontalLayout_4.addWidget(self.frequency_label)
self.freq_spinBox = QtWidgets.QDoubleSpinBox(self.groupBox_2)
self.freq_spinBox.setObjectName("freq_spinBox")
self.horizontalLayout_4.addWidget(self.freq_spinBox)
self.verticalLayout_5.addLayout(self.horizontalLayout_4)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.phase_label = QtWidgets.QLabel(self.groupBox_2)
self.phase_label.setObjectName("phase_label")
self.horizontalLayout_5.addWidget(self.phase_label)
self.phase_spinBox = QtWidgets.QDoubleSpinBox(self.groupBox_2)
self.phase_spinBox.setObjectName("phase_spinBox")
self.horizontalLayout_5.addWidget(self.phase_spinBox)
self.verticalLayout_5.addLayout(self.horizontalLayout_5)
self.add_signal_btn = QtWidgets.QPushButton(self.groupBox_2)
self.add_signal_btn.setObjectName("add_signal_btn")
self.verticalLayout_5.addWidget(self.add_signal_btn)
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.delete_signal_combobox = QtWidgets.QComboBox(self.groupBox_2)
self.delete_signal_combobox.setObjectName("delete_signal_combobox")
self.horizontalLayout_6.addWidget(self.delete_signal_combobox)
self.delete_signal_btn = QtWidgets.QPushButton(self.groupBox_2)
self.delete_signal_btn.setObjectName("delete_signal_btn")
self.horizontalLayout_6.addWidget(self.delete_signal_btn)
self.verticalLayout_5.addLayout(self.horizontalLayout_6)
self.gridLayout_3.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
spacerItem5 = QtWidgets.QSpacerItem(
20, 60, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum
)
self.gridLayout_3.addItem(spacerItem5, 1, 0, 1, 1)
self.verticalLayout_7.addWidget(self.groupBox_2)
spacerItem6 = QtWidgets.QSpacerItem(
20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum
)
self.verticalLayout_7.addItem(spacerItem6)
self.groupBox_3 = QtWidgets.QGroupBox(self.frame)
self.groupBox_3.setMinimumSize(QtCore.QSize(250, 200))
self.groupBox_3.setObjectName("groupBox_3")
self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_3)
self.gridLayout_4.setObjectName("gridLayout_4")
self.verticalLayout_6 = QtWidgets.QVBoxLayout()
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.save_ex_btn = QtWidgets.QPushButton(self.groupBox_3)
self.save_ex_btn.setObjectName("save_ex_btn")
self.verticalLayout_6.addWidget(self.save_ex_btn)
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.load_ex_combobox = QtWidgets.QComboBox(self.groupBox_3)
self.load_ex_combobox.setObjectName("load_ex_combobox")
self.horizontalLayout_7.addWidget(self.load_ex_combobox)
self.load_ex_btn = QtWidgets.QPushButton(self.groupBox_3)
self.load_ex_btn.setObjectName("load_ex_btn")
self.horizontalLayout_7.addWidget(self.load_ex_btn)
self.verticalLayout_6.addLayout(self.horizontalLayout_7)
self.gridLayout_4.addLayout(self.verticalLayout_6, 0, 0, 1, 1)
spacerItem7 = QtWidgets.QSpacerItem(
20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum
)
self.gridLayout_4.addItem(spacerItem7, 1, 0, 1, 1)
self.verticalLayout_7.addWidget(self.groupBox_3)
self.horizontalLayout_8.addLayout(self.verticalLayout_7)
self.gridLayout_5.addLayout(self.horizontalLayout_8, 0, 0, 1, 1)
self.gridLayout_6.addWidget(self.frame, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1107, 21))
self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionOpen_Signal = QtWidgets.QAction(MainWindow)
self.actionOpen_Signal.setObjectName("actionOpen_Signal")
self.actionExit = QtWidgets.QAction(MainWindow)
self.actionExit.setObjectName("actionExit")
self.menuFile.addAction(self.actionOpen_Signal)
self.menuFile.addAction(self.actionExit)
self.menubar.addAction(self.menuFile.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.groupBox.setTitle(_translate("MainWindow", "Sampling"))
self.noise_label.setText(_translate("MainWindow", "Noise"))
self.fmax_ratio_label.setText(_translate("MainWindow", "0.00"))
self.fmax_label.setText(_translate("MainWindow", "Fmax"))
self.fs_label.setText(_translate("MainWindow", "Nyquist rate(Fs)"))
self.groupBox_2.setTitle(_translate("MainWindow", "Composer"))
self.Amplitude_label.setText(_translate("MainWindow", "Amplitude"))
self.frequency_label.setText(_translate("MainWindow", "Frequency"))
self.phase_label.setText(_translate("MainWindow", "Phase"))
self.add_signal_btn.setText(_translate("MainWindow", "Add Signal"))
self.delete_signal_btn.setText(_translate("MainWindow", "Delete Signal"))
self.groupBox_3.setTitle(_translate("MainWindow", "Examples"))
self.save_ex_btn.setText(_translate("MainWindow", "Save Example"))
self.load_ex_btn.setText(_translate("MainWindow", "Load Example"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.actionOpen_Signal.setText(_translate("MainWindow", "Open Signal"))
self.actionOpen_Signal.setShortcut(_translate("MainWindow", "Ctrl+O"))
self.actionExit.setText(_translate("MainWindow", "Exit"))
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+E"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
with open("Diffnes.qss", "r") as f:
stylesheet = f.read()
app.setStyleSheet(stylesheet)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
# Set window title
MainWindow.setWindowTitle("Sampling Studio")
# Set window icon
icon = QtGui.QIcon("Resources\App-Logo-Composing.png")
MainWindow.setWindowIcon(icon)
signal_processor = SignalProcessor(ui, file_path="")
MainWindow.show()
sys.exit(app.exec_())