~ihh/impulse.bzr/main

« back to all changes in this revision

Viewing changes to screenlet/themes/circle line/__init__.py

  • Committer: Ian Halpern
  • Date: 2009-04-27 00:02:27 UTC
  • Revision ID: ian@ian-desktop-20090427000227-brh0q44j9pkxk5xp
Updated screenlet to support theme modifications

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import math
2
2
 
 
3
from screenlets.options import ColorOption, IntOption
 
4
 
3
5
fft=True
4
6
 
 
7
co = ( 0.0, 0.6, 1.0, 0.8 )
 
8
 
5
9
def load_theme( screenlet ):
6
10
        screenlet.resize( 300, 300 )
7
11
 
8
 
def on_draw( audio_sample_array, cr ):
 
12
        screenlet.add_option( ColorOption(
 
13
                'Impulse', 'co',
 
14
                co, 'Color',
 
15
                'Example options group using color'
 
16
        ) )
 
17
 
 
18
def on_after_set_attribute ( self, name, value, screenlet ):
 
19
        setattr( self, name, value )
 
20
 
 
21
def on_draw( audio_sample_array, cr, screenlet ):
9
22
 
10
23
        l = len( audio_sample_array )
11
24
 
12
25
        width, height = ( 300, 300 )
13
26
 
14
 
        cr.set_source_rgba( 0.0, 0.6, 1.0, 0.8 )
 
27
        cr.set_source_rgba( co[ 0 ], co[ 1 ], co[ 2 ], co[ 3 ] )
15
28
 
16
29
        n_bars = 32
17
30