projects
/
drlaunch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5e99dba
)
(no commit message)
author
Stefanos Harhalakis
<v13@v13.gr>
Thu, 17 Jun 2010 16:58:54 +0000
(16:58 +0000)
committer
Stefanos Harhalakis
<v13@v13.gr>
Thu, 17 Jun 2010 16:58:54 +0000
(16:58 +0000)
portrait.py
patch
|
blob
|
history
test.py
patch
|
blob
|
history
diff --git
a/portrait.py
b/portrait.py
index
a40a149
..
45043c5
100644
(file)
--- a/
portrait.py
+++ b/
portrait.py
@@
-40,6
+40,11
@@
class FremantleRotation(object):
You can set the mode for rotation to AUTOMATIC (default), NEVER or
ALWAYS with the set_mode() method.
"""
You can set the mode for rotation to AUTOMATIC (default), NEVER or
ALWAYS with the set_mode() method.
"""
+
+ AUTOMATIC, NEVER, ALWAYS = range(3)
+
+ MODE_CAPTIONS = ('Automatic', 'Landscape', 'Portrait')
+
# Privately-used constants
_PORTRAIT, _LANDSCAPE = ('portrait', 'landscape')
_ENABLE_ACCEL = 'req_accelerometer_enable'
# Privately-used constants
_PORTRAIT, _LANDSCAPE = ('portrait', 'landscape')
_ENABLE_ACCEL = 'req_accelerometer_enable'
@@
-83,6
+88,11
@@
class FremantleRotation(object):
path='/org/freedesktop/Hal/devices/platform_slide')
self.set_mode(mode)
path='/org/freedesktop/Hal/devices/platform_slide')
self.set_mode(mode)
+ self._send_mce_request(self._ENABLE_ACCEL)
+
+ def set_mode(self, new_mode):
+ self._mode=new_mode
+
def get_mode(self):
"""Get the currently-set rotation mode
def get_mode(self):
"""Get the currently-set rotation mode
@@
-90,7
+100,7
@@
class FremantleRotation(object):
"""
return self._mode
"""
return self._mode
- def NO_send_mce_request(self, request):
+ def _send_mce_request(self, request):
rpc = osso.Rpc(self._osso_context)
rpc.rpc_run(self._MCE_SERVICE, \
self._MCE_REQUEST_PATH, \
rpc = osso.Rpc(self._osso_context)
rpc.rpc_run(self._MCE_SERVICE, \
self._MCE_REQUEST_PATH, \
@@
-98,7
+108,7
@@
class FremantleRotation(object):
request, \
use_system_bus=True)
request, \
use_system_bus=True)
- def NO_on_topmost_changed(self, program, property_spec):
+ def _on_topmost_changed(self, program, property_spec):
# XXX: This seems to never get called on Fremantle(?)
if self._mode == self.AUTOMATIC:
if program.get_is_topmost():
# XXX: This seems to never get called on Fremantle(?)
if self._mode == self.AUTOMATIC:
if program.get_is_topmost():
@@
-140,6
+150,8
@@
class FremantleRotation(object):
self._orientation = orientation
self._orientation = orientation
+ self.on_orientation_changed(orientation)
+
def _get_keyboard_state(self):
# For sbox, if the device does not exist assume that it's closed
try:
def _get_keyboard_state(self):
# For sbox, if the device does not exist assume that it's closed
try:
@@
-165,6
+177,7
@@
class FremantleRotation(object):
self._keyboard_state_changed()
def _on_orientation_signal(self, orientation, stand, face, x, y, z):
self._keyboard_state_changed()
def _on_orientation_signal(self, orientation, stand, face, x, y, z):
+ print "orsignal"
if orientation in (self._PORTRAIT, self._LANDSCAPE):
if self._mode == self.AUTOMATIC and \
self._keyboard_state != self._KBD_OPEN:
if orientation in (self._PORTRAIT, self._LANDSCAPE):
if self._mode == self.AUTOMATIC and \
self._keyboard_state != self._KBD_OPEN:
diff --git
a/test.py
b/test.py
index
c674ed4
..
0dabe90
100755
(executable)
--- a/
test.py
+++ b/
test.py
@@
-116,7
+116,7
@@
class TestPlugin(HomePluginItem, Icons, FremantleRotation):
def __init__(self):
HomePluginItem.__init__(self)
Icons.__init__(self)
def __init__(self):
HomePluginItem.__init__(self)
Icons.__init__(self)
- FremantleRotation.__init__(self)
+ FremantleRotation.__init__(self, 'TestPlugin')
self.setMode('l')
self.setMode('l')
@@
-188,6
+188,9
@@
class TestPlugin(HomePluginItem, Icons, FremantleRotation):
def do_button_press_event(self, event):
print "press"
def do_button_press_event(self, event):
print "press"
+
+ def do_button_press_event_old(self, event):
+ print "press"
if event.type==gdk.BUTTON_PRESS:
print "press", event.type
if self.mode=='p':
if event.type==gdk.BUTTON_PRESS:
print "press", event.type
if self.mode=='p':
@@
-202,6
+205,9
@@
class TestPlugin(HomePluginItem, Icons, FremantleRotation):
def on_orientation_changed(self, orientation):
print "orch:", orientation
def on_orientation_changed(self, orientation):
print "orch:", orientation
+ o=orientation[0]
+ self.setMode(o)
+ self.queue_draw()
hd_plugin_type = TestPlugin
hd_plugin_type = TestPlugin