~ubuntu-branches/ubuntu/vivid/pympd/vivid

« back to all changes in this revision

Viewing changes to src/plugins/spec

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2006-09-09 11:47:39 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060909114739-d7fb3wunef46yqzf
Tags: 0.07-1.1
* Non-maintainer upload.
  - Change XB-Python-Version to current (Closes: #385643) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
How to write a plugin for pympd:
2
 
revision 0.02
3
 
 
4
 
A plugin for pympd must be a class named 'Plugin', where the name of the 
5
 
file is plugin.py
6
 
 
7
 
It's important to note that plugins are in their own scope, so they will not
8
 
inherit the imported modules from pympd, they must import the modules themself.
9
 
 
10
 
Four functions are needed in the plugin class:
11
 
 
12
 
    _init(self, data)
13
 
    param: data is a tuple of (gtk.Window, gtk.Menu, pympdclient.pympdclient, base_dir
14
 
    gtk.Window = the main Window of pympd
15
 
    gtk.Menu = the plugin menu on pympd
16
 
    pympdclient = a controller for pympd
17
 
    base_dir = the directory we are in (base directory)
18
 
    usage: called when the plugin is loaded
19
 
 
20
 
    _spin(self, data, bool=None)
21
 
    param: data is mpdclient.Status (see below for data members)
22
 
           if bool is true, then the song has changed.
23
 
    usage: called every time pympd spins, it is useful for reacting to mpd data.
24
 
 
25
 
    _conf(self, bool=None)
26
 
    param: bool is a boolean. 
27
 
    usage: If bool == None, we want to know if you have a dialog, otherwise
28
 
        we want your dialog to pop up.
29
 
 
30
 
    _unload(self)
31
 
    param: None
32
 
    usage: called when the plugin is unloaded, it is recommended to destroy
33
 
        all the gtk items created over here, so they are no longer persistant.
34
 
 
35
 
recommended functions:
36
 
 
37
 
    buildPluginMenu(pluginMenu)
38
 
    add on to the plugin menu in the menubar on top, by appending onto the menu 
39
 
    passed in init.
40
 
 
41
 
    buildConfig()
42
 
    build a config dialog, if your program needs it.
43
 
 
44
 
mpdclient.Status: (taken from mackstann's mpdclient.py)
45
 
    class Status(object):
46
 
      "Class representing the status of the player at a given point in time."
47
 
 
48
 
      volume         = -10
49
 
      repeat         = -1
50
 
      random         = -1
51
 
      playlistLength = -1
52
 
      playlist       = -1L
53
 
      state          = -1
54
 
      song           = 0
55
 
      songid         = 0
56
 
      elapsedTime    = 0
57
 
      totalTime      = 0
58
 
      updating_db    = 0
59
 
      xfade          = 0
60