diff --git a/components/DebugWindow.py b/components/DebugWindow.py
index c70586c..ca7ce6a 100644
--- a/components/DebugWindow.py
+++ b/components/DebugWindow.py
@@ -4,6 +4,7 @@ from PyQt5.QtWidgets import (
QVBoxLayout,
)
from pprint import pformat
+from logging import debug
class DebugWindow(QDialog):
@@ -16,6 +17,7 @@ class DebugWindow(QDialog):
layout = QVBoxLayout()
# Labels & input fields
+ # debug(pformat(self.text))
self.input_field = QPlainTextEdit(pformat(self.text))
layout.addWidget(self.input_field)
diff --git a/components/MusicTable.py b/components/MusicTable.py
index f6f8620..17be0dc 100644
--- a/components/MusicTable.py
+++ b/components/MusicTable.py
@@ -148,8 +148,8 @@ class MusicTable(QTableView):
# CONNECTIONS
self.clicked.connect(self.set_selected_song_filepath)
- self.doubleClicked.connect(self.set_current_song_filepath)
- self.enterKey.connect(self.set_current_song_filepath)
+ # self.doubleClicked.connect(self.set_current_song_filepath)
+ # self.enterKey.connect(self.set_current_song_filepath)
self.deleteKey.connect(self.delete_songs)
self.model2.dataChanged.connect(self.on_cell_data_changed) # editing cells
self.model2.layoutChanged.connect(self.restore_scroll_position)
@@ -465,6 +465,7 @@ class MusicTable(QTableView):
)
if new_index.isValid():
self.setCurrentIndex(new_index)
+ super().keyPressEvent(e)
elif key == Qt.Key.Key_Down: # Arrow key navigation
current_index = self.currentIndex()
new_index = self.model2.index(
@@ -472,6 +473,7 @@ class MusicTable(QTableView):
)
if new_index.isValid():
self.setCurrentIndex(new_index)
+ super().keyPressEvent(e)
elif key in (Qt.Key.Key_Return, Qt.Key.Key_Enter):
if self.state() != QAbstractItemView.EditingState:
self.enterKey.emit() # Enter key detected
@@ -737,7 +739,7 @@ class MusicTable(QTableView):
)
def set_current_song_filepath(self) -> None:
- """Sets the filepath of the currently playing song"""
+ """Sets the current song filepath to the value in column 'path' with current selected row index"""
# NOTE:
# Setting the current song filepath automatically plays that song
# self.tableView listens to this function and plays the audio file located at self.current_song_filepath
diff --git a/main.py b/main.py
index 1810a84..a7c46e7 100644
--- a/main.py
+++ b/main.py
@@ -12,6 +12,7 @@ from mutagen.id3._frames import APIC
from configparser import ConfigParser
from pathlib import Path
from appdirs import user_config_dir
+from numpy import array as nparray
from logging import debug, error, warning, basicConfig, INFO, DEBUG
from ui import Ui_MainWindow
from PyQt5.QtWidgets import (
@@ -148,6 +149,7 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
# UI
self.setupUi(self)
self.setWindowTitle("musicpom")
+ # self.vLayoutAlbumArt.SetFixedSize()
self.status_bar = QStatusBar()
self.permanent_status_label = QLabel("Status...")
self.status_bar.addPermanentWidget(self.permanent_status_label)
@@ -160,7 +162,7 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
self.config.read(self.cfg_file)
self.player: QMediaPlayer = QMediaPlayer() # Audio player object
self.probe: QAudioProbe = QAudioProbe() # Gets audio data
- self.analyzer_x_resolution = 100
+ self.analyzer_x_resolution = 200
self.audio_visualizer: AudioVisualizer = AudioVisualizer(self.player, self.analyzer_x_resolution)
self.timer = QTimer(self) # Audio timing things
self.clipboard = clipboard
@@ -186,14 +188,16 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
self.PlotWidget.setLogMode(False, False)
self.PlotWidget.setMouseEnabled(x=False, y=False)
# Remove x-axis ticks
- ticks = ['20', '31.25', '62.5', '125', '250', '500', '1000', '2000', '4000', '10000', '20000']
- self.PlotWidget.getAxis("bottom").setTicks([])
- self.PlotWidget.getAxis("bottom").setLabel("") # Remove x-axis label
- # x = nparray([0, 31.25, 62.5, 125, 250, 500, 1000, 2000, 4000, 8000, 15000, 20000])
+ # ticks = ['20', '31.25', '62.5', '125', '250', '500', '1000', '2000', '4000', '10000', '20000']
+ # self.PlotWidget.getAxis("bottom").setTicks([])
+ # self.PlotWidget.getAxis("bottom").setLabel("") # Remove x-axis label
+ # ticks = nparray([0, 31.25, 62.5, 125, 250, 500, 1000, 2000, 4000, 8000, 15000, 20000])
+
# Remove y-axis labels and decorations
# self.PlotWidget.getAxis("left").setTicks([[(str(tick), tick) for tick in ticks]])
- self.PlotWidget.getAxis("left").setTicks([])
- self.PlotWidget.getAxis("left").setLabel("") # Remove y-axis label
+ # self.PlotWidget.getAxis("left").setTicks([])
+ # self.PlotWidget.getAxis("left").setLabel("") # Remove y-axis label
+ self.PlotWidget.showGrid(x=True, y=True)
# Connections
self.playbackSlider.sliderReleased.connect(
@@ -306,7 +310,10 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
self.permanent_status_label.setText(message)
def play_audio_file(self) -> None:
- """Start playback of `tableView.current_song_filepath` & moves playback slider"""
+ """
+ Start playback of `tableView.current_song_filepath` & moves playback slider
+ """
+ self.tableView.set_current_song_filepath()
# get metadata
self.current_song_metadata = self.tableView.get_current_song_metadata()
# read the file
@@ -333,6 +340,9 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
)
title = self.current_song_metadata["TIT2"][0]
+ debug(artist)
+ debug(title)
+ debug(album)
self.artistLabel.setText(artist)
self.albumLabel.setText(album)
self.titleLabel.setText(title)
diff --git a/ui.py b/ui.py
index d3955ae..e7698fd 100644
--- a/ui.py
+++ b/ui.py
@@ -35,29 +35,6 @@ class Ui_MainWindow(object):
self.hLayoutHead.addLayout(self.vlayoutAlbumArt)
self.vLayoutSongDetails = QtWidgets.QVBoxLayout()
self.vLayoutSongDetails.setObjectName("vLayoutSongDetails")
- self.artistLabel = QtWidgets.QLabel(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(24)
- font.setBold(True)
- font.setWeight(75)
- self.artistLabel.setFont(font)
- self.artistLabel.setObjectName("artistLabel")
- self.vLayoutSongDetails.addWidget(self.artistLabel)
- self.titleLabel = QtWidgets.QLabel(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(18)
- self.titleLabel.setFont(font)
- self.titleLabel.setObjectName("titleLabel")
- self.vLayoutSongDetails.addWidget(self.titleLabel)
- self.albumLabel = QtWidgets.QLabel(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(16)
- font.setBold(False)
- font.setItalic(True)
- font.setWeight(50)
- self.albumLabel.setFont(font)
- self.albumLabel.setObjectName("albumLabel")
- self.vLayoutSongDetails.addWidget(self.albumLabel)
self.hLayoutHead.addLayout(self.vLayoutSongDetails)
self.vLayoutPlaybackVisuals = QtWidgets.QVBoxLayout()
self.vLayoutPlaybackVisuals.setObjectName("vLayoutPlaybackVisuals")
@@ -118,7 +95,6 @@ class Ui_MainWindow(object):
self.vLayoutPlaybackVisuals.addWidget(self.PlotWidget)
self.hLayoutHead.addLayout(self.vLayoutPlaybackVisuals)
self.hLayoutHead.setStretch(0, 1)
- self.hLayoutHead.setStretch(1, 4)
self.hLayoutHead.setStretch(2, 6)
self.verticalLayout.addLayout(self.hLayoutHead)
self.hLayoutMusicTable = QtWidgets.QHBoxLayout()
@@ -134,9 +110,6 @@ class Ui_MainWindow(object):
self.hLayoutMusicTable.setStretch(0, 2)
self.hLayoutMusicTable.setStretch(1, 10)
self.verticalLayout.addLayout(self.hLayoutMusicTable)
- self.verticalLayout.setStretch(0, 1)
- self.verticalLayout.setStretch(1, 2)
- self.verticalLayout_3.addLayout(self.verticalLayout)
self.hLayoutControls = QtWidgets.QHBoxLayout()
self.hLayoutControls.setSpacing(6)
self.hLayoutControls.setObjectName("hLayoutControls")
@@ -167,7 +140,7 @@ class Ui_MainWindow(object):
self.hLayoutControls.setStretch(2, 2)
self.hLayoutControls.setStretch(3, 2)
self.hLayoutControls.setStretch(4, 1)
- self.verticalLayout_3.addLayout(self.hLayoutControls)
+ self.verticalLayout.addLayout(self.hLayoutControls)
self.hLayoutControls2 = QtWidgets.QHBoxLayout()
self.hLayoutControls2.setSpacing(6)
self.hLayoutControls2.setObjectName("hLayoutControls2")
@@ -182,19 +155,46 @@ class Ui_MainWindow(object):
self.volumeLabel = QtWidgets.QLabel(self.centralwidget)
self.volumeLabel.setObjectName("volumeLabel")
self.hLayoutControls2.addWidget(self.volumeLabel)
+ self.hLayoutSongDetails = QtWidgets.QHBoxLayout()
+ self.hLayoutSongDetails.setObjectName("hLayoutSongDetails")
+ self.titleLabel = QtWidgets.QLabel(self.centralwidget)
+ font = QtGui.QFont()
+ font.setPointSize(18)
+ self.titleLabel.setFont(font)
+ self.titleLabel.setObjectName("titleLabel")
+ self.hLayoutSongDetails.addWidget(self.titleLabel)
+ self.artistLabel = QtWidgets.QLabel(self.centralwidget)
+ font = QtGui.QFont()
+ font.setPointSize(24)
+ font.setBold(True)
+ font.setWeight(75)
+ self.artistLabel.setFont(font)
+ self.artistLabel.setObjectName("artistLabel")
+ self.hLayoutSongDetails.addWidget(self.artistLabel)
+ self.albumLabel = QtWidgets.QLabel(self.centralwidget)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ font.setBold(False)
+ font.setItalic(True)
+ font.setWeight(50)
+ self.albumLabel.setFont(font)
+ self.albumLabel.setObjectName("albumLabel")
+ self.hLayoutSongDetails.addWidget(self.albumLabel)
+ self.hLayoutControls2.addLayout(self.hLayoutSongDetails)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayoutControls2.addItem(spacerItem2)
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setObjectName("pushButton")
self.hLayoutControls2.addWidget(self.pushButton)
self.hLayoutControls2.setStretch(0, 1)
- self.hLayoutControls2.setStretch(2, 4)
- self.hLayoutControls2.setStretch(3, 1)
- self.verticalLayout_3.addLayout(self.hLayoutControls2)
+ self.hLayoutControls2.setStretch(3, 4)
+ self.hLayoutControls2.setStretch(4, 1)
+ self.verticalLayout.addLayout(self.hLayoutControls2)
+ self.verticalLayout_3.addLayout(self.verticalLayout)
self.verticalLayout_3.setStretch(0, 20)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
- self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 41))
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 24))
self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
@@ -243,8 +243,6 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
- self.artistLabel.setText(_translate("MainWindow", "artist"))
- self.albumLabel.setText(_translate("MainWindow", "album"))
self.startTimeLabel.setText(_translate("MainWindow", "00:00"))
self.slashLabel.setText(_translate("MainWindow", "/"))
self.endTimeLabel.setText(_translate("MainWindow", "00:00"))
@@ -253,6 +251,8 @@ class Ui_MainWindow(object):
self.playButton.setText(_translate("MainWindow", "▶️"))
self.nextButton.setText(_translate("MainWindow", "⏭️"))
self.volumeLabel.setText(_translate("MainWindow", "50"))
+ self.artistLabel.setText(_translate("MainWindow", "artist"))
+ self.albumLabel.setText(_translate("MainWindow", "album"))
self.pushButton.setText(_translate("MainWindow", "nothing"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
diff --git a/ui.ui b/ui.ui
index ed5aaf2..c6c1496 100644
--- a/ui.ui
+++ b/ui.ui
@@ -17,9 +17,9 @@
-
+
-
-
+
6
@@ -27,7 +27,7 @@
0
-
-
+
-
@@ -39,46 +39,7 @@
-
-
-
-
-
-
-
- 24
- 75
- true
-
-
-
- artist
-
-
-
- -
-
-
-
- 18
-
-
-
-
- -
-
-
-
- 16
- 50
- true
- false
-
-
-
- album
-
-
-
-
+
-
@@ -201,127 +162,169 @@
-
-
- -
-
-
- 6
-
-
-
-
- Qt::Horizontal
+
+
+ 6
-
-
- 40
- 20
-
-
-
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 28
+
+
+
+ ⏮️
+
+
+
+ -
+
+
+
+ 28
+
+
+
+ ▶️
+
+
+
+ -
+
+
+
+ 28
+
+
+
+ ⏭️
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
-
-
-
-
- 28
-
+
+
+ 6
-
- ⏮️
-
-
-
- -
-
-
-
- 28
-
-
-
- ▶️
-
-
-
- -
-
-
-
- 28
-
-
-
- ⏭️
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- 6
-
-
-
-
-
- -1
-
-
- 101
-
-
- 50
-
-
- Qt::Horizontal
-
-
- QSlider::TicksAbove
-
-
-
- -
-
-
- 50
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- nothing
-
-
+
-
+
+
+ -1
+
+
+ 101
+
+
+ 50
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksAbove
+
+
+
+ -
+
+
+ 50
+
+
+
+ -
+
+
-
+
+
+
+ 18
+
+
+
+
+ -
+
+
+
+ 24
+ 75
+ true
+
+
+
+ artist
+
+
+
+ -
+
+
+
+ 16
+ 50
+ true
+ false
+
+
+
+ album
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ nothing
+
+
+
+
@@ -333,7 +336,7 @@
0
0
1152
- 41
+ 24