Kivy-examples 2.3.1.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (624) hide show
  1. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/main.py +77 -0
  2. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/monkey.obj +7966 -0
  3. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/objloader.py +147 -0
  4. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/simple.glsl +47 -0
  5. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/RST_Editor/editor.kv +72 -0
  6. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/RST_Editor/main.py +64 -0
  7. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/android.txt +3 -0
  8. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/compass.kv +25 -0
  9. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/main.py +77 -0
  10. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/needle.png +0 -0
  11. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/rose.png +0 -0
  12. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/android.txt +3 -0
  13. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/main.py +80 -0
  14. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/shadow32.png +0 -0
  15. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/takepicture.kv +40 -0
  16. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/animation/animate.py +42 -0
  17. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_suite.py +152 -0
  18. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_suite_data/testkvdir.kv +4 -0
  19. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_build.py +24 -0
  20. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_config.py +49 -0
  21. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_kv.py +25 -0
  22. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_kv_in_template1.py +27 -0
  23. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/template1/test.kv +4 -0
  24. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/test.kv +4 -0
  25. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/testkvfile.kv +4 -0
  26. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/asyncio_advanced.py +90 -0
  27. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/asyncio_basic.py +59 -0
  28. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/trio_advanced.py +93 -0
  29. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/trio_basic.py +58 -0
  30. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12908_sweet_trip_mm_clap_hi.wav +0 -0
  31. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12909_sweet_trip_mm_clap_lo.wav +0 -0
  32. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12910_sweet_trip_mm_clap_mid.wav +0 -0
  33. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12911_sweet_trip_mm_hat_cl.wav +0 -0
  34. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12913_sweet_trip_mm_kick_hi.wav +0 -0
  35. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12914_sweet_trip_mm_kick_lo.wav +0 -0
  36. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12915_sweet_trip_mm_kick_mid.wav +0 -0
  37. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12916_sweet_trip_mm_kwik_mod_01.wav +0 -0
  38. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12917_sweet_trip_mm_kwik_mod_02.wav +0 -0
  39. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12918_sweet_trip_mm_kwik_mod_03.wav +0 -0
  40. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12919_sweet_trip_mm_kwik_mod_04.wav +0 -0
  41. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12920_sweet_trip_mm_kwik_mod_05.wav +0 -0
  42. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12921_sweet_trip_mm_kwik_mod_06.wav +0 -0
  43. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12922_sweet_trip_mm_kwik_mod_07.wav +0 -0
  44. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12923_sweet_trip_mm_metal_clave.wav +0 -0
  45. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12925_sweet_trip_mm_sweep_x.wav +0 -0
  46. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12926_sweet_trip_mm_sweep_y.wav +0 -0
  47. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12927_sweet_trip_mm_sweep_z.wav +0 -0
  48. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/audio.kv +59 -0
  49. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/main.py +81 -0
  50. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/pitch.py +42 -0
  51. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/camera/main.py +59 -0
  52. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/bezier.py +105 -0
  53. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/canvas_stress.py +72 -0
  54. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/circle.py +84 -0
  55. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/fbo_canvas.py +91 -0
  56. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/kiwi.jpg +0 -0
  57. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/lines.py +296 -0
  58. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/lines_extended.py +183 -0
  59. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mesh.py +57 -0
  60. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mesh_manipulation.py +101 -0
  61. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mtexture1.png +0 -0
  62. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mtexture2.png +0 -0
  63. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/multitexture.py +110 -0
  64. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/repeat_texture.py +65 -0
  65. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/rotation.py +35 -0
  66. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/rounded_rectangle.py +153 -0
  67. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/scale.py +37 -0
  68. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/stencil_canvas.py +85 -0
  69. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/tesselate.py +146 -0
  70. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/texture.py +143 -0
  71. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/texture_example_image.png +0 -0
  72. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/1.kv +28 -0
  73. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/2.kv +28 -0
  74. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/3.kv +28 -0
  75. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/root.kv +32 -0
  76. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/main.py +63 -0
  77. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/cover/cover_image.py +25 -0
  78. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/cover/cover_video.py +31 -0
  79. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/camera_puzzle.py +98 -0
  80. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/AnchorLayoutContainer.kv +15 -0
  81. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/BoxLayoutContainer.kv +14 -0
  82. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/ButtonContainer.kv +27 -0
  83. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/CheckBoxContainer.kv +28 -0
  84. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/FileChooserContainer.kv +19 -0
  85. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/FloatLayoutContainer.kv +16 -0
  86. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/GridLayoutContainer.kv +20 -0
  87. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/LabelContainer.kv +62 -0
  88. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/MediaContainer.kv +9 -0
  89. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/PlaygroundContainer.kv +4 -0
  90. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/PopupContainer.kv +39 -0
  91. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/ProgressBarContainer.kv +17 -0
  92. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/RestContainer.kv +5 -0
  93. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/ScatterContainer.kv +16 -0
  94. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/SelectorsContainer.kv +10 -0
  95. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/StackLayoutContainer.kv +25 -0
  96. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/TextContainer.kv +20 -0
  97. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/kivycatalog.kv +144 -0
  98. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/main.py +192 -0
  99. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/gesturedatabase.kv +117 -0
  100. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/gesturedatabase.py +180 -0
  101. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/helpers.py +30 -0
  102. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/historymanager.kv +164 -0
  103. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/historymanager.py +276 -0
  104. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/main.py +144 -0
  105. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/multistroke.kv +101 -0
  106. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/settings.kv +110 -0
  107. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/settings.py +97 -0
  108. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/android.txt +3 -0
  109. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/Bubbles.jpg +0 -0
  110. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/Ill1.jpg +0 -0
  111. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/Wall.jpg +0 -0
  112. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/faust_github.jpg +0 -0
  113. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/main.py +73 -0
  114. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/pictures.kv +57 -0
  115. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/shadow32.png +0 -0
  116. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/shadereditor/main.py +147 -0
  117. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/shadereditor/shadereditor.kv +39 -0
  118. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/README.txt +11 -0
  119. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/android.txt +3 -0
  120. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/background.png +0 -0
  121. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/faust_github.jpg +0 -0
  122. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/README +4 -0
  123. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/bug.png +0 -0
  124. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/chevron-left.png +0 -0
  125. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/chevron-right.png +0 -0
  126. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/accordions.kv +39 -0
  127. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/bubbles.kv +33 -0
  128. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/buttons.kv +26 -0
  129. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/carousel.kv +51 -0
  130. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/checkboxes.kv +33 -0
  131. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/codeinput.kv +9 -0
  132. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/dropdown.kv +40 -0
  133. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/filechoosers.kv +24 -0
  134. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/popups.kv +17 -0
  135. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/progressbar.kv +15 -0
  136. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/rstdocument.kv +24 -0
  137. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/scatter.kv +14 -0
  138. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/screenmanager.kv +46 -0
  139. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/sliders.kv +55 -0
  140. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/spinner.kv +11 -0
  141. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/splitter.kv +13 -0
  142. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/switches.kv +39 -0
  143. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/tabbedpanel + layouts.kv +69 -0
  144. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/textinputs.kv +48 -0
  145. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/togglebutton.kv +39 -0
  146. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/main.py +243 -0
  147. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/showcase.kv +100 -0
  148. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/README.txt +12 -0
  149. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/android.txt +3 -0
  150. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/icon.png +0 -0
  151. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/main.py +170 -0
  152. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/particle.png +0 -0
  153. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/touchtracer.kv +29 -0
  154. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/frameworks/twisted/echo_client_app.py +82 -0
  155. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/frameworks/twisted/echo_server_app.py +49 -0
  156. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/frameworks/twisted/twistd_app.py +66 -0
  157. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/gestures/gesture_board.py +95 -0
  158. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/gestures/my_gestures.py +90 -0
  159. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/designwithkv/controller.kv +16 -0
  160. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/designwithkv/main.py +29 -0
  161. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/1_skeleton.py +15 -0
  162. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/2_print_touch.py +16 -0
  163. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/3_draw_ellipse.py +22 -0
  164. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/4_draw_line.py +26 -0
  165. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/5_random_colors.py +28 -0
  166. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/6_button.py +38 -0
  167. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/quickstart/main.py +15 -0
  168. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/button.kv +9 -0
  169. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/layout.kv +6 -0
  170. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/main.py +19 -0
  171. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/test.kv +5 -0
  172. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/keyboard/android.txt +3 -0
  173. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/keyboard/main.py +226 -0
  174. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/keyboard/numeric.json +38 -0
  175. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kinect/README.txt +13 -0
  176. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kinect/kinectviewer.py +283 -0
  177. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_button.kv +9 -0
  178. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_camera.kv +25 -0
  179. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_fbo.kv +11 -0
  180. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_layout.kv +23 -0
  181. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_logo.kv +36 -0
  182. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_scatter.kv +6 -0
  183. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_stencil.kv +27 -0
  184. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_video.kv +42 -0
  185. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/builder_template.py +28 -0
  186. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/id_in_kv/id_in_kv.py +20 -0
  187. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/id_in_kv/test.kv +11 -0
  188. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/kv_and_py/kv_and_py.py +34 -0
  189. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/kv_and_py/test.kv +11 -0
  190. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/kivy.jpg +0 -0
  191. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/kvrun.py +38 -0
  192. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/clipboard.py +63 -0
  193. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/custom_titlebar.py +56 -0
  194. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/imagesave.py +14 -0
  195. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/joystick.py +83 -0
  196. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/multiple_dropfile.py +51 -0
  197. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/on_textedit_event.py +104 -0
  198. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/opacitywindow.py +28 -0
  199. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/shapecollisions.py +397 -0
  200. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/shapedwindow.py +98 -0
  201. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/two_panes.py +47 -0
  202. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/urlrequest.py +128 -0
  203. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/settings/android.txt +3 -0
  204. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/settings/main.py +122 -0
  205. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/plasma.kv +9 -0
  206. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/plasma.py +86 -0
  207. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/rotated.kv +91 -0
  208. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/rotated.py +102 -0
  209. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/shadertree.kv +29 -0
  210. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/shadertree.py +193 -0
  211. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/tex3.jpg +0 -0
  212. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/benchmark.py +19 -0
  213. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/cloud.svg +25 -0
  214. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/main-smaa.py +155 -0
  215. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/main.py +50 -0
  216. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/music.svg +68 -0
  217. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/rotated.svg +23 -0
  218. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/ship.svg +181 -0
  219. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/sun.svg +35 -0
  220. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/tiger.svg +813 -0
  221. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/text/pango_demo.py +296 -0
  222. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/notes/final/data/icon.png +0 -0
  223. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/notes/final/main.py +163 -0
  224. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/notes/final/note.kv +154 -0
  225. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/main.py +82 -0
  226. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/pong.kv +53 -0
  227. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step1/main.py +15 -0
  228. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step1/pong.kv +2 -0
  229. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step2/main.py +15 -0
  230. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step2/pong.kv +21 -0
  231. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step3/main.py +26 -0
  232. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step3/pong.kv +31 -0
  233. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step4/main.py +48 -0
  234. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step4/pong.kv +34 -0
  235. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step5/main.py +75 -0
  236. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step5/pong.kv +53 -0
  237. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/accordion_1.py +17 -0
  238. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/actionbar.py +32 -0
  239. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/asyncimage.py +35 -0
  240. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/boxlayout_poshint.py +54 -0
  241. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/bubble_test.py +63 -0
  242. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/camera.py +33 -0
  243. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/carousel_buttons.py +50 -0
  244. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/cityCC0.mpg +0 -0
  245. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/cityCC0.png +0 -0
  246. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/codeinput.py +225 -0
  247. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/codeinputtest.kv +53 -0
  248. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/colorpicker.py +234 -0
  249. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/colorusage.py +62 -0
  250. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/compound_selection.py +83 -0
  251. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/customcollide.py +82 -0
  252. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/effectwidget.py +193 -0
  253. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/effectwidget2.py +47 -0
  254. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/effectwidget3_advanced.py +62 -0
  255. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/fbowidget.py +111 -0
  256. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/focus_behavior.py +98 -0
  257. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/image_mipmap.py +31 -0
  258. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/keyboardlistener.py +42 -0
  259. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_mipmap.py +28 -0
  260. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_sizing.py +193 -0
  261. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_text_size.py +49 -0
  262. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_with_markup.py +21 -0
  263. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/lang_dynamic_classes.py +18 -0
  264. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/pagelayout.py +64 -0
  265. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/popup_with_kv.py +35 -0
  266. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/basic_data.py +124 -0
  267. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/infinite_scrolling.py +143 -0
  268. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/key_viewclass.py +149 -0
  269. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/messenger.py +196 -0
  270. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/pull_to_refresh.py +95 -0
  271. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/rv_animate_items.py +109 -0
  272. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/rstexample.py +128 -0
  273. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scatter.kv +53 -0
  274. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scatter.py +16 -0
  275. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/screenmanager.py +106 -0
  276. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scrollview.kv +16 -0
  277. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scrollview.py +40 -0
  278. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/android.txt +3 -0
  279. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/bird.zip +0 -0
  280. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/button_white.png +0 -0
  281. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/button_white_animated.zip +0 -0
  282. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/cube.zip +0 -0
  283. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/info.png +0 -0
  284. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/info.zip +0 -0
  285. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/simple_cv_joint_animated.gif +0 -0
  286. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/main.kv +63 -0
  287. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/main.py +150 -0
  288. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/uix/__init__.py +7 -0
  289. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/uix/custom_button.py +98 -0
  290. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/settings.py +93 -0
  291. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/shorten_text.py +80 -0
  292. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/spinner.py +17 -0
  293. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/splitter.py +74 -0
  294. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/tabbed_panel_showcase.py +316 -0
  295. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/tabbedpanel.py +50 -0
  296. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/textalign.kv +49 -0
  297. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/textalign.py +48 -0
  298. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/textinput.py +59 -0
  299. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/unicode_textinput.py +244 -0
  300. Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/videoplayer.py +26 -0
  301. Kivy_examples-2.3.1.dev0.dist-info/AUTHORS +66 -0
  302. Kivy_examples-2.3.1.dev0.dist-info/LICENSE +21 -0
  303. Kivy_examples-2.3.1.dev0.dist-info/METADATA +382 -0
  304. Kivy_examples-2.3.1.dev0.dist-info/RECORD +624 -0
  305. Kivy_examples-2.3.1.dev0.dist-info/WHEEL +5 -0
  306. Kivy_examples-2.3.1.dev0.dist-info/dependency_links.txt +1 -0
  307. Kivy_examples-2.3.1.dev0.dist-info/top_level.txt +1 -0
  308. kivy/__init__.py +519 -0
  309. kivy/_version.py +18 -0
  310. kivy/animation.py +831 -0
  311. kivy/app.py +1213 -0
  312. kivy/atlas.py +456 -0
  313. kivy/base.py +617 -0
  314. kivy/cache.py +262 -0
  315. kivy/clock.py +1172 -0
  316. kivy/compat.py +82 -0
  317. kivy/config.py +1004 -0
  318. kivy/context.py +102 -0
  319. kivy/core/__init__.py +247 -0
  320. kivy/core/audio/__init__.py +223 -0
  321. kivy/core/audio/audio_android.py +104 -0
  322. kivy/core/audio/audio_avplayer.py +82 -0
  323. kivy/core/audio/audio_ffpyplayer.py +185 -0
  324. kivy/core/audio/audio_gstplayer.py +101 -0
  325. kivy/core/audio/audio_pygame.py +127 -0
  326. kivy/core/camera/__init__.py +151 -0
  327. kivy/core/camera/camera_android.py +206 -0
  328. kivy/core/camera/camera_gi.py +170 -0
  329. kivy/core/camera/camera_opencv.py +163 -0
  330. kivy/core/camera/camera_picamera.py +96 -0
  331. kivy/core/clipboard/__init__.py +157 -0
  332. kivy/core/clipboard/_clipboard_ext.py +36 -0
  333. kivy/core/clipboard/clipboard_android.py +91 -0
  334. kivy/core/clipboard/clipboard_dbusklipper.py +41 -0
  335. kivy/core/clipboard/clipboard_dummy.py +26 -0
  336. kivy/core/clipboard/clipboard_gtk3.py +47 -0
  337. kivy/core/clipboard/clipboard_nspaste.py +44 -0
  338. kivy/core/clipboard/clipboard_pygame.py +67 -0
  339. kivy/core/clipboard/clipboard_sdl2.py +36 -0
  340. kivy/core/clipboard/clipboard_winctypes.py +107 -0
  341. kivy/core/clipboard/clipboard_xclip.py +29 -0
  342. kivy/core/clipboard/clipboard_xsel.py +26 -0
  343. kivy/core/gl/__init__.py +90 -0
  344. kivy/core/image/__init__.py +996 -0
  345. kivy/core/image/img_dds.py +40 -0
  346. kivy/core/image/img_ffpyplayer.py +87 -0
  347. kivy/core/image/img_pil.py +123 -0
  348. kivy/core/image/img_pygame.py +119 -0
  349. kivy/core/image/img_sdl2.py +66 -0
  350. kivy/core/image/img_tex.py +58 -0
  351. kivy/core/spelling/__init__.py +135 -0
  352. kivy/core/spelling/spelling_enchant.py +50 -0
  353. kivy/core/spelling/spelling_osxappkit.py +64 -0
  354. kivy/core/text/__init__.py +1090 -0
  355. kivy/core/text/markup.py +893 -0
  356. kivy/core/text/text_pango.py +145 -0
  357. kivy/core/text/text_pil.py +84 -0
  358. kivy/core/text/text_pygame.py +117 -0
  359. kivy/core/text/text_sdl2.py +50 -0
  360. kivy/core/video/__init__.py +219 -0
  361. kivy/core/video/video_ffmpeg.py +106 -0
  362. kivy/core/video/video_ffpyplayer.py +449 -0
  363. kivy/core/video/video_gstplayer.py +140 -0
  364. kivy/core/video/video_null.py +12 -0
  365. kivy/core/window/__init__.py +2515 -0
  366. kivy/core/window/window_egl_rpi.py +86 -0
  367. kivy/core/window/window_pygame.py +441 -0
  368. kivy/core/window/window_sdl2.py +999 -0
  369. kivy/deps/__init__.py +6 -0
  370. kivy/effects/__init__.py +23 -0
  371. kivy/effects/dampedscroll.py +114 -0
  372. kivy/effects/kinetic.py +193 -0
  373. kivy/effects/opacityscroll.py +27 -0
  374. kivy/effects/scroll.py +126 -0
  375. kivy/event.py +12 -0
  376. kivy/eventmanager/__init__.py +185 -0
  377. kivy/extras/__init__.py +0 -0
  378. kivy/extras/highlight.py +52 -0
  379. kivy/factory.py +190 -0
  380. kivy/factory_registers.py +201 -0
  381. kivy/garden/__init__.py +186 -0
  382. kivy/geometry.py +121 -0
  383. kivy/gesture.py +424 -0
  384. kivy/graphics/__init__.py +126 -0
  385. kivy/graphics/cgl_backend/__init__.py +0 -0
  386. kivy/input/__init__.py +39 -0
  387. kivy/input/factory.py +35 -0
  388. kivy/input/motionevent.py +587 -0
  389. kivy/input/postproc/__init__.py +27 -0
  390. kivy/input/postproc/calibration.py +200 -0
  391. kivy/input/postproc/dejitter.py +74 -0
  392. kivy/input/postproc/doubletap.py +101 -0
  393. kivy/input/postproc/ignorelist.py +47 -0
  394. kivy/input/postproc/retaintouch.py +93 -0
  395. kivy/input/postproc/tripletap.py +106 -0
  396. kivy/input/provider.py +40 -0
  397. kivy/input/providers/__init__.py +68 -0
  398. kivy/input/providers/androidjoystick.py +117 -0
  399. kivy/input/providers/hidinput.py +778 -0
  400. kivy/input/providers/leapfinger.py +113 -0
  401. kivy/input/providers/linuxwacom.py +396 -0
  402. kivy/input/providers/mactouch.py +220 -0
  403. kivy/input/providers/mouse.py +424 -0
  404. kivy/input/providers/mtdev.py +380 -0
  405. kivy/input/providers/probesysfs.py +254 -0
  406. kivy/input/providers/tuio.py +326 -0
  407. kivy/input/providers/wm_common.py +162 -0
  408. kivy/input/providers/wm_pen.py +121 -0
  409. kivy/input/providers/wm_touch.py +157 -0
  410. kivy/input/recorder.py +335 -0
  411. kivy/input/shape.py +27 -0
  412. kivy/interactive.py +335 -0
  413. kivy/lang/__init__.py +883 -0
  414. kivy/lang/builder.py +1004 -0
  415. kivy/lang/parser.py +822 -0
  416. kivy/lib/__init__.py +21 -0
  417. kivy/lib/ddsfile.py +419 -0
  418. kivy/lib/gstplayer/__init__.py +27 -0
  419. kivy/lib/mtdev.py +254 -0
  420. kivy/lib/vidcore_lite/__init__.py +0 -0
  421. kivy/loader.py +579 -0
  422. kivy/logger.py +646 -0
  423. kivy/metrics.py +421 -0
  424. kivy/modules/__init__.py +300 -0
  425. kivy/modules/_webdebugger.py +200 -0
  426. kivy/modules/console.py +1059 -0
  427. kivy/modules/cursor.py +75 -0
  428. kivy/modules/inspector.py +755 -0
  429. kivy/modules/joycursor.py +299 -0
  430. kivy/modules/keybinding.py +64 -0
  431. kivy/modules/monitor.py +90 -0
  432. kivy/modules/recorder.py +94 -0
  433. kivy/modules/screen.py +183 -0
  434. kivy/modules/showborder.py +33 -0
  435. kivy/modules/touchring.py +97 -0
  436. kivy/modules/webdebugger.py +30 -0
  437. kivy/multistroke.py +1477 -0
  438. kivy/network/__init__.py +7 -0
  439. kivy/network/urlrequest.py +794 -0
  440. kivy/parser.py +154 -0
  441. kivy/resources.py +102 -0
  442. kivy/storage/__init__.py +405 -0
  443. kivy/storage/dictstore.py +98 -0
  444. kivy/storage/jsonstore.py +92 -0
  445. kivy/storage/redisstore.py +103 -0
  446. kivy/support.py +267 -0
  447. kivy/tests/__init__.py +11 -0
  448. kivy/tests/async_common.py +568 -0
  449. kivy/tests/common.py +524 -0
  450. kivy/tests/conftest.py +33 -0
  451. kivy/tests/fixtures.py +169 -0
  452. kivy/tests/perf_test_textinput.py +195 -0
  453. kivy/tests/pyinstaller/simple_widget/main.py +12 -0
  454. kivy/tests/pyinstaller/simple_widget/project/__init__.py +0 -0
  455. kivy/tests/pyinstaller/simple_widget/project/widget.py +12 -0
  456. kivy/tests/pyinstaller/test_pyinstaller.py +115 -0
  457. kivy/tests/pyinstaller/video_widget/main.py +6 -0
  458. kivy/tests/pyinstaller/video_widget/project/__init__.py +38 -0
  459. kivy/tests/test_animations.py +415 -0
  460. kivy/tests/test_app.py +216 -0
  461. kivy/tests/test_audio.py +69 -0
  462. kivy/tests/test_benchmark.py +292 -0
  463. kivy/tests/test_clipboard.py +48 -0
  464. kivy/tests/test_clock.py +292 -0
  465. kivy/tests/test_compat.py +6 -0
  466. kivy/tests/test_config.py +35 -0
  467. kivy/tests/test_coverage.py +83 -0
  468. kivy/tests/test_doc_gallery.py +38 -0
  469. kivy/tests/test_environ_cli.py +50 -0
  470. kivy/tests/test_fbo_py2py3.py +74 -0
  471. kivy/tests/test_filechooser.py +11 -0
  472. kivy/tests/test_filechooser_unicode.py +82 -0
  473. kivy/tests/test_fonts.py +42 -0
  474. kivy/tests/test_garden.py +23 -0
  475. kivy/tests/test_graphics.py +1149 -0
  476. kivy/tests/test_graphics_svg.py +84 -0
  477. kivy/tests/test_image.py +74 -0
  478. kivy/tests/test_imageloader.py +485 -0
  479. kivy/tests/test_invalid_lang.py +42 -0
  480. kivy/tests/test_issues/test_6315.py +55 -0
  481. kivy/tests/test_issues/test_issue_1084.py +47 -0
  482. kivy/tests/test_issues/test_issue_1091.py +19 -0
  483. kivy/tests/test_issues/test_issue_599.py +21 -0
  484. kivy/tests/test_issues/test_issue_609.py +19 -0
  485. kivy/tests/test_issues/test_issue_6909.py +28 -0
  486. kivy/tests/test_issues/test_issue_883.py +12 -0
  487. kivy/tests/test_kivy_init.py +30 -0
  488. kivy/tests/test_knspace.py +247 -0
  489. kivy/tests/test_lang.py +431 -0
  490. kivy/tests/test_lang_complex.py +87 -0
  491. kivy/tests/test_lang_pre_process_and_post_process.py +394 -0
  492. kivy/tests/test_logger.py +516 -0
  493. kivy/tests/test_metrics.py +30 -0
  494. kivy/tests/test_module_inspector.py +382 -0
  495. kivy/tests/test_motion_event.py +44 -0
  496. kivy/tests/test_mouse_hover_event.py +249 -0
  497. kivy/tests/test_mouse_multitouchsim.py +554 -0
  498. kivy/tests/test_multistroke.py +389 -0
  499. kivy/tests/test_properties.py +1332 -0
  500. kivy/tests/test_resources.py +79 -0
  501. kivy/tests/test_rst_replace.py +63 -0
  502. kivy/tests/test_screen.py +38 -0
  503. kivy/tests/test_storage.py +135 -0
  504. kivy/tests/test_uix_actionbar.py +363 -0
  505. kivy/tests/test_uix_anchorlayout.py +79 -0
  506. kivy/tests/test_uix_asyncimage.py +133 -0
  507. kivy/tests/test_uix_boxlayout.py +94 -0
  508. kivy/tests/test_uix_bubble.py +425 -0
  509. kivy/tests/test_uix_carousel.py +93 -0
  510. kivy/tests/test_uix_colorpicker.py +77 -0
  511. kivy/tests/test_uix_dropdown.py +91 -0
  512. kivy/tests/test_uix_gridlayout.py +244 -0
  513. kivy/tests/test_uix_layout.py +16 -0
  514. kivy/tests/test_uix_modal.py +101 -0
  515. kivy/tests/test_uix_recyclegridlayout.py +383 -0
  516. kivy/tests/test_uix_relativelayout.py +30 -0
  517. kivy/tests/test_uix_scrollview.py +358 -0
  518. kivy/tests/test_uix_settings.py +33 -0
  519. kivy/tests/test_uix_slider.py +156 -0
  520. kivy/tests/test_uix_stacklayout.py +120 -0
  521. kivy/tests/test_uix_textinput.py +577 -0
  522. kivy/tests/test_uix_translate_coordinates.py +72 -0
  523. kivy/tests/test_uix_videoplayer.py +112 -0
  524. kivy/tests/test_uix_widget.py +137 -0
  525. kivy/tests/test_urlrequest/test_urlrequest_requests.py +378 -0
  526. kivy/tests/test_urlrequest/test_urlrequest_urllib.py +155 -0
  527. kivy/tests/test_utils.py +237 -0
  528. kivy/tests/test_vector.py +256 -0
  529. kivy/tests/test_video.py +25 -0
  530. kivy/tests/test_weakmethod.py +44 -0
  531. kivy/tests/test_widget.py +127 -0
  532. kivy/tests/test_widget_walk.py +70 -0
  533. kivy/tests/test_window_base.py +60 -0
  534. kivy/tests/test_window_info.py +29 -0
  535. kivy/tests/visual_test_label.py +291 -0
  536. kivy/tools/__init__.py +44 -0
  537. kivy/tools/benchmark.py +286 -0
  538. kivy/tools/changelog_parser.py +120 -0
  539. kivy/tools/coverage.py +135 -0
  540. kivy/tools/gallery.py +323 -0
  541. kivy/tools/generate-icons.py +117 -0
  542. kivy/tools/gles_compat/subset_gles.py +125 -0
  543. kivy/tools/highlight/__init__.py +9 -0
  544. kivy/tools/kviewer.py +80 -0
  545. kivy/tools/packaging/__init__.py +12 -0
  546. kivy/tools/packaging/cython_cfg.py +82 -0
  547. kivy/tools/packaging/factory.py +105 -0
  548. kivy/tools/packaging/pyinstaller_hooks/__init__.py +381 -0
  549. kivy/tools/packaging/pyinstaller_hooks/__main__.py +29 -0
  550. kivy/tools/packaging/pyinstaller_hooks/hook-kivy.py +9 -0
  551. kivy/tools/packaging/pyinstaller_hooks/pyi_rth_kivy.py +17 -0
  552. kivy/tools/pep8checker/pep8.py +2316 -0
  553. kivy/tools/pep8checker/pep8kivy.py +109 -0
  554. kivy/tools/report.py +223 -0
  555. kivy/tools/stub-gl-debug.py +201 -0
  556. kivy/tools/texturecompress.py +233 -0
  557. kivy/uix/__init__.py +56 -0
  558. kivy/uix/accordion.py +484 -0
  559. kivy/uix/actionbar.py +934 -0
  560. kivy/uix/anchorlayout.py +122 -0
  561. kivy/uix/behaviors/__init__.py +95 -0
  562. kivy/uix/behaviors/button.py +212 -0
  563. kivy/uix/behaviors/codenavigation.py +167 -0
  564. kivy/uix/behaviors/compoundselection.py +688 -0
  565. kivy/uix/behaviors/cover.py +160 -0
  566. kivy/uix/behaviors/drag.py +234 -0
  567. kivy/uix/behaviors/emacs.py +140 -0
  568. kivy/uix/behaviors/focus.py +595 -0
  569. kivy/uix/behaviors/knspace.py +590 -0
  570. kivy/uix/behaviors/togglebutton.py +156 -0
  571. kivy/uix/behaviors/touchripple.py +318 -0
  572. kivy/uix/boxlayout.py +331 -0
  573. kivy/uix/bubble.py +576 -0
  574. kivy/uix/button.py +137 -0
  575. kivy/uix/camera.py +118 -0
  576. kivy/uix/carousel.py +695 -0
  577. kivy/uix/checkbox.py +197 -0
  578. kivy/uix/codeinput.py +238 -0
  579. kivy/uix/colorpicker.py +486 -0
  580. kivy/uix/dropdown.py +391 -0
  581. kivy/uix/effectwidget.py +772 -0
  582. kivy/uix/filechooser.py +1134 -0
  583. kivy/uix/floatlayout.py +148 -0
  584. kivy/uix/gesturesurface.py +625 -0
  585. kivy/uix/gridlayout.py +629 -0
  586. kivy/uix/image.py +528 -0
  587. kivy/uix/label.py +1200 -0
  588. kivy/uix/layout.py +322 -0
  589. kivy/uix/modalview.py +339 -0
  590. kivy/uix/pagelayout.py +233 -0
  591. kivy/uix/popup.py +266 -0
  592. kivy/uix/progressbar.py +95 -0
  593. kivy/uix/recycleboxlayout.py +183 -0
  594. kivy/uix/recyclegridlayout.py +255 -0
  595. kivy/uix/recyclelayout.py +446 -0
  596. kivy/uix/recycleview/__init__.py +624 -0
  597. kivy/uix/recycleview/datamodel.py +194 -0
  598. kivy/uix/recycleview/layout.py +253 -0
  599. kivy/uix/recycleview/views.py +423 -0
  600. kivy/uix/relativelayout.py +324 -0
  601. kivy/uix/rst.py +1492 -0
  602. kivy/uix/sandbox.py +198 -0
  603. kivy/uix/scatter.py +645 -0
  604. kivy/uix/scatterlayout.py +93 -0
  605. kivy/uix/screenmanager.py +1275 -0
  606. kivy/uix/scrollview.py +1288 -0
  607. kivy/uix/settings.py +1343 -0
  608. kivy/uix/slider.py +421 -0
  609. kivy/uix/spinner.py +221 -0
  610. kivy/uix/splitter.py +430 -0
  611. kivy/uix/stacklayout.py +331 -0
  612. kivy/uix/stencilview.py +40 -0
  613. kivy/uix/switch.py +122 -0
  614. kivy/uix/tabbedpanel.py +880 -0
  615. kivy/uix/textinput.py +4049 -0
  616. kivy/uix/togglebutton.py +37 -0
  617. kivy/uix/treeview.py +665 -0
  618. kivy/uix/video.py +302 -0
  619. kivy/uix/videoplayer.py +697 -0
  620. kivy/uix/vkeyboard.py +879 -0
  621. kivy/uix/widget.py +1629 -0
  622. kivy/utils.py +550 -0
  623. kivy/vector.py +412 -0
  624. kivy/weakmethod.py +72 -0
@@ -0,0 +1,2515 @@
1
+ # pylint: disable=W0611
2
+ # coding: utf-8
3
+ '''
4
+ Window
5
+ ======
6
+
7
+ Core class for creating the default Kivy window. Kivy supports only one window
8
+ per application: please don't try to create more than one.
9
+ '''
10
+
11
+ __all__ = ('Keyboard', 'WindowBase', 'Window')
12
+
13
+ from os.path import join, exists
14
+ from os import getcwd
15
+ from collections import defaultdict
16
+
17
+ from kivy.core import core_select_lib
18
+ from kivy.clock import Clock
19
+ from kivy.config import Config
20
+ from kivy.logger import Logger
21
+ from kivy.base import EventLoop, stopTouchApp
22
+ from kivy.modules import Modules
23
+ from kivy.event import EventDispatcher
24
+ from kivy.properties import ListProperty, ObjectProperty, AliasProperty, \
25
+ NumericProperty, OptionProperty, StringProperty, BooleanProperty, \
26
+ ColorProperty
27
+ from kivy.utils import platform, reify, deprecated, pi_version
28
+ from kivy.context import get_current_context
29
+ from kivy.uix.behaviors import FocusBehavior
30
+ from kivy.setupconfig import USE_SDL2
31
+ from kivy.graphics.transformation import Matrix
32
+ from kivy.graphics.cgl import cgl_get_backend_name
33
+
34
+ # late import
35
+ VKeyboard = None
36
+ android = None
37
+ Animation = None
38
+
39
+
40
+ class Keyboard(EventDispatcher):
41
+ '''Keyboard interface that is returned by
42
+ :meth:`WindowBase.request_keyboard`. When you request a keyboard,
43
+ you'll get an instance of this class. Whatever the keyboard input is
44
+ (system or virtual keyboard), you'll receive events through this
45
+ instance.
46
+
47
+ :Events:
48
+ `on_key_down`: keycode, text, modifiers
49
+ Fired when a new key is pressed down
50
+ `on_key_up`: keycode
51
+ Fired when a key is released (up)
52
+
53
+ Here is an example of how to request a Keyboard in accordance with the
54
+ current configuration:
55
+
56
+ .. include:: ../../examples/widgets/keyboardlistener.py
57
+ :literal:
58
+
59
+ '''
60
+
61
+ # Keycodes mapping, between str <-> int. These keycodes are
62
+ # currently taken from pygame.key. But when a new provider will be
63
+ # used, it must do the translation to these keycodes too.
64
+ keycodes = {
65
+ # specials keys
66
+ 'backspace': 8, 'tab': 9, 'enter': 13, 'rshift': 303, 'shift': 304,
67
+ 'alt': 308, 'rctrl': 306, 'lctrl': 305,
68
+ 'super': 309, 'alt-gr': 307, 'compose': 311, 'pipe': 310,
69
+ 'capslock': 301, 'escape': 27, 'spacebar': 32, 'pageup': 280,
70
+ 'pagedown': 281, 'end': 279, 'home': 278, 'left': 276, 'up':
71
+ 273, 'right': 275, 'down': 274, 'insert': 277, 'delete': 127,
72
+ 'numlock': 300, 'print': 144, 'screenlock': 145, 'pause': 19,
73
+
74
+ # a-z keys
75
+ 'a': 97, 'b': 98, 'c': 99, 'd': 100, 'e': 101, 'f': 102, 'g': 103,
76
+ 'h': 104, 'i': 105, 'j': 106, 'k': 107, 'l': 108, 'm': 109, 'n': 110,
77
+ 'o': 111, 'p': 112, 'q': 113, 'r': 114, 's': 115, 't': 116, 'u': 117,
78
+ 'v': 118, 'w': 119, 'x': 120, 'y': 121, 'z': 122,
79
+
80
+ # 0-9 keys
81
+ '0': 48, '1': 49, '2': 50, '3': 51, '4': 52,
82
+ '5': 53, '6': 54, '7': 55, '8': 56, '9': 57,
83
+
84
+ # numpad
85
+ 'numpad0': 256, 'numpad1': 257, 'numpad2': 258, 'numpad3': 259,
86
+ 'numpad4': 260, 'numpad5': 261, 'numpad6': 262, 'numpad7': 263,
87
+ 'numpad8': 264, 'numpad9': 265, 'numpaddecimal': 266,
88
+ 'numpaddivide': 267, 'numpadmul': 268, 'numpadsubstract': 269,
89
+ 'numpadadd': 270, 'numpadenter': 271,
90
+
91
+ # F1-15
92
+ 'f1': 282, 'f2': 283, 'f3': 284, 'f4': 285, 'f5': 286, 'f6': 287,
93
+ 'f7': 288, 'f8': 289, 'f9': 290, 'f10': 291, 'f11': 292, 'f12': 293,
94
+ 'f13': 294, 'f14': 295, 'f15': 296,
95
+
96
+ # other keys
97
+ '(': 40, ')': 41,
98
+ '[': 91, ']': 93,
99
+ '{': 123, '}': 125,
100
+ ':': 58, ';': 59,
101
+ '=': 61, '+': 43,
102
+ '-': 45, '_': 95,
103
+ '/': 47, '*': 42,
104
+ '?': 47,
105
+ '`': 96, '~': 126,
106
+ '´': 180, '¦': 166,
107
+ '\\': 92, '|': 124,
108
+ '"': 34, "'": 39,
109
+ ',': 44, '.': 46,
110
+ '<': 60, '>': 62,
111
+ '@': 64, '!': 33,
112
+ '#': 35, '$': 36,
113
+ '%': 37, '^': 94,
114
+ '&': 38, '¬': 172,
115
+ '¨': 168, '…': 8230,
116
+ 'ù': 249, 'à': 224,
117
+ 'é': 233, 'è': 232,
118
+ }
119
+
120
+ __events__ = ('on_key_down', 'on_key_up', 'on_textinput')
121
+
122
+ def __init__(self, **kwargs):
123
+ super(Keyboard, self).__init__()
124
+
125
+ #: Window which the keyboard is attached too
126
+ self.window = kwargs.get('window', None)
127
+
128
+ #: Callback that will be called when the keyboard is released
129
+ self.callback = kwargs.get('callback', None)
130
+
131
+ #: Target that have requested the keyboard
132
+ self.target = kwargs.get('target', None)
133
+
134
+ #: VKeyboard widget, if allowed by the configuration
135
+ self.widget = kwargs.get('widget', None)
136
+
137
+ def on_key_down(self, keycode, text, modifiers):
138
+ pass
139
+
140
+ def on_key_up(self, keycode):
141
+ pass
142
+
143
+ def on_textinput(self, text):
144
+ pass
145
+
146
+ def release(self):
147
+ '''Call this method to release the current keyboard.
148
+ This will ensure that the keyboard is no longer attached to your
149
+ callback.'''
150
+ if self.window:
151
+ self.window.release_keyboard(self.target)
152
+ self.target = None
153
+
154
+ def _on_window_textinput(self, instance, text):
155
+ return self.dispatch('on_textinput', text)
156
+
157
+ def _on_window_key_down(self, instance, keycode, scancode, text,
158
+ modifiers):
159
+ keycode = (keycode, self.keycode_to_string(keycode))
160
+ if text == '\x04':
161
+ Window.trigger_keyboard_height()
162
+ return
163
+ return self.dispatch('on_key_down', keycode, text, modifiers)
164
+
165
+ def _on_window_key_up(self, instance, keycode, *largs):
166
+ keycode = (keycode, self.keycode_to_string(keycode))
167
+ return self.dispatch('on_key_up', keycode)
168
+
169
+ def _on_vkeyboard_key_down(self, instance, keycode, text, modifiers):
170
+ if keycode is None:
171
+ keycode = text.lower()
172
+ keycode = (self.string_to_keycode(keycode), keycode)
173
+ return self.dispatch('on_key_down', keycode, text, modifiers)
174
+
175
+ def _on_vkeyboard_key_up(self, instance, keycode, text, modifiers):
176
+ if keycode is None:
177
+ keycode = text
178
+ keycode = (self.string_to_keycode(keycode), keycode)
179
+ return self.dispatch('on_key_up', keycode)
180
+
181
+ def _on_vkeyboard_textinput(self, instance, text):
182
+ return self.dispatch('on_textinput', text)
183
+
184
+ def string_to_keycode(self, value):
185
+ '''Convert a string to a keycode number according to the
186
+ :attr:`Keyboard.keycodes`. If the value is not found in the
187
+ keycodes, it will return -1.
188
+ '''
189
+ return Keyboard.keycodes.get(value, -1)
190
+
191
+ def keycode_to_string(self, value):
192
+ '''Convert a keycode number to a string according to the
193
+ :attr:`Keyboard.keycodes`. If the value is not found in the
194
+ keycodes, it will return ''.
195
+ '''
196
+ keycodes = list(Keyboard.keycodes.values())
197
+ if value in keycodes:
198
+ return list(Keyboard.keycodes.keys())[keycodes.index(value)]
199
+ return ''
200
+
201
+
202
+ class WindowBase(EventDispatcher):
203
+ '''WindowBase is an abstract window widget for any window implementation.
204
+
205
+ :Parameters:
206
+ `borderless`: str, one of ('0', '1')
207
+ Set the window border state. Check the
208
+ :mod:`~kivy.config` documentation for a
209
+ more detailed explanation on the values.
210
+ `custom_titlebar`: str, one of ('0', '1')
211
+ Set to `'1'` to uses a custom titlebar
212
+ `fullscreen`: str, one of ('0', '1', 'auto', 'fake')
213
+ Make the window fullscreen. Check the
214
+ :mod:`~kivy.config` documentation for a
215
+ more detailed explanation on the values.
216
+ `width`: int
217
+ Width of the window.
218
+ `height`: int
219
+ Height of the window.
220
+ `minimum_width`: int
221
+ Minimum width of the window (only works for sdl2 window provider).
222
+ `minimum_height`: int
223
+ Minimum height of the window (only works for sdl2 window provider).
224
+ `always_on_top`: bool
225
+ When enabled, the window will be brought to the front and will keep
226
+ the window above the rest. If disabled, it will restore the default
227
+ behavior. Only works for the sdl2 window provider.
228
+ `allow_screensaver`: bool
229
+ Allow the device to show a screen saver, or to go to sleep
230
+ on mobile devices. Defaults to True. Only works for sdl2 window
231
+ provider.
232
+
233
+ :Events:
234
+ `on_motion`: etype, motionevent
235
+ Fired when a new :class:`~kivy.input.motionevent.MotionEvent` is
236
+ dispatched
237
+ `on_touch_down`:
238
+ Fired when a new touch event is initiated.
239
+ `on_touch_move`:
240
+ Fired when an existing touch event changes location.
241
+ `on_touch_up`:
242
+ Fired when an existing touch event is terminated.
243
+ `on_draw`:
244
+ Fired when the :class:`Window` is being drawn.
245
+ `on_flip`:
246
+ Fired when the :class:`Window` GL surface is being flipped.
247
+ `on_rotate`: rotation
248
+ Fired when the :class:`Window` is being rotated.
249
+ `on_close`:
250
+ Fired when the :class:`Window` is closed.
251
+ `on_request_close`:
252
+ Fired when the event loop wants to close the window, or if the
253
+ escape key is pressed and `exit_on_escape` is `True`. If a function
254
+ bound to this event returns `True`, the window will not be closed.
255
+ If the event is triggered because of the keyboard escape key,
256
+ the keyword argument `source` is dispatched along with a value of
257
+ `keyboard` to the bound functions.
258
+
259
+ .. versionadded:: 1.9.0
260
+
261
+ `on_cursor_enter`:
262
+ Fired when the cursor enters the window.
263
+
264
+ .. versionadded:: 1.9.1
265
+
266
+ `on_cursor_leave`:
267
+ Fired when the cursor leaves the window.
268
+
269
+ .. versionadded:: 1.9.1
270
+
271
+ `on_minimize`:
272
+ Fired when the window is minimized.
273
+
274
+ .. versionadded:: 1.10.0
275
+
276
+ `on_maximize`:
277
+ Fired when the window is maximized.
278
+
279
+ .. versionadded:: 1.10.0
280
+
281
+ `on_restore`:
282
+ Fired when the window is restored.
283
+
284
+ .. versionadded:: 1.10.0
285
+
286
+ `on_hide`:
287
+ Fired when the window is hidden.
288
+
289
+ .. versionadded:: 1.10.0
290
+
291
+ `on_show`:
292
+ Fired when the window is shown.
293
+
294
+ .. versionadded:: 1.10.0
295
+
296
+ `on_keyboard`: key, scancode, codepoint, modifier
297
+ Fired when the keyboard is used for input.
298
+
299
+ .. versionchanged:: 1.3.0
300
+ The *unicode* parameter has been deprecated in favor of
301
+ codepoint, and will be removed completely in future versions.
302
+
303
+ `on_key_down`: key, scancode, codepoint, modifier
304
+ Fired when a key pressed.
305
+
306
+ .. versionchanged:: 1.3.0
307
+ The *unicode* parameter has been deprecated in favor of
308
+ codepoint, and will be removed completely in future versions.
309
+
310
+ `on_key_up`: key, scancode, codepoint
311
+ Fired when a key is released.
312
+
313
+ .. versionchanged:: 1.3.0
314
+ The *unicode* parameter has be deprecated in favor of
315
+ codepoint, and will be removed completely in future versions.
316
+
317
+ `on_drop_begin`: x, y, *args
318
+ Fired when text(s) or file(s) drop on the application is about to
319
+ begin.
320
+
321
+ .. versionadded:: 2.1.0
322
+
323
+ `on_drop_file`: filename (bytes), x, y, *args
324
+ Fired when a file is dropped on the application.
325
+
326
+ .. versionadded:: 1.2.0
327
+
328
+ .. versionchanged:: 2.1.0
329
+ Renamed from `on_dropfile` to `on_drop_file`.
330
+
331
+ `on_drop_text`: text (bytes), x, y, *args
332
+ Fired when a text is dropped on the application.
333
+
334
+ .. versionadded:: 2.1.0
335
+
336
+ `on_drop_end`: x, y, *args
337
+ Fired when text(s) or file(s) drop on the application has ended.
338
+
339
+ .. versionadded:: 2.1.0
340
+
341
+ `on_memorywarning`:
342
+ Fired when the platform have memory issue (iOS / Android mostly)
343
+ You can listen to this one, and clean whatever you can.
344
+
345
+ .. versionadded:: 1.9.0
346
+
347
+ `on_textedit(self, text)`:
348
+ Fired when inputting with IME.
349
+ The string inputting with IME is set as the parameter of
350
+ this event.
351
+
352
+ .. versionadded:: 1.10.1
353
+ '''
354
+
355
+ __instance = None
356
+ __initialized = False
357
+ _fake_fullscreen = False
358
+
359
+ # private properties
360
+ _density = NumericProperty(1.)
361
+ _size = ListProperty([0, 0])
362
+ _modifiers = ListProperty([])
363
+ _rotation = NumericProperty(0)
364
+ _focus = BooleanProperty(True)
365
+
366
+ gl_backends_allowed = []
367
+ """
368
+ A list of Kivy gl backend names, which if not empty, will be the
369
+ exclusive list of gl backends that can be used with this window.
370
+ """
371
+
372
+ gl_backends_ignored = []
373
+ """
374
+ A list of Kivy gl backend names that may not be used with this window.
375
+ """
376
+
377
+ managed_textinput = False
378
+ """
379
+ True if this Window class uses `on_textinput` to insert text, internal.
380
+ """
381
+
382
+ children = ListProperty([])
383
+ '''List of the children of this window.
384
+
385
+ :attr:`children` is a :class:`~kivy.properties.ListProperty` instance and
386
+ defaults to an empty list.
387
+
388
+ Use :meth:`add_widget` and :meth:`remove_widget` to manipulate the list of
389
+ children. Don't manipulate the list directly unless you know what you are
390
+ doing.
391
+ '''
392
+
393
+ parent = ObjectProperty(None, allownone=True)
394
+ '''Parent of this window.
395
+
396
+ :attr:`parent` is a :class:`~kivy.properties.ObjectProperty` instance and
397
+ defaults to None. When created, the parent is set to the window itself.
398
+ You must take care of it if you are doing a recursive check.
399
+ '''
400
+
401
+ icon = StringProperty()
402
+ '''A path to the window icon.
403
+
404
+ .. versionadded:: 1.1.2
405
+
406
+ :attr:`icon` is a :class:`~kivy.properties.StringProperty`.
407
+ '''
408
+
409
+ def _get_modifiers(self):
410
+ return self._modifiers
411
+
412
+ modifiers = AliasProperty(_get_modifiers, None, bind=('_modifiers',))
413
+ '''List of keyboard modifiers currently active.
414
+
415
+ .. versionadded:: 1.0.9
416
+
417
+ :attr:`modifiers` is an :class:`~kivy.properties.AliasProperty`.
418
+ '''
419
+
420
+ def _get_size(self):
421
+ r = self._rotation
422
+ w, h = self._size
423
+ if platform == 'win' or self._density != 1:
424
+ w, h = self._win._get_gl_size()
425
+ if self.softinput_mode == 'resize':
426
+ h -= self.keyboard_height
427
+ if r in (0, 180):
428
+ return w, h
429
+ return h, w
430
+
431
+ def _set_size(self, size):
432
+ if self._size != size:
433
+ r = self._rotation
434
+ if r in (0, 180):
435
+ self._size = size
436
+ else:
437
+ self._size = size[1], size[0]
438
+ self.dispatch('on_pre_resize', *size)
439
+
440
+ minimum_width = NumericProperty(0)
441
+ '''The minimum width to restrict the window to.
442
+
443
+ .. versionadded:: 1.9.1
444
+
445
+ :attr:`minimum_width` is a :class:`~kivy.properties.NumericProperty` and
446
+ defaults to 0.
447
+ '''
448
+
449
+ minimum_height = NumericProperty(0)
450
+ '''The minimum height to restrict the window to.
451
+
452
+ .. versionadded:: 1.9.1
453
+
454
+ :attr:`minimum_height` is a :class:`~kivy.properties.NumericProperty` and
455
+ defaults to 0.
456
+ '''
457
+
458
+ always_on_top = BooleanProperty(False)
459
+ '''When enabled, the window will be brought to the front and will keep
460
+ the window above the rest. If disabled, it will restore the default
461
+ behavior.
462
+
463
+ This option can be toggled freely during the window's lifecycle.
464
+
465
+ Only works for the sdl2 window provider. Check the :mod:`~kivy.config`
466
+ documentation for a more detailed explanation on the values.
467
+
468
+ .. versionadded:: 2.2.0
469
+
470
+ :attr:`always_on_top` is a :class:`~kivy.properties.BooleanProperty` and
471
+ defaults to False.
472
+ '''
473
+
474
+ allow_screensaver = BooleanProperty(True)
475
+ '''Whether the screen saver is enabled, or on mobile devices whether the
476
+ device is allowed to go to sleep while the app is open.
477
+
478
+ .. versionadded:: 1.10.0
479
+
480
+ :attr:`allow_screensaver` is a :class:`~kivy.properties.BooleanProperty`
481
+ and defaults to True.
482
+ '''
483
+
484
+ size = AliasProperty(_get_size, _set_size, bind=('_size', '_rotation'))
485
+ '''Get the rotated size of the window. If :attr:`rotation` is set, then the
486
+ size will change to reflect the rotation.
487
+
488
+ .. versionadded:: 1.0.9
489
+
490
+ :attr:`size` is an :class:`~kivy.properties.AliasProperty`.
491
+ '''
492
+
493
+ clearcolor = ColorProperty((0, 0, 0, 1))
494
+ '''Color used to clear the window.
495
+
496
+ ::
497
+
498
+ from kivy.core.window import Window
499
+
500
+ # red background color
501
+ Window.clearcolor = (1, 0, 0, 1)
502
+
503
+ # don't clear background at all
504
+ Window.clearcolor = None
505
+
506
+ .. versionchanged:: 1.7.2
507
+ The clearcolor default value is now: (0, 0, 0, 1).
508
+
509
+ .. versionadded:: 1.0.9
510
+
511
+ :attr:`clearcolor` is an :class:`~kivy.properties.ColorProperty` and
512
+ defaults to (0, 0, 0, 1).
513
+
514
+ .. versionchanged:: 2.1.0
515
+ Changed from :class:`~kivy.properties.AliasProperty` to
516
+ :class:`~kivy.properties.ColorProperty`.
517
+ '''
518
+
519
+ # make some property read-only
520
+ def _get_width(self):
521
+ _size = self._size
522
+ if platform == 'win' or self._density != 1:
523
+ _size = self._win._get_gl_size()
524
+ r = self._rotation
525
+ if r == 0 or r == 180:
526
+ return _size[0]
527
+ return _size[1]
528
+
529
+ width = AliasProperty(_get_width, bind=('_rotation', '_size', '_density'))
530
+ '''Rotated window width.
531
+
532
+ :attr:`width` is a read-only :class:`~kivy.properties.AliasProperty`.
533
+ '''
534
+
535
+ def _get_height(self):
536
+ '''Rotated window height'''
537
+ r = self._rotation
538
+ _size = self._size
539
+ if platform == 'win' or self._density != 1:
540
+ _size = self._win._get_gl_size()
541
+ kb = self.keyboard_height if self.softinput_mode == 'resize' else 0
542
+ if r == 0 or r == 180:
543
+ return _size[1] - kb
544
+ return _size[0] - kb
545
+
546
+ height = AliasProperty(_get_height,
547
+ bind=('_rotation', '_size', '_density'))
548
+ '''Rotated window height.
549
+
550
+ :attr:`height` is a read-only :class:`~kivy.properties.AliasProperty`.
551
+ '''
552
+
553
+ def _get_center(self):
554
+ return self.width / 2., self.height / 2.
555
+
556
+ center = AliasProperty(_get_center, bind=('width', 'height'))
557
+ '''Center of the rotated window.
558
+
559
+ .. versionadded:: 1.0.9
560
+
561
+ :attr:`center` is an :class:`~kivy.properties.AliasProperty`.
562
+ '''
563
+
564
+ def _get_rotation(self):
565
+ return self._rotation
566
+
567
+ def _set_rotation(self, x):
568
+ x = int(x % 360)
569
+ if x == self._rotation:
570
+ return
571
+ if x not in (0, 90, 180, 270):
572
+ raise ValueError('can rotate only 0, 90, 180, 270 degrees')
573
+ self._rotation = x
574
+ if not self.initialized:
575
+ return
576
+ self.dispatch('on_pre_resize', *self.size)
577
+ self.dispatch('on_rotate', x)
578
+
579
+ rotation = AliasProperty(_get_rotation, _set_rotation,
580
+ bind=('_rotation', ))
581
+ '''Get/set the window content rotation. Can be one of 0, 90, 180, 270
582
+ degrees.
583
+
584
+ .. versionadded:: 1.0.9
585
+
586
+ :attr:`rotation` is an :class:`~kivy.properties.AliasProperty`.
587
+ '''
588
+
589
+ softinput_mode = OptionProperty(
590
+ '', options=('', 'below_target', 'pan', 'scale', 'resize')
591
+ )
592
+ '''This specifies the behavior of window contents on display of the soft
593
+ keyboard on mobile platforms. It can be one of '', 'pan', 'scale',
594
+ 'resize' or 'below_target'. Their effects are listed below.
595
+
596
+ +----------------+-------------------------------------------------------+
597
+ | Value | Effect |
598
+ +================+=======================================================+
599
+ | '' | The main window is left as is, allowing you to use |
600
+ | | the :attr:`keyboard_height` to manage the window |
601
+ | | contents manually. |
602
+ +----------------+-------------------------------------------------------+
603
+ | 'pan' | The main window pans, moving the bottom part of the |
604
+ | | window to be always on top of the keyboard. |
605
+ +----------------+-------------------------------------------------------+
606
+ | 'resize' | The window is resized and the contents scaled to fit |
607
+ | | the remaining space. |
608
+ +----------------+-------------------------------------------------------+
609
+ | 'below_target' | The window pans so that the current target TextInput |
610
+ | | widget requesting the keyboard is presented just above|
611
+ | | the soft keyboard. |
612
+ +----------------+-------------------------------------------------------+
613
+
614
+ :attr:`softinput_mode` is an :class:`~kivy.properties.OptionProperty` and
615
+ defaults to ''.
616
+
617
+ .. note:: The `resize` option does not currently work with SDL2 on Android.
618
+
619
+ .. versionadded:: 1.9.0
620
+
621
+ .. versionchanged:: 1.9.1
622
+ The 'below_target' option was added.
623
+ '''
624
+
625
+ _keyboard_changed = BooleanProperty(False)
626
+ _kheight = NumericProperty(0)
627
+ _kanimation = None
628
+
629
+ def _free_kanimation(self, *largs):
630
+ WindowBase._kanimation = None
631
+
632
+ def _animate_content(self):
633
+ '''Animate content to IME height.
634
+ '''
635
+ kargs = self.keyboard_anim_args
636
+ global Animation
637
+ if not Animation:
638
+ from kivy.animation import Animation
639
+ if WindowBase._kanimation:
640
+ WindowBase._kanimation.cancel(self)
641
+ WindowBase._kanimation = kanim = Animation(
642
+ _kheight=self.keyboard_height + self.keyboard_padding,
643
+ d=kargs['d'], t=kargs['t'])
644
+ kanim.bind(on_complete=self._free_kanimation)
645
+ kanim.start(self)
646
+
647
+ def _upd_kbd_height(self, *kargs):
648
+ self._keyboard_changed = not self._keyboard_changed
649
+ self._animate_content()
650
+
651
+ def _get_ios_kheight(self):
652
+ import ios
653
+ return ios.get_kheight()
654
+
655
+ def _get_android_kheight(self):
656
+ if USE_SDL2: # Placeholder until the SDL2 bootstrap supports this
657
+ return 0
658
+ global android
659
+ if not android:
660
+ import android
661
+ return android.get_keyboard_height()
662
+
663
+ def _get_kivy_vkheight(self):
664
+ mode = Config.get('kivy', 'keyboard_mode')
665
+ if (
666
+ mode in ['dock', 'systemanddock']
667
+ and self._vkeyboard_cls is not None
668
+ ):
669
+ for w in self.children:
670
+ if isinstance(w, self._vkeyboard_cls):
671
+ vkeyboard_height = w.height * w.scale
672
+ if self.softinput_mode == 'pan':
673
+ return vkeyboard_height
674
+ elif (
675
+ self.softinput_mode == 'below_target'
676
+ and w.target.y < vkeyboard_height
677
+ ):
678
+ return vkeyboard_height - w.target.y
679
+ return 0
680
+
681
+ def _get_kheight(self):
682
+ if platform == 'android':
683
+ return self._get_android_kheight()
684
+ elif platform == 'ios':
685
+ return self._get_ios_kheight()
686
+ return self._get_kivy_vkheight()
687
+
688
+ keyboard_height = AliasProperty(_get_kheight, bind=('_keyboard_changed',))
689
+ '''Returns the height of the softkeyboard/IME on mobile platforms.
690
+ Will return 0 if not on mobile platform or if IME is not active.
691
+
692
+ .. note:: This property returns 0 with SDL2 on Android, but setting
693
+ Window.softinput_mode does work.
694
+
695
+ .. versionadded:: 1.9.0
696
+
697
+ :attr:`keyboard_height` is a read-only
698
+ :class:`~kivy.properties.AliasProperty` and defaults to 0.
699
+ '''
700
+
701
+ keyboard_anim_args = {'t': 'in_out_quart', 'd': .5}
702
+ '''The attributes for animating softkeyboard/IME.
703
+ `t` = `transition`, `d` = `duration`. This value will have no effect on
704
+ desktops.
705
+
706
+ .. versionadded:: 1.10.0
707
+
708
+ :attr:`keyboard_anim_args` is a dict and defaults to
709
+ {'t': 'in_out_quart', 'd': `.5`}.
710
+ '''
711
+
712
+ keyboard_padding = NumericProperty(0)
713
+ '''The padding to have between the softkeyboard/IME & target
714
+ or bottom of window. Will have no effect on desktops.
715
+
716
+ .. versionadded:: 1.10.0
717
+
718
+ :attr:`keyboard_padding` is a
719
+ :class:`~kivy.properties.NumericProperty` and defaults to 0.
720
+ '''
721
+
722
+ def _set_system_size(self, size):
723
+ self._size = size
724
+
725
+ def _get_system_size(self):
726
+ if self.softinput_mode == 'resize':
727
+ return self._size[0], self._size[1] - self.keyboard_height
728
+ return self._size
729
+
730
+ system_size = AliasProperty(_get_system_size, _set_system_size,
731
+ bind=('_size',))
732
+ '''Real size of the window ignoring rotation. If the density is
733
+ not 1, the :attr:`system_size` is the :attr:`size` divided by
734
+ density.
735
+
736
+ .. versionadded:: 1.0.9
737
+
738
+ :attr:`system_size` is an :class:`~kivy.properties.AliasProperty`.
739
+ '''
740
+
741
+ def _get_effective_size(self):
742
+ '''On density=1 and non-ios / non-Windows displays,
743
+ return :attr:`system_size`, else return scaled / rotated :attr:`size`.
744
+
745
+ Used by MouseMotionEvent.update_graphics() and WindowBase.on_motion().
746
+ '''
747
+ w, h = self.system_size
748
+ if platform in ('ios', 'win') or self._density != 1:
749
+ w, h = self.size
750
+
751
+ return w, h
752
+
753
+ borderless = BooleanProperty(False)
754
+ '''When set to True, this property removes the window border/decoration.
755
+ Check the :mod:`~kivy.config` documentation for a more detailed
756
+ explanation on the values.
757
+
758
+ .. versionadded:: 1.9.0
759
+
760
+ :attr:`borderless` is a :class:`~kivy.properties.BooleanProperty` and
761
+ defaults to False.
762
+ '''
763
+
764
+ custom_titlebar = BooleanProperty(False)
765
+ '''When set to True, allows the user to set a widget as a titlebar.
766
+ Check the :mod:`~kivy.config` documentation for a more detailed
767
+ explanation on the values.
768
+
769
+ .. versionadded:: 2.1.0
770
+
771
+ see :meth:`~kivy.core.window.WindowBase.set_custom_titlebar`
772
+ for detailed usage
773
+ :attr:`custom_titlebar` is a :class:`~kivy.properties.BooleanProperty` and
774
+ defaults to False.
775
+ '''
776
+
777
+ fullscreen = OptionProperty(False, options=(True, False, 'auto', 'fake'))
778
+ '''This property sets the fullscreen mode of the window. Available options
779
+ are: True, False, 'auto' and 'fake'. Check the :mod:`~kivy.config`
780
+ documentation for more detailed explanations on these values.
781
+
782
+ fullscreen is an :class:`~kivy.properties.OptionProperty` and defaults to
783
+ `False`.
784
+
785
+ .. versionadded:: 1.2.0
786
+
787
+ .. note::
788
+ The 'fake' option has been deprecated, use the :attr:`borderless`
789
+ property instead.
790
+
791
+ .. warning::
792
+ On iOS, setting :attr:`fullscreen` to `False` will not automatically
793
+ hide the status bar.
794
+
795
+ To achieve this, you must set :attr:`fullscreen` to `False`, and
796
+ then also set :attr:`borderless` to `False`.
797
+ '''
798
+
799
+ mouse_pos = ObjectProperty((0, 0))
800
+ '''2d position of the mouse cursor within the window.
801
+
802
+ Position is relative to the left/bottom point of the window.
803
+
804
+ .. note::
805
+ Cursor position will be scaled by the pixel density if the high density
806
+ mode is supported by the window provider.
807
+
808
+ .. versionadded:: 1.2.0
809
+
810
+ :attr:`mouse_pos` is an :class:`~kivy.properties.ObjectProperty` and
811
+ defaults to (0, 0).
812
+ '''
813
+
814
+ show_cursor = BooleanProperty(True)
815
+ '''Set whether or not the cursor is shown on the window.
816
+
817
+ .. versionadded:: 1.9.1
818
+
819
+ :attr:`show_cursor` is a :class:`~kivy.properties.BooleanProperty` and
820
+ defaults to True.
821
+ '''
822
+
823
+ def _get_focus(self):
824
+ return self._focus
825
+
826
+ focus = AliasProperty(_get_focus, None, bind=('_focus',))
827
+ '''Check whether or not the window currently has focus.
828
+
829
+ .. versionadded:: 1.9.1
830
+
831
+ :attr:`focus` is a read-only :class:`~kivy.properties.AliasProperty` and
832
+ defaults to True.
833
+ '''
834
+
835
+ def _set_cursor_state(self, value):
836
+ pass
837
+
838
+ def set_system_cursor(self, cursor_name):
839
+ '''Set type of a mouse cursor in the Window.
840
+
841
+ It can be one of 'arrow', 'ibeam', 'wait', 'crosshair', 'wait_arrow',
842
+ 'size_nwse', 'size_nesw', 'size_we', 'size_ns', 'size_all', 'no', or
843
+ 'hand'.
844
+
845
+ On some platforms there might not be a specific cursor supported and
846
+ such an option falls back to one of the substitutable alternatives:
847
+
848
+ +------------+-----------+------------+-----------+---------------+
849
+ | | Windows | MacOS | Linux X11 | Linux Wayland |
850
+ +============+===========+============+===========+===============+
851
+ | arrow | arrow | arrow | arrow | arrow |
852
+ +------------+-----------+------------+-----------+---------------+
853
+ | ibeam | ibeam | ibeam | ibeam | ibeam |
854
+ +------------+-----------+------------+-----------+---------------+
855
+ | wait | wait | arrow | wait | wait |
856
+ +------------+-----------+------------+-----------+---------------+
857
+ | crosshair | crosshair | crosshair | crosshair | hand |
858
+ +------------+-----------+------------+-----------+---------------+
859
+ | wait_arrow | arrow | arrow | wait | wait |
860
+ +------------+-----------+------------+-----------+---------------+
861
+ | size_nwse | size_nwse | size_all | size_all | hand |
862
+ +------------+-----------+------------+-----------+---------------+
863
+ | size_nesw | size_nesw | size_all | size_all | hand |
864
+ +------------+-----------+------------+-----------+---------------+
865
+ | size_we | size_we | size_we | size_we | hand |
866
+ +------------+-----------+------------+-----------+---------------+
867
+ | size_ns | size_ns | size_ns | size_ns | hand |
868
+ +------------+-----------+------------+-----------+---------------+
869
+ | size_all | size_all | size_all | size_all | hand |
870
+ +------------+-----------+------------+-----------+---------------+
871
+ | no | no | no | no | ibeam |
872
+ +------------+-----------+------------+-----------+---------------+
873
+ | hand | hand | hand | hand | hand |
874
+ +------------+-----------+------------+-----------+---------------+
875
+
876
+ .. versionadded:: 1.10.1
877
+
878
+ .. note::
879
+ This feature requires the SDL2 window provider and is currently
880
+ only supported on desktop platforms.
881
+ '''
882
+ pass
883
+
884
+ def _get_window_pos(self):
885
+ pass
886
+
887
+ def _set_window_pos(self, x, y):
888
+ pass
889
+
890
+ def _get_left(self):
891
+ if not self.initialized:
892
+ return self._left
893
+ return self._get_window_pos()[0]
894
+
895
+ def _set_left(self, value):
896
+ pos = self._get_window_pos()
897
+ self._set_window_pos(value, pos[1])
898
+
899
+ def _get_top(self):
900
+ if not self.initialized:
901
+ return self._top
902
+ return self._get_window_pos()[1]
903
+
904
+ def _set_top(self, value):
905
+ pos = self._get_window_pos()
906
+ self._set_window_pos(pos[0], value)
907
+
908
+ top = AliasProperty(_get_top, _set_top)
909
+ '''Top position of the window.
910
+
911
+ .. note:: It's an SDL2 property with `[0, 0]` in the top-left corner.
912
+
913
+ .. versionchanged:: 1.10.0
914
+ :attr:`top` is now an :class:`~kivy.properties.AliasProperty`
915
+
916
+ .. versionadded:: 1.9.1
917
+
918
+ :attr:`top` is an :class:`~kivy.properties.AliasProperty` and defaults to
919
+ the position set in :class:`~kivy.config.Config`.
920
+ '''
921
+
922
+ left = AliasProperty(_get_left, _set_left)
923
+ '''Left position of the window.
924
+
925
+ .. note:: It's an SDL2 property with `[0, 0]` in the top-left corner.
926
+
927
+ .. versionchanged:: 1.10.0
928
+ :attr:`left` is now an :class:`~kivy.properties.AliasProperty`
929
+
930
+ .. versionadded:: 1.9.1
931
+
932
+ :attr:`left` is an :class:`~kivy.properties.AliasProperty` and defaults to
933
+ the position set in :class:`~kivy.config.Config`.
934
+ '''
935
+
936
+ def _get_opacity(self):
937
+ return self._get_window_opacity()
938
+
939
+ def _set_opacity(self, opacity):
940
+ return self._set_window_opacity(opacity)
941
+
942
+ def _get_window_opacity(self):
943
+ Logger.warning('Window: Opacity is not implemented in the current '
944
+ 'window provider')
945
+
946
+ def _set_window_opacity(self, opacity):
947
+ Logger.warning('Window: Opacity is not implemented in the current '
948
+ 'window provider')
949
+
950
+ opacity = AliasProperty(_get_opacity, _set_opacity, cache=True)
951
+ '''Opacity of the window. Accepts a value between 0.0 (transparent) and
952
+ 1.0 (opaque).
953
+
954
+ .. note::
955
+ This feature requires the SDL2 window provider.
956
+
957
+ .. versionadded:: 2.3.0
958
+
959
+ :attr:`opacity` is an :class:`~kivy.properties.AliasProperty` and defaults
960
+ to `1.0`.
961
+ '''
962
+
963
+ @property
964
+ def __self__(self):
965
+ return self
966
+
967
+ position = OptionProperty('auto', options=['auto', 'custom'])
968
+ render_context = ObjectProperty(None)
969
+ canvas = ObjectProperty(None)
970
+ title = StringProperty('Kivy')
971
+
972
+ event_managers = None
973
+ '''Holds a `list` of registered event managers.
974
+
975
+ Don't change the property directly but use
976
+ :meth:`register_event_manager` and :meth:`unregister_event_manager` to
977
+ register and unregister an event manager.
978
+
979
+ Event manager is an instance of
980
+ :class:`~kivy.eventmanager.EventManagerBase`.
981
+
982
+ .. versionadded:: 2.1.0
983
+
984
+ .. warning::
985
+ This is an experimental property and it remains so while this warning
986
+ is present.
987
+ '''
988
+
989
+ event_managers_dict = None
990
+ '''Holds a `dict` of `type_id` to `list` of event managers.
991
+
992
+ Don't change the property directly but use
993
+ :meth:`register_event_manager` and :meth:`unregister_event_manager` to
994
+ register and unregister an event manager.
995
+
996
+ Event manager is an instance of
997
+ :class:`~kivy.eventmanager.EventManagerBase`.
998
+
999
+ .. versionadded:: 2.1.0
1000
+
1001
+ .. warning::
1002
+ This is an experimental property and it remains so while this warning
1003
+ is present.
1004
+ '''
1005
+
1006
+ trigger_create_window = None
1007
+
1008
+ __events__ = (
1009
+ 'on_draw', 'on_flip', 'on_rotate', 'on_resize', 'on_move',
1010
+ 'on_close', 'on_minimize', 'on_maximize', 'on_restore',
1011
+ 'on_hide', 'on_show', 'on_motion', 'on_touch_down',
1012
+ 'on_touch_move', 'on_touch_up', 'on_mouse_down',
1013
+ 'on_mouse_move', 'on_mouse_up', 'on_keyboard', 'on_key_down',
1014
+ 'on_key_up', 'on_textinput', 'on_drop_begin', 'on_drop_file',
1015
+ 'on_dropfile', 'on_drop_text', 'on_drop_end', 'on_request_close',
1016
+ 'on_cursor_enter', 'on_cursor_leave', 'on_joy_axis',
1017
+ 'on_joy_hat', 'on_joy_ball', 'on_joy_button_down',
1018
+ 'on_joy_button_up', 'on_memorywarning', 'on_textedit',
1019
+ # internal
1020
+ 'on_pre_resize')
1021
+
1022
+ def __new__(cls, **kwargs):
1023
+ if cls.__instance is None:
1024
+ cls.__instance = EventDispatcher.__new__(cls)
1025
+ return cls.__instance
1026
+
1027
+ def __init__(self, **kwargs):
1028
+ force = kwargs.pop('force', False)
1029
+
1030
+ # don't init window 2 times,
1031
+ # except if force is specified
1032
+ if WindowBase.__instance is not None and not force:
1033
+ return
1034
+
1035
+ self.initialized = False
1036
+ self.event_managers = []
1037
+ self.event_managers_dict = defaultdict(list)
1038
+ self._is_desktop = Config.getboolean('kivy', 'desktop')
1039
+
1040
+ # create a trigger for update/create the window when one of window
1041
+ # property changes
1042
+ self.trigger_create_window = Clock.create_trigger(
1043
+ self.create_window, -1)
1044
+
1045
+ # Create a trigger for updating the keyboard height
1046
+ self.trigger_keyboard_height = Clock.create_trigger(
1047
+ self._upd_kbd_height, .5)
1048
+ self.bind(_kheight=lambda *args: self.update_viewport())
1049
+
1050
+ # set the default window parameter according to the configuration
1051
+ if 'borderless' not in kwargs:
1052
+ kwargs['borderless'] = Config.getboolean('graphics', 'borderless')
1053
+ if 'custom_titlebar' not in kwargs:
1054
+ kwargs['custom_titlebar'] = Config.getboolean('graphics',
1055
+ 'custom_titlebar')
1056
+ if 'fullscreen' not in kwargs:
1057
+ fullscreen = Config.get('graphics', 'fullscreen')
1058
+ if fullscreen not in ('auto', 'fake'):
1059
+ fullscreen = fullscreen.lower() in ('true', '1', 'yes')
1060
+ kwargs['fullscreen'] = fullscreen
1061
+ if 'width' not in kwargs:
1062
+ kwargs['width'] = Config.getint('graphics', 'width')
1063
+ if 'height' not in kwargs:
1064
+ kwargs['height'] = Config.getint('graphics', 'height')
1065
+ if 'minimum_width' not in kwargs:
1066
+ kwargs['minimum_width'] = Config.getint('graphics',
1067
+ 'minimum_width')
1068
+ if 'minimum_height' not in kwargs:
1069
+ kwargs['minimum_height'] = Config.getint('graphics',
1070
+ 'minimum_height')
1071
+ if 'always_on_top' not in kwargs:
1072
+ kwargs['always_on_top'] = Config.getboolean(
1073
+ 'graphics', 'always_on_top'
1074
+ )
1075
+ if 'allow_screensaver' not in kwargs:
1076
+ kwargs['allow_screensaver'] = Config.getboolean(
1077
+ 'graphics', 'allow_screensaver')
1078
+ if 'rotation' not in kwargs:
1079
+ kwargs['rotation'] = Config.getint('graphics', 'rotation')
1080
+ if 'position' not in kwargs:
1081
+ kwargs['position'] = Config.getdefault('graphics', 'position',
1082
+ 'auto')
1083
+ if 'top' in kwargs:
1084
+ kwargs['position'] = 'custom'
1085
+ self._top = kwargs['top']
1086
+ else:
1087
+ self._top = Config.getint('graphics', 'top')
1088
+ if 'left' in kwargs:
1089
+ kwargs['position'] = 'custom'
1090
+ self._left = kwargs['left']
1091
+ else:
1092
+ self._left = Config.getint('graphics', 'left')
1093
+ kwargs['_size'] = (kwargs.pop('width'), kwargs.pop('height'))
1094
+ if 'show_cursor' not in kwargs:
1095
+ kwargs['show_cursor'] = Config.getboolean(
1096
+ 'graphics', 'show_cursor'
1097
+ )
1098
+ if 'shape_image' not in kwargs:
1099
+ kwargs['shape_image'] = Config.get('kivy', 'window_shape')
1100
+
1101
+ self.fbind(
1102
+ 'on_drop_file',
1103
+ lambda win, filename, *args: win.dispatch('on_dropfile', filename)
1104
+ )
1105
+ super(WindowBase, self).__init__(**kwargs)
1106
+
1107
+ # bind all the properties that need to recreate the window
1108
+ self._bind_create_window()
1109
+ self.bind(size=self.trigger_keyboard_height,
1110
+ rotation=self.trigger_keyboard_height)
1111
+
1112
+ self.bind(softinput_mode=lambda *dt: self.update_viewport(),
1113
+ keyboard_height=lambda *dt: self.update_viewport())
1114
+
1115
+ self.bind(show_cursor=lambda *dt: self._set_cursor_state(dt[1]))
1116
+
1117
+ # init privates
1118
+ self._system_keyboard = Keyboard(window=self)
1119
+ self._keyboards = {'system': self._system_keyboard}
1120
+ self._vkeyboard_cls = None
1121
+
1122
+ self.children = []
1123
+ self.parent = self
1124
+
1125
+ # before creating the window
1126
+ import kivy.core.gl # NOQA
1127
+
1128
+ # configure the window
1129
+ self.create_window()
1130
+ self.register()
1131
+
1132
+ # manage keyboard(s)
1133
+ self.configure_keyboards()
1134
+
1135
+ # assign the default context of the widget creation
1136
+ if not hasattr(self, '_context'):
1137
+ self._context = get_current_context()
1138
+
1139
+ # because Window is created as soon as imported, if we bound earlier,
1140
+ # metrics would be imported when dp is set during window creation.
1141
+ # Instead, don't process dpi changes until everything is set
1142
+ self.fbind('dpi', self._reset_metrics_dpi)
1143
+
1144
+ # mark as initialized
1145
+ self.initialized = True
1146
+
1147
+ def _reset_metrics_dpi(self, *args):
1148
+ from kivy.metrics import Metrics
1149
+ Metrics.reset_dpi()
1150
+
1151
+ def _bind_create_window(self):
1152
+ for prop in (
1153
+ 'fullscreen', 'borderless', 'position', 'top',
1154
+ 'left', '_size', 'system_size'):
1155
+ self.bind(**{prop: self.trigger_create_window})
1156
+
1157
+ def _unbind_create_window(self):
1158
+ for prop in (
1159
+ 'fullscreen', 'borderless', 'position', 'top',
1160
+ 'left', '_size', 'system_size'):
1161
+ self.unbind(**{prop: self.trigger_create_window})
1162
+
1163
+ def register(self):
1164
+ if self.initialized:
1165
+ return
1166
+ # attach modules + listener event
1167
+ EventLoop.set_window(self)
1168
+ Modules.register_window(self)
1169
+ EventLoop.add_event_listener(self)
1170
+
1171
+ def register_event_manager(self, manager):
1172
+ '''Register and start an event manager to handle events declared in
1173
+ :attr:`~kivy.eventmanager.EventManagerBase.type_ids` attribute.
1174
+
1175
+ .. versionadded:: 2.1.0
1176
+
1177
+ .. warning::
1178
+ This is an experimental method and it remains so until this warning
1179
+ is present as it can be changed or removed in the next versions of
1180
+ Kivy.
1181
+ '''
1182
+ self.event_managers.insert(0, manager)
1183
+ for type_id in manager.type_ids:
1184
+ self.event_managers_dict[type_id].insert(0, manager)
1185
+ manager.window = self
1186
+ manager.start()
1187
+
1188
+ def unregister_event_manager(self, manager):
1189
+ '''Unregister and stop an event manager previously registered with
1190
+ :meth:`register_event_manager`.
1191
+
1192
+ .. versionadded:: 2.1.0
1193
+
1194
+ .. warning::
1195
+ This is an experimental method and it remains so until this warning
1196
+ is present as it can be changed or removed in the next versions of
1197
+ Kivy.
1198
+ '''
1199
+ self.event_managers.remove(manager)
1200
+ for type_id in manager.type_ids:
1201
+ self.event_managers_dict[type_id].remove(manager)
1202
+ manager.stop()
1203
+ manager.window = None
1204
+
1205
+ def mainloop(self):
1206
+ '''Called by the EventLoop every frame after it idles.
1207
+ '''
1208
+ pass
1209
+
1210
+ def maximize(self):
1211
+ '''Maximizes the window. This method should be used on desktop
1212
+ platforms only.
1213
+
1214
+ .. versionadded:: 1.9.0
1215
+
1216
+ .. note::
1217
+ This feature requires the SDL2 window provider and is currently
1218
+ only supported on desktop platforms.
1219
+ '''
1220
+ Logger.warning('Window: maximize() is not implemented in the current '
1221
+ 'window provider.')
1222
+
1223
+ def minimize(self):
1224
+ '''Minimizes the window. This method should be used on desktop
1225
+ platforms only.
1226
+
1227
+ .. versionadded:: 1.9.0
1228
+
1229
+ .. note::
1230
+ This feature requires the SDL2 window provider and is currently
1231
+ only supported on desktop platforms.
1232
+ '''
1233
+ Logger.warning('Window: minimize() is not implemented in the current '
1234
+ 'window provider.')
1235
+
1236
+ def restore(self):
1237
+ '''Restores the size and position of a maximized or minimized window.
1238
+ This method should be used on desktop platforms only.
1239
+
1240
+ .. versionadded:: 1.9.0
1241
+
1242
+ .. note::
1243
+ This feature requires the SDL2 window provider and is currently
1244
+ only supported on desktop platforms.
1245
+ '''
1246
+ Logger.warning('Window: restore() is not implemented in the current '
1247
+ 'window provider.')
1248
+
1249
+ def hide(self):
1250
+ '''Hides the window. This method should be used on desktop
1251
+ platforms only.
1252
+
1253
+ .. versionadded:: 1.9.0
1254
+
1255
+ .. note::
1256
+ This feature requires the SDL2 window provider and is currently
1257
+ only supported on desktop platforms.
1258
+ '''
1259
+ Logger.warning('Window: hide() is not implemented in the current '
1260
+ 'window provider.')
1261
+
1262
+ def show(self):
1263
+ '''Shows the window. This method should be used on desktop
1264
+ platforms only.
1265
+
1266
+ .. versionadded:: 1.9.0
1267
+
1268
+ .. note::
1269
+ This feature requires the SDL2 window provider and is currently
1270
+ only supported on desktop platforms.
1271
+ '''
1272
+ Logger.warning('Window: show() is not implemented in the current '
1273
+ 'window provider.')
1274
+
1275
+ def raise_window(self):
1276
+ '''Raise the window. This method should be used on desktop
1277
+ platforms only.
1278
+
1279
+ .. versionadded:: 1.9.1
1280
+
1281
+ .. note::
1282
+ This feature requires the SDL2 window provider and is currently
1283
+ only supported on desktop platforms.
1284
+ '''
1285
+ Logger.warning('Window: raise_window is not implemented in the current'
1286
+ ' window provider.')
1287
+
1288
+ def close(self):
1289
+ '''Close the window'''
1290
+ self.dispatch('on_close')
1291
+
1292
+ # Prevent any leftover that can crash the app later
1293
+ # like if there is still some GL referenced values
1294
+ # they may be collected later, but because it was already
1295
+ # gone in the system, it may collect invalid GL resources
1296
+ # Just clear everything to force reloading later on.
1297
+ from kivy.cache import Cache
1298
+ from kivy.graphics.context import get_context
1299
+ Cache.remove('kv.loader')
1300
+ Cache.remove('kv.image')
1301
+ Cache.remove('kv.shader')
1302
+ Cache.remove('kv.texture')
1303
+ get_context().flush()
1304
+
1305
+ shape_image = StringProperty('')
1306
+ '''An image for the window shape (only works for sdl2 window provider).
1307
+
1308
+ .. warning:: The image size has to be the same like the window's size!
1309
+
1310
+ .. versionadded:: 1.10.1
1311
+
1312
+ :attr:`shape_image` is a :class:`~kivy.properties.StringProperty` and
1313
+ defaults to 'data/images/defaultshape.png'. This value is taken from
1314
+ :class:`~kivy.config.Config`.
1315
+ '''
1316
+ def set_custom_titlebar(self, widget):
1317
+ """
1318
+ Sets a Widget as a titlebar
1319
+
1320
+ :widget: The widget you want to set as the titlebar
1321
+
1322
+ .. versionadded:: 2.1.0
1323
+
1324
+ This function returns `True` on successfully setting the custom titlebar,
1325
+ else false
1326
+
1327
+ How to use this feature
1328
+
1329
+ ::
1330
+
1331
+ 1. first set Window.custom_titlebar to True
1332
+ 2. then call Window.set_custom_titlebar with the widget/layout you want to set as titlebar as the argument # noqa: E501
1333
+
1334
+ If you want a child of the widget to receive touch events, in
1335
+ that child define a property `draggable` and set it to False
1336
+
1337
+ If you set the property `draggable` on a layout,
1338
+ all the child in the layout will receive touch events
1339
+
1340
+ If you want to override default behavior, add function `in_drag_area(x,y)`
1341
+ to the widget
1342
+
1343
+ The function is call with two args x,y which are mouse.x, and mouse.y
1344
+ the function should return
1345
+
1346
+ | `True` if that point should be used to drag the window
1347
+ | `False` if you want to receive the touch event at the point
1348
+
1349
+ .. note::
1350
+ If you use :meth:`in_drag_area` property `draggable`
1351
+ will not be checked
1352
+
1353
+ .. note::
1354
+ This feature requires the SDL2 window provider and is currently
1355
+ only supported on desktop platforms.
1356
+
1357
+ .. warning::
1358
+ :mod:`~kivy.core.window.WindowBase.custom_titlebar` must be set to True
1359
+ for the widget to be successfully set as a titlebar
1360
+
1361
+ """
1362
+
1363
+ Logger.warning('Window: set_custom_titlebar '
1364
+ 'is not implemented in the current'
1365
+ ' window provider.')
1366
+
1367
+ def on_shape_image(self, instance, value):
1368
+ if self.initialized:
1369
+ self._set_shape(
1370
+ shape_image=value, mode=self.shape_mode,
1371
+ cutoff=self.shape_cutoff, color_key=self.shape_color_key
1372
+ )
1373
+
1374
+ shape_cutoff = BooleanProperty(True)
1375
+ '''The window :attr:`shape_image` cutoff property (only works for sdl2
1376
+ window provider).
1377
+
1378
+ .. versionadded:: 1.10.1
1379
+
1380
+ :attr:`shape_cutoff` is a :class:`~kivy.properties.BooleanProperty` and
1381
+ defaults to True.
1382
+ '''
1383
+
1384
+ def on_shape_cutoff(self, instance, value):
1385
+ self._set_shape(
1386
+ shape_image=self.shape_image, mode=self.shape_mode,
1387
+ cutoff=value, color_key=self.shape_color_key
1388
+ )
1389
+
1390
+ def _get_shaped(self):
1391
+ return self._is_shaped()
1392
+
1393
+ shaped = AliasProperty(_get_shaped, None)
1394
+ '''Read only property to check if the window is shapable or not (only works
1395
+ for sdl2 window provider).
1396
+
1397
+ .. versionadded:: 1.10.1
1398
+
1399
+ :attr:`shaped` is an :class:`~kivy.properties.AliasProperty`.
1400
+ '''
1401
+
1402
+ def _get_shape_mode(self):
1403
+ if not self.shaped:
1404
+ return ''
1405
+
1406
+ i = self._get_shaped_mode()['mode']
1407
+ modes = ('default', 'binalpha', 'reversebinalpha', 'colorkey')
1408
+ return modes[i]
1409
+
1410
+ def _set_shape_mode(self, value):
1411
+ self._set_shaped_mode(value)
1412
+
1413
+ shape_mode = AliasProperty(_get_shape_mode, _set_shape_mode)
1414
+ '''Window mode for shaping (only works for sdl2 window provider).
1415
+
1416
+ - can be RGB only
1417
+ - `default` - does nothing special
1418
+ - `colorkey` - hides a color of the :attr:`shape_color_key`
1419
+ - has to contain alpha channel
1420
+ - `binalpha` - hides an alpha channel of the :attr:`shape_image`
1421
+ - `reversebinalpha` - shows only the alpha of the :attr:`shape_image`
1422
+
1423
+ .. note::
1424
+ Before actually setting the mode make sure the Window has the same
1425
+ size like the :attr:`shape_image`, preferably via Config before
1426
+ the Window is actually created.
1427
+
1428
+ If the :attr:`shape_image` isn't set, the default one will be used
1429
+ and the mode might not take the desired visual effect.
1430
+
1431
+ .. versionadded:: 1.10.1
1432
+
1433
+ :attr:`shape_mode` is an :class:`~kivy.properties.AliasProperty`.
1434
+ '''
1435
+
1436
+ shape_color_key = ColorProperty([1, 1, 1, 1])
1437
+ '''Color key of the shaped window - sets which color will be hidden from
1438
+ the window :attr:`shape_image` (only works for sdl2 window provider).
1439
+
1440
+ .. versionadded:: 1.10.1
1441
+
1442
+ :attr:`shape_color_key` is a :class:`~kivy.properties.ColorProperty`
1443
+ instance and defaults to [1, 1, 1, 1].
1444
+
1445
+ .. versionchanged:: 2.0.0
1446
+ Changed from :class:`~kivy.properties.ListProperty` to
1447
+ :class:`~kivy.properties.ColorProperty`.
1448
+ '''
1449
+ def on_shape_color_key(self, instance, value):
1450
+ self._set_shape(
1451
+ shape_image=self.shape_image, mode=self.shape_mode,
1452
+ cutoff=self.shape_cutoff, color_key=value
1453
+ )
1454
+
1455
+ def get_gl_backend_name(self):
1456
+ """
1457
+ Returns the gl backend that will or is used with this window.
1458
+ """
1459
+ return cgl_get_backend_name(
1460
+ allowed=self.gl_backends_allowed,
1461
+ ignored=self.gl_backends_ignored)
1462
+
1463
+ def initialize_gl(self):
1464
+ from kivy.core.gl import init_gl
1465
+ init_gl(allowed=self.gl_backends_allowed,
1466
+ ignored=self.gl_backends_ignored)
1467
+
1468
+ def create_window(self, *largs):
1469
+ '''Will create the main window and configure it.
1470
+
1471
+ .. warning::
1472
+ This method is called automatically at runtime. If you call it, it
1473
+ will recreate a RenderContext and Canvas. This means you'll have a
1474
+ new graphics tree, and the old one will be unusable.
1475
+
1476
+ This method exist to permit the creation of a new OpenGL context
1477
+ AFTER closing the first one. (Like using runTouchApp() and
1478
+ stopTouchApp()).
1479
+
1480
+ This method has only been tested in a unittest environment and
1481
+ is not suitable for Applications.
1482
+
1483
+ Again, don't use this method unless you know exactly what you are
1484
+ doing!
1485
+ '''
1486
+ # just to be sure, if the trigger is set, and if this method is
1487
+ # manually called, unset the trigger
1488
+ self.trigger_create_window.cancel()
1489
+
1490
+ # ensure the window creation will not be called twice
1491
+ if platform in ('android'):
1492
+ self._unbind_create_window()
1493
+
1494
+ if not self.initialized:
1495
+ self.initialize_gl()
1496
+
1497
+ # create the render context and canvas, only the first time.
1498
+ from kivy.graphics import RenderContext, Canvas
1499
+ self.render_context = RenderContext()
1500
+ self.canvas = Canvas()
1501
+ self.render_context.add(self.canvas)
1502
+
1503
+ else:
1504
+ # if we get initialized more than once, then reload opengl state
1505
+ # after the second time.
1506
+ # XXX check how it's working on embed platform.
1507
+ if platform == 'linux' or Window.__class__.__name__ == 'WindowSDL':
1508
+ # on linux, it's safe for just sending a resize.
1509
+ self.dispatch('on_pre_resize', *self.size)
1510
+
1511
+ else:
1512
+ # on other platform, window are recreated, we need to reload.
1513
+ from kivy.graphics.context import get_context
1514
+ get_context().reload()
1515
+ Clock.schedule_once(lambda x: self.canvas.ask_update(), 0)
1516
+ self.dispatch('on_pre_resize', *self.size)
1517
+
1518
+ # ensure the gl viewport is correct
1519
+ self.update_viewport()
1520
+
1521
+ def on_flip(self):
1522
+ '''Flip between buffers (event)'''
1523
+ self.flip()
1524
+
1525
+ def flip(self):
1526
+ '''Flip between buffers'''
1527
+ pass
1528
+
1529
+ def _update_childsize(self, instance, value):
1530
+ self.update_childsize([instance])
1531
+
1532
+ def add_widget(self, widget, canvas=None):
1533
+ '''Add a widget to a window'''
1534
+ if widget.parent:
1535
+ from kivy.uix.widget import WidgetException
1536
+ raise WidgetException(
1537
+ 'Cannot add %r to window, it already has a parent %r' %
1538
+ (widget, widget.parent)
1539
+ )
1540
+
1541
+ widget.parent = self
1542
+ self.children.insert(0, widget)
1543
+ canvas = self.canvas.before if canvas == 'before' else \
1544
+ self.canvas.after if canvas == 'after' else self.canvas
1545
+ canvas.add(widget.canvas)
1546
+ self.update_childsize([widget])
1547
+ widget.bind(
1548
+ pos_hint=self._update_childsize,
1549
+ size_hint=self._update_childsize,
1550
+ size_hint_max=self._update_childsize,
1551
+ size_hint_min=self._update_childsize,
1552
+ size=self._update_childsize,
1553
+ pos=self._update_childsize)
1554
+
1555
+ def remove_widget(self, widget):
1556
+ '''Remove a widget from a window
1557
+ '''
1558
+ if widget not in self.children:
1559
+ return
1560
+ self.children.remove(widget)
1561
+ if widget.canvas in self.canvas.children:
1562
+ self.canvas.remove(widget.canvas)
1563
+ elif widget.canvas in self.canvas.after.children:
1564
+ self.canvas.after.remove(widget.canvas)
1565
+ elif widget.canvas in self.canvas.before.children:
1566
+ self.canvas.before.remove(widget.canvas)
1567
+ widget.parent = None
1568
+ widget.unbind(
1569
+ pos_hint=self._update_childsize,
1570
+ size_hint=self._update_childsize,
1571
+ size_hint_max=self._update_childsize,
1572
+ size_hint_min=self._update_childsize,
1573
+ size=self._update_childsize,
1574
+ pos=self._update_childsize)
1575
+
1576
+ def clear(self):
1577
+ '''Clear the window with the background color'''
1578
+ # XXX FIXME use late binding
1579
+ from kivy.graphics import opengl as gl
1580
+ gl.glClearColor(*self.clearcolor)
1581
+ gl.glClear(
1582
+ gl.GL_COLOR_BUFFER_BIT
1583
+ | gl.GL_DEPTH_BUFFER_BIT
1584
+ | gl.GL_STENCIL_BUFFER_BIT
1585
+ )
1586
+
1587
+ def set_title(self, title):
1588
+ '''Set the window title.
1589
+
1590
+ .. versionadded:: 1.0.5
1591
+ '''
1592
+ self.title = title
1593
+
1594
+ def set_icon(self, filename):
1595
+ '''Set the icon of the window.
1596
+
1597
+ .. versionadded:: 1.0.5
1598
+ '''
1599
+ self.icon = filename
1600
+
1601
+ def to_widget(self, x, y, initial=True, relative=False):
1602
+ return (x, y)
1603
+
1604
+ def to_window(self, x, y, initial=True, relative=False):
1605
+ return (x, y)
1606
+
1607
+ def to_normalized_pos(self, x, y):
1608
+ '''Transforms absolute coordinates to normalized (0-1) coordinates
1609
+ using :attr:`system_size`.
1610
+
1611
+ .. versionadded:: 2.1.0
1612
+ '''
1613
+ x_max = self.system_size[0] - 1.0
1614
+ y_max = self.system_size[1] - 1.0
1615
+ return (
1616
+ x / x_max if x_max > 0 else 0.0,
1617
+ y / y_max if y_max > 0 else 0.0
1618
+ )
1619
+
1620
+ def transform_motion_event_2d(self, me, widget=None):
1621
+ '''Transforms the motion event `me` to this window size and then if
1622
+ `widget` is passed transforms `me` to `widget`'s local coordinates.
1623
+
1624
+ :raises:
1625
+ `AttributeError`: If widget's ancestor is ``None``.
1626
+
1627
+ .. note::
1628
+ Unless it's a specific case, call
1629
+ :meth:`~kivy.input.motionevent.MotionEvent.push` before and
1630
+ :meth:`~kivy.input.motionevent.MotionEvent.pop` after this method's
1631
+ call to preserve previous values of `me`'s attributes.
1632
+
1633
+ .. versionadded:: 2.1.0
1634
+ '''
1635
+ width, height = self._get_effective_size()
1636
+ me.scale_for_screen(
1637
+ width, height,
1638
+ rotation=self.rotation,
1639
+ smode=self.softinput_mode,
1640
+ kheight=self.keyboard_height
1641
+ )
1642
+ if widget is not None:
1643
+ parent = widget.parent
1644
+ try:
1645
+ if parent:
1646
+ me.apply_transform_2d(parent.to_widget)
1647
+ else:
1648
+ me.apply_transform_2d(widget.to_widget)
1649
+ me.apply_transform_2d(widget.to_parent)
1650
+ except AttributeError:
1651
+ # when using inner window, an app have grab the touch
1652
+ # but app is removed. The touch can't access
1653
+ # to one of the parent. (i.e, self.parent will be None)
1654
+ # and BAM the bug happen.
1655
+ raise
1656
+
1657
+ def _apply_transform(self, m):
1658
+ return m
1659
+
1660
+ def get_window_matrix(self, x=0, y=0):
1661
+ m = Matrix()
1662
+ m.translate(x, y, 0)
1663
+ return m
1664
+
1665
+ def get_root_window(self):
1666
+ return self
1667
+
1668
+ def get_parent_window(self):
1669
+ return self
1670
+
1671
+ def get_parent_layout(self):
1672
+ return None
1673
+
1674
+ def on_draw(self):
1675
+ self.clear()
1676
+ self.render_context.draw()
1677
+
1678
+ def on_motion(self, etype, me):
1679
+ '''Event called when a motion event is received.
1680
+
1681
+ :Parameters:
1682
+ `etype`: str
1683
+ One of "begin", "update" or "end".
1684
+ `me`: :class:`~kivy.input.motionevent.MotionEvent`
1685
+ The motion event currently dispatched.
1686
+
1687
+ .. versionchanged:: 2.1.0
1688
+ Event managers get to handle the touch event first and if none of
1689
+ them accepts the event (by returning `True`) then window will
1690
+ dispatch `me` through "on_touch_down", "on_touch_move",
1691
+ "on_touch_up" events depending on the `etype`. All non-touch events
1692
+ will go only through managers.
1693
+ '''
1694
+ accepted = False
1695
+ for manager in self.event_managers_dict[me.type_id][:]:
1696
+ accepted = manager.dispatch(etype, me) or accepted
1697
+ if accepted:
1698
+ if me.is_touch and etype == 'end':
1699
+ FocusBehavior._handle_post_on_touch_up(me)
1700
+ return accepted
1701
+ if me.is_touch:
1702
+ # TODO: Use me.push/me.pop methods because `me` is transformed
1703
+ # Clock execution of partial ScrollView._on_touch_up method and
1704
+ # other similar cases should be changed so that me.push/me.pop can
1705
+ # be used restore previous values of event's attributes
1706
+ # me.push()
1707
+ self.transform_motion_event_2d(me)
1708
+ if etype == 'begin':
1709
+ self.dispatch('on_touch_down', me)
1710
+ elif etype == 'update':
1711
+ self.dispatch('on_touch_move', me)
1712
+ elif etype == 'end':
1713
+ self.dispatch('on_touch_up', me)
1714
+ FocusBehavior._handle_post_on_touch_up(me)
1715
+ # me.pop()
1716
+
1717
+ def on_touch_down(self, touch):
1718
+ '''Event called when a touch down event is initiated.
1719
+
1720
+ .. versionchanged:: 1.9.0
1721
+ The touch `pos` is now transformed to window coordinates before
1722
+ this method is called. Before, the touch `pos` coordinate would be
1723
+ `(0, 0)` when this method was called.
1724
+ '''
1725
+ for w in self.children[:]:
1726
+ if w.dispatch('on_touch_down', touch):
1727
+ return True
1728
+
1729
+ def on_touch_move(self, touch):
1730
+ '''Event called when a touch event moves (changes location).
1731
+
1732
+ .. versionchanged:: 1.9.0
1733
+ The touch `pos` is now transformed to window coordinates before
1734
+ this method is called. Before, the touch `pos` coordinate would be
1735
+ `(0, 0)` when this method was called.
1736
+ '''
1737
+ for w in self.children[:]:
1738
+ if w.dispatch('on_touch_move', touch):
1739
+ return True
1740
+
1741
+ def on_touch_up(self, touch):
1742
+ '''Event called when a touch event is released (terminated).
1743
+
1744
+ .. versionchanged:: 1.9.0
1745
+ The touch `pos` is now transformed to window coordinates before
1746
+ this method is called. Before, the touch `pos` coordinate would be
1747
+ `(0, 0)` when this method was called.
1748
+ '''
1749
+ for w in self.children[:]:
1750
+ if w.dispatch('on_touch_up', touch):
1751
+ return True
1752
+
1753
+ def on_pre_resize(self, width, height):
1754
+ key = (width, height)
1755
+ if hasattr(self, '_last_resize') and self._last_resize == key:
1756
+ return
1757
+ self._last_resize = key
1758
+ self.dispatch('on_resize', width, height)
1759
+
1760
+ def on_resize(self, width, height):
1761
+ '''Event called when the window is resized.'''
1762
+ self.update_viewport()
1763
+
1764
+ def on_move(self):
1765
+ self.property('top').dispatch(self)
1766
+ self.property('left').dispatch(self)
1767
+
1768
+ def update_viewport(self):
1769
+ from kivy.graphics.opengl import glViewport
1770
+ from kivy.graphics.transformation import Matrix
1771
+ from math import radians
1772
+
1773
+ w, h = self._get_effective_size()
1774
+
1775
+ smode = self.softinput_mode
1776
+ target = self._system_keyboard.target
1777
+ targettop = max(0, target.to_window(0, target.y)[1]) if target else 0
1778
+ kheight = self._kheight
1779
+
1780
+ w2, h2 = w / 2., h / 2.
1781
+ r = radians(self.rotation)
1782
+
1783
+ y = 0
1784
+ _h = h
1785
+ if smode == 'pan':
1786
+ y = kheight
1787
+ elif smode == 'below_target':
1788
+ y = 0 if kheight < targettop else (kheight - targettop)
1789
+ if smode == 'scale':
1790
+ _h -= kheight
1791
+
1792
+ # prepare the viewport
1793
+ glViewport(0, 0, w, _h)
1794
+
1795
+ # do projection matrix
1796
+ projection_mat = Matrix()
1797
+ projection_mat.view_clip(0.0, w, 0.0, h, -1.0, 1.0, 0)
1798
+ self.render_context['projection_mat'] = projection_mat
1799
+
1800
+ # do modelview matrix
1801
+ modelview_mat = Matrix().translate(w2, h2, 0)
1802
+ modelview_mat = modelview_mat.multiply(Matrix().rotate(r, 0, 0, 1))
1803
+
1804
+ w, h = self.size
1805
+ w2, h2 = w / 2., h / 2. - y
1806
+ modelview_mat = modelview_mat.multiply(Matrix().translate(-w2, -h2, 0))
1807
+ self.render_context['modelview_mat'] = modelview_mat
1808
+ frag_modelview_mat = Matrix()
1809
+ frag_modelview_mat.set(flat=modelview_mat.get())
1810
+ self.render_context['frag_modelview_mat'] = frag_modelview_mat
1811
+
1812
+ # redraw canvas
1813
+ self.canvas.ask_update()
1814
+
1815
+ # and update childs
1816
+ self.update_childsize()
1817
+
1818
+ def update_childsize(self, childs=None):
1819
+ width, height = self.size
1820
+ if childs is None:
1821
+ childs = self.children
1822
+ for w in childs:
1823
+ shw, shh = w.size_hint
1824
+ shw_min, shh_min = w.size_hint_min
1825
+ shw_max, shh_max = w.size_hint_max
1826
+
1827
+ if shw is not None and shh is not None:
1828
+ c_w = shw * width
1829
+ c_h = shh * height
1830
+
1831
+ if shw_min is not None and c_w < shw_min:
1832
+ c_w = shw_min
1833
+ elif shw_max is not None and c_w > shw_max:
1834
+ c_w = shw_max
1835
+
1836
+ if shh_min is not None and c_h < shh_min:
1837
+ c_h = shh_min
1838
+ elif shh_max is not None and c_h > shh_max:
1839
+ c_h = shh_max
1840
+ w.size = c_w, c_h
1841
+ elif shw is not None:
1842
+ c_w = shw * width
1843
+
1844
+ if shw_min is not None and c_w < shw_min:
1845
+ c_w = shw_min
1846
+ elif shw_max is not None and c_w > shw_max:
1847
+ c_w = shw_max
1848
+ w.width = c_w
1849
+ elif shh is not None:
1850
+ c_h = shh * height
1851
+
1852
+ if shh_min is not None and c_h < shh_min:
1853
+ c_h = shh_min
1854
+ elif shh_max is not None and c_h > shh_max:
1855
+ c_h = shh_max
1856
+ w.height = c_h
1857
+
1858
+ for key, value in w.pos_hint.items():
1859
+ if key == 'x':
1860
+ w.x = value * width
1861
+ elif key == 'right':
1862
+ w.right = value * width
1863
+ elif key == 'y':
1864
+ w.y = value * height
1865
+ elif key == 'top':
1866
+ w.top = value * height
1867
+ elif key == 'center_x':
1868
+ w.center_x = value * width
1869
+ elif key == 'center_y':
1870
+ w.center_y = value * height
1871
+
1872
+ def screenshot(self, name='screenshot{:04d}.png'):
1873
+ '''Save the actual displayed image to a file.
1874
+ '''
1875
+ i = 0
1876
+ path = None
1877
+ if name != 'screenshot{:04d}.png':
1878
+ _ext = name.split('.')[-1]
1879
+ name = ''.join((name[:-(len(_ext) + 1)], '{:04d}.', _ext))
1880
+ while True:
1881
+ i += 1
1882
+ path = join(getcwd(), name.format(i))
1883
+ if not exists(path):
1884
+ break
1885
+ return path
1886
+
1887
+ def on_rotate(self, rotation):
1888
+ '''Event called when the screen has been rotated.
1889
+ '''
1890
+ pass
1891
+
1892
+ def on_close(self, *largs):
1893
+ '''Event called when the window is closed.'''
1894
+ Modules.unregister_window(self)
1895
+ EventLoop.remove_event_listener(self)
1896
+
1897
+ def on_minimize(self, *largs):
1898
+ '''Event called when the window is minimized.
1899
+
1900
+ .. versionadded:: 1.10.0
1901
+
1902
+ .. note::
1903
+ This feature requires the SDL2 window provider.
1904
+ '''
1905
+ pass
1906
+
1907
+ def on_maximize(self, *largs):
1908
+ '''Event called when the window is maximized.
1909
+
1910
+ .. versionadded:: 1.10.0
1911
+
1912
+ .. note::
1913
+ This feature requires the SDL2 window provider.
1914
+ '''
1915
+ pass
1916
+
1917
+ def on_restore(self, *largs):
1918
+ '''Event called when the window is restored.
1919
+
1920
+ .. versionadded:: 1.10.0
1921
+
1922
+ .. note::
1923
+ This feature requires the SDL2 window provider.
1924
+ '''
1925
+ pass
1926
+
1927
+ def on_hide(self, *largs):
1928
+ '''Event called when the window is hidden.
1929
+
1930
+ .. versionadded:: 1.10.0
1931
+
1932
+ .. note::
1933
+ This feature requires the SDL2 window provider.
1934
+ '''
1935
+ pass
1936
+
1937
+ def on_show(self, *largs):
1938
+ '''Event called when the window is shown.
1939
+
1940
+ .. versionadded:: 1.10.0
1941
+
1942
+ .. note::
1943
+ This feature requires the SDL2 window provider.
1944
+ '''
1945
+ pass
1946
+
1947
+ def on_request_close(self, *largs, **kwargs):
1948
+ '''Event called before we close the window. If a bound function returns
1949
+ `True`, the window will not be closed. If the event is triggered
1950
+ because of the keyboard escape key, the keyword argument `source` is
1951
+ dispatched along with a value of `keyboard` to the bound functions.
1952
+
1953
+ .. warning::
1954
+ When the bound function returns True the window will not be closed,
1955
+ so use with care because the user would not be able to close the
1956
+ program, even if the red X is clicked.
1957
+ '''
1958
+ pass
1959
+
1960
+ def on_cursor_enter(self, *largs):
1961
+ '''Event called when the cursor enters the window.
1962
+
1963
+ .. versionadded:: 1.9.1
1964
+
1965
+ .. note::
1966
+ This feature requires the SDL2 window provider.
1967
+ '''
1968
+ pass
1969
+
1970
+ def on_cursor_leave(self, *largs):
1971
+ '''Event called when the cursor leaves the window.
1972
+
1973
+ .. versionadded:: 1.9.1
1974
+
1975
+ .. note::
1976
+ This feature requires the SDL2 window provider.
1977
+ '''
1978
+ pass
1979
+
1980
+ def on_mouse_down(self, x, y, button, modifiers):
1981
+ '''Event called when the mouse is used (pressed/released).'''
1982
+ pass
1983
+
1984
+ def on_mouse_move(self, x, y, modifiers):
1985
+ '''Event called when the mouse is moved with buttons pressed.'''
1986
+ pass
1987
+
1988
+ def on_mouse_up(self, x, y, button, modifiers):
1989
+ '''Event called when the mouse is moved with buttons pressed.'''
1990
+ pass
1991
+
1992
+ def on_joy_axis(self, stickid, axisid, value):
1993
+ '''Event called when a joystick has a stick or other axis moved.
1994
+
1995
+ .. versionadded:: 1.9.0'''
1996
+ pass
1997
+
1998
+ def on_joy_hat(self, stickid, hatid, value):
1999
+ '''Event called when a joystick has a hat/dpad moved.
2000
+
2001
+ .. versionadded:: 1.9.0'''
2002
+ pass
2003
+
2004
+ def on_joy_ball(self, stickid, ballid, xvalue, yvalue):
2005
+ '''Event called when a joystick has a ball moved.
2006
+
2007
+ .. versionadded:: 1.9.0'''
2008
+ pass
2009
+
2010
+ def on_joy_button_down(self, stickid, buttonid):
2011
+ '''Event called when a joystick has a button pressed.
2012
+
2013
+ .. versionadded:: 1.9.0'''
2014
+ pass
2015
+
2016
+ def on_joy_button_up(self, stickid, buttonid):
2017
+ '''Event called when a joystick has a button released.
2018
+
2019
+ .. versionadded:: 1.9.0'''
2020
+ pass
2021
+
2022
+ def on_keyboard(self, key, scancode=None, codepoint=None,
2023
+ modifier=None, **kwargs):
2024
+ '''Event called when keyboard is used.
2025
+
2026
+ .. warning::
2027
+ Some providers may omit `scancode`, `codepoint` and/or `modifier`.
2028
+ '''
2029
+ if 'unicode' in kwargs:
2030
+ Logger.warning("The use of the unicode parameter is deprecated, "
2031
+ "and will be removed in future versions. Use "
2032
+ "codepoint instead, which has identical "
2033
+ "semantics.")
2034
+
2035
+ # Quit if user presses ESC or the typical OSX shortcuts CMD+q or CMD+w
2036
+ # On Android a back key/gesture is mapped to 27 and initiates a pause.
2037
+ # Consume the event and tell Android to pause.
2038
+ # TODO If just CMD+w is pressed, only the window should be closed.
2039
+ is_osx = platform == 'darwin'
2040
+ if key == 27 and platform == 'android':
2041
+ from android import mActivity
2042
+ mActivity.moveTaskToBack(True)
2043
+ return True
2044
+ elif WindowBase.on_keyboard.exit_on_escape:
2045
+ if key == 27 or all([is_osx, key in [113, 119], modifier == 1024]):
2046
+ if not self.dispatch('on_request_close', source='keyboard'):
2047
+ stopTouchApp()
2048
+ self.close()
2049
+ return True
2050
+
2051
+ if Config:
2052
+ on_keyboard.exit_on_escape = Config.getboolean(
2053
+ 'kivy', 'exit_on_escape')
2054
+
2055
+ def __exit(section, name, value):
2056
+ WindowBase.__dict__['on_keyboard'].exit_on_escape = \
2057
+ Config.getboolean('kivy', 'exit_on_escape')
2058
+
2059
+ Config.add_callback(__exit, 'kivy', 'exit_on_escape')
2060
+
2061
+ def on_key_down(self, key, scancode=None, codepoint=None,
2062
+ modifier=None, **kwargs):
2063
+ '''Event called when a key is down (same arguments as on_keyboard)'''
2064
+ if 'unicode' in kwargs:
2065
+ Logger.warning("The use of the unicode parameter is deprecated, "
2066
+ "and will be removed in future versions. Use "
2067
+ "codepoint instead, which has identical "
2068
+ "semantics.")
2069
+
2070
+ def on_key_up(self, key, scancode=None, codepoint=None,
2071
+ modifier=None, **kwargs):
2072
+ '''Event called when a key is released (same arguments as on_keyboard).
2073
+ '''
2074
+ if 'unicode' in kwargs:
2075
+ Logger.warning("The use of the unicode parameter is deprecated, "
2076
+ "and will be removed in future versions. Use "
2077
+ "codepoint instead, which has identical "
2078
+ "semantics.")
2079
+
2080
+ def on_textinput(self, text):
2081
+ '''Event called when text: i.e. alpha numeric non control keys or set
2082
+ of keys is entered. As it is not guaranteed whether we get one
2083
+ character or multiple ones, this event supports handling multiple
2084
+ characters.
2085
+
2086
+ .. versionadded:: 1.9.0
2087
+ '''
2088
+ pass
2089
+
2090
+ def on_drop_begin(self, x, y, *args):
2091
+ '''Event called when a text or a file drop on the application is about
2092
+ to begin. It will be followed-up by a single or a multiple
2093
+ `on_drop_text` or `on_drop_file` events ending with an `on_drop_end`
2094
+ event.
2095
+
2096
+ Arguments `x` and `y` are the mouse cursor position at the time of the
2097
+ drop and you should only rely on them if the drop originated from the
2098
+ mouse.
2099
+
2100
+ :Parameters:
2101
+ `x`: `int`
2102
+ Cursor x position, relative to the window :attr:`left`, at the
2103
+ time of the drop.
2104
+ `y`: `int`
2105
+ Cursor y position, relative to the window :attr:`top`, at the
2106
+ time of the drop.
2107
+ `*args`: `tuple`
2108
+ Additional arguments.
2109
+
2110
+ .. note::
2111
+ This event works with sdl2 window provider.
2112
+
2113
+ .. versionadded:: 2.1.0
2114
+ '''
2115
+ pass
2116
+
2117
+ def on_drop_file(self, filename, x, y, *args):
2118
+ '''Event called when a file is dropped on the application.
2119
+
2120
+ Arguments `x` and `y` are the mouse cursor position at the time of the
2121
+ drop and you should only rely on them if the drop originated from the
2122
+ mouse.
2123
+
2124
+ :Parameters:
2125
+ `filename`: `bytes`
2126
+ Absolute path to a dropped file.
2127
+ `x`: `int`
2128
+ Cursor x position, relative to the window :attr:`left`, at the
2129
+ time of the drop.
2130
+ `y`: `int`
2131
+ Cursor y position, relative to the window :attr:`top`, at the
2132
+ time of the drop.
2133
+ `*args`: `tuple`
2134
+ Additional arguments.
2135
+
2136
+ .. warning::
2137
+ This event currently works with sdl2 window provider, on pygame
2138
+ window provider and OS X with a patched version of pygame.
2139
+ This event is left in place for further evolution
2140
+ (ios, android etc.)
2141
+
2142
+ .. note::
2143
+ On Windows it is possible to drop a file on the window title bar
2144
+ or on its edges and for that case :attr:`mouse_pos` won't be
2145
+ updated as the mouse cursor is not within the window.
2146
+
2147
+ .. note::
2148
+ This event doesn't work for apps with elevated permissions,
2149
+ because the OS API calls are filtered. Check issue
2150
+ `#4999 <https://github.com/kivy/kivy/issues/4999>`_ for
2151
+ pointers to workarounds.
2152
+
2153
+ .. versionadded:: 1.2.0
2154
+
2155
+ .. versionchanged:: 2.1.0
2156
+ Renamed from `on_dropfile` to `on_drop_file`.
2157
+ '''
2158
+ pass
2159
+
2160
+ @deprecated(msg='Deprecated in 2.1.0, use on_drop_file event instead. '
2161
+ 'Event on_dropfile will be removed in the next two '
2162
+ 'releases.')
2163
+ def on_dropfile(self, filename):
2164
+ pass
2165
+
2166
+ def on_drop_text(self, text, x, y, *args):
2167
+ '''Event called when a text is dropped on the application.
2168
+
2169
+ Arguments `x` and `y` are the mouse cursor position at the time of the
2170
+ drop and you should only rely on them if the drop originated from the
2171
+ mouse.
2172
+
2173
+ :Parameters:
2174
+ `text`: `bytes`
2175
+ Text which is dropped.
2176
+ `x`: `int`
2177
+ Cursor x position, relative to the window :attr:`left`, at the
2178
+ time of the drop.
2179
+ `y`: `int`
2180
+ Cursor y position, relative to the window :attr:`top`, at the
2181
+ time of the drop.
2182
+ `*args`: `tuple`
2183
+ Additional arguments.
2184
+
2185
+ .. note::
2186
+ This event works with sdl2 window provider on x11 window.
2187
+
2188
+ .. note::
2189
+ On Windows it is possible to drop a text on the window title bar
2190
+ or on its edges and for that case :attr:`mouse_pos` won't be
2191
+ updated as the mouse cursor is not within the window.
2192
+
2193
+ .. versionadded:: 2.1.0
2194
+ '''
2195
+ pass
2196
+
2197
+ def on_drop_end(self, x, y, *args):
2198
+ '''Event called when a text or a file drop on the application has
2199
+ ended.
2200
+
2201
+ Arguments `x` and `y` are the mouse cursor position at the time of the
2202
+ drop and you should only rely on them if the drop originated from the
2203
+ mouse.
2204
+
2205
+ :Parameters:
2206
+ `x`: `int`
2207
+ Cursor x position, relative to the window :attr:`left`, at the
2208
+ time of the drop.
2209
+ `y`: `int`
2210
+ Cursor y position, relative to the window :attr:`top`, at the
2211
+ time of the drop.
2212
+ `*args`: `tuple`
2213
+ Additional arguments.
2214
+
2215
+ .. note::
2216
+ This event works with sdl2 window provider.
2217
+
2218
+ .. versionadded:: 2.1.0
2219
+ '''
2220
+ pass
2221
+
2222
+ def on_memorywarning(self):
2223
+ '''Event called when the platform have memory issue.
2224
+ Your goal is to clear the cache in your app as much as you can,
2225
+ release unused widgets, do garbage collection etc.
2226
+
2227
+ Currently, this event is fired only from the SDL2 provider, for
2228
+ iOS and Android.
2229
+
2230
+ .. versionadded:: 1.9.0
2231
+ '''
2232
+ pass
2233
+
2234
+ def on_textedit(self, text):
2235
+ '''Event called when inputting with IME.
2236
+ The string inputting with IME is set as the parameter of
2237
+ this event.
2238
+
2239
+ .. versionadded:: 1.10.1
2240
+ '''
2241
+ pass
2242
+
2243
+ dpi = NumericProperty(96.)
2244
+ '''Return the DPI of the screen as computed by the window. If the
2245
+ implementation doesn't support DPI lookup, it's 96.
2246
+
2247
+ .. warning::
2248
+
2249
+ This value is not cross-platform. Use
2250
+ :attr:`kivy.metrics.Metrics.dpi` instead.
2251
+ '''
2252
+
2253
+ def configure_keyboards(self):
2254
+ # Configure how to provide keyboards (virtual or not)
2255
+
2256
+ # register system keyboard to listening keys from window
2257
+ sk = self._system_keyboard
2258
+ self.bind(
2259
+ on_key_down=sk._on_window_key_down,
2260
+ on_key_up=sk._on_window_key_up,
2261
+ on_textinput=sk._on_window_textinput)
2262
+
2263
+ # use the device's real keyboard
2264
+ self.use_syskeyboard = True
2265
+
2266
+ # use the device's real keyboard
2267
+ self.allow_vkeyboard = False
2268
+
2269
+ # one single vkeyboard shared between all widgets
2270
+ self.single_vkeyboard = True
2271
+
2272
+ # the single vkeyboard is always sitting at the same position
2273
+ self.docked_vkeyboard = False
2274
+
2275
+ # now read the configuration
2276
+ mode = Config.get('kivy', 'keyboard_mode')
2277
+ if mode not in ('', 'system', 'dock', 'multi', 'systemanddock',
2278
+ 'systemandmulti'):
2279
+ Logger.critical('Window: unknown keyboard mode %r' % mode)
2280
+
2281
+ # adapt mode according to the configuration
2282
+ if mode == 'system':
2283
+ self.use_syskeyboard = True
2284
+ self.allow_vkeyboard = False
2285
+ self.single_vkeyboard = True
2286
+ self.docked_vkeyboard = False
2287
+ elif mode == 'dock':
2288
+ self.use_syskeyboard = False
2289
+ self.allow_vkeyboard = True
2290
+ self.single_vkeyboard = True
2291
+ self.docked_vkeyboard = True
2292
+ elif mode == 'multi':
2293
+ self.use_syskeyboard = False
2294
+ self.allow_vkeyboard = True
2295
+ self.single_vkeyboard = False
2296
+ self.docked_vkeyboard = False
2297
+ elif mode == 'systemanddock':
2298
+ self.use_syskeyboard = True
2299
+ self.allow_vkeyboard = True
2300
+ self.single_vkeyboard = True
2301
+ self.docked_vkeyboard = True
2302
+ elif mode == 'systemandmulti':
2303
+ self.use_syskeyboard = True
2304
+ self.allow_vkeyboard = True
2305
+ self.single_vkeyboard = False
2306
+ self.docked_vkeyboard = False
2307
+
2308
+ Logger.info(
2309
+ 'Window: virtual keyboard %sallowed, %s, %s' % (
2310
+ '' if self.allow_vkeyboard else 'not ',
2311
+ 'single mode' if self.single_vkeyboard else 'multiuser mode',
2312
+ 'docked' if self.docked_vkeyboard else 'not docked'))
2313
+
2314
+ def set_vkeyboard_class(self, cls):
2315
+ '''.. versionadded:: 1.0.8
2316
+
2317
+ Set the VKeyboard class to use. If set to `None`, it will use the
2318
+ :class:`kivy.uix.vkeyboard.VKeyboard`.
2319
+ '''
2320
+ self._vkeyboard_cls = cls
2321
+
2322
+ def release_all_keyboards(self):
2323
+ '''.. versionadded:: 1.0.8
2324
+
2325
+ This will ensure that no virtual keyboard / system keyboard is
2326
+ requested. All instances will be closed.
2327
+ '''
2328
+ for key in list(self._keyboards.keys())[:]:
2329
+ keyboard = self._keyboards[key]
2330
+ if keyboard:
2331
+ keyboard.release()
2332
+
2333
+ def request_keyboard(
2334
+ self, callback, target, input_type='text', keyboard_suggestions=True
2335
+ ):
2336
+ '''.. versionadded:: 1.0.4
2337
+
2338
+ Internal widget method to request the keyboard. This method is rarely
2339
+ required by the end-user as it is handled automatically by the
2340
+ :class:`~kivy.uix.textinput.TextInput`. We expose it in case you want
2341
+ to handle the keyboard manually for unique input scenarios.
2342
+
2343
+ A widget can request the keyboard, indicating a callback to call
2344
+ when the keyboard is released (or taken by another widget).
2345
+
2346
+ :Parameters:
2347
+ `callback`: func
2348
+ Callback that will be called when the keyboard is
2349
+ closed. This can be because somebody else requested the
2350
+ keyboard or the user closed it.
2351
+ `target`: Widget
2352
+ Attach the keyboard to the specified `target`. This should be
2353
+ the widget that requested the keyboard. Ensure you have a
2354
+ different target attached to each keyboard if you're working in
2355
+ a multi user mode.
2356
+
2357
+ .. versionadded:: 1.0.8
2358
+
2359
+ `input_type`: string
2360
+ Choose the type of soft keyboard to request. Can be one of
2361
+ 'null', 'text', 'number', 'url', 'mail', 'datetime', 'tel',
2362
+ 'address'.
2363
+
2364
+ .. note::
2365
+
2366
+ `input_type` is currently only honored on Android.
2367
+
2368
+ .. versionadded:: 1.8.0
2369
+
2370
+ .. versionchanged:: 2.1.0
2371
+ Added `null` to soft keyboard types.
2372
+
2373
+ `keyboard_suggestions`: bool
2374
+ If True provides auto suggestions on top of keyboard.
2375
+ This will only work if input_type is set to `text`, `url`,
2376
+ `mail` or `address`.
2377
+
2378
+ .. versionadded:: 2.1.0
2379
+
2380
+ :Return:
2381
+ An instance of :class:`Keyboard` containing the callback, target,
2382
+ and if the configuration allows it, a
2383
+ :class:`~kivy.uix.vkeyboard.VKeyboard` instance attached as a
2384
+ *.widget* property.
2385
+
2386
+ .. note::
2387
+
2388
+ The behavior of this function is heavily influenced by the current
2389
+ `keyboard_mode`. Please see the Config's
2390
+ :ref:`configuration tokens <configuration-tokens>` section for
2391
+ more information.
2392
+
2393
+ '''
2394
+
2395
+ # release any previous keyboard attached.
2396
+ self.release_keyboard(target)
2397
+
2398
+ # if we can use virtual vkeyboard, activate it.
2399
+ if self.allow_vkeyboard:
2400
+ keyboard = None
2401
+
2402
+ # late import
2403
+ global VKeyboard
2404
+ if VKeyboard is None and self._vkeyboard_cls is None:
2405
+ from kivy.uix.vkeyboard import VKeyboard
2406
+ self._vkeyboard_cls = VKeyboard
2407
+
2408
+ # if the keyboard doesn't exist, create it.
2409
+ key = 'single' if self.single_vkeyboard else target
2410
+ if key not in self._keyboards:
2411
+ vkeyboard = self._vkeyboard_cls()
2412
+ keyboard = Keyboard(widget=vkeyboard, window=self)
2413
+ vkeyboard.bind(
2414
+ on_key_down=keyboard._on_vkeyboard_key_down,
2415
+ on_key_up=keyboard._on_vkeyboard_key_up,
2416
+ on_textinput=keyboard._on_vkeyboard_textinput)
2417
+ self._keyboards[key] = keyboard
2418
+ else:
2419
+ keyboard = self._keyboards[key]
2420
+
2421
+ # configure vkeyboard
2422
+ keyboard.target = keyboard.widget.target = target
2423
+ keyboard.callback = keyboard.widget.callback = callback
2424
+
2425
+ # add to the window
2426
+ self.add_widget(keyboard.widget)
2427
+
2428
+ # only after add, do dock mode
2429
+ keyboard.widget.docked = self.docked_vkeyboard
2430
+ keyboard.widget.setup_mode()
2431
+
2432
+ # sets vkeyboard position according to Window.softinput_mode
2433
+ if self.softinput_mode == 'pan':
2434
+ keyboard.widget.top = 0
2435
+ elif self.softinput_mode == 'below_target':
2436
+ keyboard.widget.top = keyboard.target.y
2437
+
2438
+ else:
2439
+ # system keyboard, just register the callback.
2440
+ keyboard = self._system_keyboard
2441
+ keyboard.callback = callback
2442
+ keyboard.target = target
2443
+
2444
+ # use system (hardware) keyboard according to flag
2445
+ if self.allow_vkeyboard and self.use_syskeyboard:
2446
+ self.unbind(
2447
+ on_key_down=keyboard._on_window_key_down,
2448
+ on_key_up=keyboard._on_window_key_up,
2449
+ on_textinput=keyboard._on_window_textinput)
2450
+ self.bind(
2451
+ on_key_down=keyboard._on_window_key_down,
2452
+ on_key_up=keyboard._on_window_key_up,
2453
+ on_textinput=keyboard._on_window_textinput)
2454
+
2455
+ return keyboard
2456
+
2457
+ def release_keyboard(self, target=None):
2458
+ '''.. versionadded:: 1.0.4
2459
+
2460
+ Internal method for the widget to release the real-keyboard. Check
2461
+ :meth:`request_keyboard` to understand how it works.
2462
+ '''
2463
+ if self.allow_vkeyboard:
2464
+ key = 'single' if self.single_vkeyboard else target
2465
+ if key not in self._keyboards:
2466
+ return
2467
+ keyboard = self._keyboards[key]
2468
+ callback = keyboard.callback
2469
+ if callback:
2470
+ keyboard.callback = None
2471
+ callback()
2472
+ keyboard.target = None
2473
+ self.remove_widget(keyboard.widget)
2474
+ if key != 'single' and key in self._keyboards:
2475
+ del self._keyboards[key]
2476
+ elif self._system_keyboard.callback:
2477
+ # this way will prevent possible recursion.
2478
+ callback = self._system_keyboard.callback
2479
+ self._system_keyboard.callback = None
2480
+ callback()
2481
+ return True
2482
+
2483
+ def grab_mouse(self):
2484
+ '''Grab mouse - so won't leave window
2485
+
2486
+ .. versionadded:: 1.10.0
2487
+
2488
+ .. note::
2489
+ This feature requires the SDL2 window provider.
2490
+ '''
2491
+ pass
2492
+
2493
+ def ungrab_mouse(self):
2494
+ '''Ungrab mouse
2495
+
2496
+ .. versionadded:: 1.10.0
2497
+
2498
+ .. note::
2499
+ This feature requires the SDL2 window provider.
2500
+ '''
2501
+ pass
2502
+
2503
+
2504
+ #: Instance of a :class:`WindowBase` implementation
2505
+ window_impl = []
2506
+ if platform == 'linux' and (pi_version or 4) < 4:
2507
+ window_impl += [('egl_rpi', 'window_egl_rpi', 'WindowEglRpi')]
2508
+ if USE_SDL2:
2509
+ window_impl += [('sdl2', 'window_sdl2', 'WindowSDL')]
2510
+ else:
2511
+ window_impl += [
2512
+ ('pygame', 'window_pygame', 'WindowPygame')]
2513
+ if platform == 'linux':
2514
+ window_impl += [('x11', 'window_x11', 'WindowX11')]
2515
+ Window = core_select_lib('window', window_impl, True)