Forum Archive

Patched get_keyboard_frame and convert_point

JonB

here is a subclassable RootView which aims to fix two bugs in the ui module, and add another missing feature.

  • convert_point that works in all presentation types and orientations. Existing ui module breaks in fullscreen, so this version fixes that.
  • get_keyboard_frame that works properly in all orientations. Existing ui modules version doesn't.
  • adds a get_orientation, to get screen orientation.

Running as a script shows an example, which displays convert point results for screen touches, and draws a box around the keyboard frame to show that keyboard frame is reportd correctly.
Undocking/splitting the keyboard (bottom right button on ios keyboard) shows that this works properly even for keyboards which have been undocked.

Note that, because this has to be implemented as a view in order for the orientation and keyboard frame to work, you need to call RootView.__init__(self) if subclassing. Also, there is one ui bug that I can't fix, which is that the keyboard frame sometimes reports incorrect values the first time it is shown. To fix that, see the example, which shows how to display, then hide the keyboard. After that, everything works swell.

ltddev

https://github.com/jsbain/uicomponents/blob/master/RootView.py link gives me a 404

JadedTuna

@JonB, seems like you have added another .py at the end

@ltddev, file is located here: https://github.com/jsbain/uicomponents/blob/master/RootView.py.py

JonB

Whoops. Original link is fixed now.