-
Notifications
You must be signed in to change notification settings - Fork 3
/
Mainwindow.py
332 lines (321 loc) · 16.6 KB
/
Mainwindow.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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import os
#------------------Embedding files in Pyinstaller Build------------------------------
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
#-------------------------------------------------------------------------------
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(722, 628)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.layoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
self.layoutWidget_2.setGeometry(QtCore.QRect(300, 480, 121, 121))
self.layoutWidget_2.setObjectName("layoutWidget_2")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.layoutWidget_2)
self.verticalLayout_3.setContentsMargins(0, 0, 0, 5)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.lcdNumber = QtWidgets.QLCDNumber(self.layoutWidget_2)
self.lcdNumber.setMinimumSize(QtCore.QSize(0, 42))
self.lcdNumber.setDigitCount(3)
self.lcdNumber.setProperty("intValue", 120)
self.lcdNumber.setObjectName("lcdNumber")
self.verticalLayout_3.addWidget(self.lcdNumber)
self.tempo_slider = QtWidgets.QSlider(self.layoutWidget_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tempo_slider.sizePolicy().hasHeightForWidth())
self.tempo_slider.setSizePolicy(sizePolicy)
self.tempo_slider.setMinimumSize(QtCore.QSize(0, 25))
self.tempo_slider.setMinimum(20)
self.tempo_slider.setMaximum(300)
self.tempo_slider.setSliderPosition(120)
self.tempo_slider.setOrientation(QtCore.Qt.Horizontal)
self.tempo_slider.setInvertedAppearance(False)
self.tempo_slider.setInvertedControls(False)
self.tempo_slider.setObjectName("tempo_slider")
self.verticalLayout_3.addWidget(self.tempo_slider)
self.drum_kits = QtWidgets.QPushButton(self.layoutWidget_2)
self.drum_kits.setObjectName("drum_kits")
self.verticalLayout_3.addWidget(self.drum_kits)
self.frame = QtWidgets.QFrame(self.centralwidget)
self.frame.setGeometry(QtCore.QRect(70, 400, 191, 70))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
self.frame.setSizePolicy(sizePolicy)
self.frame.setMinimumSize(QtCore.QSize(125, 70))
font = QtGui.QFont()
font.setStrikeOut(False)
self.frame.setFont(font)
self.frame.setLayoutDirection(QtCore.Qt.LeftToRight)
self.frame.setStyleSheet("border-radius: 10px;\n"
"")
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frame.setFrameShadow(QtWidgets.QFrame.Sunken)
self.frame.setObjectName("frame")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
self.horizontalLayout.setContentsMargins(0, 0, 10, 0)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.play_gui = QtWidgets.QPushButton(self.frame)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.play_gui.sizePolicy().hasHeightForWidth())
self.play_gui.setSizePolicy(sizePolicy)
self.play_gui.setMinimumSize(QtCore.QSize(70, 70))
self.play_gui.setMaximumSize(QtCore.QSize(70, 70))
self.play_gui.setFocusPolicy(QtCore.Qt.NoFocus)
self.play_gui.setAutoFillBackground(False)
self.play_gui.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border: none;\n"
"")
self.play_gui.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(resource_path("resources/images/playbutton_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap(resource_path("resources/images/pause_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.play_gui.setIcon(icon)
self.play_gui.setIconSize(QtCore.QSize(70, 70))
self.play_gui.setCheckable(True)
self.play_gui.setChecked(False)
self.play_gui.setAutoExclusive(False)
self.play_gui.setAutoDefault(False)
self.play_gui.setDefault(False)
self.play_gui.setFlat(True)
self.play_gui.setObjectName("play_gui")
self.horizontalLayout.addWidget(self.play_gui)
self.start_stop_rec = QtWidgets.QPushButton(self.frame)
self.start_stop_rec.setMinimumSize(QtCore.QSize(70, 70))
self.start_stop_rec.setMaximumSize(QtCore.QSize(70, 70))
self.start_stop_rec.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border:none;\n"
"")
self.start_stop_rec.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(resource_path("resources/images/recbutton_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon1.addPixmap(QtGui.QPixmap(resource_path("resources/images/stopbutton_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.start_stop_rec.setIcon(icon1)
self.start_stop_rec.setIconSize(QtCore.QSize(70, 70))
self.start_stop_rec.setCheckable(True)
self.start_stop_rec.setObjectName("start_stop_rec")
self.horizontalLayout.addWidget(self.start_stop_rec)
self.audio_trimmer = QtWidgets.QPushButton(self.frame)
self.audio_trimmer.setMinimumSize(QtCore.QSize(70, 70))
self.audio_trimmer.setMaximumSize(QtCore.QSize(70, 70))
self.audio_trimmer.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border:none;\n"
"")
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(resource_path("resources/images/scissors_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.audio_trimmer.setIcon(icon2)
self.audio_trimmer.setIconSize(QtCore.QSize(70, 70))
self.audio_trimmer.setCheckable(True)
self.audio_trimmer.setObjectName("audio_trimmer")
self.horizontalLayout.addWidget(self.audio_trimmer)
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(100, 370, 131, 24))
font = QtGui.QFont()
font.setFamily("Helvetica Neue")
font.setPointSize(16)
font.setBold(False)
font.setItalic(False)
font.setUnderline(False)
font.setWeight(50)
font.setStrikeOut(False)
font.setKerning(True)
self.label.setFont(font)
self.label.setAutoFillBackground(False)
self.label.setFrameShape(QtWidgets.QFrame.NoFrame)
self.label.setFrameShadow(QtWidgets.QFrame.Plain)
self.label.setMidLineWidth(0)
self.label.setScaledContents(False)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setWordWrap(False)
self.label.setOpenExternalLinks(True)
self.label.setObjectName("label")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(310, 440, 101, 24))
font = QtGui.QFont()
font.setFamily("Helvetica Neue")
font.setPointSize(16)
self.label_4.setFont(font)
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
self.label_4.setObjectName("label_4")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(470, 370, 171, 24))
font = QtGui.QFont()
font.setFamily("Helvetica Neue")
font.setPointSize(16)
self.label_2.setFont(font)
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setObjectName("label_2")
self.convert_midi = QtWidgets.QPushButton(self.centralwidget)
self.convert_midi.setGeometry(QtCore.QRect(270, 340, 181, 91))
self.convert_midi.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border:none;\n"
"")
self.convert_midi.setText("")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(resource_path("resources/images/convert_to_midi5.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.convert_midi.setIcon(icon3)
self.convert_midi.setIconSize(QtCore.QSize(150, 150))
self.convert_midi.setObjectName("convert_midi")
self.export_midi = QtWidgets.QPushButton(self.centralwidget)
self.export_midi.setGeometry(QtCore.QRect(470, 480, 171, 41))
self.export_midi.setObjectName("export_midi")
self.frame_2 = QtWidgets.QFrame(self.centralwidget)
self.frame_2.setGeometry(QtCore.QRect(460, 400, 191, 70))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.frame_2.sizePolicy().hasHeightForWidth())
self.frame_2.setSizePolicy(sizePolicy)
self.frame_2.setMinimumSize(QtCore.QSize(125, 70))
font = QtGui.QFont()
font.setStrikeOut(False)
self.frame_2.setFont(font)
self.frame_2.setLayoutDirection(QtCore.Qt.LeftToRight)
self.frame_2.setStyleSheet("border-radius: 10px;\n"
"")
self.frame_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.frame_2.setObjectName("frame_2")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.frame_2)
self.horizontalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
self.horizontalLayout_3.setContentsMargins(0, 0, 10, 0)
self.horizontalLayout_3.setSpacing(0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.midi_play = QtWidgets.QPushButton(self.frame_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(70)
sizePolicy.setVerticalStretch(70)
sizePolicy.setHeightForWidth(self.midi_play.sizePolicy().hasHeightForWidth())
self.midi_play.setSizePolicy(sizePolicy)
self.midi_play.setMinimumSize(QtCore.QSize(70, 70))
self.midi_play.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border:none;\n"
"")
self.midi_play.setText("")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap(resource_path("resources/images/midi_playbutton_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon4.addPixmap(QtGui.QPixmap(resource_path("resources/images/midi_pausebutton_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.midi_play.setIcon(icon4)
self.midi_play.setIconSize(QtCore.QSize(70, 70))
self.midi_play.setCheckable(True)
self.midi_play.setObjectName("midi_play")
self.horizontalLayout_3.addWidget(self.midi_play)
self.midi_loop = QtWidgets.QPushButton(self.frame_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.midi_loop.sizePolicy().hasHeightForWidth())
self.midi_loop.setSizePolicy(sizePolicy)
self.midi_loop.setMinimumSize(QtCore.QSize(70, 70))
self.midi_loop.setMaximumSize(QtCore.QSize(70, 70))
self.midi_loop.setFocusPolicy(QtCore.Qt.NoFocus)
self.midi_loop.setAutoFillBackground(False)
self.midi_loop.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border: none;\n"
"")
self.midi_loop.setText("")
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap(resource_path("resources/images/midi_loop_unchecked.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon5.addPixmap(QtGui.QPixmap(resource_path("resources/images/midi_loop_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.midi_loop.setIcon(icon5)
self.midi_loop.setIconSize(QtCore.QSize(70, 70))
self.midi_loop.setCheckable(True)
self.midi_loop.setChecked(False)
self.midi_loop.setAutoExclusive(False)
self.midi_loop.setAutoDefault(False)
self.midi_loop.setDefault(False)
self.midi_loop.setFlat(True)
self.midi_loop.setObjectName("midi_loop")
self.horizontalLayout_3.addWidget(self.midi_loop)
self.metronome_button = QtWidgets.QPushButton(self.frame_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(70)
sizePolicy.setVerticalStretch(70)
sizePolicy.setHeightForWidth(self.metronome_button.sizePolicy().hasHeightForWidth())
self.metronome_button.setSizePolicy(sizePolicy)
self.metronome_button.setMinimumSize(QtCore.QSize(70, 70))
self.metronome_button.setMaximumSize(QtCore.QSize(70, 70))
self.metronome_button.setStyleSheet("background-color: transparent;\n"
"outline: none;\n"
"border:none;\n"
"")
self.metronome_button.setText("")
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(resource_path("resources/images/metronome_unchecked.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon6.addPixmap(QtGui.QPixmap(resource_path("resources/images/metronome_shadow.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.metronome_button.setIcon(icon6)
self.metronome_button.setIconSize(QtCore.QSize(70, 70))
self.metronome_button.setCheckable(True)
self.metronome_button.setObjectName("metronome_button")
self.horizontalLayout_3.addWidget(self.metronome_button)
self.export_audio = QtWidgets.QPushButton(self.centralwidget)
self.export_audio.setGeometry(QtCore.QRect(80, 480, 171, 41))
self.export_audio.setObjectName("export_audio")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(230, 40, 251, 21))
font = QtGui.QFont()
font.setFamily("Helvetica Neue")
font.setPointSize(18)
self.label_3.setFont(font)
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.t_widget = QtWidgets.QWidget(self.centralwidget)
self.t_widget.setGeometry(QtCore.QRect(61, 71, 599, 259))
self.t_widget.setStyleSheet("")
self.t_widget.setObjectName("t_widget")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 722, 22))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.tempo_slider.valueChanged['int'].connect(self.lcdNumber.display)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Deepbeat"))
self.drum_kits.setText(_translate("MainWindow", "Drum Kit 1"))
self.label.setText(_translate("MainWindow", "R e c o r d e r"))
self.label_4.setText(_translate("MainWindow", "T e m p o"))
self.label_2.setText(_translate("MainWindow", "M i d i P l a y e r"))
self.export_midi.setText(_translate("MainWindow", "Export Midi"))
self.export_audio.setText(_translate("MainWindow", "Export Audio"))
self.label_3.setText(_translate("MainWindow", "D e e p b e a t"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())