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.
33 fw_slave
= "<b>ON</b> <small>SLAVE</small>"
34 text_generic
= "<small>FREE WHEEL</small>"
36 jclient_name
= "jack_freewheel_button"
38 def on_button_toggled(button
):
39 label
= button
.get_children()[0]
40 if button
.get_active():
41 b_label
.set_label(text_generic
+"\n"+fw_on
)
45 b_label
.set_label(text_generic
+"\n"+fw_off
)
46 # Return default colors
47 button
.modify_bg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('darkgreen'))
48 button
.modify_bg(gtk
.STATE_PRELIGHT
, gtk
.gdk
.color_parse('darkgreen'))
49 button
.modify_bg(gtk
.STATE_ACTIVE
, gtk
.gdk
.color_parse('darkgreen'))
50 b_label
.modify_fg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('lightgreen'))
52 button
.set_sensitive(True)
55 def check_freewheel():
56 if jack
.get_freewheel() > 0:
57 if button
.get_active() == False:
58 button
.set_active(True)
59 button
.set_sensitive(False)
60 b_label
.set_label(text_generic
+"\n"+fw_slave
)
61 b_label
.modify_fg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('pink'))
63 button
.set_active(False)
68 if not button
.get_active():
73 button
.modify_bg(gtk
.STATE_ACTIVE
, gtk
.gdk
.color_parse('brown'))
74 button
.modify_bg(gtk
.STATE_PRELIGHT
, gtk
.gdk
.color_parse('brown'))
75 b_label
.modify_fg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('pink'))
78 button
.modify_bg(gtk
.STATE_ACTIVE
, gtk
.gdk
.color_parse('darkorange'))
79 button
.modify_bg(gtk
.STATE_PRELIGHT
, gtk
.gdk
.color_parse('darkorange'))
80 b_label
.modify_fg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('lightyellow'))
86 window
.set_title("JACK time wheel control")
87 window
.set_resizable(False)
88 window
.set_decorated(False)
90 button
= gtk
.ToggleButton()
91 button
.set_active(False)
92 button
.set_label(text_generic
+"\n"+fw_off
)
94 b_label
= button
.get_children()[0]
95 b_label
.set_justify(gtk
.JUSTIFY_CENTER
)
96 b_label
.set_use_markup(True)
101 window
.connect("delete-event", gtk
.main_quit
);
102 button
.connect("toggled", on_button_toggled
);
106 button
.modify_bg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('darkgreen'))
107 button
.modify_bg(gtk
.STATE_PRELIGHT
, gtk
.gdk
.color_parse('darkgreen'))
108 button
.modify_bg(gtk
.STATE_ACTIVE
, gtk
.gdk
.color_parse('darkgreen'))
109 button
.modify_bg(gtk
.STATE_INSENSITIVE
, gtk
.gdk
.color_parse('darkred'))
110 b_label
.modify_fg(gtk
.STATE_NORMAL
, gtk
.gdk
.color_parse('lightgreen'))
113 jack
.attach(jclient_name
)
115 glib
.timeout_add(300, check_freewheel
)
116 glib
.timeout_add(700, blink_toggle
)