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.
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/main.py +77 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/monkey.obj +7966 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/objloader.py +147 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/3Drendering/simple.glsl +47 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/RST_Editor/editor.kv +72 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/RST_Editor/main.py +64 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/compass.kv +25 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/main.py +77 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/needle.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/compass/rose.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/main.py +80 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/shadow32.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/android/takepicture/takepicture.kv +40 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/animation/animate.py +42 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_suite.py +152 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_suite_data/testkvdir.kv +4 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_build.py +24 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_config.py +49 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_kv.py +25 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/app_with_kv_in_template1.py +27 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/template1/test.kv +4 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/test.kv +4 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/application/testkvfile.kv +4 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/asyncio_advanced.py +90 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/asyncio_basic.py +59 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/trio_advanced.py +93 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/async/trio_basic.py +58 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12908_sweet_trip_mm_clap_hi.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12909_sweet_trip_mm_clap_lo.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12910_sweet_trip_mm_clap_mid.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12911_sweet_trip_mm_hat_cl.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12913_sweet_trip_mm_kick_hi.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12914_sweet_trip_mm_kick_lo.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12915_sweet_trip_mm_kick_mid.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12916_sweet_trip_mm_kwik_mod_01.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12917_sweet_trip_mm_kwik_mod_02.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12918_sweet_trip_mm_kwik_mod_03.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12919_sweet_trip_mm_kwik_mod_04.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12920_sweet_trip_mm_kwik_mod_05.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12921_sweet_trip_mm_kwik_mod_06.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12922_sweet_trip_mm_kwik_mod_07.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12923_sweet_trip_mm_metal_clave.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12925_sweet_trip_mm_sweep_x.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12926_sweet_trip_mm_sweep_y.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/12927_sweet_trip_mm_sweep_z.wav +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/audio.kv +59 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/main.py +81 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/audio/pitch.py +42 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/camera/main.py +59 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/bezier.py +105 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/canvas_stress.py +72 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/circle.py +84 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/fbo_canvas.py +91 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/kiwi.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/lines.py +296 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/lines_extended.py +183 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mesh.py +57 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mesh_manipulation.py +101 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mtexture1.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/mtexture2.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/multitexture.py +110 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/repeat_texture.py +65 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/rotation.py +35 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/rounded_rectangle.py +153 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/scale.py +37 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/stencil_canvas.py +85 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/tesselate.py +146 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/texture.py +143 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/canvas/texture_example_image.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/1.kv +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/2.kv +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/3.kv +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/kv/root.kv +32 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/container/main.py +63 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/cover/cover_image.py +25 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/cover/cover_video.py +31 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/camera_puzzle.py +98 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/AnchorLayoutContainer.kv +15 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/BoxLayoutContainer.kv +14 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/ButtonContainer.kv +27 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/CheckBoxContainer.kv +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/FileChooserContainer.kv +19 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/FloatLayoutContainer.kv +16 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/GridLayoutContainer.kv +20 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/LabelContainer.kv +62 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/MediaContainer.kv +9 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/PlaygroundContainer.kv +4 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/PopupContainer.kv +39 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/ProgressBarContainer.kv +17 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/RestContainer.kv +5 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/ScatterContainer.kv +16 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/SelectorsContainer.kv +10 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/StackLayoutContainer.kv +25 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/container_kvs/TextContainer.kv +20 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/kivycatalog.kv +144 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/kivycatalog/main.py +192 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/gesturedatabase.kv +117 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/gesturedatabase.py +180 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/helpers.py +30 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/historymanager.kv +164 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/historymanager.py +276 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/main.py +144 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/multistroke.kv +101 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/settings.kv +110 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/multistroke/settings.py +97 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/Bubbles.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/Ill1.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/Wall.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/images/faust_github.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/main.py +73 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/pictures.kv +57 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/pictures/shadow32.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/shadereditor/main.py +147 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/shadereditor/shadereditor.kv +39 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/README.txt +11 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/background.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/faust_github.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/README +4 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/bug.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/chevron-left.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/icons/chevron-right.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/accordions.kv +39 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/bubbles.kv +33 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/buttons.kv +26 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/carousel.kv +51 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/checkboxes.kv +33 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/codeinput.kv +9 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/dropdown.kv +40 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/filechoosers.kv +24 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/popups.kv +17 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/progressbar.kv +15 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/rstdocument.kv +24 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/scatter.kv +14 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/screenmanager.kv +46 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/sliders.kv +55 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/spinner.kv +11 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/splitter.kv +13 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/switches.kv +39 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/tabbedpanel + layouts.kv +69 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/textinputs.kv +48 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/data/screens/togglebutton.kv +39 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/main.py +243 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/showcase/showcase.kv +100 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/README.txt +12 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/icon.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/main.py +170 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/particle.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/demo/touchtracer/touchtracer.kv +29 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/frameworks/twisted/echo_client_app.py +82 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/frameworks/twisted/echo_server_app.py +49 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/frameworks/twisted/twistd_app.py +66 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/gestures/gesture_board.py +95 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/gestures/my_gestures.py +90 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/designwithkv/controller.kv +16 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/designwithkv/main.py +29 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/1_skeleton.py +15 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/2_print_touch.py +16 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/3_draw_ellipse.py +22 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/4_draw_line.py +26 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/5_random_colors.py +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/firstwidget/6_button.py +38 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/guide/quickstart/main.py +15 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/button.kv +9 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/layout.kv +6 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/main.py +19 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/includes/test.kv +5 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/keyboard/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/keyboard/main.py +226 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/keyboard/numeric.json +38 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kinect/README.txt +13 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kinect/kinectviewer.py +283 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_button.kv +9 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_camera.kv +25 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_fbo.kv +11 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_layout.kv +23 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_logo.kv +36 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_scatter.kv +6 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_stencil.kv +27 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/app_video.kv +42 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/builder_template.py +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/id_in_kv/id_in_kv.py +20 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/id_in_kv/test.kv +11 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/kv_and_py/kv_and_py.py +34 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/ids/kv_and_py/test.kv +11 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/kivy.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/kv/kvrun.py +38 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/clipboard.py +63 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/custom_titlebar.py +56 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/imagesave.py +14 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/joystick.py +83 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/multiple_dropfile.py +51 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/on_textedit_event.py +104 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/opacitywindow.py +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/shapecollisions.py +397 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/shapedwindow.py +98 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/two_panes.py +47 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/miscellaneous/urlrequest.py +128 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/settings/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/settings/main.py +122 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/plasma.kv +9 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/plasma.py +86 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/rotated.kv +91 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/rotated.py +102 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/shadertree.kv +29 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/shadertree.py +193 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/shader/tex3.jpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/benchmark.py +19 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/cloud.svg +25 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/main-smaa.py +155 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/main.py +50 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/music.svg +68 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/rotated.svg +23 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/ship.svg +181 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/sun.svg +35 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/svg/tiger.svg +813 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/text/pango_demo.py +296 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/notes/final/data/icon.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/notes/final/main.py +163 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/notes/final/note.kv +154 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/main.py +82 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/pong.kv +53 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step1/main.py +15 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step1/pong.kv +2 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step2/main.py +15 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step2/pong.kv +21 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step3/main.py +26 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step3/pong.kv +31 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step4/main.py +48 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step4/pong.kv +34 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step5/main.py +75 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/tutorials/pong/steps/step5/pong.kv +53 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/accordion_1.py +17 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/actionbar.py +32 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/asyncimage.py +35 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/boxlayout_poshint.py +54 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/bubble_test.py +63 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/camera.py +33 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/carousel_buttons.py +50 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/cityCC0.mpg +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/cityCC0.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/codeinput.py +225 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/codeinputtest.kv +53 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/colorpicker.py +234 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/colorusage.py +62 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/compound_selection.py +83 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/customcollide.py +82 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/effectwidget.py +193 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/effectwidget2.py +47 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/effectwidget3_advanced.py +62 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/fbowidget.py +111 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/focus_behavior.py +98 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/image_mipmap.py +31 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/keyboardlistener.py +42 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_mipmap.py +28 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_sizing.py +193 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_text_size.py +49 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/label_with_markup.py +21 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/lang_dynamic_classes.py +18 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/pagelayout.py +64 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/popup_with_kv.py +35 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/basic_data.py +124 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/infinite_scrolling.py +143 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/key_viewclass.py +149 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/messenger.py +196 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/pull_to_refresh.py +95 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/recycleview/rv_animate_items.py +109 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/rstexample.py +128 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scatter.kv +53 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scatter.py +16 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/screenmanager.py +106 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scrollview.kv +16 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/scrollview.py +40 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/android.txt +3 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/bird.zip +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/button_white.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/button_white_animated.zip +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/cube.zip +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/info.png +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/info.zip +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/data/images/simple_cv_joint_animated.gif +0 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/main.kv +63 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/main.py +150 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/uix/__init__.py +7 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/sequenced_images/uix/custom_button.py +98 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/settings.py +93 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/shorten_text.py +80 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/spinner.py +17 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/splitter.py +74 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/tabbed_panel_showcase.py +316 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/tabbedpanel.py +50 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/textalign.kv +49 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/textalign.py +48 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/textinput.py +59 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/unicode_textinput.py +244 -0
- Kivy_examples-2.3.1.dev0.data/data/share/kivy-examples/widgets/videoplayer.py +26 -0
- Kivy_examples-2.3.1.dev0.dist-info/AUTHORS +66 -0
- Kivy_examples-2.3.1.dev0.dist-info/LICENSE +21 -0
- Kivy_examples-2.3.1.dev0.dist-info/METADATA +382 -0
- Kivy_examples-2.3.1.dev0.dist-info/RECORD +624 -0
- Kivy_examples-2.3.1.dev0.dist-info/WHEEL +5 -0
- Kivy_examples-2.3.1.dev0.dist-info/dependency_links.txt +1 -0
- Kivy_examples-2.3.1.dev0.dist-info/top_level.txt +1 -0
- kivy/__init__.py +519 -0
- kivy/_version.py +18 -0
- kivy/animation.py +831 -0
- kivy/app.py +1213 -0
- kivy/atlas.py +456 -0
- kivy/base.py +617 -0
- kivy/cache.py +262 -0
- kivy/clock.py +1172 -0
- kivy/compat.py +82 -0
- kivy/config.py +1004 -0
- kivy/context.py +102 -0
- kivy/core/__init__.py +247 -0
- kivy/core/audio/__init__.py +223 -0
- kivy/core/audio/audio_android.py +104 -0
- kivy/core/audio/audio_avplayer.py +82 -0
- kivy/core/audio/audio_ffpyplayer.py +185 -0
- kivy/core/audio/audio_gstplayer.py +101 -0
- kivy/core/audio/audio_pygame.py +127 -0
- kivy/core/camera/__init__.py +151 -0
- kivy/core/camera/camera_android.py +206 -0
- kivy/core/camera/camera_gi.py +170 -0
- kivy/core/camera/camera_opencv.py +163 -0
- kivy/core/camera/camera_picamera.py +96 -0
- kivy/core/clipboard/__init__.py +157 -0
- kivy/core/clipboard/_clipboard_ext.py +36 -0
- kivy/core/clipboard/clipboard_android.py +91 -0
- kivy/core/clipboard/clipboard_dbusklipper.py +41 -0
- kivy/core/clipboard/clipboard_dummy.py +26 -0
- kivy/core/clipboard/clipboard_gtk3.py +47 -0
- kivy/core/clipboard/clipboard_nspaste.py +44 -0
- kivy/core/clipboard/clipboard_pygame.py +67 -0
- kivy/core/clipboard/clipboard_sdl2.py +36 -0
- kivy/core/clipboard/clipboard_winctypes.py +107 -0
- kivy/core/clipboard/clipboard_xclip.py +29 -0
- kivy/core/clipboard/clipboard_xsel.py +26 -0
- kivy/core/gl/__init__.py +90 -0
- kivy/core/image/__init__.py +996 -0
- kivy/core/image/img_dds.py +40 -0
- kivy/core/image/img_ffpyplayer.py +87 -0
- kivy/core/image/img_pil.py +123 -0
- kivy/core/image/img_pygame.py +119 -0
- kivy/core/image/img_sdl2.py +66 -0
- kivy/core/image/img_tex.py +58 -0
- kivy/core/spelling/__init__.py +135 -0
- kivy/core/spelling/spelling_enchant.py +50 -0
- kivy/core/spelling/spelling_osxappkit.py +64 -0
- kivy/core/text/__init__.py +1090 -0
- kivy/core/text/markup.py +893 -0
- kivy/core/text/text_pango.py +145 -0
- kivy/core/text/text_pil.py +84 -0
- kivy/core/text/text_pygame.py +117 -0
- kivy/core/text/text_sdl2.py +50 -0
- kivy/core/video/__init__.py +219 -0
- kivy/core/video/video_ffmpeg.py +106 -0
- kivy/core/video/video_ffpyplayer.py +449 -0
- kivy/core/video/video_gstplayer.py +140 -0
- kivy/core/video/video_null.py +12 -0
- kivy/core/window/__init__.py +2515 -0
- kivy/core/window/window_egl_rpi.py +86 -0
- kivy/core/window/window_pygame.py +441 -0
- kivy/core/window/window_sdl2.py +999 -0
- kivy/deps/__init__.py +6 -0
- kivy/effects/__init__.py +23 -0
- kivy/effects/dampedscroll.py +114 -0
- kivy/effects/kinetic.py +193 -0
- kivy/effects/opacityscroll.py +27 -0
- kivy/effects/scroll.py +126 -0
- kivy/event.py +12 -0
- kivy/eventmanager/__init__.py +185 -0
- kivy/extras/__init__.py +0 -0
- kivy/extras/highlight.py +52 -0
- kivy/factory.py +190 -0
- kivy/factory_registers.py +201 -0
- kivy/garden/__init__.py +186 -0
- kivy/geometry.py +121 -0
- kivy/gesture.py +424 -0
- kivy/graphics/__init__.py +126 -0
- kivy/graphics/cgl_backend/__init__.py +0 -0
- kivy/input/__init__.py +39 -0
- kivy/input/factory.py +35 -0
- kivy/input/motionevent.py +587 -0
- kivy/input/postproc/__init__.py +27 -0
- kivy/input/postproc/calibration.py +200 -0
- kivy/input/postproc/dejitter.py +74 -0
- kivy/input/postproc/doubletap.py +101 -0
- kivy/input/postproc/ignorelist.py +47 -0
- kivy/input/postproc/retaintouch.py +93 -0
- kivy/input/postproc/tripletap.py +106 -0
- kivy/input/provider.py +40 -0
- kivy/input/providers/__init__.py +68 -0
- kivy/input/providers/androidjoystick.py +117 -0
- kivy/input/providers/hidinput.py +778 -0
- kivy/input/providers/leapfinger.py +113 -0
- kivy/input/providers/linuxwacom.py +396 -0
- kivy/input/providers/mactouch.py +220 -0
- kivy/input/providers/mouse.py +424 -0
- kivy/input/providers/mtdev.py +380 -0
- kivy/input/providers/probesysfs.py +254 -0
- kivy/input/providers/tuio.py +326 -0
- kivy/input/providers/wm_common.py +162 -0
- kivy/input/providers/wm_pen.py +121 -0
- kivy/input/providers/wm_touch.py +157 -0
- kivy/input/recorder.py +335 -0
- kivy/input/shape.py +27 -0
- kivy/interactive.py +335 -0
- kivy/lang/__init__.py +883 -0
- kivy/lang/builder.py +1004 -0
- kivy/lang/parser.py +822 -0
- kivy/lib/__init__.py +21 -0
- kivy/lib/ddsfile.py +419 -0
- kivy/lib/gstplayer/__init__.py +27 -0
- kivy/lib/mtdev.py +254 -0
- kivy/lib/vidcore_lite/__init__.py +0 -0
- kivy/loader.py +579 -0
- kivy/logger.py +646 -0
- kivy/metrics.py +421 -0
- kivy/modules/__init__.py +300 -0
- kivy/modules/_webdebugger.py +200 -0
- kivy/modules/console.py +1059 -0
- kivy/modules/cursor.py +75 -0
- kivy/modules/inspector.py +755 -0
- kivy/modules/joycursor.py +299 -0
- kivy/modules/keybinding.py +64 -0
- kivy/modules/monitor.py +90 -0
- kivy/modules/recorder.py +94 -0
- kivy/modules/screen.py +183 -0
- kivy/modules/showborder.py +33 -0
- kivy/modules/touchring.py +97 -0
- kivy/modules/webdebugger.py +30 -0
- kivy/multistroke.py +1477 -0
- kivy/network/__init__.py +7 -0
- kivy/network/urlrequest.py +794 -0
- kivy/parser.py +154 -0
- kivy/resources.py +102 -0
- kivy/storage/__init__.py +405 -0
- kivy/storage/dictstore.py +98 -0
- kivy/storage/jsonstore.py +92 -0
- kivy/storage/redisstore.py +103 -0
- kivy/support.py +267 -0
- kivy/tests/__init__.py +11 -0
- kivy/tests/async_common.py +568 -0
- kivy/tests/common.py +524 -0
- kivy/tests/conftest.py +33 -0
- kivy/tests/fixtures.py +169 -0
- kivy/tests/perf_test_textinput.py +195 -0
- kivy/tests/pyinstaller/simple_widget/main.py +12 -0
- kivy/tests/pyinstaller/simple_widget/project/__init__.py +0 -0
- kivy/tests/pyinstaller/simple_widget/project/widget.py +12 -0
- kivy/tests/pyinstaller/test_pyinstaller.py +115 -0
- kivy/tests/pyinstaller/video_widget/main.py +6 -0
- kivy/tests/pyinstaller/video_widget/project/__init__.py +38 -0
- kivy/tests/test_animations.py +415 -0
- kivy/tests/test_app.py +216 -0
- kivy/tests/test_audio.py +69 -0
- kivy/tests/test_benchmark.py +292 -0
- kivy/tests/test_clipboard.py +48 -0
- kivy/tests/test_clock.py +292 -0
- kivy/tests/test_compat.py +6 -0
- kivy/tests/test_config.py +35 -0
- kivy/tests/test_coverage.py +83 -0
- kivy/tests/test_doc_gallery.py +38 -0
- kivy/tests/test_environ_cli.py +50 -0
- kivy/tests/test_fbo_py2py3.py +74 -0
- kivy/tests/test_filechooser.py +11 -0
- kivy/tests/test_filechooser_unicode.py +82 -0
- kivy/tests/test_fonts.py +42 -0
- kivy/tests/test_garden.py +23 -0
- kivy/tests/test_graphics.py +1149 -0
- kivy/tests/test_graphics_svg.py +84 -0
- kivy/tests/test_image.py +74 -0
- kivy/tests/test_imageloader.py +485 -0
- kivy/tests/test_invalid_lang.py +42 -0
- kivy/tests/test_issues/test_6315.py +55 -0
- kivy/tests/test_issues/test_issue_1084.py +47 -0
- kivy/tests/test_issues/test_issue_1091.py +19 -0
- kivy/tests/test_issues/test_issue_599.py +21 -0
- kivy/tests/test_issues/test_issue_609.py +19 -0
- kivy/tests/test_issues/test_issue_6909.py +28 -0
- kivy/tests/test_issues/test_issue_883.py +12 -0
- kivy/tests/test_kivy_init.py +30 -0
- kivy/tests/test_knspace.py +247 -0
- kivy/tests/test_lang.py +431 -0
- kivy/tests/test_lang_complex.py +87 -0
- kivy/tests/test_lang_pre_process_and_post_process.py +394 -0
- kivy/tests/test_logger.py +516 -0
- kivy/tests/test_metrics.py +30 -0
- kivy/tests/test_module_inspector.py +382 -0
- kivy/tests/test_motion_event.py +44 -0
- kivy/tests/test_mouse_hover_event.py +249 -0
- kivy/tests/test_mouse_multitouchsim.py +554 -0
- kivy/tests/test_multistroke.py +389 -0
- kivy/tests/test_properties.py +1332 -0
- kivy/tests/test_resources.py +79 -0
- kivy/tests/test_rst_replace.py +63 -0
- kivy/tests/test_screen.py +38 -0
- kivy/tests/test_storage.py +135 -0
- kivy/tests/test_uix_actionbar.py +363 -0
- kivy/tests/test_uix_anchorlayout.py +79 -0
- kivy/tests/test_uix_asyncimage.py +133 -0
- kivy/tests/test_uix_boxlayout.py +94 -0
- kivy/tests/test_uix_bubble.py +425 -0
- kivy/tests/test_uix_carousel.py +93 -0
- kivy/tests/test_uix_colorpicker.py +77 -0
- kivy/tests/test_uix_dropdown.py +91 -0
- kivy/tests/test_uix_gridlayout.py +244 -0
- kivy/tests/test_uix_layout.py +16 -0
- kivy/tests/test_uix_modal.py +101 -0
- kivy/tests/test_uix_recyclegridlayout.py +383 -0
- kivy/tests/test_uix_relativelayout.py +30 -0
- kivy/tests/test_uix_scrollview.py +358 -0
- kivy/tests/test_uix_settings.py +33 -0
- kivy/tests/test_uix_slider.py +156 -0
- kivy/tests/test_uix_stacklayout.py +120 -0
- kivy/tests/test_uix_textinput.py +577 -0
- kivy/tests/test_uix_translate_coordinates.py +72 -0
- kivy/tests/test_uix_videoplayer.py +112 -0
- kivy/tests/test_uix_widget.py +137 -0
- kivy/tests/test_urlrequest/test_urlrequest_requests.py +378 -0
- kivy/tests/test_urlrequest/test_urlrequest_urllib.py +155 -0
- kivy/tests/test_utils.py +237 -0
- kivy/tests/test_vector.py +256 -0
- kivy/tests/test_video.py +25 -0
- kivy/tests/test_weakmethod.py +44 -0
- kivy/tests/test_widget.py +127 -0
- kivy/tests/test_widget_walk.py +70 -0
- kivy/tests/test_window_base.py +60 -0
- kivy/tests/test_window_info.py +29 -0
- kivy/tests/visual_test_label.py +291 -0
- kivy/tools/__init__.py +44 -0
- kivy/tools/benchmark.py +286 -0
- kivy/tools/changelog_parser.py +120 -0
- kivy/tools/coverage.py +135 -0
- kivy/tools/gallery.py +323 -0
- kivy/tools/generate-icons.py +117 -0
- kivy/tools/gles_compat/subset_gles.py +125 -0
- kivy/tools/highlight/__init__.py +9 -0
- kivy/tools/kviewer.py +80 -0
- kivy/tools/packaging/__init__.py +12 -0
- kivy/tools/packaging/cython_cfg.py +82 -0
- kivy/tools/packaging/factory.py +105 -0
- kivy/tools/packaging/pyinstaller_hooks/__init__.py +381 -0
- kivy/tools/packaging/pyinstaller_hooks/__main__.py +29 -0
- kivy/tools/packaging/pyinstaller_hooks/hook-kivy.py +9 -0
- kivy/tools/packaging/pyinstaller_hooks/pyi_rth_kivy.py +17 -0
- kivy/tools/pep8checker/pep8.py +2316 -0
- kivy/tools/pep8checker/pep8kivy.py +109 -0
- kivy/tools/report.py +223 -0
- kivy/tools/stub-gl-debug.py +201 -0
- kivy/tools/texturecompress.py +233 -0
- kivy/uix/__init__.py +56 -0
- kivy/uix/accordion.py +484 -0
- kivy/uix/actionbar.py +934 -0
- kivy/uix/anchorlayout.py +122 -0
- kivy/uix/behaviors/__init__.py +95 -0
- kivy/uix/behaviors/button.py +212 -0
- kivy/uix/behaviors/codenavigation.py +167 -0
- kivy/uix/behaviors/compoundselection.py +688 -0
- kivy/uix/behaviors/cover.py +160 -0
- kivy/uix/behaviors/drag.py +234 -0
- kivy/uix/behaviors/emacs.py +140 -0
- kivy/uix/behaviors/focus.py +595 -0
- kivy/uix/behaviors/knspace.py +590 -0
- kivy/uix/behaviors/togglebutton.py +156 -0
- kivy/uix/behaviors/touchripple.py +318 -0
- kivy/uix/boxlayout.py +331 -0
- kivy/uix/bubble.py +576 -0
- kivy/uix/button.py +137 -0
- kivy/uix/camera.py +118 -0
- kivy/uix/carousel.py +695 -0
- kivy/uix/checkbox.py +197 -0
- kivy/uix/codeinput.py +238 -0
- kivy/uix/colorpicker.py +486 -0
- kivy/uix/dropdown.py +391 -0
- kivy/uix/effectwidget.py +772 -0
- kivy/uix/filechooser.py +1134 -0
- kivy/uix/floatlayout.py +148 -0
- kivy/uix/gesturesurface.py +625 -0
- kivy/uix/gridlayout.py +629 -0
- kivy/uix/image.py +528 -0
- kivy/uix/label.py +1200 -0
- kivy/uix/layout.py +322 -0
- kivy/uix/modalview.py +339 -0
- kivy/uix/pagelayout.py +233 -0
- kivy/uix/popup.py +266 -0
- kivy/uix/progressbar.py +95 -0
- kivy/uix/recycleboxlayout.py +183 -0
- kivy/uix/recyclegridlayout.py +255 -0
- kivy/uix/recyclelayout.py +446 -0
- kivy/uix/recycleview/__init__.py +624 -0
- kivy/uix/recycleview/datamodel.py +194 -0
- kivy/uix/recycleview/layout.py +253 -0
- kivy/uix/recycleview/views.py +423 -0
- kivy/uix/relativelayout.py +324 -0
- kivy/uix/rst.py +1492 -0
- kivy/uix/sandbox.py +198 -0
- kivy/uix/scatter.py +645 -0
- kivy/uix/scatterlayout.py +93 -0
- kivy/uix/screenmanager.py +1275 -0
- kivy/uix/scrollview.py +1288 -0
- kivy/uix/settings.py +1343 -0
- kivy/uix/slider.py +421 -0
- kivy/uix/spinner.py +221 -0
- kivy/uix/splitter.py +430 -0
- kivy/uix/stacklayout.py +331 -0
- kivy/uix/stencilview.py +40 -0
- kivy/uix/switch.py +122 -0
- kivy/uix/tabbedpanel.py +880 -0
- kivy/uix/textinput.py +4049 -0
- kivy/uix/togglebutton.py +37 -0
- kivy/uix/treeview.py +665 -0
- kivy/uix/video.py +302 -0
- kivy/uix/videoplayer.py +697 -0
- kivy/uix/vkeyboard.py +879 -0
- kivy/uix/widget.py +1629 -0
- kivy/utils.py +550 -0
- kivy/vector.py +412 -0
- kivy/weakmethod.py +72 -0
kivy/lang/builder.py
ADDED
|
@@ -0,0 +1,1004 @@
|
|
|
1
|
+
'''
|
|
2
|
+
Builder
|
|
3
|
+
======
|
|
4
|
+
|
|
5
|
+
Class used for the registering and application of rules for specific widgets.
|
|
6
|
+
'''
|
|
7
|
+
import sys
|
|
8
|
+
from os import environ
|
|
9
|
+
from os.path import join
|
|
10
|
+
from copy import copy
|
|
11
|
+
from types import CodeType
|
|
12
|
+
from functools import partial
|
|
13
|
+
|
|
14
|
+
from kivy.factory import Factory
|
|
15
|
+
from kivy.lang.parser import (
|
|
16
|
+
Parser,
|
|
17
|
+
ParserException,
|
|
18
|
+
_handlers,
|
|
19
|
+
global_idmap,
|
|
20
|
+
ParserRuleProperty,
|
|
21
|
+
)
|
|
22
|
+
from kivy.logger import Logger
|
|
23
|
+
from kivy.utils import QueryDict
|
|
24
|
+
from kivy.cache import Cache
|
|
25
|
+
from kivy import kivy_data_dir
|
|
26
|
+
from kivy.context import register_context
|
|
27
|
+
from kivy.resources import resource_find
|
|
28
|
+
from kivy._event import Observable, EventDispatcher
|
|
29
|
+
|
|
30
|
+
__all__ = ('Observable', 'Builder', 'BuilderBase', 'BuilderException')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
trace = Logger.trace
|
|
34
|
+
|
|
35
|
+
# late import
|
|
36
|
+
Instruction = None
|
|
37
|
+
|
|
38
|
+
# delayed calls are canvas expression triggered during an loop. It is one
|
|
39
|
+
# directional linked list of args to call call_fn with. Each element is a list
|
|
40
|
+
# whose last element points to the next list of args to execute when
|
|
41
|
+
# Builder.sync is called.
|
|
42
|
+
_delayed_start = None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class BuilderException(ParserException):
|
|
46
|
+
'''Exception raised when the Builder fails to apply a rule on a widget.
|
|
47
|
+
'''
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def get_proxy(widget):
|
|
52
|
+
try:
|
|
53
|
+
return widget.proxy_ref
|
|
54
|
+
except AttributeError:
|
|
55
|
+
return widget
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def custom_callback(__kvlang__, idmap, *largs, **kwargs):
|
|
59
|
+
idmap['args'] = largs
|
|
60
|
+
exec(__kvlang__.co_value, idmap)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def call_fn(args, instance, v):
|
|
64
|
+
element, key, value, rule, idmap = args
|
|
65
|
+
if __debug__:
|
|
66
|
+
trace('Lang: call_fn %s, key=%s, value=%r, %r' % (
|
|
67
|
+
element, key, value, rule.value))
|
|
68
|
+
rule.count += 1
|
|
69
|
+
e_value = eval(value, idmap)
|
|
70
|
+
if __debug__:
|
|
71
|
+
trace('Lang: call_fn => value=%r' % (e_value, ))
|
|
72
|
+
setattr(element, key, e_value)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def delayed_call_fn(args, instance, v):
|
|
76
|
+
# it's already on the list
|
|
77
|
+
if args[-1] is not None:
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
global _delayed_start
|
|
81
|
+
if _delayed_start is None:
|
|
82
|
+
_delayed_start = args
|
|
83
|
+
args[-1] = StopIteration
|
|
84
|
+
else:
|
|
85
|
+
args[-1] = _delayed_start
|
|
86
|
+
_delayed_start = args
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def update_intermediates(base, keys, bound, s, fn, args, instance, value):
|
|
90
|
+
''' Function that is called when an intermediate property is updated
|
|
91
|
+
and `rebind` of that property is True. In that case, we unbind
|
|
92
|
+
all bound funcs that were bound to attrs of the old value of the
|
|
93
|
+
property and rebind them to the new value of the property.
|
|
94
|
+
|
|
95
|
+
For example, if the rule is `self.a.b.c.d`, then when b is changed, we
|
|
96
|
+
unbind from `b`, `c` and `d`, if they were bound before (they were not
|
|
97
|
+
None and `rebind` of the respective properties was True) and we rebind
|
|
98
|
+
to the new values of the attrs `b`, `c``, `d` that are not None and
|
|
99
|
+
`rebind` is True.
|
|
100
|
+
|
|
101
|
+
:Parameters:
|
|
102
|
+
`base`
|
|
103
|
+
A (proxied) ref to the base widget, `self` in the example
|
|
104
|
+
above.
|
|
105
|
+
`keys`
|
|
106
|
+
A list of the name off the attrs of `base` being watched. In
|
|
107
|
+
the example above it'd be `['a', 'b', 'c', 'd']`.
|
|
108
|
+
`bound`
|
|
109
|
+
A list 4-tuples, each tuple being (widget, attr, callback, uid)
|
|
110
|
+
representing callback functions bound to the attributed `attr`
|
|
111
|
+
of `widget`. `uid` is returned by `fbind` when binding.
|
|
112
|
+
The callback may be None, in which case the attr
|
|
113
|
+
was not bound, but is there to be able to walk the attr tree.
|
|
114
|
+
E.g. in the example above, if `b` was not an eventdispatcher,
|
|
115
|
+
`(_b_ref_, `c`, None)` would be added to the list so we can get
|
|
116
|
+
to `c` and `d`, which may be eventdispatchers and their attrs.
|
|
117
|
+
`s`
|
|
118
|
+
The index in `keys` of the of the attr that needs to be
|
|
119
|
+
updated. That is all the keys from `s` and further will be
|
|
120
|
+
rebound, since the `s` key was changed. In bound, the
|
|
121
|
+
corresponding index is `s - 1`. If `s` is None, we start from
|
|
122
|
+
1 (first attr).
|
|
123
|
+
`fn`
|
|
124
|
+
The function to be called args, `args` on bound callback.
|
|
125
|
+
'''
|
|
126
|
+
# first remove all the old bound functions from `s` and down.
|
|
127
|
+
for f, k, fun, uid in bound[s:]:
|
|
128
|
+
if fun is None:
|
|
129
|
+
continue
|
|
130
|
+
try:
|
|
131
|
+
f.unbind_uid(k, uid)
|
|
132
|
+
except ReferenceError:
|
|
133
|
+
pass
|
|
134
|
+
del bound[s:]
|
|
135
|
+
|
|
136
|
+
# find the first attr from which we need to start rebinding.
|
|
137
|
+
f = getattr(*bound[-1][:2])
|
|
138
|
+
if f is None:
|
|
139
|
+
fn(args, None, None)
|
|
140
|
+
return
|
|
141
|
+
s += 1
|
|
142
|
+
append = bound.append
|
|
143
|
+
|
|
144
|
+
# bind all attrs, except last to update_intermediates
|
|
145
|
+
for val in keys[s:-1]:
|
|
146
|
+
# if we need to dynamically rebind, bindm otherwise just
|
|
147
|
+
# add the attr to the list
|
|
148
|
+
if isinstance(f, (EventDispatcher, Observable)):
|
|
149
|
+
prop = f.property(val, True)
|
|
150
|
+
if prop is not None and getattr(prop, 'rebind', False):
|
|
151
|
+
# fbind should not dispatch, otherwise
|
|
152
|
+
# update_intermediates might be called in the middle
|
|
153
|
+
# here messing things up
|
|
154
|
+
uid = f.fbind(
|
|
155
|
+
val, update_intermediates, base, keys, bound, s, fn, args)
|
|
156
|
+
append([f.proxy_ref, val, update_intermediates, uid])
|
|
157
|
+
else:
|
|
158
|
+
append([f.proxy_ref, val, None, None])
|
|
159
|
+
else:
|
|
160
|
+
append([getattr(f, 'proxy_ref', f), val, None, None])
|
|
161
|
+
|
|
162
|
+
f = getattr(f, val, None)
|
|
163
|
+
if f is None:
|
|
164
|
+
break
|
|
165
|
+
s += 1
|
|
166
|
+
|
|
167
|
+
# for the last attr we bind directly to the setting function,
|
|
168
|
+
# because that attr sets the value of the rule.
|
|
169
|
+
if isinstance(f, (EventDispatcher, Observable)):
|
|
170
|
+
uid = f.fbind(keys[-1], fn, args)
|
|
171
|
+
if uid:
|
|
172
|
+
append([f.proxy_ref, keys[-1], fn, uid])
|
|
173
|
+
# when we rebind we have to update the
|
|
174
|
+
# rule with the most recent value, otherwise, the value might be wrong
|
|
175
|
+
# and wouldn't be updated since we might not have tracked it before.
|
|
176
|
+
# This only happens for a callback when rebind was True for the prop.
|
|
177
|
+
fn(args, None, None)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def create_handler(iself, element, key, value, rule, idmap, delayed=False):
|
|
181
|
+
idmap = copy(idmap)
|
|
182
|
+
idmap.update(global_idmap)
|
|
183
|
+
idmap['self'] = iself.proxy_ref
|
|
184
|
+
bound_list = _handlers[iself.uid][key]
|
|
185
|
+
handler_append = bound_list.append
|
|
186
|
+
|
|
187
|
+
# we need a hash for when delayed, so we don't execute duplicate canvas
|
|
188
|
+
# callbacks from the same handler during a sync op
|
|
189
|
+
if delayed:
|
|
190
|
+
fn = delayed_call_fn
|
|
191
|
+
args = [element, key, value, rule, idmap, None] # see _delayed_start
|
|
192
|
+
else:
|
|
193
|
+
fn = call_fn
|
|
194
|
+
args = (element, key, value, rule, idmap)
|
|
195
|
+
|
|
196
|
+
# bind every key.value
|
|
197
|
+
if rule.watched_keys is not None:
|
|
198
|
+
for keys in rule.watched_keys:
|
|
199
|
+
base = idmap.get(keys[0])
|
|
200
|
+
if base is None:
|
|
201
|
+
continue
|
|
202
|
+
f = base = getattr(base, 'proxy_ref', base)
|
|
203
|
+
bound = []
|
|
204
|
+
was_bound = False
|
|
205
|
+
append = bound.append
|
|
206
|
+
|
|
207
|
+
# bind all attrs, except last to update_intermediates
|
|
208
|
+
k = 1
|
|
209
|
+
for val in keys[1:-1]:
|
|
210
|
+
# if we need to dynamically rebind, bindm otherwise
|
|
211
|
+
# just add the attr to the list
|
|
212
|
+
if isinstance(f, (EventDispatcher, Observable)):
|
|
213
|
+
prop = f.property(val, True)
|
|
214
|
+
if prop is not None and getattr(prop, 'rebind', False):
|
|
215
|
+
# fbind should not dispatch, otherwise
|
|
216
|
+
# update_intermediates might be called in the middle
|
|
217
|
+
# here messing things up
|
|
218
|
+
uid = f.fbind(
|
|
219
|
+
val, update_intermediates, base, keys, bound, k,
|
|
220
|
+
fn, args)
|
|
221
|
+
append([f.proxy_ref, val, update_intermediates, uid])
|
|
222
|
+
was_bound = True
|
|
223
|
+
else:
|
|
224
|
+
append([f.proxy_ref, val, None, None])
|
|
225
|
+
elif not isinstance(f, type):
|
|
226
|
+
append([getattr(f, 'proxy_ref', f), val, None, None])
|
|
227
|
+
else:
|
|
228
|
+
append([f, val, None, None])
|
|
229
|
+
f = getattr(f, val, None)
|
|
230
|
+
if f is None:
|
|
231
|
+
break
|
|
232
|
+
k += 1
|
|
233
|
+
|
|
234
|
+
# for the last attr we bind directly to the setting
|
|
235
|
+
# function, because that attr sets the value of the rule.
|
|
236
|
+
if isinstance(f, (EventDispatcher, Observable)):
|
|
237
|
+
uid = f.fbind(keys[-1], fn, args) # f is not None
|
|
238
|
+
if uid:
|
|
239
|
+
append([f.proxy_ref, keys[-1], fn, uid])
|
|
240
|
+
was_bound = True
|
|
241
|
+
if was_bound:
|
|
242
|
+
handler_append(bound)
|
|
243
|
+
|
|
244
|
+
try:
|
|
245
|
+
return eval(value, idmap), bound_list
|
|
246
|
+
except Exception as e:
|
|
247
|
+
tb = sys.exc_info()[2]
|
|
248
|
+
raise BuilderException(rule.ctx, rule.line,
|
|
249
|
+
'{}: {}'.format(e.__class__.__name__, e),
|
|
250
|
+
cause=tb)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class BuilderBase(object):
|
|
254
|
+
'''The Builder is responsible for creating a :class:`Parser` for parsing a
|
|
255
|
+
kv file, merging the results into its internal rules, templates, etc.
|
|
256
|
+
|
|
257
|
+
By default, :class:`Builder` is a global Kivy instance used in widgets
|
|
258
|
+
that you can use to load other kv files in addition to the default ones.
|
|
259
|
+
'''
|
|
260
|
+
|
|
261
|
+
def __init__(self):
|
|
262
|
+
super(BuilderBase, self).__init__()
|
|
263
|
+
self._match_cache = {}
|
|
264
|
+
self._match_name_cache = {}
|
|
265
|
+
self.files = []
|
|
266
|
+
self.dynamic_classes = {}
|
|
267
|
+
self.templates = {}
|
|
268
|
+
self.rules = []
|
|
269
|
+
self.rulectx = {}
|
|
270
|
+
|
|
271
|
+
@classmethod
|
|
272
|
+
def create_from(cls, builder):
|
|
273
|
+
"""Creates a instance of the class, and initializes to the state of
|
|
274
|
+
``builder``.
|
|
275
|
+
|
|
276
|
+
:param builder: The builder to initialize from.
|
|
277
|
+
:return: A new instance of this class.
|
|
278
|
+
"""
|
|
279
|
+
obj = cls()
|
|
280
|
+
obj._match_cache = copy(builder._match_cache)
|
|
281
|
+
obj._match_name_cache = copy(builder._match_name_cache)
|
|
282
|
+
obj.files = copy(builder.files)
|
|
283
|
+
obj.dynamic_classes = copy(builder.dynamic_classes)
|
|
284
|
+
obj.templates = copy(builder.templates)
|
|
285
|
+
obj.rules = list(builder.rules)
|
|
286
|
+
assert not builder.rulectx
|
|
287
|
+
obj.rulectx = dict(builder.rulectx)
|
|
288
|
+
|
|
289
|
+
return obj
|
|
290
|
+
|
|
291
|
+
def load_file(self, filename, encoding='utf8', **kwargs):
|
|
292
|
+
'''Insert a file into the language builder and return the root widget
|
|
293
|
+
(if defined) of the kv file.
|
|
294
|
+
|
|
295
|
+
:parameters:
|
|
296
|
+
`rulesonly`: bool, defaults to False
|
|
297
|
+
If True, the Builder will raise an exception if you have a root
|
|
298
|
+
widget inside the definition.
|
|
299
|
+
|
|
300
|
+
`encoding`: File character encoding. Defaults to utf-8,
|
|
301
|
+
'''
|
|
302
|
+
|
|
303
|
+
filename = resource_find(filename) or filename
|
|
304
|
+
if __debug__:
|
|
305
|
+
trace('Lang: load file %s, using %s encoding', filename, encoding)
|
|
306
|
+
|
|
307
|
+
kwargs['filename'] = filename
|
|
308
|
+
with open(filename, 'r', encoding=encoding) as fd:
|
|
309
|
+
data = fd.read()
|
|
310
|
+
return self.load_string(data, **kwargs)
|
|
311
|
+
|
|
312
|
+
def unload_file(self, filename):
|
|
313
|
+
'''Unload all rules associated with a previously imported file.
|
|
314
|
+
|
|
315
|
+
.. versionadded:: 1.0.8
|
|
316
|
+
|
|
317
|
+
.. warning::
|
|
318
|
+
|
|
319
|
+
This will not remove rules or templates already applied/used on
|
|
320
|
+
current widgets. It will only effect the next widgets creation or
|
|
321
|
+
template invocation.
|
|
322
|
+
'''
|
|
323
|
+
# remove rules and templates
|
|
324
|
+
filename = resource_find(filename) or filename
|
|
325
|
+
self.rules = [x for x in self.rules if x[1].ctx.filename != filename]
|
|
326
|
+
self._clear_matchcache()
|
|
327
|
+
templates = {}
|
|
328
|
+
for x, y in self.templates.items():
|
|
329
|
+
if y[2] != filename:
|
|
330
|
+
templates[x] = y
|
|
331
|
+
self.templates = templates
|
|
332
|
+
|
|
333
|
+
if filename in self.files:
|
|
334
|
+
self.files.remove(filename)
|
|
335
|
+
|
|
336
|
+
# unregister all the dynamic classes
|
|
337
|
+
Factory.unregister_from_filename(filename)
|
|
338
|
+
|
|
339
|
+
def load_string(self, string, **kwargs):
|
|
340
|
+
'''Insert a string into the Language Builder and return the root widget
|
|
341
|
+
(if defined) of the kv string.
|
|
342
|
+
|
|
343
|
+
:Parameters:
|
|
344
|
+
`rulesonly`: bool, defaults to False
|
|
345
|
+
If True, the Builder will raise an exception if you have a root
|
|
346
|
+
widget inside the definition.
|
|
347
|
+
`filename`: str, defaults to None
|
|
348
|
+
If specified, the filename used to index the kv rules.
|
|
349
|
+
|
|
350
|
+
The filename parameter can be used to unload kv strings in the same way
|
|
351
|
+
as you unload kv files. This can be achieved using pseudo file names
|
|
352
|
+
e.g.::
|
|
353
|
+
|
|
354
|
+
Build.load_string("""
|
|
355
|
+
<MyRule>:
|
|
356
|
+
Label:
|
|
357
|
+
text="Hello"
|
|
358
|
+
""", filename="myrule.kv")
|
|
359
|
+
|
|
360
|
+
can be unloaded via::
|
|
361
|
+
|
|
362
|
+
Build.unload_file("myrule.kv")
|
|
363
|
+
|
|
364
|
+
'''
|
|
365
|
+
|
|
366
|
+
kwargs.setdefault('rulesonly', False)
|
|
367
|
+
self._current_filename = fn = kwargs.get('filename', None)
|
|
368
|
+
|
|
369
|
+
# put a warning if a file is loaded multiple times
|
|
370
|
+
if fn in self.files:
|
|
371
|
+
Logger.warning(
|
|
372
|
+
'Lang: The file {} is loaded multiples times, '
|
|
373
|
+
'you might have unwanted behaviors.'.format(fn))
|
|
374
|
+
|
|
375
|
+
try:
|
|
376
|
+
# parse the string
|
|
377
|
+
parser = Parser(content=string, filename=fn)
|
|
378
|
+
|
|
379
|
+
# merge rules with our rules
|
|
380
|
+
self.rules.extend(parser.rules)
|
|
381
|
+
self._clear_matchcache()
|
|
382
|
+
|
|
383
|
+
# add the template found by the parser into ours
|
|
384
|
+
for name, cls, template in parser.templates:
|
|
385
|
+
self.templates[name] = (cls, template, fn)
|
|
386
|
+
Factory.register(name,
|
|
387
|
+
cls=partial(self.template, name),
|
|
388
|
+
is_template=True, warn=True)
|
|
389
|
+
|
|
390
|
+
# register all the dynamic classes
|
|
391
|
+
for name, baseclasses in parser.dynamic_classes.items():
|
|
392
|
+
Factory.register(name, baseclasses=baseclasses, filename=fn,
|
|
393
|
+
warn=True)
|
|
394
|
+
|
|
395
|
+
# create root object is exist
|
|
396
|
+
if kwargs['rulesonly'] and parser.root:
|
|
397
|
+
filename = kwargs.get('rulesonly', '<string>')
|
|
398
|
+
raise Exception('The file <%s> contain also non-rules '
|
|
399
|
+
'directives' % filename)
|
|
400
|
+
|
|
401
|
+
# save the loaded files only if there is a root without
|
|
402
|
+
# template/dynamic classes
|
|
403
|
+
if fn and (parser.templates or
|
|
404
|
+
parser.dynamic_classes or parser.rules):
|
|
405
|
+
self.files.append(fn)
|
|
406
|
+
|
|
407
|
+
if parser.root:
|
|
408
|
+
widget = Factory.get(parser.root.name)(__no_builder=True)
|
|
409
|
+
rule_children = []
|
|
410
|
+
widget.apply_class_lang_rules(
|
|
411
|
+
root=widget, rule_children=rule_children)
|
|
412
|
+
self._apply_rule(
|
|
413
|
+
widget, parser.root, parser.root,
|
|
414
|
+
rule_children=rule_children)
|
|
415
|
+
|
|
416
|
+
for child in rule_children:
|
|
417
|
+
child.dispatch('on_kv_post', widget)
|
|
418
|
+
widget.dispatch('on_kv_post', widget)
|
|
419
|
+
return widget
|
|
420
|
+
finally:
|
|
421
|
+
self._current_filename = None
|
|
422
|
+
|
|
423
|
+
def template(self, *args, **ctx):
|
|
424
|
+
'''Create a specialized template using a specific context.
|
|
425
|
+
|
|
426
|
+
.. versionadded:: 1.0.5
|
|
427
|
+
|
|
428
|
+
With templates, you can construct custom widgets from a kv lang
|
|
429
|
+
definition by giving them a context. Check :ref:`Template usage
|
|
430
|
+
<template_usage>`.
|
|
431
|
+
'''
|
|
432
|
+
# Prevent naming clash with whatever the user might be putting into the
|
|
433
|
+
# ctx as key.
|
|
434
|
+
name = args[0]
|
|
435
|
+
if name not in self.templates:
|
|
436
|
+
raise Exception('Unknown <%s> template name' % name)
|
|
437
|
+
baseclasses, rule, fn = self.templates[name]
|
|
438
|
+
key = '%s|%s' % (name, baseclasses)
|
|
439
|
+
cls = Cache.get('kv.lang', key)
|
|
440
|
+
if cls is None:
|
|
441
|
+
rootwidgets = []
|
|
442
|
+
for basecls in baseclasses.split('+'):
|
|
443
|
+
rootwidgets.append(Factory.get(basecls))
|
|
444
|
+
cls = type(name, tuple(rootwidgets), {})
|
|
445
|
+
Cache.append('kv.lang', key, cls)
|
|
446
|
+
widget = cls()
|
|
447
|
+
# in previous versions, ``ctx`` is passed as is as ``template_ctx``
|
|
448
|
+
# preventing widgets in it from be collected by the GC. This was
|
|
449
|
+
# especially relevant to AccordionItem's title_template.
|
|
450
|
+
proxy_ctx = {k: get_proxy(v) for k, v in ctx.items()}
|
|
451
|
+
self._apply_rule(widget, rule, rule, template_ctx=proxy_ctx)
|
|
452
|
+
return widget
|
|
453
|
+
|
|
454
|
+
def apply_rules(
|
|
455
|
+
self, widget, rule_name, ignored_consts=set(), rule_children=None,
|
|
456
|
+
dispatch_kv_post=False):
|
|
457
|
+
'''Search all the rules that match the name `rule_name`
|
|
458
|
+
and apply them to `widget`.
|
|
459
|
+
|
|
460
|
+
.. versionadded:: 1.10.0
|
|
461
|
+
|
|
462
|
+
:Parameters:
|
|
463
|
+
|
|
464
|
+
`widget`: :class:`~kivy.uix.widget.Widget`
|
|
465
|
+
The widget to whom the matching rules should be applied to.
|
|
466
|
+
`ignored_consts`: set
|
|
467
|
+
A set or list type whose elements are property names for which
|
|
468
|
+
constant KV rules (i.e. those that don't create bindings) of
|
|
469
|
+
that widget will not be applied. This allows e.g. skipping
|
|
470
|
+
constant rules that overwrite a value initialized in python.
|
|
471
|
+
`rule_children`: list
|
|
472
|
+
If not ``None``, it should be a list that will be populated
|
|
473
|
+
with all the widgets created by the kv rules being applied.
|
|
474
|
+
|
|
475
|
+
.. versionchanged:: 1.11.0
|
|
476
|
+
|
|
477
|
+
`dispatch_kv_post`: bool
|
|
478
|
+
Normally the class `Widget` dispatches the `on_kv_post` event
|
|
479
|
+
to widgets created during kv rule application.
|
|
480
|
+
But if the rules are manually applied by calling :meth:`apply`,
|
|
481
|
+
that may not happen, so if this is `True`, we will dispatch the
|
|
482
|
+
`on_kv_post` event where needed after applying the rules to
|
|
483
|
+
`widget` (we won't dispatch it for `widget` itself).
|
|
484
|
+
|
|
485
|
+
Defaults to False.
|
|
486
|
+
|
|
487
|
+
.. versionchanged:: 1.11.0
|
|
488
|
+
'''
|
|
489
|
+
rules = self.match_rule_name(rule_name)
|
|
490
|
+
if __debug__:
|
|
491
|
+
trace('Lang: Found %d rules for %s' % (len(rules), rule_name))
|
|
492
|
+
if not rules:
|
|
493
|
+
return
|
|
494
|
+
|
|
495
|
+
if dispatch_kv_post:
|
|
496
|
+
rule_children = rule_children if rule_children is not None else []
|
|
497
|
+
for rule in rules:
|
|
498
|
+
self._apply_rule(
|
|
499
|
+
widget, rule, rule, ignored_consts=ignored_consts,
|
|
500
|
+
rule_children=rule_children)
|
|
501
|
+
if dispatch_kv_post:
|
|
502
|
+
for w in rule_children:
|
|
503
|
+
w.dispatch('on_kv_post', widget)
|
|
504
|
+
|
|
505
|
+
def apply(self, widget, ignored_consts=set(), rule_children=None,
|
|
506
|
+
dispatch_kv_post=False):
|
|
507
|
+
'''Search all the rules that match the widget and apply them.
|
|
508
|
+
|
|
509
|
+
:Parameters:
|
|
510
|
+
|
|
511
|
+
`widget`: :class:`~kivy.uix.widget.Widget`
|
|
512
|
+
The widget whose class rules should be applied to this widget.
|
|
513
|
+
`ignored_consts`: set
|
|
514
|
+
A set or list type whose elements are property names for which
|
|
515
|
+
constant KV rules (i.e. those that don't create bindings) of
|
|
516
|
+
that widget will not be applied. This allows e.g. skipping
|
|
517
|
+
constant rules that overwrite a value initialized in python.
|
|
518
|
+
`rule_children`: list
|
|
519
|
+
If not ``None``, it should be a list that will be populated
|
|
520
|
+
with all the widgets created by the kv rules being applied.
|
|
521
|
+
|
|
522
|
+
.. versionchanged:: 1.11.0
|
|
523
|
+
|
|
524
|
+
`dispatch_kv_post`: bool
|
|
525
|
+
Normally the class `Widget` dispatches the `on_kv_post` event
|
|
526
|
+
to widgets created during kv rule application.
|
|
527
|
+
But if the rules are manually applied by calling :meth:`apply`,
|
|
528
|
+
that may not happen, so if this is `True`, we will dispatch the
|
|
529
|
+
`on_kv_post` event where needed after applying the rules to
|
|
530
|
+
`widget` (we won't dispatch it for `widget` itself).
|
|
531
|
+
|
|
532
|
+
Defaults to False.
|
|
533
|
+
|
|
534
|
+
.. versionchanged:: 1.11.0
|
|
535
|
+
'''
|
|
536
|
+
rules = self.match(widget)
|
|
537
|
+
if __debug__:
|
|
538
|
+
trace('Lang: Found %d rules for %s' % (len(rules), widget))
|
|
539
|
+
if not rules:
|
|
540
|
+
return
|
|
541
|
+
|
|
542
|
+
if dispatch_kv_post:
|
|
543
|
+
rule_children = rule_children if rule_children is not None else []
|
|
544
|
+
for rule in rules:
|
|
545
|
+
self._apply_rule(
|
|
546
|
+
widget, rule, rule, ignored_consts=ignored_consts,
|
|
547
|
+
rule_children=rule_children)
|
|
548
|
+
if dispatch_kv_post:
|
|
549
|
+
for w in rule_children:
|
|
550
|
+
w.dispatch('on_kv_post', widget)
|
|
551
|
+
|
|
552
|
+
def _clear_matchcache(self):
|
|
553
|
+
self._match_cache.clear()
|
|
554
|
+
self._match_name_cache.clear()
|
|
555
|
+
|
|
556
|
+
def _apply_rule(self, widget, rule, rootrule, template_ctx=None,
|
|
557
|
+
ignored_consts=set(), rule_children=None):
|
|
558
|
+
# widget: the current instantiated widget
|
|
559
|
+
# rule: the current rule
|
|
560
|
+
# rootrule: the current root rule (for children of a rule)
|
|
561
|
+
|
|
562
|
+
# will collect reference to all the id in children
|
|
563
|
+
assert rule not in self.rulectx
|
|
564
|
+
self.rulectx[rule] = rctx = {
|
|
565
|
+
'ids': {'root': widget.proxy_ref},
|
|
566
|
+
'set': [], 'hdl': []}
|
|
567
|
+
|
|
568
|
+
# extract the context of the rootrule (not rule!)
|
|
569
|
+
assert rootrule in self.rulectx
|
|
570
|
+
rctx = self.rulectx[rootrule]
|
|
571
|
+
|
|
572
|
+
# if a template context is passed, put it as "ctx"
|
|
573
|
+
if template_ctx is not None:
|
|
574
|
+
rctx['ids']['ctx'] = QueryDict(template_ctx)
|
|
575
|
+
|
|
576
|
+
# if we got an id, put it in the root rule for a later global usage
|
|
577
|
+
if rule.id:
|
|
578
|
+
# use only the first word as `id` discard the rest.
|
|
579
|
+
rule.id = rule.id.split('#', 1)[0].strip()
|
|
580
|
+
rctx['ids'][rule.id] = widget.proxy_ref
|
|
581
|
+
# set id name as a attribute for root widget so one can in python
|
|
582
|
+
# code simply access root_widget.id_name
|
|
583
|
+
_ids = dict(rctx['ids'])
|
|
584
|
+
_root = _ids.pop('root')
|
|
585
|
+
_new_ids = _root.ids
|
|
586
|
+
for _key, _value in _ids.items():
|
|
587
|
+
if _value == _root:
|
|
588
|
+
# skip on self
|
|
589
|
+
continue
|
|
590
|
+
_new_ids[_key] = _value
|
|
591
|
+
_root.ids = _new_ids
|
|
592
|
+
|
|
593
|
+
# first, ensure that the widget have all the properties used in
|
|
594
|
+
# the rule if not, they will be created as ObjectProperty.
|
|
595
|
+
rule.create_missing(widget)
|
|
596
|
+
|
|
597
|
+
# build the widget canvas
|
|
598
|
+
if rule.canvas_before:
|
|
599
|
+
with widget.canvas.before:
|
|
600
|
+
self._build_canvas(widget.canvas.before, widget,
|
|
601
|
+
rule.canvas_before, rootrule)
|
|
602
|
+
if rule.canvas_root:
|
|
603
|
+
with widget.canvas:
|
|
604
|
+
self._build_canvas(widget.canvas, widget,
|
|
605
|
+
rule.canvas_root, rootrule)
|
|
606
|
+
if rule.canvas_after:
|
|
607
|
+
with widget.canvas.after:
|
|
608
|
+
self._build_canvas(widget.canvas.after, widget,
|
|
609
|
+
rule.canvas_after, rootrule)
|
|
610
|
+
|
|
611
|
+
# create children tree
|
|
612
|
+
Factory_get = Factory.get
|
|
613
|
+
Factory_is_template = Factory.is_template
|
|
614
|
+
for crule in rule.children:
|
|
615
|
+
cname = crule.name
|
|
616
|
+
|
|
617
|
+
if cname in ('canvas', 'canvas.before', 'canvas.after'):
|
|
618
|
+
raise ParserException(
|
|
619
|
+
crule.ctx, crule.line,
|
|
620
|
+
'Canvas instructions added in kv must '
|
|
621
|
+
'be declared before child widgets.')
|
|
622
|
+
|
|
623
|
+
# depending if the child rule is a template or not, we are not
|
|
624
|
+
# having the same approach
|
|
625
|
+
cls = Factory_get(cname)
|
|
626
|
+
|
|
627
|
+
if Factory_is_template(cname):
|
|
628
|
+
# we got a template, so extract all the properties and
|
|
629
|
+
# handlers, and push them in a "ctx" dictionary.
|
|
630
|
+
ctx = {}
|
|
631
|
+
idmap = copy(global_idmap)
|
|
632
|
+
idmap.update({'root': rctx['ids']['root']})
|
|
633
|
+
if 'ctx' in rctx['ids']:
|
|
634
|
+
idmap.update({'ctx': rctx['ids']['ctx']})
|
|
635
|
+
try:
|
|
636
|
+
for prule in crule.properties.values():
|
|
637
|
+
value = prule.co_value
|
|
638
|
+
if type(value) is CodeType:
|
|
639
|
+
value = eval(value, idmap)
|
|
640
|
+
ctx[prule.name] = value
|
|
641
|
+
for prule in crule.handlers:
|
|
642
|
+
value = eval(prule.value, idmap)
|
|
643
|
+
ctx[prule.name] = value
|
|
644
|
+
except Exception as e:
|
|
645
|
+
tb = sys.exc_info()[2]
|
|
646
|
+
raise BuilderException(
|
|
647
|
+
prule.ctx, prule.line,
|
|
648
|
+
'{}: {}'.format(e.__class__.__name__, e), cause=tb)
|
|
649
|
+
|
|
650
|
+
# create the template with an explicit ctx
|
|
651
|
+
child = cls(**ctx)
|
|
652
|
+
widget.add_widget(child)
|
|
653
|
+
|
|
654
|
+
# reference it on our root rule context
|
|
655
|
+
if crule.id:
|
|
656
|
+
rctx['ids'][crule.id] = child
|
|
657
|
+
|
|
658
|
+
else:
|
|
659
|
+
# we got a "normal" rule, construct it manually
|
|
660
|
+
# we can't construct it without __no_builder=True, because the
|
|
661
|
+
# previous implementation was doing the add_widget() before
|
|
662
|
+
# apply(), and so, we could use "self.parent".
|
|
663
|
+
child = cls(__no_builder=True)
|
|
664
|
+
widget.add_widget(child)
|
|
665
|
+
child.apply_class_lang_rules(
|
|
666
|
+
root=rctx['ids']['root'], rule_children=rule_children)
|
|
667
|
+
self._apply_rule(
|
|
668
|
+
child, crule, rootrule, rule_children=rule_children)
|
|
669
|
+
|
|
670
|
+
if rule_children is not None:
|
|
671
|
+
rule_children.append(child)
|
|
672
|
+
|
|
673
|
+
# append the properties and handlers to our final resolution task
|
|
674
|
+
if rule.properties:
|
|
675
|
+
rctx['set'].append((widget.proxy_ref,
|
|
676
|
+
list(rule.properties.values())))
|
|
677
|
+
for key, crule in rule.properties.items():
|
|
678
|
+
# clear previously applied rules if asked
|
|
679
|
+
if crule.ignore_prev:
|
|
680
|
+
Builder.unbind_property(widget, key)
|
|
681
|
+
if rule.handlers:
|
|
682
|
+
rctx['hdl'].append((widget.proxy_ref, rule.handlers))
|
|
683
|
+
|
|
684
|
+
# if we are applying another rule that the root one, then it's done for
|
|
685
|
+
# us!
|
|
686
|
+
if rootrule is not rule:
|
|
687
|
+
del self.rulectx[rule]
|
|
688
|
+
return
|
|
689
|
+
|
|
690
|
+
# normally, we can apply a list of properties with a proper context
|
|
691
|
+
try:
|
|
692
|
+
rule = None
|
|
693
|
+
for widget_set, rules in reversed(rctx['set']):
|
|
694
|
+
for rule in rules:
|
|
695
|
+
assert isinstance(rule, ParserRuleProperty)
|
|
696
|
+
key = rule.name
|
|
697
|
+
value = rule.co_value
|
|
698
|
+
if type(value) is CodeType:
|
|
699
|
+
value, bound = create_handler(
|
|
700
|
+
widget_set, widget_set, key, value, rule,
|
|
701
|
+
rctx['ids'])
|
|
702
|
+
# if there's a rule
|
|
703
|
+
if (widget_set != widget or bound or
|
|
704
|
+
key not in ignored_consts):
|
|
705
|
+
setattr(widget_set, key, value)
|
|
706
|
+
else:
|
|
707
|
+
if (widget_set != widget or
|
|
708
|
+
key not in ignored_consts):
|
|
709
|
+
setattr(widget_set, key, value)
|
|
710
|
+
|
|
711
|
+
except Exception as e:
|
|
712
|
+
if rule is not None:
|
|
713
|
+
tb = sys.exc_info()[2]
|
|
714
|
+
raise BuilderException(rule.ctx, rule.line,
|
|
715
|
+
'{}: {}'.format(e.__class__.__name__,
|
|
716
|
+
e), cause=tb)
|
|
717
|
+
raise e
|
|
718
|
+
|
|
719
|
+
# build handlers
|
|
720
|
+
try:
|
|
721
|
+
crule = None
|
|
722
|
+
for widget_set, rules in rctx['hdl']:
|
|
723
|
+
for crule in rules:
|
|
724
|
+
assert isinstance(crule, ParserRuleProperty)
|
|
725
|
+
assert crule.name.startswith('on_')
|
|
726
|
+
key = crule.name
|
|
727
|
+
if not widget_set.is_event_type(key):
|
|
728
|
+
key = key[3:]
|
|
729
|
+
idmap = copy(global_idmap)
|
|
730
|
+
idmap.update(rctx['ids'])
|
|
731
|
+
idmap['self'] = widget_set.proxy_ref
|
|
732
|
+
if not widget_set.fbind(key, custom_callback, crule,
|
|
733
|
+
idmap):
|
|
734
|
+
raise AttributeError(key)
|
|
735
|
+
# hack for on_parent
|
|
736
|
+
if crule.name == 'on_parent':
|
|
737
|
+
Factory.Widget.parent.dispatch(widget_set.__self__)
|
|
738
|
+
except Exception as e:
|
|
739
|
+
if crule is not None:
|
|
740
|
+
tb = sys.exc_info()[2]
|
|
741
|
+
raise BuilderException(
|
|
742
|
+
crule.ctx, crule.line,
|
|
743
|
+
'{}: {}'.format(e.__class__.__name__, e), cause=tb)
|
|
744
|
+
raise e
|
|
745
|
+
|
|
746
|
+
# rule finished, forget it
|
|
747
|
+
del self.rulectx[rootrule]
|
|
748
|
+
|
|
749
|
+
def match(self, widget):
|
|
750
|
+
'''Return a list of :class:`ParserRule` objects matching the widget.
|
|
751
|
+
'''
|
|
752
|
+
cache = self._match_cache
|
|
753
|
+
k = (widget.__class__, tuple(widget.cls))
|
|
754
|
+
if k in cache:
|
|
755
|
+
return cache[k]
|
|
756
|
+
rules = []
|
|
757
|
+
for selector, rule in self.rules:
|
|
758
|
+
if selector.match(widget):
|
|
759
|
+
if rule.avoid_previous_rules:
|
|
760
|
+
del rules[:]
|
|
761
|
+
rules.append(rule)
|
|
762
|
+
cache[k] = rules
|
|
763
|
+
return rules
|
|
764
|
+
|
|
765
|
+
def match_rule_name(self, rule_name):
|
|
766
|
+
'''Return a list of :class:`ParserRule` objects matching the widget.
|
|
767
|
+
'''
|
|
768
|
+
cache = self._match_name_cache
|
|
769
|
+
rule_name = str(rule_name)
|
|
770
|
+
k = rule_name.lower()
|
|
771
|
+
if k in cache:
|
|
772
|
+
return cache[k]
|
|
773
|
+
rules = []
|
|
774
|
+
for selector, rule in self.rules:
|
|
775
|
+
if selector.match_rule_name(rule_name):
|
|
776
|
+
if rule.avoid_previous_rules:
|
|
777
|
+
del rules[:]
|
|
778
|
+
rules.append(rule)
|
|
779
|
+
cache[k] = rules
|
|
780
|
+
return rules
|
|
781
|
+
|
|
782
|
+
def sync(self):
|
|
783
|
+
'''Execute all the waiting operations, such as the execution of all the
|
|
784
|
+
expressions related to the canvas.
|
|
785
|
+
|
|
786
|
+
.. versionadded:: 1.7.0
|
|
787
|
+
'''
|
|
788
|
+
global _delayed_start
|
|
789
|
+
next_args = _delayed_start
|
|
790
|
+
if next_args is None:
|
|
791
|
+
return
|
|
792
|
+
|
|
793
|
+
while next_args is not StopIteration:
|
|
794
|
+
# is this try/except still needed? yes, in case widget died in this
|
|
795
|
+
# frame after the call was scheduled
|
|
796
|
+
try:
|
|
797
|
+
call_fn(next_args[:-1], None, None)
|
|
798
|
+
except ReferenceError:
|
|
799
|
+
pass
|
|
800
|
+
args = next_args
|
|
801
|
+
next_args = args[-1]
|
|
802
|
+
args[-1] = None
|
|
803
|
+
_delayed_start = None
|
|
804
|
+
|
|
805
|
+
def unbind_widget(self, uid):
|
|
806
|
+
'''Unbind all the handlers created by the KV rules of the
|
|
807
|
+
widget. The :attr:`kivy.uix.widget.Widget.uid` is passed here
|
|
808
|
+
instead of the widget itself, because Builder is using it in the
|
|
809
|
+
widget destructor.
|
|
810
|
+
|
|
811
|
+
This effectively clears all the KV rules associated with this widget.
|
|
812
|
+
For example:
|
|
813
|
+
|
|
814
|
+
.. code-block:: python
|
|
815
|
+
|
|
816
|
+
>>> w = Builder.load_string(\'''
|
|
817
|
+
... Widget:
|
|
818
|
+
... height: self.width / 2. if self.disabled else self.width
|
|
819
|
+
... x: self.y + 50
|
|
820
|
+
... \''')
|
|
821
|
+
>>> w.size
|
|
822
|
+
[100, 100]
|
|
823
|
+
>>> w.pos
|
|
824
|
+
[50, 0]
|
|
825
|
+
>>> w.width = 500
|
|
826
|
+
>>> w.size
|
|
827
|
+
[500, 500]
|
|
828
|
+
>>> Builder.unbind_widget(w.uid)
|
|
829
|
+
>>> w.width = 222
|
|
830
|
+
>>> w.y = 500
|
|
831
|
+
>>> w.size
|
|
832
|
+
[222, 500]
|
|
833
|
+
>>> w.pos
|
|
834
|
+
[50, 500]
|
|
835
|
+
|
|
836
|
+
.. versionadded:: 1.7.2
|
|
837
|
+
'''
|
|
838
|
+
if uid not in _handlers:
|
|
839
|
+
return
|
|
840
|
+
for prop_callbacks in _handlers[uid].values():
|
|
841
|
+
for callbacks in prop_callbacks:
|
|
842
|
+
for f, k, fn, bound_uid in callbacks:
|
|
843
|
+
if fn is None: # it's not a kivy prop.
|
|
844
|
+
continue
|
|
845
|
+
try:
|
|
846
|
+
f.unbind_uid(k, bound_uid)
|
|
847
|
+
except ReferenceError:
|
|
848
|
+
# proxy widget is already gone, that's cool :)
|
|
849
|
+
pass
|
|
850
|
+
del _handlers[uid]
|
|
851
|
+
|
|
852
|
+
def unbind_property(self, widget, name):
|
|
853
|
+
'''Unbind the handlers created by all the rules of the widget that set
|
|
854
|
+
the name.
|
|
855
|
+
|
|
856
|
+
This effectively clears all the rules of widget that take the form::
|
|
857
|
+
|
|
858
|
+
name: rule
|
|
859
|
+
|
|
860
|
+
For example:
|
|
861
|
+
|
|
862
|
+
.. code-block:: python
|
|
863
|
+
|
|
864
|
+
>>> w = Builder.load_string(\'''
|
|
865
|
+
... Widget:
|
|
866
|
+
... height: self.width / 2. if self.disabled else self.width
|
|
867
|
+
... x: self.y + 50
|
|
868
|
+
... \''')
|
|
869
|
+
>>> w.size
|
|
870
|
+
[100, 100]
|
|
871
|
+
>>> w.pos
|
|
872
|
+
[50, 0]
|
|
873
|
+
>>> w.width = 500
|
|
874
|
+
>>> w.size
|
|
875
|
+
[500, 500]
|
|
876
|
+
>>> Builder.unbind_property(w, 'height')
|
|
877
|
+
>>> w.width = 222
|
|
878
|
+
>>> w.size
|
|
879
|
+
[222, 500]
|
|
880
|
+
>>> w.y = 500
|
|
881
|
+
>>> w.pos
|
|
882
|
+
[550, 500]
|
|
883
|
+
|
|
884
|
+
.. versionadded:: 1.9.1
|
|
885
|
+
'''
|
|
886
|
+
uid = widget.uid
|
|
887
|
+
if uid not in _handlers:
|
|
888
|
+
return
|
|
889
|
+
|
|
890
|
+
prop_handlers = _handlers[uid]
|
|
891
|
+
if name not in prop_handlers:
|
|
892
|
+
return
|
|
893
|
+
|
|
894
|
+
for callbacks in prop_handlers[name]:
|
|
895
|
+
for f, k, fn, bound_uid in callbacks:
|
|
896
|
+
if fn is None: # it's not a kivy prop.
|
|
897
|
+
continue
|
|
898
|
+
try:
|
|
899
|
+
f.unbind_uid(k, bound_uid)
|
|
900
|
+
except ReferenceError:
|
|
901
|
+
# proxy widget is already gone, that's cool :)
|
|
902
|
+
pass
|
|
903
|
+
del prop_handlers[name]
|
|
904
|
+
if not prop_handlers:
|
|
905
|
+
del _handlers[uid]
|
|
906
|
+
|
|
907
|
+
def _build_canvas(self, canvas, widget, rule, rootrule):
|
|
908
|
+
global Instruction
|
|
909
|
+
if Instruction is None:
|
|
910
|
+
Instruction = Factory.get('Instruction')
|
|
911
|
+
idmap = copy(self.rulectx[rootrule]['ids'])
|
|
912
|
+
for crule in rule.children:
|
|
913
|
+
name = crule.name
|
|
914
|
+
if name == 'Clear':
|
|
915
|
+
canvas.clear()
|
|
916
|
+
continue
|
|
917
|
+
instr = Factory.get(name)()
|
|
918
|
+
if not isinstance(instr, Instruction):
|
|
919
|
+
raise BuilderException(
|
|
920
|
+
crule.ctx, crule.line,
|
|
921
|
+
'You can add only graphics Instruction in canvas.')
|
|
922
|
+
try:
|
|
923
|
+
for prule in crule.properties.values():
|
|
924
|
+
key = prule.name
|
|
925
|
+
value = prule.co_value
|
|
926
|
+
if type(value) is CodeType:
|
|
927
|
+
value, _ = create_handler(
|
|
928
|
+
widget, instr.proxy_ref,
|
|
929
|
+
key, value, prule, idmap, True)
|
|
930
|
+
setattr(instr, key, value)
|
|
931
|
+
except Exception as e:
|
|
932
|
+
tb = sys.exc_info()[2]
|
|
933
|
+
raise BuilderException(
|
|
934
|
+
prule.ctx, prule.line,
|
|
935
|
+
'{}: {}'.format(e.__class__.__name__, e), cause=tb)
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
#: Main instance of a :class:`BuilderBase`.
|
|
939
|
+
Builder: BuilderBase = register_context('Builder', BuilderBase)
|
|
940
|
+
Builder.load_file(join(kivy_data_dir, 'style.kv'), rulesonly=True)
|
|
941
|
+
|
|
942
|
+
if 'KIVY_PROFILE_LANG' in environ:
|
|
943
|
+
import atexit
|
|
944
|
+
from html import escape
|
|
945
|
+
|
|
946
|
+
def match_rule(fn, index, rule):
|
|
947
|
+
if rule.ctx.filename != fn:
|
|
948
|
+
return
|
|
949
|
+
for prop, prp in rule.properties.items():
|
|
950
|
+
if prp.line != index:
|
|
951
|
+
continue
|
|
952
|
+
yield prp
|
|
953
|
+
for child in rule.children:
|
|
954
|
+
for r in match_rule(fn, index, child):
|
|
955
|
+
yield r
|
|
956
|
+
if rule.canvas_root:
|
|
957
|
+
for r in match_rule(fn, index, rule.canvas_root):
|
|
958
|
+
yield r
|
|
959
|
+
if rule.canvas_before:
|
|
960
|
+
for r in match_rule(fn, index, rule.canvas_before):
|
|
961
|
+
yield r
|
|
962
|
+
if rule.canvas_after:
|
|
963
|
+
for r in match_rule(fn, index, rule.canvas_after):
|
|
964
|
+
yield r
|
|
965
|
+
|
|
966
|
+
def dump_builder_stats():
|
|
967
|
+
html = [
|
|
968
|
+
'<!doctype html>'
|
|
969
|
+
'<html><body>',
|
|
970
|
+
'<style type="text/css">\n',
|
|
971
|
+
'pre { margin: 0; }\n',
|
|
972
|
+
'</style>']
|
|
973
|
+
files = {x[1].ctx.filename for x in Builder.rules}
|
|
974
|
+
for fn in files:
|
|
975
|
+
try:
|
|
976
|
+
with open(fn) as f:
|
|
977
|
+
lines = f.readlines()
|
|
978
|
+
except (IOError, TypeError) as e:
|
|
979
|
+
continue
|
|
980
|
+
html += ['<h2>', fn, '</h2>', '<table>']
|
|
981
|
+
count = 0
|
|
982
|
+
for index, line in enumerate(lines):
|
|
983
|
+
line = line.rstrip()
|
|
984
|
+
line = escape(line)
|
|
985
|
+
matched_prp = []
|
|
986
|
+
for psn, rule in Builder.rules:
|
|
987
|
+
matched_prp.extend(match_rule(fn, index, rule))
|
|
988
|
+
|
|
989
|
+
count = sum({x.count for x in matched_prp})
|
|
990
|
+
|
|
991
|
+
color = (255, 155, 155) if count else (255, 255, 255)
|
|
992
|
+
html += ['<tr style="background-color: rgb{}">'.format(color),
|
|
993
|
+
'<td>', str(index + 1), '</td>',
|
|
994
|
+
'<td>', str(count), '</td>',
|
|
995
|
+
'<td><pre>', line, '</pre></td>',
|
|
996
|
+
'</tr>']
|
|
997
|
+
html += ['</table>']
|
|
998
|
+
html += ['</body></html>']
|
|
999
|
+
with open('builder_stats.html', 'w', encoding='utf-8') as fd:
|
|
1000
|
+
fd.write(''.join(html))
|
|
1001
|
+
|
|
1002
|
+
print('Profiling written at builder_stats.html')
|
|
1003
|
+
|
|
1004
|
+
atexit.register(dump_builder_stats)
|