![]() |
HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Hello!
Now that python-hildon has got support for portrait mode, I've added portrait mode support and auto-rotation to gPodder for Maemo 5, and in order to make my life easier, I've come up with a nice object that you can throw into your own code and that will take care of auto-rotation: http://repo.or.cz/w/gpodder.git?a=bl...tl/portrait.py The only thing you (might) need to do is to connect your windows to the configure-event signal and check the ratio of the width and height to determine if you need to relayout your window. For some windows (i.e. a window with just a treeview) you don't need to do anything :) Usage: Save the code as "portrait.py" or find some nice place in the module structure of you project, then use something like the following, and you're done: Code:
from portrait import FremantleAutoRotation |
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Screenshots please :p
|
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Good to hear that autorotation finally made it into python-hildon. No more need for setting XAtoms on the GdkWindow. :)
I like the idea of iterating through the whole window stack on rotation signal. This makes it really easy. |
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Heh, 3 months after N900 sales start, Nokia will think that nobody cares about rotation anymore. But the truth will be that everyone will be using community apps that do the same thing and that have auto-rotation built-in... :)
|
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Quote:
|
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Quote:
Tim |
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Quote:
|
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
I have updated the code to support forced-portrait and forced-landscape mode in addition to the auto-rotation mode (auto-rotation is still the default). You can now also pass your main window to the constructor which will be slightly more efficient than querying the HildonWindowStack for rotation (it still works without passing the main window if for any reason you cannot get a reference to it..). Usage:
Code:
main_window = .... # set this to your main window |
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
I'm trying to draw support for THIS BRAINSTORM IDEA about Nokia supporting Automatic Screen Rotation in the entire UI of Maemo 5/N900. Please give it a look and give me a hand. I thought since this thread mentioned rotation, maybe someone might be interested.
|
Re: HOWTO: Python auto-rotation (Portrait mode) on Maemo 5
Quote:
What's up with that? I'm confused. :confused: |
All times are GMT. The time now is 06:06. |
vBulletin® Version 3.8.8