pymultilame
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édente | ||
| pymultilame [2018/08/29 12:22] – [Documentation gégérée avec pydoc3.5] serge | pymultilame [2022/02/14 08:49] (Version actuelle) – supprimée serge | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ======Python: | ||
| - | <WRAP center round box centeralign 60%> | ||
| - | **Des scripts pour les tâches de tous les jours** | ||
| - | </ | ||
| - | |||
| - | =====Les sources sur GitHub===== | ||
| - | * **[[https:// | ||
| - | |||
| - | ===== pymultilame ===== | ||
| - | |||
| - | ==== Des scripts python pour les tâches répétitives. ==== | ||
| - | |||
| - | Ce module propose les outils les plus courrant que j' | ||
| - | |||
| - | Ce module est une amélioration de | ||
| - | |||
| - | * [[https:// | ||
| - | |||
| - | qui n'est plus maintenu. | ||
| - | |||
| - | === Rubriques proposées === | ||
| - | |||
| - | * Blender: Des scripts spécifiques pour le Blender Game Engine 2.7x et qui ne peuvent tourner que dans Blender | ||
| - | * Twisted: des exemples de twisted en python3 | ||
| - | * Network: des sockets simples en python3 | ||
| - | * Tools: des outils utilisés fréquement | ||
| - | |||
| - | ==== Installation ==== | ||
| - | |||
| - | === Installation de Twisted pour python 3.x === | ||
| - | |||
| - | * [[https:// | ||
| - | |||
| - | < | ||
| - | sudo pip3 install twisted | ||
| - | </ | ||
| - | === Installation de pymultilame === | ||
| - | |||
| - | * [[https:// | ||
| - | |||
| - | < | ||
| - | sudo pip3 install -e git+https:// | ||
| - | </ | ||
| - | Mise à jour: | ||
| - | |||
| - | < | ||
| - | sudo pip3 install --upgrade git+https:// | ||
| - | </ | ||
| - | ==== Utilisation ==== | ||
| - | |||
| - | <code python> | ||
| - | from pymultilame import HttpDownload | ||
| - | from pymultilame import MyTools | ||
| - | from pymultilame import TcpClient | ||
| - | from pymultilame import MyConfig | ||
| - | from pymultilame import get_my_ip | ||
| - | from pymultilame import Multicast | ||
| - | from pymultilame import UdpClient | ||
| - | from pymultilame import PileFIFO | ||
| - | from pymultilame import Multicast | ||
| - | |||
| - | from pymultilame import Tempo | ||
| - | from pymultilame import EasyAudio | ||
| - | from pymultilame import TextureChange | ||
| - | |||
| - | from pymultilame import scene_change, | ||
| - | from pymultilame import get_all_objects, | ||
| - | </ | ||
| - | ==== Licence ==== | ||
| - | |||
| - | Touls les scripts sont sous | ||
| - | |||
| - | GNU GENERAL PUBLIC LICENSE Version 3 | ||
| - | |||
| - | voir le fichier LICENSE | ||
| - | |||
| - | ==== Documentation ==== | ||
| - | |||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | </ | ||
| - | |||
| - | ==== Documentation pour créer son propre package python==== | ||
| - | |||
| - | * [[https:// | ||
| - | |||
| - | =====Documentation générée avec pydoc3.5===== | ||
| - | |||
| - | ====blendergetobject==== | ||
| - | <code txt> | ||
| - | FUNCTIONS | ||
| - | get_all_objects() | ||
| - | Retourne une liste de tous les objets des scènes actives | ||
| - | | ||
| - | get_all_scenes() | ||
| - | Récupération des scènes | ||
| - | | ||
| - | get_scene_with_name(scn) | ||
| - | Récupération de la scène avec le nom | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====blendersound==== | ||
| - | <code txt> | ||
| - | DESCRIPTION | ||
| - | Classe générique qui permet de gérer facilement le son | ||
| - | dans le Blender Game Engine BGE. | ||
| - | | ||
| - | gl est le GameLogic, get with : from bge import logic as gl | ||
| - | | ||
| - | Appel de cette classe où tous les sons sont dans une liste avec : | ||
| - | import aud | ||
| - | | ||
| - | soundList = [" | ||
| - | | ||
| - | Création de l' | ||
| - | | ||
| - | gl.sound = EasyAudio(soundList) | ||
| - | soit { " | ||
| - | Joue le son boum | ||
| - | gl.sound[" | ||
| - | Stop le son | ||
| - | gl.sound[" | ||
| - | Idem repeat, pause | ||
| - | |||
| - | CLASSES | ||
| - | Factory | ||
| - | | ||
| - | class EasyAudio(builtins.dict) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | class Factory(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====blendertempo==== | ||
| - | <code txt> | ||
| - | CLASSES | ||
| - | TempoFactory | ||
| - | | ||
| - | class Tempo(builtins.dict) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | class TempoFactory(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | FUNCTIONS | ||
| - | test() | ||
| - | Tourne en dehors de Blender. | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====blendertexture==== | ||
| - | <code txt> | ||
| - | DESCRIPTION | ||
| - | Class générique qui permet de changer la texture d'un objet. | ||
| - | Ce script ne peut tourner que dans blender. | ||
| - | |||
| - | CLASSES | ||
| - | class TextureChange(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====blendertools==== | ||
| - | <code txt> | ||
| - | FUNCTIONS | ||
| - | droiteAffine(x1, | ||
| - | Retourne les valeurs de a et b de y=ax+b | ||
| - | à partir des coordonnées de 2 points. | ||
| - | | ||
| - | print_str_args(*args) | ||
| - | Imprime en terminal les variables en argument | ||
| - | Les variables doivent être sous forme de string, | ||
| - | par exemple | ||
| - | print_str_args(" | ||
| - | imprime la variable a qui a une valeur 42 | ||
| - | a = 42 | ||
| - | | ||
| - | scene_change(sceneOld, | ||
| - | End of sceneOld, load sceneNew. | ||
| - | Scene must be str: if scene = scene python object, name is scene.name | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====blenderviewport==== | ||
| - | <code txt> | ||
| - | FUNCTIONS | ||
| - | disable_viewport(cam) | ||
| - | Disable | ||
| - | | ||
| - | enable_full_viewport(cam) | ||
| - | cam is blender object | ||
| - | | ||
| - | enable_half_viewport(cam1, | ||
| - | cam1 and 2 are blender objects | ||
| - | | ||
| - | enable_quad_viewport(cam1, | ||
| - | cam1 2 3 4 are blender objects | ||
| - | | ||
| - | enable_stereo_viewport(cam1, | ||
| - | cam1 and 2 are blender objects | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====fifolist==== | ||
| - | <code txt> | ||
| - | CLASSES | ||
| - | class PileFIFO(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====getmyip==== | ||
| - | <code txt> | ||
| - | FUNCTIONS | ||
| - | get_my_ip() | ||
| - | Retourne l' | ||
| - | Valable pour python 3.x | ||
| - | Non valable sur android | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====httpdownload==== | ||
| - | <code txt> | ||
| - | DESCRIPTION | ||
| - | Télécharge une url. | ||
| - | Peut aussi l' | ||
| - | |||
| - | CLASSES | ||
| - | class HttpDownload(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | FUNCTIONS | ||
| - | save_data_in_file(data, | ||
| - | Mode ' | ||
| - | Mode ' | ||
| - | donc enregistre un fichier | ||
| - | w ecrase | ||
| - | a ajoute | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====multicast==== | ||
| - | <code txt> | ||
| - | CLASSES | ||
| - | class Multicast(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====myconfig==== | ||
| - | <code txt> | ||
| - | DESCRIPTION | ||
| - | Le fichier ini doit être défini avec son chemin absolu | ||
| - | | ||
| - | Pour un projet python: | ||
| - | import os | ||
| - | dossier = os.path.dirname(os.path.abspath(__file__)) | ||
| - | ou | ||
| - | os.getcwd() | ||
| - | | ||
| - | Pour un projet Blender, le chemin complet est trouvé avec: | ||
| - | bge.logic.expandPath() | ||
| - | |||
| - | CLASSES | ||
| - | class MyConfig(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====mytools==== | ||
| - | <code txt> | ||
| - | DESCRIPTION | ||
| - | Des méthodes souvent appelées par les autres scripts, | ||
| - | regroupées dans une class MyTools | ||
| - | |||
| - | CLASSES | ||
| - | class MyTools(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====tcpclient==== | ||
| - | <code txt> | ||
| - | CLASSES | ||
| - | class TcpClient(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====udpclient==== | ||
| - | <code txt> | ||
| - | DESCRIPTION | ||
| - | Recréer un socket avant chaque envoi ou réception, résoud les problèmes | ||
| - | de réseau, ça se reconnecte tout seul. | ||
| - | Par contre, le port éphémère du recvfrom changera à chaque fois. | ||
| - | |||
| - | CLASSES | ||
| - | class UdpClient(builtins.object) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | |||
| - | {{tag> | ||
pymultilame.1535545367.txt.gz · Dernière modification : de serge
