more better modals
This commit is contained in:
parent
e2d28b50fb
commit
34dde803ce
@ -4,8 +4,8 @@ import DBA
|
|||||||
|
|
||||||
|
|
||||||
class CreatePlaylistWindow(QDialog):
|
class CreatePlaylistWindow(QDialog):
|
||||||
def __init__(self, playlistCreatedSignal):
|
def __init__(self, playlistCreatedSignal, parent=None):
|
||||||
super(CreatePlaylistWindow, self).__init__()
|
super().__init__(parent)
|
||||||
self.playlistCreatedSignal = playlistCreatedSignal
|
self.playlistCreatedSignal = playlistCreatedSignal
|
||||||
self.setWindowTitle("Create new playlist")
|
self.setWindowTitle("Create new playlist")
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
@ -16,10 +16,9 @@ class CreatePlaylistWindow(QDialog):
|
|||||||
|
|
||||||
ok_button = QPushButton("OK")
|
ok_button = QPushButton("OK")
|
||||||
ok_button.clicked.connect(self.save)
|
ok_button.clicked.connect(self.save)
|
||||||
button_layout.addWidget(ok_button)
|
|
||||||
|
|
||||||
cancel_button = QPushButton("Cancel")
|
cancel_button = QPushButton("Cancel")
|
||||||
cancel_button.clicked.connect(self.cancel)
|
cancel_button.clicked.connect(self.cancel)
|
||||||
|
button_layout.addWidget(ok_button)
|
||||||
button_layout.addWidget(cancel_button)
|
button_layout.addWidget(cancel_button)
|
||||||
|
|
||||||
layout.addLayout(button_layout)
|
layout.addLayout(button_layout)
|
||||||
|
|||||||
@ -12,10 +12,11 @@ from PyQt5.QtGui import QFont
|
|||||||
|
|
||||||
|
|
||||||
class EditPlaylistOptionsWindow(QDialog):
|
class EditPlaylistOptionsWindow(QDialog):
|
||||||
def __init__(self, playlist_id):
|
def __init__(self, playlist_id, parent=None):
|
||||||
super(EditPlaylistOptionsWindow, self).__init__()
|
# super(EditPlaylistOptionsWindow, self).__init__()
|
||||||
|
super().__init__(parent)
|
||||||
self.setWindowTitle("Playlist options")
|
self.setWindowTitle("Playlist options")
|
||||||
self.setMinimumSize(800, 200)
|
# self.setMinimumSize(800, 200)
|
||||||
self.playlist_id = playlist_id
|
self.playlist_id = playlist_id
|
||||||
# self.playlist_path_prefix: str = self.config.get(
|
# self.playlist_path_prefix: str = self.config.get(
|
||||||
# "settings", "playlist_path_prefix"
|
# "settings", "playlist_path_prefix"
|
||||||
@ -27,6 +28,15 @@ class EditPlaylistOptionsWindow(QDialog):
|
|||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
def resizeEvent(self, a0):
|
||||||
|
"""
|
||||||
|
Adjust maximum size with parent resize
|
||||||
|
"""
|
||||||
|
parent = self.parentWidget()
|
||||||
|
if parent:
|
||||||
|
self.setMaximumSize(parent.size())
|
||||||
|
super().resizeEvent(a0)
|
||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class PlaylistsPane(QTreeWidget):
|
|||||||
|
|
||||||
def __init__(self: QTreeWidget, parent=None):
|
def __init__(self: QTreeWidget, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
self._library_root = QTreeWidgetItem(["Library"])
|
self._library_root = QTreeWidgetItem(["Library"])
|
||||||
self._playlists_root: QTreeWidgetItem = QTreeWidgetItem(["Playlists"])
|
self._playlists_root: QTreeWidgetItem = QTreeWidgetItem(["Playlists"])
|
||||||
self.addTopLevelItem(self._library_root)
|
self.addTopLevelItem(self._library_root)
|
||||||
@ -88,12 +89,12 @@ class PlaylistsPane(QTreeWidget):
|
|||||||
|
|
||||||
def create_playlist(self):
|
def create_playlist(self):
|
||||||
"""Creates a database record for a playlist, given a name"""
|
"""Creates a database record for a playlist, given a name"""
|
||||||
window = CreatePlaylistWindow(self.playlistCreatedSignal)
|
window = CreatePlaylistWindow(self.playlistCreatedSignal, self.parent)
|
||||||
window.playlistCreatedSignal.connect(self.reload_playlists)
|
window.playlistCreatedSignal.connect(self.reload_playlists)
|
||||||
window.exec_()
|
window.exec_()
|
||||||
|
|
||||||
def options(self):
|
def options(self):
|
||||||
window = EditPlaylistOptionsWindow(self.playlist_db_id_choice)
|
window = EditPlaylistOptionsWindow(self.playlist_db_id_choice, self.parent)
|
||||||
window.exec_()
|
window.exec_()
|
||||||
|
|
||||||
def rename_playlist(self, *args):
|
def rename_playlist(self, *args):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user