~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to scripts/shutdown/main.py

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import clementine
2
 
 
3
 
from PyQt4.QtGui import QAction
4
 
 
5
 
import sys
6
 
 
7
 
class Plugin:
8
 
  def __init__(self):
9
 
    self.enabled = False
10
 
    clementine.player.PlaylistFinished.connect(self.PlaylistFinished)
11
 
    self.action = QAction("Shutdown at end", None)
12
 
    self.action.setCheckable(True)
13
 
    self.action.triggered.connect(self.Enabled)
14
 
    clementine.ui.AddAction("playlist_menu", self.action)
15
 
 
16
 
 
17
 
  # Slots
18
 
  def PlaylistFinished(self):
19
 
    if self.enabled:
20
 
      print "Reached the end of the playlist - shutting down."
21
 
      sys.exit(0)
22
 
 
23
 
  def Enabled(self, enabled):
24
 
    print "Shutdown at end of playlist enabled: %s" % enabled
25
 
    self.enabled = enabled
26
 
 
27
 
plugin = Plugin()