Add copying information
[jack_freewheel_button.git] / jack_freewheel_button
blob26ac0ecfc30ef42d0fb6da35a585c7fe4fa76822
1 #!/usr/bin/python
3 # JACK FreeWheel button
5 # Copyright (C) 2010 Nikita Zlobin <cook60020tmp@mail.ru>
7 #*************************************************************************
8 # This file implements dialogs that are not implemented in dedicated files
9 #*************************************************************************
11 # LADI Session Handler is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # LADI Session Handler is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 # or write to the Free Software Foundation, Inc.,
24 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27 import glib
28 import gtk
29 import jack
31 text_freewheel = "ON"
32 text_rtwheel = "OFF"
33 text_generic = "Free wheel: "
35 jclient_name = "jack_freewheel_button"
37 def on_button_toggled(button):
38 if button.get_active():
39 button.set_label(text_generic+text_freewheel)
40 jack.set_freewheel(1)
41 else:
42 button.set_label(text_generic+text_rtwheel)
43 button.set_sensitive(True)
44 jack.set_freewheel(0)
46 def timeout():
47 if jack.get_freewheel() > 0:
48 if button.get_active() == False:
49 button.set_active(True)
50 button.set_sensitive(False)
51 else:
52 button.set_active(False)
54 return True
56 # Create objects
57 window = gtk.Window()
58 window.set_title("JACK time wheel control")
59 window.set_resizable(False)
60 window.set_decorated(False)
62 button = gtk.ToggleButton()
63 button.set_active(False)
64 button.set_label(text_generic+text_rtwheel)
66 # Connections
67 window.connect("delete-event", gtk.main_quit);
68 button.connect("toggled", on_button_toggled);
69 window.add(button)
71 # JACK
72 jack.attach(jclient_name)
73 jack.activate()
74 glib.timeout_add(300, timeout)
76 window.show_all()
78 gtk.main()
80 jack.deactivate()
81 jack.detach()