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.btnAdd.clicked.connect(self.add_selected)
|
||||||
self.ui.btnAddClose.clicked.connect(self.add_selected_and_close)
|
self.ui.btnAddClose.clicked.connect(self.add_selected_and_close)
|
||||||
self.ui.btnClose.clicked.connect(self.close)
|
self.ui.btnClose.clicked.connect(self.close)
|
||||||
|
self.ui.matchList.itemSelectionChanged.connect(self.selection_changed)
|
||||||
|
|
||||||
record = Settings.get_int("dbdialog_width")
|
record = Settings.get_int("dbdialog_width")
|
||||||
width = record.f_int or 800
|
width = record.f_int or 800
|
||||||
@ -554,6 +555,14 @@ class DbDialog(QDialog):
|
|||||||
self.ui.searchString.selectAll()
|
self.ui.searchString.selectAll()
|
||||||
self.ui.searchString.setFocus()
|
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):
|
class SelectPlaylistDialog(QDialog):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
@ -564,6 +573,12 @@ class SelectPlaylistDialog(QDialog):
|
|||||||
self.ui.buttonBox.accepted.connect(self.open)
|
self.ui.buttonBox.accepted.connect(self.open)
|
||||||
self.ui.buttonBox.rejected.connect(self.close)
|
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 [
|
for (plid, plname) in [
|
||||||
(a.id, a.name) for a in Playlists.get_all_playlists()
|
(a.id, a.name) for a in Playlists.get_all_playlists()
|
||||||
]:
|
]:
|
||||||
@ -572,6 +587,15 @@ class SelectPlaylistDialog(QDialog):
|
|||||||
p.setData(Qt.UserRole, plid)
|
p.setData(Qt.UserRole, plid)
|
||||||
self.ui.lstPlaylists.addItem(p)
|
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):
|
def list_doubleclick(self, entry):
|
||||||
self.plid = entry.data(Qt.UserRole)
|
self.plid = entry.data(Qt.UserRole)
|
||||||
self.accept()
|
self.accept()
|
||||||
|
|||||||
@ -13,8 +13,8 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
@ -28,51 +28,54 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<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>
|
<item>
|
||||||
<widget class="QListWidget" name="matchList"/>
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QPushButton" name="btnAdd">
|
||||||
<item>
|
<property name="text">
|
||||||
<spacer name="horizontalSpacer">
|
<string>&Add</string>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
<property name="default">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="sizeHint" stdset="0">
|
</property>
|
||||||
<size>
|
</widget>
|
||||||
<width>88</width>
|
</item>
|
||||||
<height>20</height>
|
<item>
|
||||||
</size>
|
<widget class="QPushButton" name="btnAddClose">
|
||||||
</property>
|
<property name="text">
|
||||||
</spacer>
|
<string>A&dd and close</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QPushButton" name="btnAdd">
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>&Add</string>
|
<widget class="QPushButton" name="btnClose">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="default">
|
<string>&Close</string>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnAddClose">
|
|
||||||
<property name="text">
|
|
||||||
<string>A&dd and close</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnClose">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Close</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user