smartcitizen
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteDernière révisionLes deux révisions suivantes | ||
kivy_application_android_smart_citizen [2020/01/28 09:02] – [ReSSources] serge | smartcitizen [2020/11/13 09:21] – [Les difficultés rencontrées] serge | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== | + | ====== |
+ | Le [[https:// | ||
+ | |||
+ | Le module électronique peut envoyer ses données environnementale sur la plateforme web proposée, il peut aussi marcher "off line" en écrivant les données sur une carte SD, ou se connecter à d' | ||
+ | |||
+ | {{ : | ||
+ | ---- | ||
+ | |||
+ | ===== Kit de mesure SmartCitizen - approches hardware et software ===== | ||
+ | **Voir [[smartcitizen_hardware_software|la page dédiée aux recherches et expérimentations autour du kit SmartCitizen coté logiciel et matériel]]** : extraction de données, envoi par client mqtt, connexion au réseau Lora, ... | ||
+ | |||
+ | {{ :: | ||
+ | |||
+ | |||
+ | ===== Application SmartCitizen Android avec Kivy ===== | ||
<WRAP center round box 60% centeralign> | <WRAP center round box 60% centeralign> | ||
**{{tagpage> | **{{tagpage> | ||
**[[http:// | **[[http:// | ||
</ | </ | ||
+ | <WRAP center round box 40% centeralign> | ||
+ | **[[les_pages_kivy_en_details|Les pages Kivy en détails]]** | ||
+ | </ | ||
+ | |||
+ | <WRAP group> | ||
+ | <WRAP third column> | ||
+ | {{:: | ||
+ | </ | ||
+ | <WRAP third column> | ||
+ | {{:: | ||
+ | </ | ||
+ | |||
+ | <WRAP third column> | ||
+ | {{:: | ||
+ | </ | ||
+ | </ | ||
+ | |||
- | =====Ressources===== | + | {{ : |
+ | ====Ressources==== | ||
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
+ | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
- | * | + | |
===apk=== | ===apk=== | ||
- | **{{ :: | + | **{{ :: |
+ | ====Les choses non réussies==== | ||
+ | * Créer les box du menu déroulant dans le main.py alors que ça marche dans [[taposc|TapOSC]] mais sans menu déroulant. | ||
+ | * Un simple label transparent au dessus d'un widget | ||
- | =====Widgets Kivy utilisés===== | + | ====Les difficultés rencontrées==== |
- | * **ScreenManager: | + | ===L' |
- | * **ActionBar: | + | La class A peut accéder à la variable self.toto de la class B, mais pas l' |
+ | |||
+ | Une solution plus élégante est utilisée dans **[[https:// | ||
+ | <code python> | ||
+ | class AccelerometerApp(App): | ||
+ | def build(self): | ||
+ | return Accelerometer(self) | ||
+ | |||
+ | class Accelerometer(BoxLayout): | ||
+ | def __init__(self, | ||
+ | super().__init__(**kwargs) | ||
+ | self.app = app | ||
+ | self.app.osc = OSC() | ||
+ | |||
+ | class OSC: | ||
+ | def __init__(self): | ||
+ | self.histo = [] | ||
+ | self.server = OSCThreadServer() | ||
+ | self.server.bind(b'/ | ||
+ | |||
+ | def on_histo(self, | ||
+ | self.histo = .... | ||
+ | |||
+ | class Screen2: | ||
+ | def __init__(self): | ||
+ | self.app = App.get_running_app() # dans __init__() | ||
+ | # et appel de l' | ||
+ | self.app.osc.histo | ||
+ | Clock.schedule_once(self._once, | ||
+ | |||
+ | def _once(self, dt): | ||
+ | Clock.schedule_interval(self.update, | ||
+ | |||
+ | def update(self, | ||
+ | blabla = self.app.osc.histo | ||
+ | # blabla retrouve la valeur de histo de OSC !!!! | ||
+ | </ | ||
+ | |||
+ | ===Création du graph dans le kv=== | ||
+ | * [[https:// | ||
+ | |||
+ | ====Widgets Kivy utilisés==== | ||
+ | * **ScreenManager: | ||
+ | |||
+ | ===Une barre de menu=== | ||
+ | * **ActionBar: | ||
* **ActionView: | * **ActionView: | ||
* **ActionPrevious: | * **ActionPrevious: | ||
Ligne 22: | Ligne 104: | ||
* **ActionButton: | * **ActionButton: | ||
* **ActionGroup: | * **ActionGroup: | ||
+ | |||
+ | ===Widgets classiques=== | ||
+ | [[kivy_liste_des_elements_graphiques# | ||
* **BoxLayout: | * **BoxLayout: | ||
* **GridLayout: | * **GridLayout: | ||
* **Button:** | * **Button:** | ||
* **Label:** | * **Label:** | ||
- | | + | |
+ | ===Une image en background=== | ||
+ | [[kivy_image_avec_alpha_sur_fond_blanc|Une image avec canal alpha sur un fond blanc dans un BoxLayout]] | ||
+ | | ||
* **Rectangle: | * **Rectangle: | ||
- | | + | |
+ | ===Menu glissant=== | ||
+ | | ||
+ | |||
+ | ===Affichage d' | ||
* **Popup: | * **Popup: | ||
+ | |||
+ | ===Une belle courbe=== | ||
* **[[kivy_garden|Kivy: | * **[[kivy_garden|Kivy: | ||
- | {{tag> | + | ====buildozer.spec==== |
+ | <code text> | ||
+ | [app] | ||
+ | title = Smart Citizen | ||
+ | package.name = smartcitizen | ||
+ | package.domain = org.test | ||
+ | source.dir = . | ||
+ | source.include_exts = py, | ||
+ | source.exclude_dirs = old, bin, recherche, garden_graph_example | ||
+ | source.include_patterns = images/ | ||
+ | version.regex = __version__ = ['" | ||
+ | version.filename = %(source.dir)s/ | ||
+ | requirements = python3, | ||
+ | garden_requirements = graph | ||
+ | orientation = all | ||
+ | fullscreen = 1 | ||
+ | android.permissions = INTERNET | ||
+ | android.arch = armeabi-v7a | ||
+ | [buildozer] | ||
+ | log_level = 2 | ||
+ | warn_on_root = 1 | ||
+ | </ | ||
+ | |||
+ | ====Thread in Kivy==== | ||
+ | Pour stopper un thread à la fermeture de la fenêtre, le définir comme Salsa du démon | ||
+ | <code python> | ||
+ | thread_update = threading.Thread(target=self.update) | ||
+ | thread_update.setDaemon(True) | ||
+ | thread_update.start() | ||
+ | </ | ||
+ | ou\\ | ||
+ | class threading.Thread(group=None, | ||
+ | |||
+ | {{tag> |
smartcitizen.txt · Dernière modification : 2020/12/01 17:43 de serge