From 3c1d831c3bc6ae77d3726e46b2c5305c92d4a23a Mon Sep 17 00:00:00 2001
From: Jean-Marie Favreau <J-Marie.Favreau@uca.fr>
Date: Wed, 16 Jan 2019 11:34:12 +0100
Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20des=20modifications=20sugg?=
 =?UTF-8?q?=C3=A9r=C3=A9es=20il=20y=20a=20quelques=20mois=20(fin)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 musique/exercice.py | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/musique/exercice.py b/musique/exercice.py
index f4176e4..5252dba 100644
--- a/musique/exercice.py
+++ b/musique/exercice.py
@@ -17,8 +17,8 @@ class GenerateurExercice(GammeTemperee):
         GammeTemperee.__init__(self, bpm)
         self.dureeFrappe = dureeFrappe
         self.margeDocument = 1.0
-        self.margeDuree = 0.5
-        self.margeFrequence = 50
+        self.margeDuree = 0.
+        self.margeFrequence = 100 
         self.margeFrequenceLegende = 20
         self.margeLegende = 2.0
 
@@ -330,7 +330,7 @@ class GenerateurExercice(GammeTemperee):
     
       return result
     
-    def lignesVerticales(self):
+    def lignesVerticales(self, premier = False):
       result = ""
       
       espace = self.doublecroche
@@ -338,14 +338,15 @@ class GenerateurExercice(GammeTemperee):
       nbsteps = int(self.duree / espace) + 1
       
       for i in range(0, nbsteps):
-        h = i * espace
-        hinc = self.dureeEnCm(h + self.margeDuree)
-        
-        if i % 4 == 0:
-          result += "\draw[lightgray, ultra thin] (" + str(hinc) + ", 0) -- ";
-        else:
-          result += "\draw[lightgray!30, ultra thin] (" + str(hinc) + ", 0) -- ";
-        result += "(" + str(hinc) + ", " + str(self.hauteur) + ");\n";
+        if i != 0 or premier:
+          h = i * espace
+          hinc = self.dureeEnCm(h + self.margeDuree)
+          
+          if i % 4 == 0:
+            result += "\draw[lightgray, ultra thin] (" + str(hinc) + ", 0) -- ";
+          else:
+            result += "\draw[lightgray!30, ultra thin] (" + str(hinc) + ", 0) -- ";
+          result += "(" + str(hinc) + ", " + str(self.hauteur) + ");\n";
       return result
     
     def lignesHorizontales(self, partitions):
@@ -375,9 +376,15 @@ class GenerateurExercice(GammeTemperee):
 
         result += "\\begin{tikzpicture}[]"
         
+        # lignes verticales
+        result += self.lignesVerticales()
+        # lignes horizontales
+        result += self.lignesHorizontales(partitions)
+
+
         # axe des abscisses
         result += "\draw[->, black] (0, 0) -- ";
-        result += "(" + str(self.largeur) + ", 0) node[below]{durée (s)};\n";
+        result += "(" + str(self.largeur) + ", 0) node[below]{temps (s)};\n";
 
         # axe des ordonnées
         result += "\draw[black, dashed] (0, 0) -- ";
@@ -385,11 +392,6 @@ class GenerateurExercice(GammeTemperee):
 
         result += "\draw[->, black] (0, " + str(self.frequenceEnCm(self.fmin)) + ") -- ";
         result += "(0," + str(self.hauteur) + ")  node[above]{fréquence (Hz)};\n";
-
-        # lignes verticales
-        result += self.lignesVerticales()
-        # lignes horizontales
-        result += self.lignesHorizontales(partitions)
         
         # gradations sur les axes
         result += self.graduationAbscisses()
-- 
GitLab