Improve Add from Database dialog
- remember size of dialog box - show path of selected entry
This commit is contained in:
parent
51cc3bfbca
commit
eedd898df9
@ -496,6 +496,7 @@ class DbDialog(QDialog):
|
||||
self.ui.btnAdd.clicked.connect(self.add_selected)
|
||||
self.ui.btnAddClose.clicked.connect(self.add_selected_and_close)
|
||||
self.ui.btnClose.clicked.connect(self.close)
|
||||
self.ui.matchList.itemSelectionChanged.connect(self.selection_changed)
|
||||
|
||||
record = Settings.get_int("dbdialog_width")
|
||||
width = record.f_int or 800
|
||||
@ -554,6 +555,14 @@ class DbDialog(QDialog):
|
||||
self.ui.searchString.selectAll()
|
||||
self.ui.searchString.setFocus()
|
||||
|
||||
def selection_changed(self):
|
||||
if not self.ui.matchList.selectedItems():
|
||||
return
|
||||
|
||||
item = self.ui.matchList.currentItem()
|
||||
track_id = item.data(Qt.UserRole)
|
||||
self.ui.dbPath.setText(Tracks.get_path(track_id))
|
||||
|
||||
|
||||
class SelectPlaylistDialog(QDialog):
|
||||
def __init__(self, parent=None):
|
||||
@ -564,6 +573,12 @@ class SelectPlaylistDialog(QDialog):
|
||||
self.ui.buttonBox.accepted.connect(self.open)
|
||||
self.ui.buttonBox.rejected.connect(self.close)
|
||||
|
||||
record = Settings.get_int("select_playlist_dialog_width")
|
||||
width = record.f_int or 800
|
||||
record = Settings.get_int("select_playlist_dialog_height")
|
||||
height = record.f_int or 600
|
||||
self.resize(width, height)
|
||||
|
||||
for (plid, plname) in [
|
||||
(a.id, a.name) for a in Playlists.get_all_playlists()
|
||||
]:
|
||||
@ -572,6 +587,15 @@ class SelectPlaylistDialog(QDialog):
|
||||
p.setData(Qt.UserRole, plid)
|
||||
self.ui.lstPlaylists.addItem(p)
|
||||
|
||||
def __del__(self):
|
||||
record = Settings.get_int("select_playlist_dialog_height")
|
||||
if record.f_int != self.height():
|
||||
record.update({'f_int': self.height()})
|
||||
|
||||
record = Settings.get_int("select_playlist_dialog_width")
|
||||
if record.f_int != self.width():
|
||||
record.update({'f_int': self.width()})
|
||||
|
||||
def list_doubleclick(self, entry):
|
||||
self.plid = entry.data(Qt.UserRole)
|
||||
self.accept()
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
@ -28,11 +28,16 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="matchList"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dbPath">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@ -75,8 +80,6 @@
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user