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
kivy/uix/settings.py ADDED
@@ -0,0 +1,1343 @@
1
+ '''
2
+ Settings
3
+ ========
4
+
5
+ .. versionadded:: 1.0.7
6
+
7
+ This module provides a complete and extensible framework for adding a
8
+ Settings interface to your application. By default, the interface uses
9
+ a :class:`SettingsWithSpinner`, which consists of a
10
+ :class:`~kivy.uix.spinner.Spinner` (top) to switch between individual
11
+ settings panels (bottom). See :ref:`differentlayouts` for some
12
+ alternatives.
13
+
14
+ .. image:: images/settingswithspinner_kivy.jpg
15
+ :align: center
16
+
17
+ A :class:`SettingsPanel` represents a group of configurable options. The
18
+ :attr:`SettingsPanel.title` property is used by :class:`Settings` when a panel
19
+ is added: it determines the name of the sidebar button. SettingsPanel controls
20
+ a :class:`~kivy.config.ConfigParser` instance.
21
+
22
+ The panel can be automatically constructed from a JSON definition file: you
23
+ describe the settings you want and corresponding sections/keys in the
24
+ ConfigParser instance... and you're done!
25
+
26
+ Settings are also integrated into the :class:`~kivy.app.App` class. Use
27
+ :meth:`Settings.add_kivy_panel` to configure the Kivy core settings in a panel.
28
+
29
+
30
+ .. _settings_json:
31
+
32
+ Create a panel from JSON
33
+ ------------------------
34
+
35
+ To create a panel from a JSON-file, you need two things:
36
+
37
+ * a :class:`~kivy.config.ConfigParser` instance with default values
38
+ * a JSON file
39
+
40
+ .. warning::
41
+
42
+ The :class:`kivy.config.ConfigParser` is required. You cannot use the
43
+ default ConfigParser from Python libraries.
44
+
45
+ You must create and handle the :class:`~kivy.config.ConfigParser`
46
+ object. SettingsPanel will read the values from the associated
47
+ ConfigParser instance. Make sure you have set default values (using
48
+ :attr:`~kivy.config.ConfigParser.setdefaults`) for all the sections/keys
49
+ in your JSON file!
50
+
51
+ The JSON file contains structured information to describe the available
52
+ settings. Here is an example::
53
+
54
+ [
55
+ {
56
+ "type": "title",
57
+ "title": "Windows"
58
+ },
59
+ {
60
+ "type": "bool",
61
+ "title": "Fullscreen",
62
+ "desc": "Set the window in windowed or fullscreen",
63
+ "section": "graphics",
64
+ "key": "fullscreen"
65
+ }
66
+ ]
67
+
68
+ Each element in the root list represents a setting that the user can
69
+ configure. Only the "type" key is mandatory: an instance of the associated
70
+ class will be created and used for the setting - other keys are assigned to
71
+ corresponding properties of that class.
72
+
73
+ ============== =================================================
74
+ Type Associated class
75
+ -------------- -------------------------------------------------
76
+ title :class:`SettingTitle`
77
+ bool :class:`SettingBoolean`
78
+ numeric :class:`SettingNumeric`
79
+ options :class:`SettingOptions`
80
+ string :class:`SettingString`
81
+ path :class:`SettingPath`
82
+ color :class:`SettingColor`
83
+ ============== =================================================
84
+
85
+ .. versionadded:: 1.1.0
86
+ Added :attr:`SettingPath` type
87
+
88
+ .. versionadded:: 2.1.0
89
+ Added :attr:`SettingColor` type
90
+
91
+ In the JSON example above, the first element is of type "title". It will create
92
+ a new instance of :class:`SettingTitle` and apply the rest of the key-value
93
+ pairs to the properties of that class, i.e. "title": "Windows" sets the
94
+ :attr:`~SettingsPanel.title` property of the panel to "Windows".
95
+
96
+ To load the JSON example to a :class:`Settings` instance, use the
97
+ :meth:`Settings.add_json_panel` method. It will automatically instantiate a
98
+ :class:`SettingsPanel` and add it to :class:`Settings`::
99
+
100
+ from kivy.config import ConfigParser
101
+
102
+ config = ConfigParser()
103
+ config.read('myconfig.ini')
104
+
105
+ s = Settings()
106
+ s.add_json_panel('My custom panel', config, 'settings_custom.json')
107
+ s.add_json_panel('Another panel', config, 'settings_test2.json')
108
+
109
+ # then use the s as a widget...
110
+
111
+
112
+ .. _differentlayouts:
113
+
114
+ Different panel layouts
115
+ -----------------------
116
+
117
+ A kivy :class:`~kivy.app.App` can automatically create and display a
118
+ :class:`Settings` instance. See the :attr:`~kivy.app.App.settings_cls`
119
+ documentation for details on how to choose which settings class to
120
+ display.
121
+
122
+ Several pre-built settings widgets are available. All except
123
+ :class:`SettingsWithNoMenu` include close buttons triggering the
124
+ on_close event.
125
+
126
+ - :class:`Settings`: Displays settings with a sidebar at the left to
127
+ switch between json panels.
128
+
129
+ - :class:`SettingsWithSidebar`: A trivial subclass of
130
+ :class:`Settings`.
131
+
132
+ - :class:`SettingsWithSpinner`: Displays settings with a spinner at
133
+ the top, which can be used to switch between json panels. Uses
134
+ :class:`InterfaceWithSpinner` as the
135
+ :attr:`~Settings.interface_cls`. This is the default behavior from
136
+ Kivy 1.8.0.
137
+
138
+ - :class:`SettingsWithTabbedPanel`: Displays json panels as individual
139
+ tabs in a :class:`~kivy.uix.tabbedpanel.TabbedPanel`. Uses
140
+ :class:`InterfaceWithTabbedPanel` as the :attr:`~Settings.interface_cls`.
141
+
142
+ - :class:`SettingsWithNoMenu`: Displays a single json panel, with no
143
+ way to switch to other panels and no close button. This makes it
144
+ impossible for the user to exit unless
145
+ :meth:`~kivy.app.App.close_settings` is overridden with a different
146
+ close trigger! Uses :class:`InterfaceWithNoMenu` as the
147
+ :attr:`~Settings.interface_cls`.
148
+
149
+ You can construct your own settings panels with any layout you choose
150
+ by setting :attr:`Settings.interface_cls`. This should be a widget
151
+ that displays a json settings panel with some way to switch between
152
+ panels. An instance will be automatically created by :class:`Settings`.
153
+
154
+ Interface widgets may be anything you like, but *must* have a method
155
+ add_panel that receives newly created json settings panels for the
156
+ interface to display. See the documentation for
157
+ :class:`InterfaceWithSidebar` for more information. They may
158
+ optionally dispatch an on_close event, for instance if a close button
159
+ is clicked. This event is used by :class:`Settings` to trigger its own
160
+ on_close event.
161
+
162
+ For a complete, working example, please see
163
+ :file:`kivy/examples/settings/main.py`.
164
+
165
+ '''
166
+
167
+ __all__ = ('Settings', 'SettingsPanel', 'SettingItem', 'SettingString',
168
+ 'SettingPath', 'SettingBoolean', 'SettingNumeric', 'SettingOptions',
169
+ 'SettingTitle', 'SettingsWithSidebar', 'SettingsWithSpinner',
170
+ 'SettingsWithTabbedPanel', 'SettingsWithNoMenu',
171
+ 'InterfaceWithSidebar', 'ContentPanel', 'MenuSidebar')
172
+
173
+ import json
174
+ import os
175
+ import kivy.utils as utils
176
+ from kivy.factory import Factory
177
+ from kivy.metrics import dp
178
+ from kivy.config import ConfigParser
179
+ from kivy.animation import Animation
180
+ from kivy.compat import string_types, text_type
181
+ from kivy.core.window import Window
182
+ from kivy.uix.boxlayout import BoxLayout
183
+ from kivy.uix.tabbedpanel import TabbedPanelHeader
184
+ from kivy.uix.button import Button
185
+ from kivy.uix.filechooser import FileChooserListView
186
+ from kivy.uix.colorpicker import ColorPicker
187
+ from kivy.uix.scrollview import ScrollView
188
+ from kivy.uix.floatlayout import FloatLayout
189
+ from kivy.uix.gridlayout import GridLayout
190
+ from kivy.uix.label import Label
191
+ from kivy.uix.popup import Popup
192
+ from kivy.uix.textinput import TextInput
193
+ from kivy.uix.togglebutton import ToggleButton
194
+ from kivy.uix.widget import Widget
195
+ from kivy.properties import ObjectProperty, StringProperty, ListProperty, \
196
+ BooleanProperty, NumericProperty, DictProperty
197
+
198
+
199
+ class SettingSpacer(Widget):
200
+ # Internal class, not documented.
201
+ pass
202
+
203
+
204
+ class SettingItem(FloatLayout):
205
+ '''Base class for individual settings (within a panel). This class cannot
206
+ be used directly; it is used for implementing the other setting classes.
207
+ It builds a row with a title/description (left) and a setting control
208
+ (right).
209
+
210
+ Look at :class:`SettingBoolean`, :class:`SettingNumeric` and
211
+ :class:`SettingOptions` for usage examples.
212
+
213
+ :Events:
214
+ `on_release`
215
+ Fired when the item is touched and then released.
216
+
217
+ '''
218
+
219
+ title = StringProperty('<No title set>')
220
+ '''Title of the setting, defaults to '<No title set>'.
221
+
222
+ :attr:`title` is a :class:`~kivy.properties.StringProperty` and defaults
223
+ to '<No title set>'.
224
+ '''
225
+
226
+ desc = StringProperty(None, allownone=True)
227
+ '''Description of the setting, rendered on the line below the title.
228
+
229
+ :attr:`desc` is a :class:`~kivy.properties.StringProperty` and defaults to
230
+ None.
231
+ '''
232
+
233
+ disabled = BooleanProperty(False)
234
+ '''Indicate if this setting is disabled. If True, all touches on the
235
+ setting item will be discarded.
236
+
237
+ :attr:`disabled` is a :class:`~kivy.properties.BooleanProperty` and
238
+ defaults to False.
239
+ '''
240
+
241
+ section = StringProperty(None)
242
+ '''Section of the token inside the :class:`~kivy.config.ConfigParser`
243
+ instance.
244
+
245
+ :attr:`section` is a :class:`~kivy.properties.StringProperty` and defaults
246
+ to None.
247
+ '''
248
+
249
+ key = StringProperty(None)
250
+ '''Key of the token inside the :attr:`section` in the
251
+ :class:`~kivy.config.ConfigParser` instance.
252
+
253
+ :attr:`key` is a :class:`~kivy.properties.StringProperty` and defaults to
254
+ None.
255
+ '''
256
+
257
+ value = ObjectProperty(None)
258
+ '''Value of the token according to the :class:`~kivy.config.ConfigParser`
259
+ instance. Any change to this value will trigger a
260
+ :meth:`Settings.on_config_change` event.
261
+
262
+ :attr:`value` is an :class:`~kivy.properties.ObjectProperty` and defaults
263
+ to None.
264
+ '''
265
+
266
+ panel = ObjectProperty(None)
267
+ '''(internal) Reference to the SettingsPanel for this setting. You don't
268
+ need to use it.
269
+
270
+ :attr:`panel` is an :class:`~kivy.properties.ObjectProperty` and defaults
271
+ to None.
272
+ '''
273
+
274
+ content = ObjectProperty(None)
275
+ '''(internal) Reference to the widget that contains the real setting.
276
+ As soon as the content object is set, any further call to add_widget will
277
+ call the content.add_widget. This is automatically set.
278
+
279
+ :attr:`content` is an :class:`~kivy.properties.ObjectProperty` and
280
+ defaults to None.
281
+ '''
282
+
283
+ selected_alpha = NumericProperty(0)
284
+ '''(internal) Float value from 0 to 1, used to animate the background when
285
+ the user touches the item.
286
+
287
+ :attr:`selected_alpha` is a :class:`~kivy.properties.NumericProperty` and
288
+ defaults to 0.
289
+ '''
290
+
291
+ __events__ = ('on_release', )
292
+
293
+ def __init__(self, **kwargs):
294
+ super(SettingItem, self).__init__(**kwargs)
295
+ self.value = self.panel.get_value(self.section, self.key)
296
+
297
+ def add_widget(self, *args, **kwargs):
298
+ if self.content is None:
299
+ return super(SettingItem, self).add_widget(*args, **kwargs)
300
+ return self.content.add_widget(*args, **kwargs)
301
+
302
+ def on_touch_down(self, touch):
303
+ if not self.collide_point(*touch.pos):
304
+ return
305
+ if self.disabled:
306
+ return
307
+ touch.grab(self)
308
+ self.selected_alpha = 1
309
+ return super(SettingItem, self).on_touch_down(touch)
310
+
311
+ def on_touch_up(self, touch):
312
+ if touch.grab_current is self:
313
+ touch.ungrab(self)
314
+ self.dispatch('on_release')
315
+ Animation(selected_alpha=0, d=.25, t='out_quad').start(self)
316
+ return True
317
+ return super(SettingItem, self).on_touch_up(touch)
318
+
319
+ def on_release(self):
320
+ pass
321
+
322
+ def on_value(self, instance, value):
323
+ if not self.section or not self.key:
324
+ return
325
+ # get current value in config
326
+ panel = self.panel
327
+ if not isinstance(value, string_types):
328
+ value = str(value)
329
+ panel.set_value(self.section, self.key, value)
330
+
331
+
332
+ class SettingBoolean(SettingItem):
333
+ '''Implementation of a boolean setting on top of a :class:`SettingItem`.
334
+ It is visualized with a :class:`~kivy.uix.switch.Switch` widget.
335
+ By default, 0 and 1 are used for values: you can change them by setting
336
+ :attr:`values`.
337
+ '''
338
+
339
+ values = ListProperty(['0', '1'])
340
+ '''Values used to represent the state of the setting. If you want to use
341
+ "yes" and "no" in your ConfigParser instance::
342
+
343
+ SettingBoolean(..., values=['no', 'yes'])
344
+
345
+ .. warning::
346
+
347
+ You need a minimum of two values, the index 0 will be used as False,
348
+ and index 1 as True
349
+
350
+ :attr:`values` is a :class:`~kivy.properties.ListProperty` and defaults to
351
+ ['0', '1']
352
+ '''
353
+
354
+
355
+ class SettingString(SettingItem):
356
+ '''Implementation of a string setting on top of a :class:`SettingItem`.
357
+ It is visualized with a :class:`~kivy.uix.label.Label` widget that, when
358
+ clicked, will open a :class:`~kivy.uix.popup.Popup` with a
359
+ :class:`~kivy.uix.textinput.Textinput` so the user can enter a custom
360
+ value.
361
+ '''
362
+
363
+ popup = ObjectProperty(None, allownone=True)
364
+ '''(internal) Used to store the current popup when it's shown.
365
+
366
+ :attr:`popup` is an :class:`~kivy.properties.ObjectProperty` and defaults
367
+ to None.
368
+ '''
369
+
370
+ textinput = ObjectProperty(None)
371
+ '''(internal) Used to store the current textinput from the popup and
372
+ to listen for changes.
373
+
374
+ :attr:`textinput` is an :class:`~kivy.properties.ObjectProperty` and
375
+ defaults to None.
376
+ '''
377
+
378
+ def on_panel(self, instance, value):
379
+ if value is None:
380
+ return
381
+ self.fbind('on_release', self._create_popup)
382
+
383
+ def _dismiss(self, *largs):
384
+ if self.textinput:
385
+ self.textinput.focus = False
386
+ if self.popup:
387
+ self.popup.dismiss()
388
+ self.popup = None
389
+
390
+ def _validate(self, instance):
391
+ self._dismiss()
392
+ value = self.textinput.text.strip()
393
+ self.value = value
394
+
395
+ def _create_popup(self, instance):
396
+ # create popup layout
397
+ content = BoxLayout(orientation='vertical', spacing='5dp')
398
+ popup_width = min(0.95 * Window.width, dp(500))
399
+ self.popup = popup = Popup(
400
+ title=self.title, content=content, size_hint=(None, None),
401
+ size=(popup_width, '250dp'))
402
+
403
+ # create the textinput used for numeric input
404
+ self.textinput = textinput = TextInput(
405
+ text=self.value, font_size='24sp', multiline=False,
406
+ size_hint_y=None, height='42sp')
407
+ textinput.bind(on_text_validate=self._validate)
408
+ self.textinput = textinput
409
+
410
+ # construct the content, widget are used as a spacer
411
+ content.add_widget(Widget())
412
+ content.add_widget(textinput)
413
+ content.add_widget(Widget())
414
+ content.add_widget(SettingSpacer())
415
+
416
+ # 2 buttons are created for accept or cancel the current value
417
+ btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
418
+ btn = Button(text='Ok')
419
+ btn.bind(on_release=self._validate)
420
+ btnlayout.add_widget(btn)
421
+ btn = Button(text='Cancel')
422
+ btn.bind(on_release=self._dismiss)
423
+ btnlayout.add_widget(btn)
424
+ content.add_widget(btnlayout)
425
+
426
+ # all done, open the popup !
427
+ popup.open()
428
+
429
+
430
+ class SettingPath(SettingItem):
431
+ '''Implementation of a Path setting on top of a :class:`SettingItem`.
432
+ It is visualized with a :class:`~kivy.uix.label.Label` widget that, when
433
+ clicked, will open a :class:`~kivy.uix.popup.Popup` with a
434
+ :class:`~kivy.uix.filechooser.FileChooserListView` so the user can enter
435
+ a custom value.
436
+
437
+ .. versionadded:: 1.1.0
438
+ '''
439
+
440
+ popup = ObjectProperty(None, allownone=True)
441
+ '''(internal) Used to store the current popup when it is shown.
442
+
443
+ :attr:`popup` is an :class:`~kivy.properties.ObjectProperty` and defaults
444
+ to None.
445
+ '''
446
+
447
+ textinput = ObjectProperty(None)
448
+ '''(internal) Used to store the current textinput from the popup and
449
+ to listen for changes.
450
+
451
+ :attr:`textinput` is an :class:`~kivy.properties.ObjectProperty` and
452
+ defaults to None.
453
+ '''
454
+
455
+ show_hidden = BooleanProperty(False)
456
+ '''Whether to show 'hidden' filenames. What that means is
457
+ operating-system-dependent.
458
+
459
+ :attr:`show_hidden` is an :class:`~kivy.properties.BooleanProperty` and
460
+ defaults to False.
461
+
462
+ .. versionadded:: 1.10.0
463
+ '''
464
+
465
+ dirselect = BooleanProperty(True)
466
+ '''Whether to allow selection of directories.
467
+
468
+ :attr:`dirselect` is a :class:`~kivy.properties.BooleanProperty` and
469
+ defaults to True.
470
+
471
+ .. versionadded:: 1.10.0
472
+ '''
473
+
474
+ def on_panel(self, instance, value):
475
+ if value is None:
476
+ return
477
+ self.fbind('on_release', self._create_popup)
478
+
479
+ def _dismiss(self, *largs):
480
+ if self.textinput:
481
+ self.textinput.focus = False
482
+ if self.popup:
483
+ self.popup.dismiss()
484
+ self.popup = None
485
+
486
+ def _validate(self, instance):
487
+ self._dismiss()
488
+ value = self.textinput.selection
489
+
490
+ if not value:
491
+ return
492
+
493
+ self.value = os.path.realpath(value[0])
494
+
495
+ def _create_popup(self, instance):
496
+ # create popup layout
497
+ content = BoxLayout(orientation='vertical', spacing=5)
498
+ popup_width = min(0.95 * Window.width, dp(500))
499
+ self.popup = popup = Popup(
500
+ title=self.title, content=content, size_hint=(None, 0.9),
501
+ width=popup_width)
502
+
503
+ # create the filechooser
504
+ initial_path = self.value or os.getcwd()
505
+ self.textinput = textinput = FileChooserListView(
506
+ path=initial_path, size_hint=(1, 1),
507
+ dirselect=self.dirselect, show_hidden=self.show_hidden)
508
+ textinput.bind(on_path=self._validate)
509
+
510
+ # construct the content
511
+ content.add_widget(textinput)
512
+ content.add_widget(SettingSpacer())
513
+
514
+ # 2 buttons are created for accept or cancel the current value
515
+ btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
516
+ btn = Button(text='Ok')
517
+ btn.bind(on_release=self._validate)
518
+ btnlayout.add_widget(btn)
519
+ btn = Button(text='Cancel')
520
+ btn.bind(on_release=self._dismiss)
521
+ btnlayout.add_widget(btn)
522
+ content.add_widget(btnlayout)
523
+
524
+ # all done, open the popup !
525
+ popup.open()
526
+
527
+
528
+ class SettingColor(SettingItem):
529
+ '''Implementation of a color setting on top of a :class:`SettingItem`.
530
+ It is visualized with a :class:`~kivy.uix.label.Label` widget and a
531
+ colored canvas rectangle that, when clicked, will open a
532
+ :class:`~kivy.uix.popup.Popup` with a
533
+ :class:`~kivy.uix.colorpicker.ColorPicker` so the user can choose a color.
534
+
535
+ .. versionadded:: 2.0.1
536
+ '''
537
+
538
+ popup = ObjectProperty(None, allownone=True)
539
+ '''(internal) Used to store the current popup when it's shown.
540
+
541
+ :attr:`popup` is an :class:`~kivy.properties.ObjectProperty` and defaults
542
+ to None.
543
+ '''
544
+
545
+ def on_panel(self, instance, value):
546
+ if value is None:
547
+ return
548
+ self.bind(on_release=self._create_popup)
549
+
550
+ def _dismiss(self, *largs):
551
+ if self.popup:
552
+ self.popup.dismiss()
553
+ self.popup = None
554
+
555
+ def _validate(self, instance):
556
+ self._dismiss()
557
+ value = utils.get_hex_from_color(self.colorpicker.color)
558
+ self.value = value
559
+
560
+ def _create_popup(self, instance):
561
+ # create popup layout
562
+ content = BoxLayout(orientation='vertical', spacing='5dp')
563
+ popup_width = min(0.95 * Window.width, dp(500))
564
+ self.popup = popup = Popup(
565
+ title=self.title, content=content, size_hint=(None, 0.9),
566
+ width=popup_width)
567
+
568
+ self.colorpicker = colorpicker = \
569
+ ColorPicker(color=utils.get_color_from_hex(self.value))
570
+ colorpicker.bind(on_color=self._validate)
571
+
572
+ self.colorpicker = colorpicker
573
+ content.add_widget(colorpicker)
574
+ content.add_widget(SettingSpacer())
575
+
576
+ # 2 buttons are created for accept or cancel the current value
577
+ btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
578
+ btn = Button(text='Ok')
579
+ btn.bind(on_release=self._validate)
580
+ btnlayout.add_widget(btn)
581
+ btn = Button(text='Cancel')
582
+ btn.bind(on_release=self._dismiss)
583
+ btnlayout.add_widget(btn)
584
+ content.add_widget(btnlayout)
585
+
586
+ # all done, open the popup !
587
+ popup.open()
588
+
589
+
590
+ class SettingNumeric(SettingString):
591
+ '''Implementation of a numeric setting on top of a :class:`SettingString`.
592
+ It is visualized with a :class:`~kivy.uix.label.Label` widget that, when
593
+ clicked, will open a :class:`~kivy.uix.popup.Popup` with a
594
+ :class:`~kivy.uix.textinput.Textinput` so the user can enter a custom
595
+ value.
596
+ '''
597
+
598
+ def _validate(self, instance):
599
+ # we know the type just by checking if there is a '.' in the original
600
+ # value
601
+ is_float = '.' in str(self.value)
602
+ self._dismiss()
603
+ try:
604
+ if is_float:
605
+ self.value = text_type(float(self.textinput.text))
606
+ else:
607
+ self.value = text_type(int(self.textinput.text))
608
+ except ValueError:
609
+ return
610
+
611
+
612
+ class SettingOptions(SettingItem):
613
+ '''Implementation of an option list on top of a :class:`SettingItem`.
614
+ It is visualized with a :class:`~kivy.uix.label.Label` widget that, when
615
+ clicked, will open a :class:`~kivy.uix.popup.Popup` with a
616
+ list of options from which the user can select.
617
+ '''
618
+
619
+ options = ListProperty([])
620
+ '''List of all availables options. This must be a list of "string" items.
621
+ Otherwise, it will crash. :)
622
+
623
+ :attr:`options` is a :class:`~kivy.properties.ListProperty` and defaults
624
+ to [].
625
+ '''
626
+
627
+ popup = ObjectProperty(None, allownone=True)
628
+ '''(internal) Used to store the current popup when it is shown.
629
+
630
+ :attr:`popup` is an :class:`~kivy.properties.ObjectProperty` and defaults
631
+ to None.
632
+ '''
633
+
634
+ def on_panel(self, instance, value):
635
+ if value is None:
636
+ return
637
+ self.fbind('on_release', self._create_popup)
638
+
639
+ def _set_option(self, instance):
640
+ self.value = instance.text
641
+ self.popup.dismiss()
642
+
643
+ def _create_popup(self, instance):
644
+ # create the popup
645
+ content = BoxLayout(orientation='vertical', spacing='5dp')
646
+ popup_width = min(0.95 * Window.width, dp(500))
647
+ self.popup = popup = Popup(
648
+ content=content, title=self.title, size_hint=(None, None),
649
+ size=(popup_width, '400dp'))
650
+ popup.height = len(self.options) * dp(55) + dp(150)
651
+
652
+ # add all the options
653
+ content.add_widget(Widget(size_hint_y=None, height=1))
654
+ uid = str(self.uid)
655
+ for option in self.options:
656
+ state = 'down' if option == self.value else 'normal'
657
+ btn = ToggleButton(text=option, state=state, group=uid)
658
+ btn.bind(on_release=self._set_option)
659
+ content.add_widget(btn)
660
+
661
+ # finally, add a cancel button to return on the previous panel
662
+ content.add_widget(SettingSpacer())
663
+ btn = Button(text='Cancel', size_hint_y=None, height=dp(50))
664
+ btn.bind(on_release=popup.dismiss)
665
+ content.add_widget(btn)
666
+
667
+ # and open the popup !
668
+ popup.open()
669
+
670
+
671
+ class SettingTitle(Label):
672
+ '''A simple title label, used to organize the settings in sections.
673
+ '''
674
+
675
+ title = StringProperty()
676
+
677
+ panel = ObjectProperty(None)
678
+
679
+
680
+ class SettingsPanel(GridLayout):
681
+ '''This class is used to construct panel settings, for use with a
682
+ :class:`Settings` instance or subclass.
683
+ '''
684
+
685
+ title = StringProperty('Default title')
686
+ '''Title of the panel. The title will be reused by the :class:`Settings` in
687
+ the sidebar.
688
+ '''
689
+
690
+ config = ObjectProperty(None, allownone=True)
691
+ '''A :class:`kivy.config.ConfigParser` instance. See module documentation
692
+ for more information.
693
+ '''
694
+
695
+ settings = ObjectProperty(None)
696
+ '''A :class:`Settings` instance that will be used to fire the
697
+ `on_config_change` event.
698
+ '''
699
+
700
+ def __init__(self, **kwargs):
701
+ kwargs.setdefault('cols', 1)
702
+ super(SettingsPanel, self).__init__(**kwargs)
703
+
704
+ def on_config(self, instance, value):
705
+ if value is None:
706
+ return
707
+ if not isinstance(value, ConfigParser):
708
+ raise Exception('Invalid config object, you must use a'
709
+ 'kivy.config.ConfigParser, not another one !')
710
+
711
+ def get_value(self, section, key):
712
+ '''Return the value of the section/key from the :attr:`config`
713
+ ConfigParser instance. This function is used by :class:`SettingItem` to
714
+ get the value for a given section/key.
715
+
716
+ If you don't want to use a ConfigParser instance, you might want to
717
+ override this function.
718
+ '''
719
+ config = self.config
720
+ if not config:
721
+ return
722
+ return config.get(section, key)
723
+
724
+ def set_value(self, section, key, value):
725
+ current = self.get_value(section, key)
726
+ if current == value:
727
+ return
728
+ config = self.config
729
+ if config:
730
+ config.set(section, key, value)
731
+ config.write()
732
+ settings = self.settings
733
+ if settings:
734
+ settings.dispatch('on_config_change',
735
+ config, section, key, value)
736
+
737
+
738
+ class InterfaceWithSidebar(BoxLayout):
739
+ '''The default Settings interface class. It displays a sidebar menu
740
+ with names of available settings panels, which may be used to switch
741
+ which one is currently displayed.
742
+
743
+ See :meth:`~InterfaceWithSidebar.add_panel` for information on the
744
+ method you must implement if creating your own interface.
745
+
746
+ This class also dispatches an event 'on_close', which is triggered
747
+ when the sidebar menu's close button is released. If creating your
748
+ own interface widget, it should also dispatch such an event which
749
+ will automatically be caught by :class:`Settings` and used to
750
+ trigger its own 'on_close' event.
751
+
752
+ '''
753
+
754
+ menu = ObjectProperty()
755
+ '''(internal) A reference to the sidebar menu widget.
756
+
757
+ :attr:`menu` is an :class:`~kivy.properties.ObjectProperty` and
758
+ defaults to None.
759
+ '''
760
+
761
+ content = ObjectProperty()
762
+ '''(internal) A reference to the panel display widget (a
763
+ :class:`ContentPanel`).
764
+
765
+ :attr:`content` is an :class:`~kivy.properties.ObjectProperty` and
766
+ defaults to None.
767
+
768
+ '''
769
+
770
+ __events__ = ('on_close', )
771
+
772
+ def __init__(self, *args, **kwargs):
773
+ super(InterfaceWithSidebar, self).__init__(*args, **kwargs)
774
+ self.menu.close_button.bind(
775
+ on_release=lambda j: self.dispatch('on_close'))
776
+
777
+ def add_panel(self, panel, name, uid):
778
+ '''This method is used by Settings to add new panels for possible
779
+ display. Any replacement for ContentPanel *must* implement
780
+ this method.
781
+
782
+ :Parameters:
783
+ `panel`: :class:`SettingsPanel`
784
+ It should be stored and the interface should provide a way to
785
+ switch between panels.
786
+ `name`:
787
+ The name of the panel as a string. It may be used to represent
788
+ the panel but isn't necessarily unique.
789
+ `uid`:
790
+ A unique int identifying the panel. It should be used to
791
+ identify and switch between panels.
792
+
793
+ '''
794
+ self.menu.add_item(name, uid)
795
+ self.content.add_panel(panel, name, uid)
796
+
797
+ def on_close(self, *args):
798
+ pass
799
+
800
+
801
+ class InterfaceWithSpinner(BoxLayout):
802
+ '''A settings interface that displays a spinner at the top for
803
+ switching between panels.
804
+
805
+ The workings of this class are considered internal and are not
806
+ documented. See :meth:`InterfaceWithSidebar` for
807
+ information on implementing your own interface class.
808
+
809
+ '''
810
+
811
+ __events__ = ('on_close', )
812
+
813
+ menu = ObjectProperty()
814
+ '''(internal) A reference to the sidebar menu widget.
815
+
816
+ :attr:`menu` is an :class:`~kivy.properties.ObjectProperty` and
817
+ defaults to None.
818
+ '''
819
+
820
+ content = ObjectProperty()
821
+ '''(internal) A reference to the panel display widget (a
822
+ :class:`ContentPanel`).
823
+
824
+ :attr:`menu` is an :class:`~kivy.properties.ObjectProperty` and
825
+ defaults to None.
826
+
827
+ '''
828
+
829
+ def __init__(self, *args, **kwargs):
830
+ super(InterfaceWithSpinner, self).__init__(*args, **kwargs)
831
+ self.menu.close_button.bind(
832
+ on_release=lambda j: self.dispatch('on_close'))
833
+
834
+ def add_panel(self, panel, name, uid):
835
+ '''This method is used by Settings to add new panels for possible
836
+ display. Any replacement for ContentPanel *must* implement
837
+ this method.
838
+
839
+ :Parameters:
840
+ `panel`: :class:`SettingsPanel`
841
+ It should be stored and the interface should provide a way to
842
+ switch between panels.
843
+ `name`:
844
+ The name of the panel as a string. It may be used to represent
845
+ the panel but may not be unique.
846
+ `uid`:
847
+ A unique int identifying the panel. It should be used to
848
+ identify and switch between panels.
849
+
850
+ '''
851
+ self.content.add_panel(panel, name, uid)
852
+ self.menu.add_item(name, uid)
853
+
854
+ def on_close(self, *args):
855
+ pass
856
+
857
+
858
+ class ContentPanel(ScrollView):
859
+ '''A class for displaying settings panels. It displays a single
860
+ settings panel at a time, taking up the full size and shape of the
861
+ ContentPanel. It is used by :class:`InterfaceWithSidebar` and
862
+ :class:`InterfaceWithSpinner` to display settings.
863
+
864
+ '''
865
+
866
+ panels = DictProperty({})
867
+ '''(internal) Stores a dictionary mapping settings panels to their uids.
868
+
869
+ :attr:`panels` is a :class:`~kivy.properties.DictProperty` and
870
+ defaults to {}.
871
+
872
+ '''
873
+
874
+ container = ObjectProperty()
875
+ '''(internal) A reference to the GridLayout that contains the
876
+ settings panel.
877
+
878
+ :attr:`container` is an :class:`~kivy.properties.ObjectProperty` and
879
+ defaults to None.
880
+
881
+ '''
882
+
883
+ current_panel = ObjectProperty(None)
884
+ '''(internal) A reference to the current settings panel.
885
+
886
+ :attr:`current_panel` is an :class:`~kivy.properties.ObjectProperty` and
887
+ defaults to None.
888
+
889
+ '''
890
+
891
+ current_uid = NumericProperty(0)
892
+ '''(internal) A reference to the uid of the current settings panel.
893
+
894
+ :attr:`current_uid` is a
895
+ :class:`~kivy.properties.NumericProperty` and defaults to 0.
896
+
897
+ '''
898
+
899
+ def add_panel(self, panel, name, uid):
900
+ '''This method is used by Settings to add new panels for possible
901
+ display. Any replacement for ContentPanel *must* implement
902
+ this method.
903
+
904
+ :Parameters:
905
+ `panel`: :class:`SettingsPanel`
906
+ It should be stored and displayed when requested.
907
+ `name`:
908
+ The name of the panel as a string. It may be used to represent
909
+ the panel.
910
+ `uid`:
911
+ A unique int identifying the panel. It should be stored and
912
+ used to identify panels when switching.
913
+
914
+ '''
915
+ self.panels[uid] = panel
916
+ if not self.current_uid:
917
+ self.current_uid = uid
918
+
919
+ def on_current_uid(self, *args):
920
+ '''The uid of the currently displayed panel. Changing this will
921
+ automatically change the displayed panel.
922
+
923
+ :Parameters:
924
+ `uid`:
925
+ A panel uid. It should be used to retrieve and display
926
+ a settings panel that has previously been added with
927
+ :meth:`add_panel`.
928
+
929
+ '''
930
+ uid = self.current_uid
931
+ if uid in self.panels:
932
+ if self.current_panel is not None:
933
+ self.remove_widget(self.current_panel)
934
+ new_panel = self.panels[uid]
935
+ self.add_widget(new_panel)
936
+ self.current_panel = new_panel
937
+ return True
938
+ return False # New uid doesn't exist
939
+
940
+ def add_widget(self, *args, **kwargs):
941
+ if self.container is None:
942
+ super(ContentPanel, self).add_widget(*args, **kwargs)
943
+ else:
944
+ self.container.add_widget(*args, **kwargs)
945
+
946
+ def remove_widget(self, *args, **kwargs):
947
+ self.container.remove_widget(*args, **kwargs)
948
+
949
+
950
+ class Settings(BoxLayout):
951
+
952
+ '''Settings UI. Check module documentation for more information on how
953
+ to use this class.
954
+
955
+ :Events:
956
+ `on_config_change`: ConfigParser instance, section, key, value
957
+ Fired when the section's key-value pair of a ConfigParser changes.
958
+
959
+ .. warning:
960
+
961
+ value will be str/unicode type, regardless of the setting
962
+ type (numeric, boolean, etc)
963
+ `on_close`
964
+ Fired by the default panel when the Close button is pressed.
965
+
966
+ '''
967
+
968
+ interface = ObjectProperty(None)
969
+ '''(internal) Reference to the widget that will contain, organise and
970
+ display the panel configuration panel widgets.
971
+
972
+ :attr:`interface` is an :class:`~kivy.properties.ObjectProperty` and
973
+ defaults to None.
974
+
975
+ '''
976
+
977
+ interface_cls = ObjectProperty(InterfaceWithSidebar)
978
+ '''The widget class that will be used to display the graphical
979
+ interface for the settings panel. By default, it displays one Settings
980
+ panel at a time with a sidebar to switch between them.
981
+
982
+ :attr:`interface_cls` is an
983
+ :class:`~kivy.properties.ObjectProperty` and defaults to
984
+ :class:`InterfaceWithSidebar`.
985
+
986
+ .. versionchanged:: 1.8.0
987
+ If you set a string, the :class:`~kivy.factory.Factory` will be used to
988
+ resolve the class.
989
+
990
+ '''
991
+
992
+ __events__ = ('on_close', 'on_config_change')
993
+
994
+ def __init__(self, *args, **kargs):
995
+ self._types = {}
996
+ super(Settings, self).__init__(*args, **kargs)
997
+ self.add_interface()
998
+ self.register_type('string', SettingString)
999
+ self.register_type('bool', SettingBoolean)
1000
+ self.register_type('numeric', SettingNumeric)
1001
+ self.register_type('options', SettingOptions)
1002
+ self.register_type('title', SettingTitle)
1003
+ self.register_type('path', SettingPath)
1004
+ self.register_type('color', SettingColor)
1005
+
1006
+ def on_touch_down(self, touch):
1007
+ if self.collide_point(*touch.pos):
1008
+ super(Settings, self).on_touch_down(touch)
1009
+ return True
1010
+
1011
+ def register_type(self, tp, cls):
1012
+ '''Register a new type that can be used in the JSON definition.
1013
+ '''
1014
+ self._types[tp] = cls
1015
+
1016
+ def on_close(self, *args):
1017
+ pass
1018
+
1019
+ def add_interface(self):
1020
+ '''(Internal) creates an instance of :attr:`Settings.interface_cls`,
1021
+ and sets it to :attr:`~Settings.interface`. When json panels are
1022
+ created, they will be added to this interface which will display them
1023
+ to the user.
1024
+ '''
1025
+ cls = self.interface_cls
1026
+ if isinstance(cls, string_types):
1027
+ cls = Factory.get(cls)
1028
+ interface = cls()
1029
+ self.interface = interface
1030
+ self.add_widget(interface)
1031
+ self.interface.bind(on_close=lambda j: self.dispatch('on_close'))
1032
+
1033
+ def on_config_change(self, config, section, key, value):
1034
+ pass
1035
+
1036
+ def add_json_panel(self, title, config, filename=None, data=None):
1037
+ '''Create and add a new :class:`SettingsPanel` using the configuration
1038
+ `config` with the JSON definition `filename`. If `filename` is not set,
1039
+ then the JSON definition is read from the `data` parameter instead.
1040
+
1041
+ Check the :ref:`settings_json` section in the documentation for more
1042
+ information about JSON format and the usage of this function.
1043
+ '''
1044
+ panel = self.create_json_panel(title, config, filename, data)
1045
+ uid = panel.uid
1046
+ if self.interface is not None:
1047
+ self.interface.add_panel(panel, title, uid)
1048
+
1049
+ def create_json_panel(self, title, config, filename=None, data=None):
1050
+ '''Create new :class:`SettingsPanel`.
1051
+
1052
+ .. versionadded:: 1.5.0
1053
+
1054
+ Check the documentation of :meth:`add_json_panel` for more information.
1055
+ '''
1056
+ if filename is None and data is None:
1057
+ raise Exception('You must specify either the filename or data')
1058
+ if filename is not None:
1059
+ with open(filename, 'r') as fd:
1060
+ data = json.loads(fd.read())
1061
+ else:
1062
+ data = json.loads(data)
1063
+ if not isinstance(data, list):
1064
+ raise ValueError('The first element must be a list')
1065
+ panel = SettingsPanel(title=title, settings=self, config=config)
1066
+
1067
+ for setting in data:
1068
+ # determine the type and the class to use
1069
+ if 'type' not in setting:
1070
+ raise ValueError('One setting are missing the "type" element')
1071
+ ttype = setting['type']
1072
+ cls = self._types.get(ttype)
1073
+ if cls is None:
1074
+ raise ValueError(
1075
+ 'No class registered to handle the <%s> type' %
1076
+ setting['type'])
1077
+
1078
+ # create a instance of the class, without the type attribute
1079
+ del setting['type']
1080
+ str_settings = {}
1081
+ for key, item in setting.items():
1082
+ str_settings[str(key)] = item
1083
+
1084
+ instance = cls(panel=panel, **str_settings)
1085
+
1086
+ # instance created, add to the panel
1087
+ panel.add_widget(instance)
1088
+
1089
+ return panel
1090
+
1091
+ def add_kivy_panel(self):
1092
+ '''Add a panel for configuring Kivy. This panel acts directly on the
1093
+ kivy configuration. Feel free to include or exclude it in your
1094
+ configuration.
1095
+
1096
+ See :meth:`~kivy.app.App.use_kivy_settings` for information on
1097
+ enabling/disabling the automatic kivy panel.
1098
+
1099
+ '''
1100
+ from kivy import kivy_data_dir
1101
+ from kivy.config import Config
1102
+ from os.path import join
1103
+ self.add_json_panel('Kivy', Config,
1104
+ join(kivy_data_dir, 'settings_kivy.json'))
1105
+
1106
+
1107
+ class SettingsWithSidebar(Settings):
1108
+ '''A settings widget that displays settings panels with a sidebar to
1109
+ switch between them. This is the default behavior of
1110
+ :class:`Settings`, and this widget is a trivial wrapper subclass.
1111
+
1112
+ '''
1113
+
1114
+
1115
+ class SettingsWithSpinner(Settings):
1116
+ '''A settings widget that displays one settings panel at a time with a
1117
+ spinner at the top to switch between them.
1118
+
1119
+ '''
1120
+ def __init__(self, *args, **kwargs):
1121
+ self.interface_cls = InterfaceWithSpinner
1122
+ super(SettingsWithSpinner, self).__init__(*args, **kwargs)
1123
+
1124
+
1125
+ class SettingsWithTabbedPanel(Settings):
1126
+ '''A settings widget that displays settings panels as pages in a
1127
+ :class:`~kivy.uix.tabbedpanel.TabbedPanel`.
1128
+ '''
1129
+
1130
+ __events__ = ('on_close', )
1131
+
1132
+ def __init__(self, *args, **kwargs):
1133
+ self.interface_cls = InterfaceWithTabbedPanel
1134
+ super(SettingsWithTabbedPanel, self).__init__(*args, **kwargs)
1135
+
1136
+ def on_close(self, *args):
1137
+ pass
1138
+
1139
+
1140
+ class SettingsWithNoMenu(Settings):
1141
+ '''A settings widget that displays a single settings panel with *no*
1142
+ Close button. It will not accept more than one Settings panel. It
1143
+ is intended for use in programs with few enough settings that a
1144
+ full panel switcher is not useful.
1145
+
1146
+ .. warning::
1147
+
1148
+ This Settings panel does *not* provide a Close
1149
+ button, and so it is impossible to leave the settings screen
1150
+ unless you also add other behavior or override
1151
+ :meth:`~kivy.app.App.display_settings` and
1152
+ :meth:`~kivy.app.App.close_settings`.
1153
+
1154
+ '''
1155
+ def __init__(self, *args, **kwargs):
1156
+ self.interface_cls = InterfaceWithNoMenu
1157
+ super(SettingsWithNoMenu, self).__init__(*args, **kwargs)
1158
+
1159
+
1160
+ class InterfaceWithNoMenu(ContentPanel):
1161
+ '''The interface widget used by :class:`SettingsWithNoMenu`. It
1162
+ stores and displays a single settings panel.
1163
+
1164
+ This widget is considered internal and is not documented. See the
1165
+ :class:`ContentPanel` for information on defining your own content
1166
+ widget.
1167
+
1168
+ '''
1169
+ def add_widget(self, *args, **kwargs):
1170
+ if self.container is not None and len(self.container.children) > 0:
1171
+ raise Exception(
1172
+ 'ContentNoMenu cannot accept more than one settings panel')
1173
+ super(InterfaceWithNoMenu, self).add_widget(*args, **kwargs)
1174
+
1175
+
1176
+ class InterfaceWithTabbedPanel(FloatLayout):
1177
+ '''The content widget used by :class:`SettingsWithTabbedPanel`. It
1178
+ stores and displays Settings panels in tabs of a TabbedPanel.
1179
+
1180
+ This widget is considered internal and is not documented. See
1181
+ :class:`InterfaceWithSidebar` for information on defining your own
1182
+ interface widget.
1183
+
1184
+ '''
1185
+ tabbedpanel = ObjectProperty()
1186
+ close_button = ObjectProperty()
1187
+
1188
+ __events__ = ('on_close', )
1189
+
1190
+ def __init__(self, *args, **kwargs):
1191
+ super(InterfaceWithTabbedPanel, self).__init__(*args, **kwargs)
1192
+ self.close_button.bind(on_release=lambda j: self.dispatch('on_close'))
1193
+
1194
+ def add_panel(self, panel, name, uid):
1195
+ scrollview = ScrollView()
1196
+ scrollview.add_widget(panel)
1197
+ if not self.tabbedpanel.default_tab_content:
1198
+ self.tabbedpanel.default_tab_text = name
1199
+ self.tabbedpanel.default_tab_content = scrollview
1200
+ else:
1201
+ panelitem = TabbedPanelHeader(text=name, content=scrollview)
1202
+ self.tabbedpanel.add_widget(panelitem)
1203
+
1204
+ def on_close(self, *args):
1205
+ pass
1206
+
1207
+
1208
+ class MenuSpinner(BoxLayout):
1209
+ '''The menu class used by :class:`SettingsWithSpinner`. It provides a
1210
+ sidebar with an entry for each settings panel.
1211
+
1212
+ This widget is considered internal and is not documented. See
1213
+ :class:`MenuSidebar` for information on menus and creating your own menu
1214
+ class.
1215
+
1216
+ '''
1217
+ selected_uid = NumericProperty(0)
1218
+ close_button = ObjectProperty(0)
1219
+ spinner = ObjectProperty()
1220
+ panel_names = DictProperty({})
1221
+ spinner_text = StringProperty()
1222
+ close_button = ObjectProperty()
1223
+
1224
+ def add_item(self, name, uid):
1225
+ values = self.spinner.values
1226
+ if name in values:
1227
+ i = 2
1228
+ while name + ' {}'.format(i) in values:
1229
+ i += 1
1230
+ name = name + ' {}'.format(i)
1231
+ self.panel_names[name] = uid
1232
+ self.spinner.values.append(name)
1233
+ if not self.spinner.text:
1234
+ self.spinner.text = name
1235
+
1236
+ def on_spinner_text(self, *args):
1237
+ text = self.spinner_text
1238
+ self.selected_uid = self.panel_names[text]
1239
+
1240
+
1241
+ class MenuSidebar(FloatLayout):
1242
+ '''The menu used by :class:`InterfaceWithSidebar`. It provides a
1243
+ sidebar with an entry for each settings panel, which the user may
1244
+ click to select.
1245
+
1246
+ '''
1247
+
1248
+ selected_uid = NumericProperty(0)
1249
+ '''The uid of the currently selected panel. This may be used to switch
1250
+ between displayed panels, e.g. by binding it to the
1251
+ :attr:`~ContentPanel.current_uid` of a :class:`ContentPanel`.
1252
+
1253
+ :attr:`selected_uid` is a
1254
+ :class:`~kivy.properties.NumericProperty` and defaults to 0.
1255
+
1256
+ '''
1257
+
1258
+ buttons_layout = ObjectProperty(None)
1259
+ '''(internal) Reference to the GridLayout that contains individual
1260
+ settings panel menu buttons.
1261
+
1262
+ :attr:`buttons_layout` is an
1263
+ :class:`~kivy.properties.ObjectProperty` and defaults to None.
1264
+
1265
+ '''
1266
+
1267
+ close_button = ObjectProperty(None)
1268
+ '''(internal) Reference to the widget's Close button.
1269
+
1270
+ :attr:`buttons_layout` is an
1271
+ :class:`~kivy.properties.ObjectProperty` and defaults to None.
1272
+
1273
+ '''
1274
+
1275
+ def add_item(self, name, uid):
1276
+ '''This method is used to add new panels to the menu.
1277
+
1278
+ :Parameters:
1279
+ `name`:
1280
+ The name (a string) of the panel. It should be used
1281
+ to represent the panel in the menu.
1282
+ `uid`:
1283
+ The name (an int) of the panel. It should be used internally
1284
+ to represent the panel and used to set self.selected_uid when
1285
+ the panel is changed.
1286
+
1287
+ '''
1288
+
1289
+ label = SettingSidebarLabel(text=name, uid=uid, menu=self)
1290
+ if len(self.buttons_layout.children) == 0:
1291
+ label.selected = True
1292
+ if self.buttons_layout is not None:
1293
+ self.buttons_layout.add_widget(label)
1294
+
1295
+ def on_selected_uid(self, *args):
1296
+ '''(internal) unselects any currently selected menu buttons, unless
1297
+ they represent the current panel.
1298
+
1299
+ '''
1300
+ for button in self.buttons_layout.children:
1301
+ if button.uid != self.selected_uid:
1302
+ button.selected = False
1303
+
1304
+
1305
+ class SettingSidebarLabel(Label):
1306
+ # Internal class, not documented.
1307
+ selected = BooleanProperty(False)
1308
+ uid = NumericProperty(0)
1309
+ menu = ObjectProperty(None)
1310
+
1311
+ def on_touch_down(self, touch):
1312
+ if not self.collide_point(*touch.pos):
1313
+ return
1314
+ self.selected = True
1315
+ self.menu.selected_uid = self.uid
1316
+
1317
+
1318
+ if __name__ == '__main__':
1319
+ from kivy.app import App
1320
+
1321
+ class SettingsApp(App):
1322
+ demo_json_settings = json.dumps([
1323
+ {
1324
+ 'type': 'color',
1325
+ 'title': 'Test color',
1326
+ 'desc': 'Your chosen Color',
1327
+ 'section': 'colorselection',
1328
+ 'key': 'testcolor'
1329
+ }])
1330
+
1331
+ def build(self):
1332
+ s = Settings()
1333
+ s.add_kivy_panel()
1334
+ s.add_json_panel('Color settings',
1335
+ self.config,
1336
+ data=self.demo_json_settings)
1337
+ s.bind(on_close=self.stop)
1338
+ return s
1339
+
1340
+ def build_config(self, config):
1341
+ config.setdefaults('colorselection', {'testcolor': '#FF0000'})
1342
+
1343
+ SettingsApp().run()