source: modules/device_modules/device_n9.py @ c484fad

Last change on this file since c484fad was c484fad, checked in by Martin Kolman <martin.kolman@…>, 2 years ago

update screen blanking control API; screen blanking support for N9/N950

  • Property mode set to 100644
File size: 3.1 KB
Line 
1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3#----------------------------------------------------------------------------
4# Sample of a modRana device-specific module.
5# It is a basic modRana module, that has some special features
6# and is loaded only on the correpsponding device.
7#----------------------------------------------------------------------------
8# Copyright 2010, Martin Kolman
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22#---------------------------------------------------------------------------
23from base_device_module import deviceModule
24
25from QtMobility.SystemInfo import QSystemScreenSaver
26""" ^^ back-light control"""
27
28# NOTE: use the device_ prefix when naming the module
29
30def getModule(m,d,i):
31  return(device_example(m,d,i))
32
33class device_example(deviceModule):
34  """A sample modRana device-specific module"""
35 
36  def __init__(self, m, d, i):
37    deviceModule.__init__(self, m, d, i)
38    # create the screen-saver controller
39    self.qScreenSaver = QSystemScreenSaver()
40
41  def getDeviceIDString(self):
42    return "n9"
43
44  def getDeviceName(self):
45    return "Nokia N9 or N950"
46
47  def getWinWH(self):
48    """N9/N950 screen resolution"""
49    return ((854,480))
50
51  def startInFullscreen(self):
52    """
53    non-fullscreen mode just draw some weird toolbar & status-bar
54    on Harmattan
55    """
56    return True
57
58  def fullscreenOnly(self):
59    """
60    basically no need to
61    """
62    return True
63
64  def screenBlankingControlSupported(self):
65    """
66    Screen blanking support is handled through Qt Mobility
67    """
68    return True
69
70  def pauseScreenBlanking(self):
71    """
72    inhibit screen blanking
73    """
74    QSystemScreenSaver.setScreenSaverInhibit(self.qScreenSaver)
75
76
77  def getLocationType(self):
78    return "qt_mobility"
79
80  def hasButtons(self):
81    # TODO: support for volume buttons
82    return False
83
84
85  # ** LOCATION **
86
87  def handlesLocation(self):
88    """using Qt Mobility"""
89    return False
90
91  def startLocation(self):
92    pass
93
94  def stopLocation(self):
95    pass
96
97
98  # ** PATHS **
99
100  # NOTE: basically the same as on
101  # maemo 5 on the N900
102
103  def getTracklogFolderPath(self):
104    return "/home/user/MyDocs/tracklogs"
105
106  def getMapFolderPath(self):
107    return "/home/user/MyDocs/.maps/"
108
109  def getPOIFolderPath(self):
110    return "/home/user/MyDocs/.maps"
111
112  def getLogFolderPath(self):
113    return "/home/user/MyDocs/modrana_debug_logs/"
114
115  def needsQuitButton(self):
116    """No need for a separate Quit button thanks to Swipe UI"""
117    return False
118
119if(__name__ == "__main__"):
120  a = device_example({}, {})
121  a.update()
122  a.update()
123  a.update()
Note: See TracBrowser for help on using the repository browser.