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/rst.py ADDED
@@ -0,0 +1,1492 @@
1
+ '''
2
+ reStructuredText renderer
3
+ =========================
4
+
5
+ .. versionadded:: 1.1.0
6
+
7
+ `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ is an
8
+ easy-to-read, what-you-see-is-what-you-get plaintext markup syntax and parser
9
+ system.
10
+
11
+ .. note::
12
+
13
+ This widget requires the ``docutils`` package to run. Install it with
14
+ ``pip`` or include it as one of your deployment requirements.
15
+
16
+ .. warning::
17
+
18
+ This widget is highly experimental. The styling and implementation should
19
+ not be considered stable until this warning has been removed.
20
+
21
+ Usage with Text
22
+ ---------------
23
+
24
+ ::
25
+
26
+ text = """
27
+ .. _top:
28
+
29
+ Hello world
30
+ ===========
31
+
32
+ This is an **emphased text**, some ``interpreted text``.
33
+ And this is a reference to top_::
34
+
35
+ $ print("Hello world")
36
+
37
+ """
38
+ document = RstDocument(text=text)
39
+
40
+ The rendering will output:
41
+
42
+ .. image:: images/rstdocument.png
43
+
44
+ Usage with Source
45
+ -----------------
46
+
47
+ You can also render a rst file using the :attr:`~RstDocument.source` property::
48
+
49
+ document = RstDocument(source='index.rst')
50
+
51
+ You can reference other documents using the role ``:doc:``. For example, in the
52
+ document ``index.rst`` you can write::
53
+
54
+ Go to my next document: :doc:`moreinfo.rst`
55
+
56
+ It will generate a link that, when clicked, opens the ``moreinfo.rst``
57
+ document.
58
+
59
+ '''
60
+
61
+ __all__ = ('RstDocument', )
62
+
63
+ import os
64
+ from os.path import dirname, join, exists, abspath
65
+ from kivy.clock import Clock
66
+ from kivy.compat import PY2
67
+ from kivy.properties import ObjectProperty, NumericProperty, \
68
+ DictProperty, ListProperty, StringProperty, \
69
+ BooleanProperty, OptionProperty, AliasProperty
70
+ from kivy.lang import Builder
71
+ from kivy.utils import get_hex_from_color, get_color_from_hex
72
+ from kivy.uix.widget import Widget
73
+ from kivy.uix.scrollview import ScrollView
74
+ from kivy.uix.gridlayout import GridLayout
75
+ from kivy.uix.label import Label
76
+ from kivy.uix.image import AsyncImage, Image
77
+ from kivy.uix.videoplayer import VideoPlayer
78
+ from kivy.uix.anchorlayout import AnchorLayout
79
+ from kivy.animation import Animation
80
+ from kivy.logger import Logger
81
+ from docutils.parsers import rst
82
+ from docutils.parsers.rst import roles
83
+ from docutils import nodes, frontend, utils
84
+ from docutils.parsers.rst import Directive, directives
85
+ from docutils.parsers.rst.roles import set_classes
86
+
87
+
88
+ #
89
+ # Handle some additional roles
90
+ #
91
+ if 'KIVY_DOC' not in os.environ:
92
+
93
+ class role_doc(nodes.Inline, nodes.TextElement):
94
+ pass
95
+
96
+ class role_video(nodes.General, nodes.TextElement):
97
+ pass
98
+
99
+ class VideoDirective(Directive):
100
+ has_content = False
101
+ required_arguments = 1
102
+ optional_arguments = 0
103
+ final_argument_whitespace = True
104
+ option_spec = {'width': directives.nonnegative_int,
105
+ 'height': directives.nonnegative_int}
106
+
107
+ def run(self):
108
+ set_classes(self.options)
109
+ node = role_video(source=self.arguments[0], **self.options)
110
+ return [node]
111
+
112
+ generic_docroles = {
113
+ 'doc': role_doc}
114
+
115
+ for rolename, nodeclass in generic_docroles.items():
116
+ generic = roles.GenericRole(rolename, nodeclass)
117
+ role = roles.CustomRole(rolename, generic, {'classes': [rolename]})
118
+ roles.register_local_role(rolename, role)
119
+
120
+ directives.register_directive('video', VideoDirective)
121
+
122
+ Builder.load_string('''
123
+ #:import parse_color kivy.parser.parse_color
124
+
125
+
126
+
127
+ <RstDocument>:
128
+ content: content
129
+ scatter: scatter
130
+ do_scroll_x: False
131
+ canvas.before:
132
+ Color:
133
+ rgba: parse_color(root.colors['background'])
134
+ Rectangle:
135
+ pos: self.pos
136
+ size: self.size
137
+
138
+ Scatter:
139
+ id: scatter
140
+ size_hint_y: None
141
+ height: content.minimum_height
142
+ width: root.width
143
+ scale: 1
144
+ do_translation: False, False
145
+ do_scale: False
146
+ do_rotation: False
147
+
148
+ GridLayout:
149
+ id: content
150
+ cols: 1
151
+ height: self.minimum_height
152
+ width: root.width
153
+ padding: 10
154
+
155
+ <RstTitle>:
156
+ markup: True
157
+ valign: 'top'
158
+ font_size:
159
+ sp(self.document.base_font_size - self.section * (
160
+ self.document.base_font_size / 31.0 * 2))
161
+ size_hint_y: None
162
+ height: self.texture_size[1] + dp(20)
163
+ text_size: self.width, None
164
+ bold: True
165
+
166
+ canvas:
167
+ Color:
168
+ rgba: parse_color(self.document.underline_color)
169
+ Rectangle:
170
+ pos: self.x, self.y + 5
171
+ size: self.width, 1
172
+
173
+
174
+ <RstParagraph>:
175
+ markup: True
176
+ valign: 'top'
177
+ size_hint_y: None
178
+ height: self.texture_size[1] + self.my
179
+ text_size: self.width - self.mx, None
180
+ font_size: sp(self.document.base_font_size / 2.0)
181
+
182
+ <RstTerm>:
183
+ size_hint: None, None
184
+ height: label.height
185
+ anchor_x: 'left'
186
+ Label:
187
+ id: label
188
+ text: root.text
189
+ markup: True
190
+ valign: 'top'
191
+ size_hint: None, None
192
+ size: self.texture_size[0] + dp(10), self.texture_size[1] + dp(10)
193
+ font_size: sp(root.document.base_font_size / 2.0)
194
+
195
+ <RstBlockQuote>:
196
+ cols: 2
197
+ content: content
198
+ size_hint_y: None
199
+ height: content.height
200
+ Widget:
201
+ size_hint_x: None
202
+ width: 20
203
+ GridLayout:
204
+ id: content
205
+ cols: 1
206
+ size_hint_y: None
207
+ height: self.minimum_height
208
+
209
+ <RstLiteralBlock>:
210
+ cols: 1
211
+ content: content
212
+ size_hint_y: None
213
+ height: content.texture_size[1] + dp(20)
214
+ canvas:
215
+ Color:
216
+ rgb: parse_color('#cccccc')
217
+ Rectangle:
218
+ pos: self.x - 1, self.y - 1
219
+ size: self.width + 2, self.height + 2
220
+ Color:
221
+ rgb: parse_color('#eeeeee')
222
+ Rectangle:
223
+ pos: self.pos
224
+ size: self.size
225
+ Label:
226
+ id: content
227
+ markup: True
228
+ valign: 'top'
229
+ text_size: self.width - 20, None
230
+ font_name: 'data/fonts/RobotoMono-Regular.ttf'
231
+ color: (0, 0, 0, 1)
232
+
233
+ <RstList>:
234
+ cols: 2
235
+ size_hint_y: None
236
+ height: self.minimum_height
237
+
238
+ <RstListItem>:
239
+ cols: 1
240
+ size_hint_y: None
241
+ height: self.minimum_height
242
+
243
+ <RstSystemMessage>:
244
+ cols: 1
245
+ size_hint_y: None
246
+ height: self.minimum_height
247
+ canvas:
248
+ Color:
249
+ rgba: 1, 0, 0, .3
250
+ Rectangle:
251
+ pos: self.pos
252
+ size: self.size
253
+
254
+ <RstWarning>:
255
+ content: content
256
+ cols: 1
257
+ padding: 20
258
+ size_hint_y: None
259
+ height: self.minimum_height
260
+ canvas:
261
+ Color:
262
+ rgba: 1, 0, 0, .5
263
+ Rectangle:
264
+ pos: self.x + 10, self.y + 10
265
+ size: self.width - 20, self.height - 20
266
+ GridLayout:
267
+ cols: 1
268
+ id: content
269
+ size_hint_y: None
270
+ height: self.minimum_height
271
+
272
+ <RstNote>:
273
+ content: content
274
+ cols: 1
275
+ padding: 20
276
+ size_hint_y: None
277
+ height: self.minimum_height
278
+ canvas:
279
+ Color:
280
+ rgba: 0, 1, 0, .5
281
+ Rectangle:
282
+ pos: self.x + 10, self.y + 10
283
+ size: self.width - 20, self.height - 20
284
+ GridLayout:
285
+ cols: 1
286
+ id: content
287
+ size_hint_y: None
288
+ height: self.minimum_height
289
+
290
+ <RstImage>:
291
+ size_hint: None, None
292
+ size: self.texture_size[0], self.texture_size[1] + dp(10)
293
+
294
+ <RstAsyncImage>:
295
+ size_hint: None, None
296
+ size: self.texture_size[0], self.texture_size[1] + dp(10)
297
+
298
+ <RstDefinitionList>:
299
+ cols: 1
300
+ size_hint_y: None
301
+ height: self.minimum_height
302
+ font_size: sp(self.document.base_font_size / 2.0)
303
+
304
+ <RstDefinition>:
305
+ cols: 2
306
+ size_hint_y: None
307
+ height: self.minimum_height
308
+ font_size: sp(self.document.base_font_size / 2.0)
309
+
310
+ <RstFieldList>:
311
+ cols: 2
312
+ size_hint_y: None
313
+ height: self.minimum_height
314
+
315
+ <RstFieldName>:
316
+ markup: True
317
+ valign: 'top'
318
+ size_hint: 0.2, 1
319
+ color: (0, 0, 0, 1)
320
+ bold: True
321
+ text_size: self.width - 10, self.height - 10
322
+ valign: 'top'
323
+ font_size: sp(self.document.base_font_size / 2.0)
324
+
325
+ <RstFieldBody>:
326
+ cols: 1
327
+ size_hint_y: None
328
+ height: self.minimum_height
329
+
330
+ <RstFootnote>:
331
+ cols: 2
332
+ size_hint_y: None
333
+ height: self.minimum_height
334
+
335
+ <RstFootName>:
336
+ markup: True
337
+ valign: 'top'
338
+ size_hint: 0.2, 1
339
+ color: (0, 0, 0, 1)
340
+ bold: True
341
+ text_size: self.width - 10, self.height - 10
342
+ valign: 'top'
343
+ font_size: sp(self.document.base_font_size / 2.0)
344
+
345
+ <RstTable>:
346
+ size_hint_y: None
347
+ height: self.minimum_height
348
+
349
+ <RstEntry>:
350
+ cols: 1
351
+ size_hint_y: None
352
+ height: self.minimum_height
353
+
354
+ canvas:
355
+ Color:
356
+ rgb: .2, .2, .2
357
+ Line:
358
+ points: [\
359
+ self.x,\
360
+ self.y,\
361
+ self.right,\
362
+ self.y,\
363
+ self.right,\
364
+ self.top,\
365
+ self.x,\
366
+ self.top,\
367
+ self.x,\
368
+ self.y]
369
+
370
+ <RstTransition>:
371
+ size_hint_y: None
372
+ height: 20
373
+ canvas:
374
+ Color:
375
+ rgb: .2, .2, .2
376
+ Line:
377
+ points: [self.x, self.center_y, self.right, self.center_y]
378
+
379
+ <RstListBullet>:
380
+ markup: True
381
+ valign: 'top'
382
+ size_hint_x: None
383
+ width: self.texture_size[0] + dp(10)
384
+ text_size: None, self.height - dp(10)
385
+ font_size: sp(self.document.base_font_size / 2.0)
386
+
387
+ <RstEmptySpace>:
388
+ size_hint: 0.01, 0.01
389
+
390
+ <RstDefinitionSpace>:
391
+ size_hint: None, 0.1
392
+ width: 50
393
+ font_size: sp(self.document.base_font_size / 2.0)
394
+
395
+ <RstVideoPlayer>:
396
+ options: {'fit_mode': 'contain'}
397
+ canvas.before:
398
+ Color:
399
+ rgba: (1, 1, 1, 1)
400
+ BorderImage:
401
+ source: 'atlas://data/images/defaulttheme/player-background'
402
+ pos: self.x - 25, self.y - 25
403
+ size: self.width + 50, self.height + 50
404
+ border: (25, 25, 25, 25)
405
+ ''')
406
+
407
+
408
+ class RstVideoPlayer(VideoPlayer):
409
+ pass
410
+
411
+
412
+ class RstDocument(ScrollView):
413
+ '''Base widget used to store an Rst document. See module documentation for
414
+ more information.
415
+ '''
416
+ source = StringProperty(None)
417
+ '''Filename of the RST document.
418
+
419
+ :attr:`source` is a :class:`~kivy.properties.StringProperty` and
420
+ defaults to None.
421
+ '''
422
+
423
+ source_encoding = StringProperty('utf-8')
424
+ '''Encoding to be used for the :attr:`source` file.
425
+
426
+ :attr:`source_encoding` is a :class:`~kivy.properties.StringProperty` and
427
+ defaults to `utf-8`.
428
+
429
+ .. Note::
430
+ It is your responsibility to ensure that the value provided is a
431
+ valid codec supported by python.
432
+ '''
433
+
434
+ source_error = OptionProperty('strict',
435
+ options=('strict', 'ignore', 'replace',
436
+ 'xmlcharrefreplace',
437
+ 'backslashreplac'))
438
+ '''Error handling to be used while encoding the :attr:`source` file.
439
+
440
+ :attr:`source_error` is an :class:`~kivy.properties.OptionProperty` and
441
+ defaults to `strict`. Can be one of 'strict', 'ignore', 'replace',
442
+ 'xmlcharrefreplace' or 'backslashreplac'.
443
+ '''
444
+
445
+ text = StringProperty(None)
446
+ '''RST markup text of the document.
447
+
448
+ :attr:`text` is a :class:`~kivy.properties.StringProperty` and defaults to
449
+ None.
450
+ '''
451
+
452
+ document_root = StringProperty(None)
453
+ '''Root path where :doc: will search for rst documents. If no path is
454
+ given, it will use the directory of the first loaded source file.
455
+
456
+ :attr:`document_root` is a :class:`~kivy.properties.StringProperty` and
457
+ defaults to None.
458
+ '''
459
+
460
+ base_font_size = NumericProperty(31)
461
+ '''Font size for the biggest title, 31 by default. All other font sizes are
462
+ derived from this.
463
+
464
+ .. versionadded:: 1.8.0
465
+ '''
466
+
467
+ show_errors = BooleanProperty(False)
468
+ '''Indicate whether RST parsers errors should be shown on the screen
469
+ or not.
470
+
471
+ :attr:`show_errors` is a :class:`~kivy.properties.BooleanProperty` and
472
+ defaults to False.
473
+ '''
474
+
475
+ def _get_bgc(self):
476
+ return get_color_from_hex(self.colors.background)
477
+
478
+ def _set_bgc(self, value):
479
+ self.colors.background = get_hex_from_color(value)[1:]
480
+
481
+ background_color = AliasProperty(_get_bgc, _set_bgc,
482
+ bind=('colors',),
483
+ cache=True)
484
+ '''Specifies the background_color to be used for the RstDocument.
485
+
486
+ .. versionadded:: 1.8.0
487
+
488
+ :attr:`background_color` is an :class:`~kivy.properties.AliasProperty`
489
+ for colors['background'].
490
+ '''
491
+
492
+ colors = DictProperty({
493
+ 'background': 'e5e6e9ff',
494
+ 'link': 'ce5c00ff',
495
+ 'paragraph': '202020ff',
496
+ 'title': '204a87ff',
497
+ 'bullet': '000000ff'})
498
+ '''Dictionary of all the colors used in the RST rendering.
499
+
500
+ .. warning::
501
+
502
+ This dictionary is needs special handling. You also need to call
503
+ :meth:`RstDocument.render` if you change them after loading.
504
+
505
+ :attr:`colors` is a :class:`~kivy.properties.DictProperty`.
506
+ '''
507
+
508
+ title = StringProperty('')
509
+ '''Title of the current document.
510
+
511
+ :attr:`title` is a :class:`~kivy.properties.StringProperty` and defaults to
512
+ ''. It is read-only.
513
+ '''
514
+
515
+ toctrees = DictProperty({})
516
+ '''Toctree of all loaded or preloaded documents. This dictionary is filled
517
+ when a rst document is explicitly loaded or where :meth:`preload` has been
518
+ called.
519
+
520
+ If the document has no filename, e.g. when the document is loaded from a
521
+ text file, the key will be ''.
522
+
523
+ :attr:`toctrees` is a :class:`~kivy.properties.DictProperty` and defaults
524
+ to {}.
525
+ '''
526
+
527
+ underline_color = StringProperty('204a9699')
528
+ '''underline color of the titles, expressed in html color notation
529
+
530
+ :attr:`underline_color` is a
531
+ :class:`~kivy.properties.StringProperty` and defaults to '204a9699'.
532
+
533
+ .. versionadded: 1.9.0
534
+ '''
535
+
536
+ # internals.
537
+ content = ObjectProperty(None)
538
+ scatter = ObjectProperty(None)
539
+ anchors_widgets = ListProperty([])
540
+ refs_assoc = DictProperty({})
541
+
542
+ def __init__(self, **kwargs):
543
+ self._trigger_load = Clock.create_trigger(self._load_from_text, -1)
544
+ self._parser = rst.Parser()
545
+ self._settings = frontend.OptionParser(
546
+ components=(rst.Parser, )).get_default_values()
547
+ super(RstDocument, self).__init__(**kwargs)
548
+
549
+ def on_source(self, instance, value):
550
+ if not value:
551
+ return
552
+ if self.document_root is None:
553
+ # set the documentation root to the directory name of the
554
+ # first tile
555
+ self.document_root = abspath(dirname(value))
556
+ self._load_from_source()
557
+
558
+ def on_text(self, instance, value):
559
+ self._trigger_load()
560
+
561
+ def render(self):
562
+ '''Force document rendering.
563
+ '''
564
+ self._load_from_text()
565
+
566
+ def resolve_path(self, filename):
567
+ '''Get the path for this filename. If the filename doesn't exist,
568
+ it returns the document_root + filename.
569
+ '''
570
+ if exists(filename):
571
+ return filename
572
+ return join(self.document_root, filename)
573
+
574
+ def preload(self, filename, encoding='utf-8', errors='strict'):
575
+ '''Preload a rst file to get its toctree and its title.
576
+
577
+ The result will be stored in :attr:`toctrees` with the ``filename`` as
578
+ key.
579
+ '''
580
+
581
+ with open(filename, 'rb') as fd:
582
+ text = fd.read().decode(encoding, errors)
583
+ # parse the source
584
+ document = utils.new_document('Document', self._settings)
585
+ self._parser.parse(text, document)
586
+ # fill the current document node
587
+ visitor = _ToctreeVisitor(document)
588
+ document.walkabout(visitor)
589
+ self.toctrees[filename] = visitor.toctree
590
+ return text
591
+
592
+ def _load_from_source(self):
593
+ filename = self.resolve_path(self.source)
594
+ self.text = self.preload(filename,
595
+ self.source_encoding,
596
+ self.source_error)
597
+
598
+ def _load_from_text(self, *largs):
599
+ try:
600
+ # clear the current widgets
601
+ self.content.clear_widgets()
602
+ self.anchors_widgets = []
603
+ self.refs_assoc = {}
604
+
605
+ # parse the source
606
+ document = utils.new_document('Document', self._settings)
607
+ text = self.text
608
+ if PY2 and type(text) is str:
609
+ text = text.decode('utf-8')
610
+ self._parser.parse(text, document)
611
+
612
+ # fill the current document node
613
+ visitor = _Visitor(self, document)
614
+ document.walkabout(visitor)
615
+
616
+ self.title = visitor.title or 'No title'
617
+ except:
618
+ Logger.exception('Rst: error while loading text')
619
+
620
+ def on_ref_press(self, node, ref):
621
+ self.goto(ref)
622
+
623
+ def goto(self, ref, *largs):
624
+ '''Scroll to the reference. If it's not found, nothing will be done.
625
+
626
+ For this text::
627
+
628
+ .. _myref:
629
+
630
+ This is something I always wanted.
631
+
632
+ You can do::
633
+
634
+ from kivy.clock import Clock
635
+ from functools import partial
636
+
637
+ doc = RstDocument(...)
638
+ Clock.schedule_once(partial(doc.goto, 'myref'), 0.1)
639
+
640
+ .. note::
641
+
642
+ It is preferable to delay the call of the goto if you just loaded
643
+ the document because the layout might not be finished or the
644
+ size of the RstDocument has not yet been determined. In
645
+ either case, the calculation of the scrolling would be
646
+ wrong.
647
+
648
+ You can, however, do a direct call if the document is already
649
+ loaded.
650
+
651
+ .. versionadded:: 1.3.0
652
+ '''
653
+ # check if it's a file ?
654
+ if ref.endswith('.rst'):
655
+ # whether it's a valid or invalid file, let source deal with it
656
+ self.source = ref
657
+ return
658
+
659
+ # get the association
660
+ ref = self.refs_assoc.get(ref, ref)
661
+
662
+ # search into all the nodes containing anchors
663
+ ax = ay = None
664
+ for node in self.anchors_widgets:
665
+ if ref in node.anchors:
666
+ ax, ay = node.anchors[ref]
667
+ break
668
+
669
+ # not found, stop here
670
+ if ax is None:
671
+ return
672
+
673
+ # found, calculate the real coordinate
674
+
675
+ # get the anchor coordinate inside widget space
676
+ ax += node.x
677
+ ay = node.top - ay
678
+ # ay += node.y
679
+
680
+ # what's the current coordinate for us?
681
+ sx, sy = self.scatter.x, self.scatter.top
682
+ # ax, ay = self.scatter.to_parent(ax, ay)
683
+
684
+ ay -= self.height
685
+
686
+ dx, dy = self.convert_distance_to_scroll(0, ay)
687
+ dy = max(0, min(1, dy))
688
+ Animation(scroll_y=dy, d=.25, t='in_out_expo').start(self)
689
+
690
+ def add_anchors(self, node):
691
+ self.anchors_widgets.append(node)
692
+
693
+
694
+ class RstTitle(Label):
695
+
696
+ section = NumericProperty(0)
697
+
698
+ document = ObjectProperty(None)
699
+
700
+
701
+ class RstParagraph(Label):
702
+
703
+ mx = NumericProperty(10)
704
+
705
+ my = NumericProperty(10)
706
+
707
+ document = ObjectProperty(None)
708
+
709
+
710
+ class RstTerm(AnchorLayout):
711
+
712
+ text = StringProperty('')
713
+
714
+ document = ObjectProperty(None)
715
+
716
+
717
+ class RstBlockQuote(GridLayout):
718
+ content = ObjectProperty(None)
719
+
720
+
721
+ class RstLiteralBlock(GridLayout):
722
+ content = ObjectProperty(None)
723
+
724
+
725
+ class RstList(GridLayout):
726
+ pass
727
+
728
+
729
+ class RstListItem(GridLayout):
730
+ content = ObjectProperty(None)
731
+
732
+
733
+ class RstListBullet(Label):
734
+
735
+ document = ObjectProperty(None)
736
+
737
+
738
+ class RstSystemMessage(GridLayout):
739
+ pass
740
+
741
+
742
+ class RstWarning(GridLayout):
743
+ content = ObjectProperty(None)
744
+
745
+
746
+ class RstNote(GridLayout):
747
+ content = ObjectProperty(None)
748
+
749
+
750
+ class RstImage(Image):
751
+ pass
752
+
753
+
754
+ class RstAsyncImage(AsyncImage):
755
+ pass
756
+
757
+
758
+ class RstDefinitionList(GridLayout):
759
+
760
+ document = ObjectProperty(None)
761
+
762
+
763
+ class RstDefinition(GridLayout):
764
+
765
+ document = ObjectProperty(None)
766
+
767
+
768
+ class RstFieldList(GridLayout):
769
+ pass
770
+
771
+
772
+ class RstFieldName(Label):
773
+
774
+ document = ObjectProperty(None)
775
+
776
+
777
+ class RstFieldBody(GridLayout):
778
+ pass
779
+
780
+
781
+ class RstFootnote(GridLayout):
782
+ pass
783
+
784
+
785
+ class RstFootName(Label):
786
+
787
+ document = ObjectProperty(None)
788
+
789
+
790
+ class RstGridLayout(GridLayout):
791
+ pass
792
+
793
+
794
+ class RstTable(GridLayout):
795
+ pass
796
+
797
+
798
+ class RstEntry(GridLayout):
799
+ pass
800
+
801
+
802
+ class RstTransition(Widget):
803
+ pass
804
+
805
+
806
+ class RstEmptySpace(Widget):
807
+ pass
808
+
809
+
810
+ class RstDefinitionSpace(Widget):
811
+
812
+ document = ObjectProperty(None)
813
+
814
+
815
+ class _ToctreeVisitor(nodes.NodeVisitor):
816
+
817
+ def __init__(self, *largs):
818
+ self.toctree = self.current = []
819
+ self.queue = []
820
+ self.text = ''
821
+ nodes.NodeVisitor.__init__(self, *largs)
822
+
823
+ def push(self, tree):
824
+ self.queue.append(tree)
825
+ self.current = tree
826
+
827
+ def pop(self):
828
+ self.current = self.queue.pop()
829
+
830
+ def dispatch_visit(self, node):
831
+ cls = node.__class__
832
+ if cls is nodes.section:
833
+ section = {
834
+ 'ids': node['ids'],
835
+ 'names': node['names'],
836
+ 'title': '',
837
+ 'children': []}
838
+ if isinstance(self.current, dict):
839
+ self.current['children'].append(section)
840
+ else:
841
+ self.current.append(section)
842
+ self.push(section)
843
+ elif cls is nodes.title:
844
+ self.text = ''
845
+ elif cls is nodes.Text:
846
+ self.text += node
847
+
848
+ def dispatch_departure(self, node):
849
+ cls = node.__class__
850
+ if cls is nodes.section:
851
+ self.pop()
852
+ elif cls is nodes.title:
853
+ self.current['title'] = self.text
854
+
855
+
856
+ class _Visitor(nodes.NodeVisitor):
857
+
858
+ def __init__(self, root, *largs):
859
+ self.root = root
860
+ self.title = None
861
+ self.current_list = []
862
+ self.current = None
863
+ self.idx_list = None
864
+ self.text = ''
865
+ self.text_have_anchor = False
866
+ self.section = 0
867
+ self.do_strip_text = False
868
+ self.substitution = {}
869
+
870
+ # store refblock here while building
871
+ self.foot_refblock = None
872
+
873
+ # store order for autonum/sym footnotes+refs
874
+ self.footnotes = {
875
+ 'autonum': 0,
876
+ 'autosym': 0,
877
+ 'autonum_ref': 0,
878
+ 'autosym_ref': 0,
879
+ }
880
+
881
+ # last four default chars aren't in our Roboto font,
882
+ # those were replaced with something else
883
+ self.footlist = [
884
+ '\u002A', # asterisk
885
+ '\u2020', # dagger
886
+ '\u2021', # doubledagger
887
+ '\u00A7', # section
888
+ '\u00B6', # pilcrow
889
+ '\u0023', # number
890
+ '\u2206', # cap delta
891
+ '\u220F', # cap pi
892
+ '\u0470', # cap psi
893
+ '\u0466', # cap yus
894
+ ]
895
+ nodes.NodeVisitor.__init__(self, *largs)
896
+
897
+ def push(self, widget):
898
+ self.current_list.append(self.current)
899
+ self.current = widget
900
+
901
+ def pop(self):
902
+ self.current = self.current_list.pop()
903
+
904
+ def brute_refs(self, node):
905
+ # get foot/cit refs manually because the output from
906
+ # docutils' parser doesn't contain any of these:
907
+ # node's refid, refname, backref, ... and/or are just ''/[]
908
+
909
+ def get_refs(condition, backref=False):
910
+ # backref=True is used in nodes.footnote
911
+ autonum = autosym = 0
912
+ _nodes = node.traverse(condition=condition, ascend=False)
913
+
914
+ for f in _nodes:
915
+ id = f['ids'][0]
916
+ auto = ''
917
+ if 'auto' in f:
918
+ auto = f['auto']
919
+
920
+ # auto is either 1(int) or '*'
921
+ if auto == 1:
922
+ autonum += 1
923
+ key = 'backref' + str(autonum) if backref else str(autonum)
924
+ self.root.refs_assoc[key] = id
925
+ elif auto == '*':
926
+ sym = self.footlist[
927
+ autosym % 10
928
+ ] * (int(autosym / 10) + 1)
929
+ key = 'backref' + sym if backref else sym
930
+ self.root.refs_assoc[key] = id
931
+ autosym += 1
932
+ else:
933
+ if not backref:
934
+ key = f['names'][0]
935
+ if key:
936
+ self.root.refs_assoc[key] = id
937
+ continue
938
+
939
+ key = 'backref' + f['refname'][0]
940
+
941
+ if key in self.root.refs_assoc:
942
+ self.root.refs_assoc[key].append(id)
943
+ else:
944
+ self.root.refs_assoc[key] = [id, ]
945
+
946
+ # these are unique and need to go FIRST
947
+ get_refs(nodes.footnote, backref=False)
948
+
949
+ # autonum & autosym are unique
950
+ get_refs(nodes.footnote_reference, backref=True)
951
+
952
+ def dispatch_visit(self, node):
953
+ cls = node.__class__
954
+ if cls is nodes.document:
955
+ self.push(self.root.content)
956
+ self.brute_refs(node)
957
+
958
+ elif cls is nodes.comment:
959
+ return
960
+
961
+ elif cls is nodes.section:
962
+ self.section += 1
963
+
964
+ elif cls is nodes.substitution_definition:
965
+ name = node.attributes['names'][0]
966
+ self.substitution[name] = node.children[0]
967
+
968
+ elif cls is nodes.substitution_reference:
969
+ node = self.substitution[node.attributes['refname']]
970
+ # it can be e.g. image or something else too!
971
+ if isinstance(node, nodes.Text):
972
+ self.text += node
973
+
974
+ elif cls is nodes.footnote:
975
+ # .. [x] footnote
976
+ text = ''
977
+ foot = RstFootnote()
978
+ ids = node.attributes['ids']
979
+ self.current.add_widget(foot)
980
+ self.push(foot)
981
+
982
+ # check if its autonumbered
983
+ auto = ''
984
+ if 'auto' in node.attributes:
985
+ auto = node.attributes['auto']
986
+
987
+ # auto is either 1(int) or '*'
988
+ if auto == 1:
989
+ self.footnotes['autonum'] += 1
990
+ name = str(self.footnotes['autonum'])
991
+ node_id = node.attributes['ids'][0]
992
+ elif auto == '*':
993
+ autosym = self.footnotes['autosym']
994
+ name = self.footlist[
995
+ autosym % 10
996
+ ] * (int(autosym / 10) + 1)
997
+ self.footnotes['autosym'] += 1
998
+ node_id = node.attributes['ids'][0]
999
+ else:
1000
+ # can have multiple refs:
1001
+ # [8] (1, 2) Footnote ref
1002
+ name = node.attributes['names'][0]
1003
+ node_id = node['ids'][0]
1004
+
1005
+ # we can have a footnote without any link or ref
1006
+ # .. [1] Empty footnote
1007
+ link = self.root.refs_assoc.get(name, '')
1008
+
1009
+ # handle no refs
1010
+ ref = self.root.refs_assoc.get('backref' + name, '')
1011
+
1012
+ # colorize only with refs
1013
+ colorized = self.colorize(name, 'link') if ref else name
1014
+
1015
+ # has no refs
1016
+ if not ref:
1017
+ text = '&bl;%s&br;' % (colorized)
1018
+ # list of refs
1019
+ elif ref and isinstance(ref, list):
1020
+ ref_block = [
1021
+ '[ref=%s][u]%s[/u][/ref]' % (r, i + 1)
1022
+ for i, r in enumerate(ref)
1023
+ ]
1024
+ # [1] ( 1, 2, ...) Footnote
1025
+ self.foot_refblock = ''.join([
1026
+ '[i]( ', ', '.join(ref_block), ' )[/i]'
1027
+ ])
1028
+
1029
+ text = '[anchor=%s]&bl;%s&br;' % (
1030
+ node['ids'][0], colorized
1031
+ )
1032
+ # single ref
1033
+ else:
1034
+ text = '[anchor=%s][ref=%s]&bl;%s&br;[/ref]' % (
1035
+ node['ids'][0], ref, colorized
1036
+ )
1037
+
1038
+ name = RstFootName(
1039
+ document=self.root,
1040
+ text=text,
1041
+ )
1042
+ self.current.add_widget(name)
1043
+ # give it anchor + event manually
1044
+ self.root.add_anchors(name)
1045
+ name.bind(on_ref_press=self.root.on_ref_press)
1046
+
1047
+ elif cls is nodes.footnote_reference:
1048
+ self.text += '&bl;'
1049
+ text = ''
1050
+ name = ''
1051
+
1052
+ # check if its autonumbered
1053
+ auto = ''
1054
+ if 'auto' in node.attributes:
1055
+ auto = node.attributes['auto']
1056
+
1057
+ # auto is either 1(int) or '*'
1058
+ if auto == 1:
1059
+ self.footnotes['autonum_ref'] += 1
1060
+ name = str(self.footnotes['autonum_ref'])
1061
+ node_id = node.attributes['ids'][0]
1062
+ elif auto == '*':
1063
+ autosym = self.footnotes['autosym_ref']
1064
+ name = self.footlist[
1065
+ autosym % 10
1066
+ ] * (int(autosym / 10) + 1)
1067
+ self.footnotes['autosym_ref'] += 1
1068
+ node_id = node.attributes['ids'][0]
1069
+ else:
1070
+ # can have multiple refs:
1071
+ # [8] (1, 2) Footnote ref
1072
+ name = node.children[0]
1073
+ node_id = node['ids'][0]
1074
+ text += name
1075
+
1076
+ refs = self.root.refs_assoc.get(name, '')
1077
+ if not refs and auto in (1, '*'):
1078
+ # parser should trigger it when checking
1079
+ # for backlinks, but we don't have **any** refs
1080
+ # to work with, so we have to trigger it manually
1081
+ raise Exception(
1082
+ 'Too many autonumbered or autosymboled '
1083
+ 'footnote references!'
1084
+ )
1085
+
1086
+ # has a single or no refs ( '' )
1087
+ text = '[anchor=%s][ref=%s][color=%s]%s' % (
1088
+ node_id, refs,
1089
+ self.root.colors.get(
1090
+ 'link', self.root.colors.get('paragraph')
1091
+ ),
1092
+ text
1093
+ )
1094
+ self.text += text
1095
+ self.text_have_anchor = True
1096
+
1097
+ elif cls is nodes.title:
1098
+ label = RstTitle(section=self.section, document=self.root)
1099
+ self.current.add_widget(label)
1100
+ self.push(label)
1101
+ # assert self.text == ''
1102
+
1103
+ elif cls is nodes.Text:
1104
+ # check if parent isn't a special directive
1105
+ if hasattr(node, 'parent'):
1106
+ if node.parent.tagname == 'substitution_definition':
1107
+ # .. |ref| replace:: something
1108
+ return
1109
+ elif node.parent.tagname == 'substitution_reference':
1110
+ # |ref|
1111
+ return
1112
+ elif node.parent.tagname == 'comment':
1113
+ # .. COMMENT
1114
+ return
1115
+ elif node.parent.tagname == 'footnote_reference':
1116
+ # .. [#]_
1117
+ # .. [*]_
1118
+ # rewrite it to handle autonum/sym here
1119
+ # close tags with departure
1120
+ return
1121
+
1122
+ if self.do_strip_text:
1123
+ node = node.replace('\n', ' ')
1124
+ node = node.replace(' ', ' ')
1125
+ node = node.replace('\t', ' ')
1126
+ node = node.replace(' ', ' ')
1127
+ if node.startswith(' '):
1128
+ node = ' ' + node.lstrip(' ')
1129
+ if node.endswith(' '):
1130
+ node = node.rstrip(' ') + ' '
1131
+ if self.text.endswith(' ') and node.startswith(' '):
1132
+ node = node[1:]
1133
+ self.text += node
1134
+
1135
+ elif cls is nodes.paragraph:
1136
+ self.do_strip_text = True
1137
+
1138
+ if isinstance(node.parent, nodes.footnote):
1139
+ if self.foot_refblock:
1140
+ self.text = self.foot_refblock + ' '
1141
+ self.foot_refblock = None
1142
+ # self.do_strip_text = False
1143
+
1144
+ label = RstParagraph(document=self.root)
1145
+ if isinstance(self.current, RstEntry):
1146
+ label.mx = 10
1147
+ self.current.add_widget(label)
1148
+ self.push(label)
1149
+
1150
+ elif cls is nodes.literal_block:
1151
+ box = RstLiteralBlock()
1152
+ self.current.add_widget(box)
1153
+ self.push(box)
1154
+
1155
+ elif cls is nodes.emphasis:
1156
+ self.text += '[i]'
1157
+
1158
+ elif cls is nodes.strong:
1159
+ self.text += '[b]'
1160
+
1161
+ elif cls is nodes.literal:
1162
+ self.text += '[font=fonts/RobotoMono-Regular.ttf]'
1163
+
1164
+ elif cls is nodes.block_quote:
1165
+ box = RstBlockQuote()
1166
+ self.current.add_widget(box)
1167
+ self.push(box.content)
1168
+ assert self.text == ''
1169
+
1170
+ elif cls is nodes.enumerated_list:
1171
+ box = RstList()
1172
+ self.current.add_widget(box)
1173
+ self.push(box)
1174
+ self.idx_list = 0
1175
+
1176
+ elif cls is nodes.bullet_list:
1177
+ box = RstList()
1178
+ self.current.add_widget(box)
1179
+ self.push(box)
1180
+ self.idx_list = None
1181
+
1182
+ elif cls is nodes.list_item:
1183
+ bullet = '-'
1184
+ if self.idx_list is not None:
1185
+ self.idx_list += 1
1186
+ bullet = '%d.' % self.idx_list
1187
+ bullet = self.colorize(bullet, 'bullet')
1188
+ item = RstListItem()
1189
+ self.current.add_widget(RstListBullet(
1190
+ text=bullet, document=self.root))
1191
+ self.current.add_widget(item)
1192
+ self.push(item)
1193
+
1194
+ elif cls is nodes.system_message:
1195
+ label = RstSystemMessage()
1196
+ if self.root.show_errors:
1197
+ self.current.add_widget(label)
1198
+ self.push(label)
1199
+
1200
+ elif cls is nodes.warning:
1201
+ label = RstWarning()
1202
+ self.current.add_widget(label)
1203
+ self.push(label.content)
1204
+ assert self.text == ''
1205
+
1206
+ elif cls is nodes.note:
1207
+ label = RstNote()
1208
+ self.current.add_widget(label)
1209
+ self.push(label.content)
1210
+ assert self.text == ''
1211
+
1212
+ elif cls is nodes.image:
1213
+ # docutils parser breaks path with spaces
1214
+ # e.g. "C:/my path" -> "C:/mypath"
1215
+ uri = node['uri']
1216
+ align = node.get('align', 'center')
1217
+ image_size = [
1218
+ node.get('width'),
1219
+ node.get('height')
1220
+ ]
1221
+
1222
+ # use user's size if defined
1223
+ def set_size(img, size):
1224
+ img.size = [
1225
+ size[0] or img.width,
1226
+ size[1] or img.height
1227
+ ]
1228
+
1229
+ if uri.startswith('/') and self.root.document_root:
1230
+ uri = join(self.root.document_root, uri[1:])
1231
+
1232
+ if uri.startswith('http://') or uri.startswith('https://'):
1233
+ image = RstAsyncImage(source=uri)
1234
+ image.bind(on_load=lambda *a: set_size(image, image_size))
1235
+ else:
1236
+ image = RstImage(source=uri)
1237
+ set_size(image, image_size)
1238
+
1239
+ root = AnchorLayout(
1240
+ size_hint_y=None,
1241
+ anchor_x=align,
1242
+ height=image.height
1243
+ )
1244
+
1245
+ image.bind(height=root.setter('height'))
1246
+ root.add_widget(image)
1247
+ self.current.add_widget(root)
1248
+ # TODO:
1249
+ # .. _img: <url>
1250
+ # .. |img| image:: <img>
1251
+ # |img|_ <- needs refs and on_ref_press
1252
+
1253
+ elif cls is nodes.definition_list:
1254
+ lst = RstDefinitionList(document=self.root)
1255
+ self.current.add_widget(lst)
1256
+ self.push(lst)
1257
+
1258
+ elif cls is nodes.term:
1259
+ assert isinstance(self.current, RstDefinitionList)
1260
+ term = RstTerm(document=self.root)
1261
+ self.current.add_widget(term)
1262
+ self.push(term)
1263
+
1264
+ elif cls is nodes.definition:
1265
+ assert isinstance(self.current, RstDefinitionList)
1266
+ definition = RstDefinition(document=self.root)
1267
+ definition.add_widget(RstDefinitionSpace(document=self.root))
1268
+ self.current.add_widget(definition)
1269
+ self.push(definition)
1270
+
1271
+ elif cls is nodes.field_list:
1272
+ fieldlist = RstFieldList()
1273
+ self.current.add_widget(fieldlist)
1274
+ self.push(fieldlist)
1275
+
1276
+ elif cls is nodes.field_name:
1277
+ name = RstFieldName(document=self.root)
1278
+ self.current.add_widget(name)
1279
+ self.push(name)
1280
+
1281
+ elif cls is nodes.field_body:
1282
+ body = RstFieldBody()
1283
+ self.current.add_widget(body)
1284
+ self.push(body)
1285
+
1286
+ elif cls is nodes.table:
1287
+ table = RstTable(cols=0)
1288
+ self.current.add_widget(table)
1289
+ self.push(table)
1290
+
1291
+ elif cls is nodes.colspec:
1292
+ self.current.cols += 1
1293
+
1294
+ elif cls is nodes.entry:
1295
+ entry = RstEntry()
1296
+ self.current.add_widget(entry)
1297
+ self.push(entry)
1298
+
1299
+ elif cls is nodes.transition:
1300
+ self.current.add_widget(RstTransition())
1301
+
1302
+ elif cls is nodes.reference:
1303
+ name = node.get('name', node.get('refuri'))
1304
+ self.text += '[ref=%s][color=%s]' % (
1305
+ name, self.root.colors.get(
1306
+ 'link', self.root.colors.get('paragraph')))
1307
+ if 'refname' in node and 'name' in node:
1308
+ self.root.refs_assoc[node['name']] = node['refname']
1309
+
1310
+ elif cls is nodes.target:
1311
+ name = None
1312
+ if 'ids' in node:
1313
+ name = node['ids'][0]
1314
+ elif 'names' in node:
1315
+ name = node['names'][0]
1316
+ self.text += '[anchor=%s]' % name
1317
+ self.text_have_anchor = True
1318
+
1319
+ elif cls is role_doc:
1320
+ self.doc_index = len(self.text)
1321
+
1322
+ elif cls is role_video:
1323
+ pass
1324
+
1325
+ def dispatch_departure(self, node):
1326
+ cls = node.__class__
1327
+ if cls is nodes.document:
1328
+ self.pop()
1329
+
1330
+ elif cls is nodes.section:
1331
+ self.section -= 1
1332
+
1333
+ elif cls is nodes.title:
1334
+ assert isinstance(self.current, RstTitle)
1335
+ if not self.title:
1336
+ self.title = self.text
1337
+ self.set_text(self.current, 'title')
1338
+ self.pop()
1339
+
1340
+ elif cls is nodes.Text:
1341
+ pass
1342
+
1343
+ elif cls is nodes.paragraph:
1344
+ self.do_strip_text = False
1345
+ assert isinstance(self.current, RstParagraph)
1346
+ self.set_text(self.current, 'paragraph')
1347
+ self.pop()
1348
+
1349
+ elif cls is nodes.literal_block:
1350
+ assert isinstance(self.current, RstLiteralBlock)
1351
+ self.set_text(self.current.content, 'literal_block')
1352
+ self.pop()
1353
+
1354
+ elif cls is nodes.emphasis:
1355
+ self.text += '[/i]'
1356
+
1357
+ elif cls is nodes.strong:
1358
+ self.text += '[/b]'
1359
+
1360
+ elif cls is nodes.literal:
1361
+ self.text += '[/font]'
1362
+
1363
+ elif cls is nodes.block_quote:
1364
+ self.pop()
1365
+
1366
+ elif cls is nodes.enumerated_list:
1367
+ self.idx_list = None
1368
+ self.pop()
1369
+
1370
+ elif cls is nodes.bullet_list:
1371
+ self.pop()
1372
+
1373
+ elif cls is nodes.list_item:
1374
+ self.pop()
1375
+
1376
+ elif cls is nodes.system_message:
1377
+ self.pop()
1378
+
1379
+ elif cls is nodes.warning:
1380
+ self.pop()
1381
+
1382
+ elif cls is nodes.note:
1383
+ self.pop()
1384
+
1385
+ elif cls is nodes.definition_list:
1386
+ self.pop()
1387
+
1388
+ elif cls is nodes.term:
1389
+ assert isinstance(self.current, RstTerm)
1390
+ self.set_text(self.current, 'term')
1391
+ self.pop()
1392
+
1393
+ elif cls is nodes.definition:
1394
+ self.pop()
1395
+
1396
+ elif cls is nodes.field_list:
1397
+ self.pop()
1398
+
1399
+ elif cls is nodes.field_name:
1400
+ assert isinstance(self.current, RstFieldName)
1401
+ self.set_text(self.current, 'field_name')
1402
+ self.pop()
1403
+
1404
+ elif cls is nodes.field_body:
1405
+ self.pop()
1406
+
1407
+ elif cls is nodes.table:
1408
+ self.pop()
1409
+
1410
+ elif cls is nodes.colspec:
1411
+ pass
1412
+
1413
+ elif cls is nodes.entry:
1414
+ self.pop()
1415
+
1416
+ elif cls is nodes.reference:
1417
+ self.text += '[/color][/ref]'
1418
+
1419
+ elif cls is nodes.footnote:
1420
+ self.pop()
1421
+ self.set_text(self.current, 'link')
1422
+
1423
+ elif cls is nodes.footnote_reference:
1424
+ # close opened footnote [x]
1425
+ # self.text += '[/ref]'
1426
+ # self.set_text(self.current, 'link')
1427
+ self.text += '[/color][/ref]'
1428
+ # self.text += '[/color][/ref]'
1429
+ self.text += '&br;'
1430
+
1431
+ elif cls is role_doc:
1432
+ docname = self.text[self.doc_index:]
1433
+ rst_docname = docname
1434
+ if rst_docname.endswith('.rst'):
1435
+ docname = docname[:-4]
1436
+ else:
1437
+ rst_docname += '.rst'
1438
+
1439
+ # try to preload it
1440
+ filename = self.root.resolve_path(rst_docname)
1441
+ self.root.preload(filename)
1442
+
1443
+ # if exist, use the title of the first section found in the
1444
+ # document
1445
+ title = docname
1446
+ if filename in self.root.toctrees:
1447
+ toctree = self.root.toctrees[filename]
1448
+ if len(toctree):
1449
+ title = toctree[0]['title']
1450
+
1451
+ # replace the text with a good reference
1452
+ text = '[ref=%s]%s[/ref]' % (
1453
+ rst_docname,
1454
+ self.colorize(title, 'link'))
1455
+ self.text = self.text[:self.doc_index] + text
1456
+
1457
+ elif cls is role_video:
1458
+ width = node['width'] if 'width' in node.attlist() else 400
1459
+ height = node['height'] if 'height' in node.attlist() else 300
1460
+ uri = node['source']
1461
+ if uri.startswith('/') and self.root.document_root:
1462
+ uri = join(self.root.document_root, uri[1:])
1463
+ video = RstVideoPlayer(
1464
+ source=uri,
1465
+ size_hint=(None, None),
1466
+ size=(width, height))
1467
+ anchor = AnchorLayout(size_hint_y=None, height=height + 20)
1468
+ anchor.add_widget(video)
1469
+ self.current.add_widget(anchor)
1470
+
1471
+ def set_text(self, node, parent):
1472
+ text = self.text
1473
+ if parent == 'term' or parent == 'field_name':
1474
+ text = '[b]%s[/b]' % text
1475
+ # search anchors
1476
+ node.text = self.colorize(text, parent)
1477
+ node.bind(on_ref_press=self.root.on_ref_press)
1478
+ if self.text_have_anchor:
1479
+ self.root.add_anchors(node)
1480
+ self.text = ''
1481
+ self.text_have_anchor = False
1482
+
1483
+ def colorize(self, text, name):
1484
+ return '[color=%s]%s[/color]' % (
1485
+ self.root.colors.get(name, self.root.colors['paragraph']),
1486
+ text)
1487
+
1488
+
1489
+ if __name__ == '__main__':
1490
+ from kivy.base import runTouchApp
1491
+ import sys
1492
+ runTouchApp(RstDocument(source=sys.argv[1]))