Skip to main content

Androids SystemFileChooser with Kivy

Project description

Android's SystemFileChooser with Kivy

A tool that uses Android's SystemFileChooser to process materials with the set of tools from Kivy.

Buildozer

To include these tools with Buildozer just include androidssystemfilechooser in the requirements.

API

For now it's better if you just read the source/code.
JavaStream(input_stream)
SystemFileChooser(mime_type, multiple)
uri_to_extension(uri)
uri_to_filename(uri)
uri_to_stream(uri)
uri_image_to_texture(uri)

Permissions and Runtime-permissions

You don't have to state anything.

Example code of use

from androidssystemfilechooser import (SystemFileChooser,
                                       uri_image_to_texture,
                                       uri_to_extension,
                                       uri_to_stream)
from kivy.app import App
from kivy.core.image import Image as CoreImage
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.uix.button import Button
from kivy.uix.image import Image

KV = '''
BoxLayout:
    orientation: 'vertical'

    MyTriggerButton:
        multiple: True
        text: 'Choose and execute results!'
        on_release: self.trigger()
'''


class MyTriggerButton(SystemFileChooser, Button):
    mime_type = StringProperty('image/*')

    def on_uris(self, instance, uris):
        for nr, uri in enumerate(uris):
            if nr % 2 == 0:
                with uri_to_stream(uri) as stream:
                    image = CoreImage(stream, ext=uri_to_extension(uri))
                texture = image.texture
            else:
                texture = uri_image_to_texture(uri)
            instance.parent.add_widget(Image(texture=texture))
        self.uris = []


class MyApp(App):
    def build(self):
        return Builder.load_string(KV)


if __name__ == '__main__':
    MyApp().run()

License

MIT-Licensed.

Project details


Release history Release notifications | RSS feed

This version

1.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

androidssystemfilechooser-1.7.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

androidssystemfilechooser-1.7-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file androidssystemfilechooser-1.7.tar.gz.

File metadata

  • Download URL: androidssystemfilechooser-1.7.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for androidssystemfilechooser-1.7.tar.gz
Algorithm Hash digest
SHA256 52abd443903351548cbce1b0b82c04a2d7cc952e3895211c9c31c96986d849bc
MD5 64508d48657e46f7b16d47a309073312
BLAKE2b-256 a22e35f8e549cdb352743404435f6c3e1cebaafdad08d1f48a75265c50cc1e1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for androidssystemfilechooser-1.7.tar.gz:

Publisher: python-publish.yml on kuzeyron/AndroidsSystemFileChooser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file androidssystemfilechooser-1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for androidssystemfilechooser-1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 588eed5fbe2bd8f94b560104d67dc97c0fe2fada9766d10e91bb52b46397cc98
MD5 21d746c486a5b8b128d8c2036a7b9290
BLAKE2b-256 cebbfaaab194cf370879d8d0534ff9729857de5b6f94d4bc228b1e9e51f12a1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for androidssystemfilechooser-1.7-py3-none-any.whl:

Publisher: python-publish.yml on kuzeyron/AndroidsSystemFileChooser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page