1 # -*- coding: utf-8 -*-
3 # This file is part of Panucci.
4 # Copyright (c) 2008-2010 The Panucci Audiobook and Podcast Player Project
6 # Panucci is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Panucci is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Panucci. If not, see <http://www.gnu.org/licenses/>.
20 from __future__
import absolute_import
28 class MaemoDevice(object):
30 self
._osso
_context
= osso
.Context('Panucci', panucci
.__version
__, False)
31 self
._osso
_device
_state
= osso
.DeviceState(self
._osso
_context
)
32 self
.anti_blank_timer_id
= None
34 def disable_blanking(self
):
35 """Inhibit blanking of the screen
37 Calling this function will keep the backlight turned on.
39 self
.anti_blank_timer_id
is not None:
40 self
.anti_blank_timer_id
= gobject
.timeout_add(1000*59, \
41 self
._blanking
_timer
_callback
)
43 def enable_blanking(self
):
44 """(Re-)enable blanking of the screen
46 If blanking has been inhibited previously, this will
47 allow blanking the screen again.
49 if self
.anti_blank_timer_id
is not None:
50 gobject
.source_remove(self
.anti_blank_timer_id
)
52 def _blanking_timer_callback(self
):
53 self
._osso
_device
_state
.display_blanking_pause()