mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-18 20:40:43 +01:00
Fix the shutdown script to work with PythonQt
This commit is contained in:
parent
97a8aa54be
commit
143308d2d2
@ -1,27 +1,30 @@
|
||||
import clementine
|
||||
|
||||
from PyQt4.QtGui import QAction
|
||||
from PythonQt.QtGui import QAction
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
LOGGER = logging.getLogger("system-shutdown")
|
||||
|
||||
|
||||
class Plugin:
|
||||
def __init__(self):
|
||||
self.enabled = False
|
||||
clementine.player.PlaylistFinished.connect(self.PlaylistFinished)
|
||||
clementine.player.connect("PlaylistFinished()", self.PlaylistFinished)
|
||||
self.action = QAction("Shutdown at end", None)
|
||||
self.action.setCheckable(True)
|
||||
self.action.triggered.connect(self.Enabled)
|
||||
self.action.connect("triggered(bool)", self.Enabled)
|
||||
clementine.ui.AddAction("playlist_menu", self.action)
|
||||
|
||||
|
||||
# Slots
|
||||
def PlaylistFinished(self):
|
||||
if self.enabled:
|
||||
print "Reached the end of the playlist - shutting down."
|
||||
LOGGER.info("Reached the end of the playlist - shutting down")
|
||||
sys.exit(0)
|
||||
|
||||
def Enabled(self, enabled):
|
||||
print "Shutdown at end of playlist enabled: %s" % enabled
|
||||
LOGGER.info("Shutdown at end of playlist enabled: %s" % str(enabled))
|
||||
self.enabled = enabled
|
||||
|
||||
|
||||
plugin = Plugin()
|
||||
|
Loading…
Reference in New Issue
Block a user