Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/toolbar_side.py
blob: 975ddc7ebf43a7a2447615120f9ab510749e68b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /usr/bin/python
import pygtk
import gtk
import os

import config  	#This has all the globals


class SideToolbar(gtk.DrawingArea):

    def __init__(self, wave, audiograb):
        gtk.DrawingArea.__init__(self)

        self.wave_copy = wave
        self.audiograb = audiograb
        self.show_toolbar = True

        self.adjustmenty = gtk.Adjustment(3.0, 0.0, 4.0 ,0.1, 0.1, 0.0)
        self.adjustmenty.connect("value_changed", self.cb_page_sizey,\
	        self.adjustmenty)
        self.yscrollbar = gtk.VScale(self.adjustmenty)
        self.yscrollbar.set_draw_value(False)
        self.yscrollbar.set_inverted(True)
        self.yscrollbar.set_update_policy(gtk.UPDATE_CONTINUOUS)
		
        self.img_amphigh = gtk.Image()
        self.img_amplow =  gtk.Image()		

        self.img_amphigh.set_from_file(config.ICONS_DIR + '/amp-high.svg')
        self.img_amplow.set_from_file(config.ICONS_DIR + '/amp-low.svg')

        self.box1 = gtk.VBox(False,0)
        self.box1.pack_start(self.img_amphigh, False, True, 0)
        self.box1.pack_start(self.yscrollbar, True, True, 0)
        self.box1.pack_start(self.img_amplow, False, True, 0)

        ##test  
        self.set_show_hide(False)


    def cb_page_sizey(self, get, data=None):
        # FIXME: use dB values for volume
        if(get.value<=1.5):
            self.wave_copy.y_mag= get.value
            self.wave_copy.g = 1            #0dB
            volume = 25
        if(get.value>1.5 and get.value<=2.5 ):
            self.wave_copy.y_mag= (get.value*1.5)
            self.wave_copy.g = 1.9952       #6dB
            volume = 50
        if(get.value>2.5 and get.value<=3.5 ):
            self.wave_copy.y_mag= (get.value*3)
            self.wave_copy.g = 3.981        #12dB
            volume = 75
        if(get.value>3.5 and get.value<=4.0 ):
            self.wave_copy.y_mag= (get.value*4)
            self.wave_copy.g = 13.335       #22.5dB
            volume = 100
        self.audiograb.set_capture_gain(volume)
        return True


    def set_show_hide(self, show=True):
        self.show_toolbar = show
        #self.yscrollbar.show(self.show_toolbar)

    def get_show_hide(self):
        return self.show_toolbar