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'
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
"""
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, \
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():
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:
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:
def __init__(self):
HomePluginItem.__init__(self)
Icons.__init__(self)
- FremantleRotation.__init__(self)
+ FremantleRotation.__init__(self, 'TestPlugin')
self.setMode('l')
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':
def on_orientation_changed(self, orientation):
print "orch:", orientation
+ o=orientation[0]
+ self.setMode(o)
+ self.queue_draw()
hd_plugin_type = TestPlugin