Can add notes, not saved to db
This commit is contained in:
parent
8f749fa78d
commit
8ccded2a57
@ -5,13 +5,14 @@ import music
|
|||||||
|
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
# from log import DEBUG, ERROR
|
from log import DEBUG
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QTimer
|
from PyQt5.QtCore import Qt, QTimer
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
QDialog,
|
QDialog,
|
||||||
QFileDialog,
|
QFileDialog,
|
||||||
|
QInputDialog,
|
||||||
QListWidgetItem,
|
QListWidgetItem,
|
||||||
QMainWindow,
|
QMainWindow,
|
||||||
)
|
)
|
||||||
@ -92,6 +93,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.actionPlay_next.triggered.connect(self.play_next)
|
self.actionPlay_next.triggered.connect(self.play_next)
|
||||||
self.actionSearch_database.triggered.connect(self.search_database)
|
self.actionSearch_database.triggered.connect(self.search_database)
|
||||||
self.actionSkip_next.triggered.connect(self.play_next)
|
self.actionSkip_next.triggered.connect(self.play_next)
|
||||||
|
self.btnInsertNote.clicked.connect(self.insert_note)
|
||||||
self.btnPrevious.clicked.connect(self.play_previous)
|
self.btnPrevious.clicked.connect(self.play_previous)
|
||||||
self.btnSearchDatabase.clicked.connect(self.search_database)
|
self.btnSearchDatabase.clicked.connect(self.search_database)
|
||||||
self.btnSetNextTrack.clicked.connect(self.set_next_track)
|
self.btnSetNextTrack.clicked.connect(self.set_next_track)
|
||||||
@ -109,6 +111,17 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def fade(self):
|
def fade(self):
|
||||||
self.playlist.fade()
|
self.playlist.fade()
|
||||||
|
|
||||||
|
def insert_note(self):
|
||||||
|
"Add non-track row to playlist"
|
||||||
|
|
||||||
|
dlg = QInputDialog(self)
|
||||||
|
dlg.setInputMode(QInputDialog.TextInput)
|
||||||
|
dlg.setLabelText("Note:")
|
||||||
|
dlg.resize(500, 100)
|
||||||
|
ok = dlg.exec()
|
||||||
|
if ok:
|
||||||
|
self.playlist.add_note(dlg.textValue())
|
||||||
|
|
||||||
def play_next(self):
|
def play_next(self):
|
||||||
self.playlist.play_next()
|
self.playlist.play_next()
|
||||||
self.disable_play_next_controls()
|
self.disable_play_next_controls()
|
||||||
@ -225,6 +238,13 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AddNoteDialog(QDialog):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.ui = Ui_dlgAddNote()
|
||||||
|
self.ui.setupUi(self)
|
||||||
|
|
||||||
|
|
||||||
class DbDialog(QDialog):
|
class DbDialog(QDialog):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|||||||
@ -73,6 +73,32 @@ class Playlist(QTableWidget):
|
|||||||
if record.f_int != self.columnWidth(column):
|
if record.f_int != self.columnWidth(column):
|
||||||
record.update({'f_int': width})
|
record.update({'f_int': width})
|
||||||
|
|
||||||
|
def add_note(self, note):
|
||||||
|
"""
|
||||||
|
Add note to playlist
|
||||||
|
|
||||||
|
If a row is selected, add note above. Otherwise, add to end of
|
||||||
|
playlist.
|
||||||
|
"""
|
||||||
|
|
||||||
|
DEBUG(f"add_note({note})")
|
||||||
|
|
||||||
|
DEBUG(f"self.currentRow()={self.currentRow()}")
|
||||||
|
row = self.currentRow()
|
||||||
|
if row < 0:
|
||||||
|
row = self.rowCount()
|
||||||
|
DEBUG(f"row={row}")
|
||||||
|
|
||||||
|
self.insertRow(row)
|
||||||
|
item = QTableWidgetItem("0")
|
||||||
|
self.setItem(row, self.COL_INDEX, item)
|
||||||
|
item = QTableWidgetItem(note)
|
||||||
|
self.setItem(row, 1, item)
|
||||||
|
self.setSpan(row, 1, 1, 6)
|
||||||
|
self.meta_set_note(row)
|
||||||
|
|
||||||
|
self.repaint()
|
||||||
|
|
||||||
def add_to_playlist(self, track):
|
def add_to_playlist(self, track):
|
||||||
"""
|
"""
|
||||||
Add track to playlist
|
Add track to playlist
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user