edit preferences view vs edit mode toggle button
This commit is contained in:
parent
b219d0109e
commit
ae74aa8421
11
README.md
11
README.md
@ -59,18 +59,14 @@ config.ini db/
|
|||||||
- ~~automatically fix broken config before loading app (new config options added)~~
|
- ~~automatically fix broken config before loading app (new config options added)~~
|
||||||
- ~~allow spectrum analyzer to fall when playback stops or song is paused~~
|
- ~~allow spectrum analyzer to fall when playback stops or song is paused~~
|
||||||
- ~~ability to delete playlist~~
|
- ~~ability to delete playlist~~
|
||||||
|
- ~~jump to currently playing song~~
|
||||||
##### QMediaPlaylist
|
##### QMediaPlaylist
|
||||||
https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QMediaPlaylist.html#PySide2.QtMultimedia.PySide2.QtMultimedia.QMediaPlaylist
|
https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QMediaPlaylist.html#PySide2.QtMultimedia.PySide2.QtMultimedia.QMediaPlaylist
|
||||||
- playback modes (normal, repeat playlist, repeat 1 song, shuffle)
|
- playback modes (normal, repeat playlist, repeat 1 song, shuffle)
|
||||||
> Use `PySide2.QtMultimedia.QMediaPlaylist.PlaybackMode` ?
|
> Use `PySide2.QtMultimedia.QMediaPlaylist.PlaybackMode` ?
|
||||||
> Use `PySide2.QtMultimedia.QMediaPlaylist.shuffle()` ?
|
> Use `PySide2.QtMultimedia.QMediaPlaylist.shuffle()` ?
|
||||||
- jump to currently playing song - how do i make this work regardless of current sort params?
|
|
||||||
- autoplay next song in all modes
|
- autoplay next song in all modes
|
||||||
> Use `PySide2.QtMultimedia.QMediaPlaylist.next()` after implementing playlist?
|
> Use `PySide2.QtMultimedia.QMediaPlaylist.next()` after implementing playlist?
|
||||||
##### misc
|
|
||||||
- database playlist autoexporting
|
|
||||||
- .wav, .ogg, .flac convertor
|
|
||||||
- automatic "radio" based on artist or genre
|
|
||||||
- playback rate audio quality fix?
|
- playback rate audio quality fix?
|
||||||
> https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QAudioDecoder.html#qaudiodecoder
|
> https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QAudioDecoder.html#qaudiodecoder
|
||||||
> Since Qt 5.12.2, the url scheme gst-pipeline provides custom pipelines for the GStreamer backend.
|
> Since Qt 5.12.2, the url scheme gst-pipeline provides custom pipelines for the GStreamer backend.
|
||||||
@ -79,4 +75,7 @@ player = new QMediaPlayer;
|
|||||||
player->setMedia(QUrl("gst-pipeline: videotestsrc ! autovideosink"));
|
player->setMedia(QUrl("gst-pipeline: videotestsrc ! autovideosink"));
|
||||||
player->play();
|
player->play();
|
||||||
```
|
```
|
||||||
|
##### misc
|
||||||
|
- database playlist autoexporting
|
||||||
|
- .wav, .ogg, .flac convertor
|
||||||
|
- automatic "radio" based on artist or genre
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class PreferencesWindow(QDialog):
|
|||||||
self.reloadConfigSignal = reloadConfigSignal
|
self.reloadConfigSignal = reloadConfigSignal
|
||||||
self.reloadDatabaseSignal = reloadDatabaseSignal
|
self.reloadDatabaseSignal = reloadDatabaseSignal
|
||||||
self.setWindowTitle("Preferences")
|
self.setWindowTitle("Preferences")
|
||||||
self.setMinimumSize(800, 800)
|
self.setMinimumSize(800, 600)
|
||||||
self.cfg_file = (
|
self.cfg_file = (
|
||||||
Path(user_config_dir(appname="musicpom", appauthor="billypom"))
|
Path(user_config_dir(appname="musicpom", appauthor="billypom"))
|
||||||
/ "config.ini"
|
/ "config.ini"
|
||||||
@ -34,7 +34,8 @@ class PreferencesWindow(QDialog):
|
|||||||
self.config.read(self.cfg_file)
|
self.config.read(self.cfg_file)
|
||||||
self.current_category = ""
|
self.current_category = ""
|
||||||
# # Labels & input fields
|
# # Labels & input fields
|
||||||
self.input_fields = {}
|
self.input_fields: dict[str, QLineEdit] = {}
|
||||||
|
self.edit_button: QPushButton
|
||||||
|
|
||||||
# Widgets
|
# Widgets
|
||||||
self.content_area = QWidget()
|
self.content_area = QWidget()
|
||||||
@ -70,7 +71,16 @@ class PreferencesWindow(QDialog):
|
|||||||
def on_nav_item_clicked(self, item: QListWidgetItem):
|
def on_nav_item_clicked(self, item: QListWidgetItem):
|
||||||
self.current_category = item
|
self.current_category = item
|
||||||
self.clear_layout(self.content_layout)
|
self.clear_layout(self.content_layout)
|
||||||
self.input_fields = {}
|
|
||||||
|
# Edit toggle button
|
||||||
|
edit_button = QPushButton()
|
||||||
|
self.edit_button: QPushButton = edit_button
|
||||||
|
self.edit_button.setText("view mode")
|
||||||
|
self.edit_button.clicked.connect(self.on_edit_toggled)
|
||||||
|
self.content_layout.addWidget(edit_button)
|
||||||
|
|
||||||
|
# dict of text input fields
|
||||||
|
self.input_fields: dict[str, QLineEdit] = {}
|
||||||
if isinstance(item, str):
|
if isinstance(item, str):
|
||||||
self.current_category_str = item
|
self.current_category_str = item
|
||||||
else:
|
else:
|
||||||
@ -84,6 +94,7 @@ class PreferencesWindow(QDialog):
|
|||||||
for key in self.config[self.current_category_str]:
|
for key in self.config[self.current_category_str]:
|
||||||
label = QLabel(key)
|
label = QLabel(key)
|
||||||
input_field = QLineEdit(self.config[self.current_category_str][key])
|
input_field = QLineEdit(self.config[self.current_category_str][key])
|
||||||
|
input_field.setEnabled(False)
|
||||||
self.content_layout.addWidget(label)
|
self.content_layout.addWidget(label)
|
||||||
self.content_layout.addWidget(input_field)
|
self.content_layout.addWidget(input_field)
|
||||||
self.input_fields[key] = input_field
|
self.input_fields[key] = input_field
|
||||||
@ -93,7 +104,21 @@ class PreferencesWindow(QDialog):
|
|||||||
save_button.clicked.connect(self.save_preferences)
|
save_button.clicked.connect(self.save_preferences)
|
||||||
self.content_layout.addWidget(save_button)
|
self.content_layout.addWidget(save_button)
|
||||||
|
|
||||||
|
def on_edit_toggled(self):
|
||||||
|
"""Toggle editable text or not"""
|
||||||
|
# kinda ugly
|
||||||
|
is_button_on: bool = True
|
||||||
|
for _, field in self.input_fields.items():
|
||||||
|
if field.isEnabled():
|
||||||
|
is_button_on = False
|
||||||
|
field.setEnabled(not field.isEnabled())
|
||||||
|
if is_button_on:
|
||||||
|
self.edit_button.setText("edit mode")
|
||||||
|
else:
|
||||||
|
self.edit_button.setText("view mode")
|
||||||
|
|
||||||
def clear_layout(self, layout):
|
def clear_layout(self, layout):
|
||||||
|
"""Clears all widgets in the current layout"""
|
||||||
while layout.count():
|
while layout.count():
|
||||||
child = layout.takeAt(0)
|
child = layout.takeAt(0)
|
||||||
if child.widget():
|
if child.widget():
|
||||||
|
|||||||
@ -6,6 +6,7 @@ database = db/library.db
|
|||||||
# Useful paths to have stored
|
# Useful paths to have stored
|
||||||
library = /path/to/music
|
library = /path/to/music
|
||||||
reorganize_destination = /where/to/reorganize/to
|
reorganize_destination = /where/to/reorganize/to
|
||||||
|
playlist_auto_export_enabled = 0
|
||||||
playlist_export_path = /where/to/export/to
|
playlist_export_path = /where/to/export/to
|
||||||
playlist_relative_path = /relative/prefix
|
playlist_relative_path = /relative/prefix
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user