parent
79f9a49659
commit
04788ef923
@ -5,6 +5,7 @@ from PyQt5.QtGui import QColor, QDropEvent
|
|||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView,
|
QAbstractItemView,
|
||||||
|
QApplication,
|
||||||
QMenu,
|
QMenu,
|
||||||
QMessageBox,
|
QMessageBox,
|
||||||
QTableWidget,
|
QTableWidget,
|
||||||
@ -154,6 +155,9 @@ class PlaylistTab(QTableWidget):
|
|||||||
if row not in self._meta_get_notes():
|
if row not in self._meta_get_notes():
|
||||||
act_setnext = self.menu.addAction("Set next")
|
act_setnext = self.menu.addAction("Set next")
|
||||||
act_setnext.triggered.connect(lambda: self._set_next(row))
|
act_setnext.triggered.connect(lambda: self._set_next(row))
|
||||||
|
act_copypath = self.menu.addAction("Copy track path")
|
||||||
|
act_copypath.triggered.connect(
|
||||||
|
lambda: self._copy_path(row))
|
||||||
self.menu.addSeparator()
|
self.menu.addSeparator()
|
||||||
act_delete = self.menu.addAction('Delete')
|
act_delete = self.menu.addAction('Delete')
|
||||||
act_delete.triggered.connect(lambda: self._delete_row(row))
|
act_delete.triggered.connect(lambda: self._delete_row(row))
|
||||||
@ -545,6 +549,25 @@ class PlaylistTab(QTableWidget):
|
|||||||
|
|
||||||
self.menu.exec_(self.mapToGlobal(pos))
|
self.menu.exec_(self.mapToGlobal(pos))
|
||||||
|
|
||||||
|
def _copy_path(self, row):
|
||||||
|
"""
|
||||||
|
If passed row is track row, copy the track path to the clipboard.
|
||||||
|
Otherwise return None.
|
||||||
|
"""
|
||||||
|
|
||||||
|
DEBUG(f"_copy_path({row})")
|
||||||
|
|
||||||
|
if row in self._meta_get_notes():
|
||||||
|
return None
|
||||||
|
|
||||||
|
track_id = self._get_row_id(row)
|
||||||
|
if track_id:
|
||||||
|
with Session() as session:
|
||||||
|
path = Tracks.get_path(session, track_id)
|
||||||
|
cb = QApplication.clipboard()
|
||||||
|
cb.clear(mode=cb.Clipboard)
|
||||||
|
cb.setText(path, mode=cb.Clipboard)
|
||||||
|
|
||||||
def _delete_row(self, row):
|
def _delete_row(self, row):
|
||||||
"Delete row"
|
"Delete row"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user