Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/PrestametuVoz.activity/prestame_tu_voz.py
blob: 572d71421d0ade0a2a465c97de695bf4f16e0808 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (C) 2010  Federico Moreira - <federico@piensalibre.info>
#                    Alejandro Esperón - <ratman26@gmail.com>
#                    Esteban Arias - <earias@plan.ceibal.edu.uy>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>


import gtk 
from gettext import gettext as _
from sugar.activity.activity import Activity, ActivityToolbox

from toolbar import ConfigToolbar        
import grid
import config_nuevo

_TOOLBAR_CONFIG = 1

class PrestameTuVozActivity(Activity):

    def __init__(self, handle):
        Activity.__init__(self, handle)

        self.config_load = False

        toolbox = ActivityToolbox(self)

        toolbar_config = ConfigToolbar(toolbox, self)
        toolbox.add_toolbar(_('Configuration'), toolbar_config)
        toolbar_config.show()

        self.set_toolbox(toolbox)
        toolbox.show()

        self.lista_tarjetas =[]
        self.pos_actual = 0
        self.recording = False
        self.rec_process = None

        self.mainbox = gtk.VBox()
        #self.mainbox.pack_start(self.image)

        self.tablebox = grid.VentanaPrincipal()
    	self.control = grid.ControlBarrido(self.tablebox)
    	self.chatbox = grid.get_chat_box()
    	self.tablebox.show_all()
    	self.control.show_all()
    	self.chatbox.show_all()
	self.mainbox.pack_start(self.control)
	self.mainbox.pack_start(self.tablebox)
	self.mainbox.pack_start(self.chatbox)

        self.set_canvas(self.mainbox)
        self.mainbox.show_all()

        self.toolbox.connect('current-toolbar-changed', self.change_mode)

    def change_mode(self, notebook, index):
        if index == _TOOLBAR_CONFIG:
            if not self.config_load:
                self.config_load = True
            self.mainbox.remove(self.control)
            self.mainbox.remove(self.tablebox)
            self.mainbox.remove(self.chatbox)

            self.ventana_config = config_nuevo.VentanaConfig()
            self.mainbox.pack_start(self.ventana_config)
            self.ventana_config.show_all()

        else:
            self.mainbox.remove(self.ventana_config)
            
            self.mainbox.pack_start(self.control)
            self.mainbox.pack_start(self.tablebox)
            self.mainbox.pack_start(self.chatbox)