Migrations : Qt5 -> Qt6 et Pylint v2 -> v3

This commit is contained in:
Philippe Roy 2024-01-02 15:13:14 +01:00
parent 02bec156c7
commit 3854aef055
10 changed files with 370 additions and 30 deletions

View File

@ -49,7 +49,7 @@ Les applications pédagogique se trouvent dans le [dépôt des ressouces pédago
https://forge.aeif.fr/blender-edutech/jumeau-numerique . </div> <div> &nbsp; </div> <div> L'environnement de développement est basé sur : la plateforme de
modélisation et d'animation 3D [Blender](https://blender.org), le langage [Python](https://python.org) et le moteur de jeu 3D
[UPBGE](https://upbge.org). </div> <div> &nbsp; </div> <div> La version de Blender/UPBGE utilisée pour le développement est la version 0.36.1 (20 août
2023).</td>
2023). Etant trop lente sous Windows, la version utilisée pour le déploiement (mise en production) est la version 0.30 (3 décembre 2021).</td>
</tr>
</table>
@ -64,15 +64,15 @@ Les bibliothèques suivantes ne sont pas incluses par défaut dans l'environneme
<!-- - [**whell**](https://pyfirmata.readthedocs.io) : format de paquet Python -->
Il faut donc les installer localement (dans UPBGE), les étapes sont :
- **GNU/Linux** : La configuration ici présente est UPBGE installé sur ~ avec Python 3.9 :
- Aller dans le répertoire local de Python de UPBGE: $ cd ~/UPBGE-0.30-linux-x86_64/3.0/python/bin
- **GNU/Linux** : La configuration ici présente est UPBGE installé sur ~ avec Python 3.10 :
- Aller dans le répertoire local de Python de UPBGE: $ cd ~/upbge-0.36.1-linux-x86_64/3.6/python/bin
- Télécharger le script ['get-pip.py'](https://bootstrap.pypa.io/get-pip.py) pour installer le gestionnaire de paquet [**Pip**](https://pip.pypa.io)
- Installer le gestionnaire de paquet Pip : $ ./python3.9 get-pip.py
- Installer le gestionnaire de paquet Pip : $ ./python3.10 get-pip.py
- Installer Pylint : $ ./pip install pylint
- Installer pySerial : $ ./pip install pyserial
- Installer pyFirmata : $ ./pip install pyfirmata
- Installer Matplotlib : $ ./pip install matplotlib
- Installer PyQt5 : $ ./pip install PyQt5
- Installer PyQt5 : $ ./pip install PyQt6
<!-- - Installer Pylint : $ ./pip install pylint -t ~/UPBGE-0.30-linux-x86_64/3.0/python/lib/python3.9/site-packages -->
<!-- - Installer pySerial : $ ./pip install pyserial -t ~/UPBGE-0.30-linux-x86_64/3.0/python/lib/python3.9/site-packages -->
<!-- - Installer pyFirmata : $ ./pip install pyfirmata -t ~/UPBGE-0.30-linux-x86_64/3.0/python/lib/python3.9/site-packages -->
@ -81,10 +81,10 @@ Il faut donc les installer localement (dans UPBGE), les étapes sont :
- **Windows** : La configuration ici présente est UPBGE installé sur le bureau utilisateur (prenom.nom) :
- Ouvrir un terminal Powershell (éventuellement en passant par Anaconda Navigator)
- Aller dans le répertoire local de Python de UPBGE: cd C:\Users\prenom.nom\Desktop\UPBGE-0.30-windows-x86_64\3.0\python\bin
- Aller dans le répertoire local de Python de UPBGE: cd C:\Users\prenom.nom\Desktop\upbge-0.36.1-windows-x86_64\3.6\python\bin
- Télécharger le script ['get-pip.py'](https://bootstrap.pypa.io/get-pip.py) pour installer le gestionnaire de paquet [**Pip**](https://pip.pypa.io)
- Installer le gestionnaire de paquet Pip : python.exe get-pip.py
- Aller dans le répertoire 'Scripts' : cd C:\Users\prenom.nom\Desktop\UPBGE-0.30-windows-x86_64\3.0\python\Scripts
- Aller dans le répertoire 'Scripts' : cd C:\Users\prenom.nom\Desktop\upbge-0.36.1-windows-x86_64\3.6\python\Scripts
- Installer Pylint : pip.exe install pylint
- Installer pySerial : pip.exe install pyserial
- Installer pyFirmata : pip.exe install pyfirmata

View File

@ -5,3 +5,15 @@ org.gnome.Builder.svg :
- Website : https://gitlab.gnome.org/GNOME/gnome-builder
- Authors : Jakub Steiner ( https://jimmac.eu/ ), Christian Hergert ( http://hergert.me/ )
- Licence : CC-BY-SA 3
la_forge-komit.svg :
- Remix by Philippe Roy ( https://forge.aeif.fr/phroy )
- Initial file : avatar_Komit_face_transparent.png
- Source repository : https://forge.aeif.fr/framaka/visuel-forge
- Author : Juliette Taka ( https://juliettetaka.com/fr )
- Licence : Creative Commons BY 4.0
upbge.svg :
- TM / ®UPBGE Project
- Website : https://upbge.org

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 140 KiB

109
asset/icons/app/upbge.svg Normal file
View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="64"
height="64"
viewBox="0 0 16.933333 16.933334"
version="1.1"
id="svg8"
sodipodi:docname="upbge.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
inkscape:export-filename="/home/mysticfall/workspace/upbge.github.io/src/assets/images/favicon.png"
inkscape:export-xdpi="3.9485862"
inkscape:export-ydpi="3.9485862"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<title
id="title34">UPBGE Logo</title>
<sodipodi:namedview
id="namedview17"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
width="778px"
inkscape:zoom="10.351563"
inkscape:cx="34.970565"
inkscape:cy="31.444527"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg8"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-page="true" />
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>UPBGE Logo</dc:title>
<dc:source>https://upbge.org/</dc:source>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="matrix(0.08438259,0,0,0.08438259,-15.007767,2.5980586)">
<g
id="g904"
transform="matrix(1.1079146,0,0,1.1079146,-30.0208,-7.5052)">
<g
id="g881"
transform="matrix(1.178273,0,0,1.178273,-195.84964,-76.927885)">
<g
id="g918">
<path
id="path4567-7-24"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;opacity:1;fill:#f19237;fill-opacity:1;stroke:#000000;stroke-width:1.91042;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 468.7251,139.87685 c 0,19.4791 -5.61331,34.406 -16.83991,44.7807 -11.22661,10.3748 -27.7658,15.5622 -49.61757,15.5622 -21.8518,0 -38.391,-5.1874 -49.6176,-15.5622 -11.15977,-10.3747 -16.73967,-25.2664 -16.73967,-44.6749 V 48.407691 h 38.6917 v 89.245959 c 0,10.9393 2.17181,7.4064 6.51544,12.7702 4.34362,5.3638 11.39367,8.0457 21.15013,8.0457 9.62279,0 16.63943,-2.576 21.04988,-7.7281 4.47728,-5.1521 6.7159,-1.725 6.7159,-13.0878 V 48.407691 h 38.6917 z" />
<path
id="path840-9-58"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:#fffbfb;stroke-width:2.56093;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 438.40602,129.81773 a 35.496628,35.49662 0 0 1 -35.49663,35.49662 35.496628,35.49662 0 0 1 -35.49662,-35.49662 35.496628,35.49662 0 0 1 35.49662,-35.496616 35.496628,35.49662 0 0 1 35.49663,35.496616 z" />
<path
id="rect836-2-5-2-07"
d="m 442.01709,164.67535 -46.60417,-18.6759 c -4.12869,-1.6545 -9.04213,0.643 -11.0167,5.1513 -1.97455,4.5082 0.33404,9.7909 4.46505,11.4389 l 46.02744,18.361 c 4.13102,1.6479 9.04223,-0.643 11.01687,-5.1512 1.97457,-4.5083 0.24027,-9.4697 -3.88848,-11.1242 z"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0a0400;fill-opacity:1;stroke:#ffffff;stroke-width:2.1801;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.981438" />
<path
id="rect836-2-5-2-0-6"
d="m 413.5441,78.521171 7.12832,49.698279 c 0.63151,4.4028 5.07787,7.5092 9.96943,6.9652 4.89155,-0.5441 8.31228,-5.1848 7.67391,-9.5864 l -7.11265,-49.041448 c -0.63832,-4.401431 -5.07788,-7.509301 -9.96948,-6.965181 -4.89158,0.54403 -8.32109,4.526741 -7.68958,8.92955 z"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0a0400;fill-opacity:1;stroke:#ffffff;stroke-width:2.1801;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.981438" />
<path
id="rect836-2-5-2-0-4-8"
d="m 353.16891,146.25655 39.47583,-31.02246 c 3.49723,-2.74835 3.96429,-8.15219 1.0473,-12.11635 -2.91701,-3.964069 -8.64633,-4.606258 -12.13898,-1.85259 l -38.91481,30.6804 c -3.49268,2.7536 -3.96426,8.1522 -1.04733,12.1164 2.91695,3.9643 8.08081,4.943 11.57803,2.1947 z"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0a0400;fill-opacity:1;stroke:#ffffff;stroke-width:2.1801;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.981438" />
<path
id="path840-5-7-2"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:18.5649;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
d="m 428.15509,129.81773 a 25.245695,25.245697 0 0 1 -25.2457,25.2457 25.245695,25.245697 0 0 1 -25.24569,-25.2457 25.245695,25.245697 0 0 1 25.24569,-25.24569 25.245695,25.245697 0 0 1 25.2457,25.24569 z" />
<path
id="path840-5-2-1-7"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;opacity:1;fill:#fcfcfc;fill-opacity:1;stroke:none;stroke-width:15.1972;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
d="m 423.85297,129.81773 a 20.943581,20.392342 0 0 1 -20.94358,20.39235 20.943581,20.392342 0 0 1 -20.94358,-20.39235 20.943581,20.392342 0 0 1 20.94358,-20.39234 20.943581,20.392342 0 0 1 20.94358,20.39234 z" />
<path
id="path4753-5-1"
style="font-style:normal;font-weight:normal;font-size:219.75px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;opacity:1;fill:#f19237;fill-opacity:1;stroke:none;stroke-width:13.5669;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.997625;paint-order:markers stroke fill"
d="m 417.59176,129.81773 a 14.682365,14.682365 0 0 1 -14.68237,14.68237 14.682365,14.682365 0 0 1 -14.68236,-14.68237 14.682365,14.682365 0 0 1 14.68236,-14.68236 14.682365,14.682365 0 0 1 14.68237,14.68236 z" />
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -62,15 +62,15 @@ def commandes():
print ("Version sans sécurité : sans réouverture")
print ("Mise en place : Fermeture")
while fdc_f() ==False :
gyr(True)
gyrr(True)
mot_o(False)
mot_f(True)
mot_f(False)
gyr(False)
# Jumelage
jumeau(brochage)
jumeau_mode(True, True, True, True)
# jumeau(brochage)
# jumeau_mode(True, True, True, True)
# Fonctionnement normal
print ("Attente")

43
twin.py
View File

@ -8,7 +8,6 @@ import math
import time
import xml.etree.ElementTree as ET # Creating/parsing XML file
import runpy # Exécution de script Python légère (sans import)
from pylint import epylint as lint # Mesure de la qualité d'un code Python
import twin_doc # Documentation
import twin_about # About
@ -218,9 +217,16 @@ def cmd_hl(cont):
# Désactivation
if cont.sensors['MO'].status == JUST_RELEASED and (scene.objects['System']['manip_mode']==0 or scene.objects['System']['manip_mode']==9):
if scene.objects['Cmd-text']['modal'] != True:
# Texte
if scene.objects['Cmd-text']['modal']:
scene.objects['Cmd-text']['Text']= "Erreur dans le script ... "
scene.objects['Cmd-text'].setVisible(True,False)
else:
scene.objects['Cmd-text']['Text']= ""
scene.objects['Cmd-text'].setVisible(False,False)
# Icone
if obj.name!="Run" and obj.name!="Pause" and obj.name!="Stop" and obj.name!="Doc-cmd-colbox":
scene.objects[obj.name+'-Hl'].setVisible(False,True)
obj.setVisible(True,True)
@ -495,22 +501,35 @@ def file_open():
##
def python_validation(file):
(pylint_stdout, pylint_stderr) = lint.py_run(file+' --disable=C --disable=W --disable=R', return_std=True)
stdout = pylint_stdout.read()
stderr = pylint_stderr.read()
if " error (" in stdout: # Présence d'erreur
# Terminer le processus fils précédent
if ('pylint_proc' in scene.objects['Commands']):
if scene.objects['Commands']['pylint_proc'].poll()==None:
scene.objects['Commands']['pylint_proc'].terminate()
# Lancer le processus fils
scene.objects['Commands']['pylint_proc'] = subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "twin_pylint.py"), file], stdout=subprocess.PIPE, encoding = 'utf8')
stout = scene.objects['Commands']['pylint_proc'].communicate()
# Présence d'erreur
if stout[0][:-1] != 'None' and len(stout[0][:-1])>0 :
# UI : information
scene.objects['Cmd-text']['modal']= True
scene.objects['Cmd-text']['Text']= "Erreur dans le script ... "
scene.objects['Cmd-text'].setVisible(True,False)
print(stdout) # Affichage console
# Affichage console
stout_lines = stout[0].split("\n")
for stout_line in stout_lines:
print ("Pylint :", stout_line) # Affichage console
return False
else:
scene.objects['Cmd-text']['modal']= False
scene.objects['Cmd-text']['Text']= ""
scene.objects['Cmd-text'].setVisible(False,False)
return True
# Absence d'erreur
scene.objects['Cmd-text']['modal']= False
scene.objects['Cmd-text']['Text']= ""
scene.objects['Cmd-text'].setVisible(False,False)
return True
##
# Mise en route et pause du cycle

View File

@ -1,14 +1,14 @@
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QFileDialog
from PyQt6 import QtWidgets
from PyQt6.QtWidgets import QApplication, QFileDialog
###############################################################################
# twin_file_qt.py
# @title: Selecteur de fichier (pyQt5)
# @title: Selecteur de fichier (pyQt6)
# @project: Blender-EduTech
# @lang: fr
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
# @copyright: Copyright (C) 2023 Philippe Roy
# @copyright: Copyright (C) 2023-2024 Philippe Roy
# @license: GNU GPL
###############################################################################

View File

@ -1,19 +1,19 @@
import sys
from twin_plot import plot_config_get_dict, plot_config_get, plot_config_get_enable, plot_nb, csv_read, plots_static # Gestion communes des graphiques (Qt, wx)
from PyQt5 import QtCore, QtGui, QtWidgets # GUI Qt5
from PyQt6 import QtCore, QtGui, QtWidgets # GUI Qt6
import matplotlib # Grapheur Matplotlib
import matplotlib.pyplot as plts
matplotlib.use('Qt5Agg')
matplotlib.use('Qt6Agg')
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
###############################################################################
# twin_plot_qt.py
# @title: Visualisation des données (pyQt5+Matplotlib)
# @title: Visualisation des données (pyQt6+Matplotlib)
# @project: Blender-EduTech
# @lang: fr
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
# @copyright: Copyright (C) 2023 Philippe Roy
# @copyright: Copyright (C) 2023-2024 Philippe Roy
# @license: GNU GPL
###############################################################################

21
twin_pylint.py Normal file
View File

@ -0,0 +1,21 @@
import sys
from pylint import run_pylint
###############################################################################
# twin_pylint.py
# @title: Mesure de la qualité d'un code Python
# @project: Ropy (Blender-EduTech)
# @lang: fr
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
# @copyright: Copyright (C) 2024 Philippe Roy
# @license: GNU GPL
###############################################################################
# print (sys.argv[0])
# print (sys.argv[1])
# run_pylint(argv=["--version"])
# Détection des erreurs
run_pylint(argv=["--errors-only", sys.argv[1]])
# run_pylint(argv=["--disable=line-too-long", sys.argv[1]])
sys.exit(0)