root/branches/0.3/src/control.py

Revision 529, 2.7 kB (checked in by nicfit, 2 years ago)

Profile based dbus services and a few more service methods

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 #  $Id$
19 ################################################################################
20 import gobject, gtk
21 import mesk.gtk_utils
22
23 class Control(gobject.GObject):
24     '''A GUI element'''
25
26     # The notebook tab widget
27     tab_widget = gtk.Label('')
28     # The notebook page widget
29     widget = None
30
31     def __init__(self):
32         gobject.GObject.__init__(self)
33         # A signal all controls can emit when requesting to become active.
34         # Right now this means getting control of the AudioControl
35         if gobject.signal_lookup('control_request_active', Control) == 0:
36             gobject.signal_new('control_request_active', Control,
37                                gobject.SIGNAL_RUN_LAST,
38                                gobject.TYPE_NONE, [])
39
40         # The control wishes to close
41         if gobject.signal_lookup('control_request_close', Control) == 0:
42             gobject.signal_new('control_request_close', Control,
43                                gobject.SIGNAL_RUN_LAST,
44                                gobject.TYPE_NONE, [])
45         self._is_active = False
46
47     def shutdown(self):
48         pass
49
50     def set_active(self, state=True, audio_ctrl=None):
51         self._is_active = state
52     def is_active(self):
53         return self._is_active
54
55     def set_focused(self, state=True):
56         pass
57
58     def has_playlist(self):
59         return False
60     def get_playlist(self):
61         return None
62     def is_playlist_saved(self):
63         return False
64
65 class EmptyControl(Control):
66     '''A placeholder control for when there are no others to display'''
67
68     def __init__(self):
69         Control.__init__(self)
70         self.xml = mesk.gtk_utils.get_glade('empty_control',
71                                             'main_window.glade')
72         self.widget = self.xml.get_widget('empty_control')
73         splash = self.xml.get_widget('splash_image')
74         splash.set_from_file('data/images/mesk-splash.jpg')
75         self.widget.show()
Note: See TracBrowser for help on using the browser.