-
Notifications
You must be signed in to change notification settings - Fork 0
/
song_info_dialog.py
42 lines (31 loc) · 1.53 KB
/
song_info_dialog.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
from PySide6 import QtWidgets
from uade import Song
class SongInfoDialog(QtWidgets.QDialog):
def __init__(self, song: Song):
super().__init__()
attributes = {}
attributes['Author'] = song.song_file.author
attributes['Filename'] = song.song_file.filename
attributes['Format'] = song.song_file.formatname
attributes['Extension'] = song.song_file.ext
attributes['Size (Bytes)'] = str(song.song_file.modulebytes)
attributes['md5'] = song.song_file.modulemd5
attributes['Player'] = song.song_file.playername
attributes['Player filename'] = song.song_file.playerfname
self.setWindowTitle('Song info')
QBtn = QtWidgets.QDialogButtonBox.Close
self.buttonBox = QtWidgets.QDialogButtonBox(QBtn)
self.buttonBox.rejected.connect(self.close)
self.vboxlayout = QtWidgets.QVBoxLayout()
tableWidget = QtWidgets.QTableWidget(self)
tableWidget.setRowCount(len(attributes))
tableWidget.setColumnCount(2)
tableWidget.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.Stretch)
tableWidget.horizontalHeader().hide()
tableWidget.verticalHeader().hide()
self.vboxlayout.addWidget(tableWidget)
self.setLayout(self.vboxlayout)
for idx, attribute in enumerate(attributes):
tableWidget.setItem(idx, 0, QtWidgets.QTableWidgetItem(attribute))
tableWidget.setItem(
idx, 1, QtWidgets.QTableWidgetItem(attributes[attribute]))