View Single Post
Posts: 1,042 | Thanked: 430 times | Joined on May 2010
#19
Yes true. Here is the needed code for the script to rotate the whole UI
while True:
[x,y,z] = get_rotation()
print x,y,z
if y < -500:
rotate(1)
elif y > 500:
rotate(4)

elif x < -500:
rotate(2)
elif x > 500:
rotate(8)
And here is the loop which executes the script every second
time.sleep(1)
on that script it instructs that once the device reads that code it stops for 1 second(the lesser the time is the more accurate the rotation will be) and then start reading again the code from the start.
The key is for getting an alternative for that code that instead of looping the code every second to detect the device's position. My idea is either using QT to detect the device's auto rotation using this code
win.setAttribute(Qt::WA_Maemo5AutoOrientation, true);
and execute execute the python script whenever the app encounters that event. But thing is I don't know much about QT. LOL

Last edited by Radicalz38; 2010-06-01 at 15:29.
 

The Following 2 Users Say Thank You to Radicalz38 For This Useful Post: