root/trunk/src/control.py

Revision 852, 2.7 kB (checked in by nicfit, 1 year ago)

Formatting

Line 
1 ################################################################################
2 #  Copyright (C) 2006  Travis Shirk <travis@pobox.com>
3 #
4 #  This program is free software; you can redistribute it and/or modify
5 #  it under the terms of the GNU General Public License as published by
6 #  the Free Software Foundation; either version 2 of the License, or
7 #  (at your option) any later version.
8 #
9 #  This program is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #  GNU General Public License for more details.
13 #
14 #  You should have received a copy of the GNU General Public License
15 #  along with this program; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 #
18 ################################################################################
19 import gobject, gtk
20 import mesk.gtk_utils
21
22 class Control(gobject.GObject):
23     '''A GUI element'''
24
25     # The notebook tab widget
26     tab_widget = gtk.Label('')
27     # The notebook page widget
28     widget = None
29
30     def __init__(self):
31         gobject.GObject.__init__(self)
32         # A signal all controls can emit when requesting to become active.
33         # Right now this means getting control of the AudioControl
34         if gobject.signal_lookup('control_request_active', Control) == 0:
35             gobject.signal_new('control_request_active', Control,
36                                gobject.SIGNAL_RUN_LAST,
37                                gobject.TYPE_NONE, [])
38
39         # The control wishes to close
40         if gobject.signal_lookup('control_request_close', Control) == 0:
41             gobject.signal_new('control_request_close', Control,
42                                gobject.SIGNAL_RUN_LAST,
43                                gobject.TYPE_NONE, [])
44         self._is_active = False
45
46     def shutdown(self):
47         pass
48
49     def set_active(self, state=True, audio_ctrl=None):
50         self._is_active = state
51     def is_active(self):
52         return self._is_active
53
54     def set_focused(self, state=True):
55         pass
56
57     def has_playlist(self):
58         return False
59     def get_playlist(self):
60         return None
61     def is_playlist_saved(self):
62         return False
63
64 class EmptyControl(Control):
65     '''A placeholder control for when there are no others to display'''
66
67     def __init__(self):
68         Control.__init__(self)
69         self.xml = mesk.gtk_utils.get_glade('empty_control',
70                                             'main_window.glade')
71         self.widget = self.xml.get_widget('empty_control')
72         splash = self.xml.get_widget('splash_image')
73         splash.set_from_file('data/images/mesk-splash.jpg')
74         self.widget.show()
Note: See TracBrowser for help on using the browser.