29 lines
627 B
Python
29 lines
627 B
Python
#!/usr/bin/python3
|
|
|
|
from PyQt6.QtCore import QPoint
|
|
from PyQt6.QtGui import QAction
|
|
from PyQt6.QtWidgets import QMenu, QTabBar
|
|
|
|
|
|
class PlaylistContextMenu(QMenu):
|
|
def __init__(self, parent=None):
|
|
super().__init__(parent)
|
|
|
|
self.tab_bar: QTabBar = parent
|
|
|
|
self.playlist_title = None
|
|
|
|
self.rename_action = QAction("Rename")
|
|
|
|
self.addAction(self.rename_action)
|
|
|
|
self.rename_action.triggered.connect(self.rename)
|
|
|
|
def exec(self, pos: QPoint, title):
|
|
self.playlist_title = title
|
|
|
|
super().exec(pos)
|
|
|
|
def rename(self):
|
|
self.playlist_title.setFocus()
|
|
|