Dogeku 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/app/Historique/Action.rb +29 -0
- data/app/Historique/ChangerCase.rb +44 -0
- data/app/Historique/HistoriqueAction.rb +114 -0
- data/app/components/CaseDessin.rb +325 -0
- data/app/components/GrilleDessin.rb +235 -0
- data/app/components/Header.rb +194 -0
- data/app/config/app.yml +0 -0
- data/app/config/database.yml +2 -0
- data/app/controller/ApprentissageControleur.rb +75 -0
- data/app/controller/ChargerControleur.rb +41 -0
- data/app/controller/JeuLibreControleur.rb +244 -0
- data/app/controller/MenuControleur.rb +57 -0
- data/app/controller/NiveauControleur.rb +54 -0
- data/app/controller/NouvellePartieControleur.rb +34 -0
- data/app/controller/PrincipaleControleur.rb +30 -0
- data/app/controller/PseudoControleur.rb +95 -0
- data/app/controller/ReglagesControleur.rb +86 -0
- data/app/controller/ReglesControleur.rb +34 -0
- data/app/controller/ScoresControleur.rb +42 -0
- data/app/controller/StatistiquesControleur.rb +64 -0
- data/app/core/Conf.rb +26 -0
- data/app/core/Controller.rb +180 -0
- data/app/core/Core.rb +186 -0
- data/app/core/Model.rb +159 -0
- data/app/core/View.rb +56 -0
- data/app/db/main.sqlite3 +0 -0
- data/app/model/Configuration.rb +180 -0
- data/app/model/Grille.rb +180 -0
- data/app/model/Jeu.rb +74 -0
- data/app/model/Score.rb +100 -0
- data/app/model/Utilisateur.rb +113 -0
- data/app/utils/DSubset.rb +98 -0
- data/app/utils/Generateur.rb +171 -0
- data/app/utils/HPTriple.rb +75 -0
- data/app/utils/Peche.rb +46 -0
- data/app/utils/SCandidate.rb +86 -0
- data/app/utils/SCell.rb +73 -0
- data/app/utils/Technique.rb +202 -0
- data/app/utils/TechniqueUsine.rb +25 -0
- data/app/utils/XWing.rb +203 -0
- data/app/view/Fenetre.rb +424 -0
- data/app/view/FenetreApprentissage.rb +272 -0
- data/app/view/FenetreCharger.rb +31 -0
- data/app/view/FenetreJeuLibre.rb +468 -0
- data/app/view/FenetreMenu.rb +198 -0
- data/app/view/FenetreNiveau.rb +105 -0
- data/app/view/FenetreNouvellePartie.rb +92 -0
- data/app/view/FenetrePrincipale.rb +45 -0
- data/app/view/FenetrePseudo.rb +115 -0
- data/app/view/FenetreReglages.rb +209 -0
- data/app/view/FenetreRegles.rb +111 -0
- data/app/view/FenetreScores.rb +120 -0
- data/app/view/FenetreStatistiques.rb +134 -0
- data/assets/css/style.css +69 -0
- data/assets/img/eraser.png +0 -0
- data/assets/img/fond.jpg +0 -0
- data/assets/img/iconApp.png +0 -0
- data/assets/img/logoS.jpeg +0 -0
- data/assets/img/sudokuIntro.jpg +0 -0
- data/assets/img/user.png +0 -0
- data/bin/dogeku +19 -0
- data/doc/Action.html +309 -0
- data/doc/ApprentissageControleur.html +568 -0
- data/doc/CaseDessin.html +2405 -0
- data/doc/ChangerCase.html +405 -0
- data/doc/ChargerControleur.html +342 -0
- data/doc/Conf.html +378 -0
- data/doc/Configuration.html +1115 -0
- data/doc/Controller.html +1008 -0
- data/doc/Core.html +1191 -0
- data/doc/DSubset.html +647 -0
- data/doc/Fenetre.html +2631 -0
- data/doc/FenetreApprentissage.html +1175 -0
- data/doc/FenetreCharger.html +343 -0
- data/doc/FenetreJeuLibre.html +1859 -0
- data/doc/FenetreMenu.html +900 -0
- data/doc/FenetreNiveau.html +626 -0
- data/doc/FenetreNouvellePartie.html +602 -0
- data/doc/FenetrePrincipale.html +371 -0
- data/doc/FenetrePseudo.html +695 -0
- data/doc/FenetreReglages.html +946 -0
- data/doc/FenetreRegles.html +636 -0
- data/doc/FenetreScores.html +650 -0
- data/doc/FenetreStatistiques.html +672 -0
- data/doc/Generateur.html +1015 -0
- data/doc/Grille.html +1348 -0
- data/doc/GrilleDessin.html +1281 -0
- data/doc/HPTriple.html +593 -0
- data/doc/Header.html +1253 -0
- data/doc/HistoriqueAction.html +792 -0
- data/doc/Jeu.html +923 -0
- data/doc/JeuLibreControleur.html +1445 -0
- data/doc/MenuControleur.html +522 -0
- data/doc/Model.html +996 -0
- data/doc/NiveauControleur.html +451 -0
- data/doc/NouvellePartieControleur.html +330 -0
- data/doc/Peche.html +396 -0
- data/doc/PrincipaleControleur.html +320 -0
- data/doc/PseudoControleur.html +695 -0
- data/doc/ReglagesControleur.html +747 -0
- data/doc/ReglesControleur.html +330 -0
- data/doc/SCandidate.html +617 -0
- data/doc/SCell.html +587 -0
- data/doc/Score.html +926 -0
- data/doc/ScoresControleur.html +346 -0
- data/doc/StatistiquesControleur.html +390 -0
- data/doc/Technique.html +543 -0
- data/doc/TechniqueUsine.html +252 -0
- data/doc/Utilisateur.html +806 -0
- data/doc/View.html +844 -0
- data/doc/XWing.html +1031 -0
- data/doc/_index.html +478 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +492 -0
- data/doc/file.README.html +141 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +141 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +2523 -0
- data/doc/top-level-namespace.html +112 -0
- data/test/Generateur/grilleCorrecte.rb +198 -0
- data/test/Model/scoreCorrecte.rb +55 -0
- data/test/Model/utilisateurCorrecte.rb +68 -0
- data/test/test_helper.rb +2 -0
- data/test/unitTest.rb +72 -0
- metadata +187 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# => Contient la classe FenetreCharger
|
|
2
|
+
#
|
|
3
|
+
# => Author:: Valentin, DanAurea
|
|
4
|
+
# => Version:: 0.1
|
|
5
|
+
# => Copyright:: © 2016
|
|
6
|
+
# => License:: Distributes under the same terms as Ruby
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
## classe FenetreCharger
|
|
10
|
+
##
|
|
11
|
+
class FenetreCharger < View
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
## Initialize
|
|
15
|
+
##
|
|
16
|
+
##
|
|
17
|
+
def initialize()
|
|
18
|
+
require Core::ROOT + "components/GrilleDessin.rb"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
23
|
+
##
|
|
24
|
+
## @return self
|
|
25
|
+
##
|
|
26
|
+
def run()
|
|
27
|
+
grilleDessin = GrilleDessin.new(@grille)
|
|
28
|
+
Fenetre::box.add(grilleDessin)
|
|
29
|
+
return self
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# => Author:: Valentin, DanAurea
|
|
2
|
+
# => Version:: 0.1
|
|
3
|
+
# => Copyright:: © 2016
|
|
4
|
+
# => License:: Distributes under the same terms as Ruby
|
|
5
|
+
|
|
6
|
+
require Core::ROOT + "components/GrilleDessin.rb"
|
|
7
|
+
require "observer"
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
## classe FenetreJeuLibre
|
|
11
|
+
##
|
|
12
|
+
class FenetreJeuLibre < View
|
|
13
|
+
include Observable
|
|
14
|
+
## VI box
|
|
15
|
+
@menuBarre
|
|
16
|
+
@boxMilieu
|
|
17
|
+
@boxGrille
|
|
18
|
+
@boxInfo
|
|
19
|
+
@boxTexte
|
|
20
|
+
@boxExplication
|
|
21
|
+
@boxEtape
|
|
22
|
+
|
|
23
|
+
# VI dessin
|
|
24
|
+
@grilleDessin
|
|
25
|
+
@scoreLabel
|
|
26
|
+
|
|
27
|
+
# VI info
|
|
28
|
+
@labelChoix
|
|
29
|
+
@list
|
|
30
|
+
@labelChoix2
|
|
31
|
+
@boutonEtapePrec
|
|
32
|
+
@boutonEtapeSuiv
|
|
33
|
+
@labelEtape
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# VI recup
|
|
37
|
+
@etapeEnCours
|
|
38
|
+
@nbEtape
|
|
39
|
+
@techniqueChoisie
|
|
40
|
+
@texteContenu
|
|
41
|
+
@tabTechnique
|
|
42
|
+
@techniqueObjet
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
## Initialize
|
|
46
|
+
##
|
|
47
|
+
##
|
|
48
|
+
def initialize()
|
|
49
|
+
#liste technique
|
|
50
|
+
@tabTechnique=[
|
|
51
|
+
"SCandidate",
|
|
52
|
+
"DSubset",
|
|
53
|
+
"SCell"
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
#Recuperation de la classe technique
|
|
57
|
+
@etapeEnCours=0
|
|
58
|
+
@nbEtape=0
|
|
59
|
+
@techniqueChoisie=""
|
|
60
|
+
@texteContenu = Fenetre::creerLabelType("Bonjour, si vous choisissez une technique, une pénalité sera décompté du score !",Fenetre::SIZE_AUTRE_JEU)
|
|
61
|
+
|
|
62
|
+
#box
|
|
63
|
+
@menuBarre=Fenetre::creerBarreMenu()
|
|
64
|
+
@boxMilieu = Gtk::Box.new(:horizontal, 0)
|
|
65
|
+
@boxGrille = Gtk::Box.new(:vertical, 0)
|
|
66
|
+
@boxChiffres = Gtk::Box.new(:horizontal, 5)
|
|
67
|
+
@boxChiffres.set_margin_top(10)
|
|
68
|
+
@boxChiffres.set_margin_left(3)
|
|
69
|
+
@boxInfo = Gtk::Box.new(:vertical, 40)
|
|
70
|
+
@boxEtape = Gtk::Box.new(:horizontal, 30)
|
|
71
|
+
@boxExplication = Gtk::Box.new(:horizontal, 0)
|
|
72
|
+
@boxContour = Gtk::Box.new(:horizontal,0)
|
|
73
|
+
@boxTexte = Gtk::Box.new(:vertical,10)
|
|
74
|
+
@boxInvisible = Gtk::Label.new("")
|
|
75
|
+
@boxInvisible.set_size_request(50, 150)
|
|
76
|
+
|
|
77
|
+
#Choix technique
|
|
78
|
+
@labelChoix = Fenetre::creerLabelType("<u>Choisir une aide</u>", Fenetre::SIZE_TITRE_JEU)
|
|
79
|
+
@list = Gtk::ComboBoxText.new()
|
|
80
|
+
|
|
81
|
+
#information de la technique
|
|
82
|
+
@labelChoix2 = Fenetre::creerLabelType("Choississez une technique...", Fenetre::SIZE_AUTRE_JEU)
|
|
83
|
+
@boutonEtapePrec = Gtk::Button.new(:label => "Precedente")
|
|
84
|
+
@boutonEtapeSuiv = Gtk::Button.new(:label => " Suivante ")
|
|
85
|
+
@labelEtape = Fenetre::creerLabelType("Etape #{@etapeEnCours}/#{@nbEtape}", Fenetre::SIZE_AUTRE_JEU)
|
|
86
|
+
|
|
87
|
+
@valeurSelectionnee = nil
|
|
88
|
+
@grilleDessin = nil
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
##
|
|
92
|
+
## Met à jour suite à la notification de la grille
|
|
93
|
+
##
|
|
94
|
+
## @param x Position x qui a subit une modification
|
|
95
|
+
## @param y Position y qui a subit une modification
|
|
96
|
+
##
|
|
97
|
+
## @return self
|
|
98
|
+
##
|
|
99
|
+
def update(x, y)
|
|
100
|
+
@grilleDessin.reset()
|
|
101
|
+
updateGrille(x, y, @valeurSelectionnee)
|
|
102
|
+
|
|
103
|
+
@grilleDessin.cases[x][y].nombre = @valeurSelectionnee
|
|
104
|
+
|
|
105
|
+
self.resetIndices
|
|
106
|
+
self.candidats
|
|
107
|
+
@grilleDessin.redessiner
|
|
108
|
+
|
|
109
|
+
if(finPartie?())
|
|
110
|
+
partieTerminee()
|
|
111
|
+
|
|
112
|
+
mess = Fenetre::creerPopup("Bravo partie terminée !", "CLOSE")
|
|
113
|
+
|
|
114
|
+
if(mess.run() == Gtk::ResponseType::CLOSE)
|
|
115
|
+
Header.profil(@pseudo)
|
|
116
|
+
Core::changeTo("Menu", :pseudo => @pseudo)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
mess.destroy()
|
|
120
|
+
elsif(getNbVides == 0)
|
|
121
|
+
|
|
122
|
+
Header.penalite()
|
|
123
|
+
|
|
124
|
+
mess = Fenetre::creerPopup("Erreur sur la grille !", "CLOSE")
|
|
125
|
+
mess.run()
|
|
126
|
+
mess.destroy()
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
return self
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
##
|
|
133
|
+
## Crée le dessin de la grille
|
|
134
|
+
##
|
|
135
|
+
## @return Self
|
|
136
|
+
##
|
|
137
|
+
def creerGrille()
|
|
138
|
+
@grilleDessin = GrilleDessin.new(@grille, @config)
|
|
139
|
+
@grilleDessin.add_observer(self)
|
|
140
|
+
|
|
141
|
+
self.candidats
|
|
142
|
+
@grilleDessin.indices = false
|
|
143
|
+
|
|
144
|
+
## Dessine les boutons chiffres
|
|
145
|
+
for i in 1..9
|
|
146
|
+
boutonChiffre = Gtk::Button.new(:label => i.to_s, :expand => false, :fill => false)
|
|
147
|
+
|
|
148
|
+
boutonChiffre.signal_connect("clicked") do |widget|
|
|
149
|
+
@valeurSelectionnee = widget.label.to_i
|
|
150
|
+
|
|
151
|
+
@grilleDessin.reset
|
|
152
|
+
|
|
153
|
+
@grilleDessin.memeValeurs(@valeurSelectionnee)
|
|
154
|
+
@grilleDessin.redessiner
|
|
155
|
+
|
|
156
|
+
@active.set_name("")
|
|
157
|
+
@active = widget
|
|
158
|
+
@active.set_name("active")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
@boxChiffres.add(boutonChiffre)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
img = Gtk::Image.new(:file => Core::ROOTPROJECT + "assets/img/eraser.png")
|
|
165
|
+
boutonGomme = Gtk::Button.new(:label => "")
|
|
166
|
+
|
|
167
|
+
boutonGomme.set_image(img)
|
|
168
|
+
boutonGomme.set_always_show_image (true)
|
|
169
|
+
|
|
170
|
+
boutonGomme.signal_connect("clicked") do
|
|
171
|
+
@grilleDessin.reset
|
|
172
|
+
@grilleDessin.redessiner
|
|
173
|
+
@valeurSelectionnee = nil
|
|
174
|
+
|
|
175
|
+
@active.set_name("")
|
|
176
|
+
@active = boutonGomme
|
|
177
|
+
@active.set_name("active")
|
|
178
|
+
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@active = boutonGomme
|
|
182
|
+
@active.set_name("active")
|
|
183
|
+
|
|
184
|
+
@boxChiffres.add(boutonGomme)
|
|
185
|
+
|
|
186
|
+
return self
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
##
|
|
190
|
+
## Réinitialise les indices à false
|
|
191
|
+
##
|
|
192
|
+
## @return self
|
|
193
|
+
##
|
|
194
|
+
def resetIndices()
|
|
195
|
+
|
|
196
|
+
@grilleDessin.resetIndices()
|
|
197
|
+
|
|
198
|
+
return self
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
##
|
|
202
|
+
## Récupére les candidats et les définis pour l'affichage
|
|
203
|
+
##
|
|
204
|
+
## @return self
|
|
205
|
+
##
|
|
206
|
+
def candidats
|
|
207
|
+
listeCandidats = getCandidats
|
|
208
|
+
|
|
209
|
+
## Affiche les candidats en parcourant ce qui a été calculé
|
|
210
|
+
## pour chaque chiffre.
|
|
211
|
+
listeCandidats.each do |key, candidats|
|
|
212
|
+
|
|
213
|
+
candidats.each do |value|
|
|
214
|
+
x, y = value[0], value[1]
|
|
215
|
+
@grilleDessin.cases[x][y].indices[key.to_s] = true
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
return self
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
##
|
|
224
|
+
## Met en place tout les éléments sur la page
|
|
225
|
+
##
|
|
226
|
+
##
|
|
227
|
+
def miseEnPlace()
|
|
228
|
+
#barre de menu
|
|
229
|
+
gestionBarreMenu()
|
|
230
|
+
|
|
231
|
+
ligne = 0
|
|
232
|
+
colonne = 0
|
|
233
|
+
|
|
234
|
+
boutonIndices = Gtk::Button.new(:label => "Activer indices")
|
|
235
|
+
boutonIndices.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
236
|
+
|
|
237
|
+
boutonIndices.signal_connect("clicked"){
|
|
238
|
+
if(@grilleDessin.indices? == true)
|
|
239
|
+
@grilleDessin.indices = false
|
|
240
|
+
boutonIndices.label = "Activer indices"
|
|
241
|
+
else
|
|
242
|
+
@grilleDessin.indices = true
|
|
243
|
+
boutonIndices.label = "Désactiver indices"
|
|
244
|
+
end
|
|
245
|
+
boutonIndices.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
246
|
+
|
|
247
|
+
@grilleDessin.redessiner
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#partie droite
|
|
251
|
+
gestionDroite()
|
|
252
|
+
|
|
253
|
+
#box grille
|
|
254
|
+
@boxGrille.add(@grilleDessin)
|
|
255
|
+
@boxGrille.add(@boxChiffres)
|
|
256
|
+
@boxGrille.add(boutonIndices)
|
|
257
|
+
boutonIndices.set_margin(20)
|
|
258
|
+
|
|
259
|
+
@boxMilieu.add(@boxGrille)
|
|
260
|
+
@boxMilieu.add(@boxInfo)
|
|
261
|
+
@boxInfo.add(@boxInvisible)
|
|
262
|
+
|
|
263
|
+
ajoutCss()
|
|
264
|
+
|
|
265
|
+
#add a la box
|
|
266
|
+
Fenetre::box.add(@menuBarre)
|
|
267
|
+
Fenetre::box.add(@boxMilieu)
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
##
|
|
271
|
+
## actualisation informations
|
|
272
|
+
##
|
|
273
|
+
def actualisation()
|
|
274
|
+
@labelChoix2.set_text("Explication de #{@techniqueChoisie}")
|
|
275
|
+
@labelEtape.set_text("Etape #{@etapeEnCours}/#{@nbEtape}")
|
|
276
|
+
recuperationEtape()
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
##
|
|
280
|
+
## Recuperatuon du nombre d'etapes pour le tutoriel
|
|
281
|
+
##
|
|
282
|
+
##
|
|
283
|
+
def recuperationNbEtape()
|
|
284
|
+
@nbEtape=@techniqueObjet.combienEtape()
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
##
|
|
288
|
+
## Recuperatuon du texte de l'etape en cours
|
|
289
|
+
##
|
|
290
|
+
##
|
|
291
|
+
def recuperationEtape()
|
|
292
|
+
string=@techniqueObjet.etape(@etapeEnCours)
|
|
293
|
+
@texteContenu.set_text(string)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
##
|
|
297
|
+
## Ajoute les classes css au widget
|
|
298
|
+
##
|
|
299
|
+
def ajoutCss()
|
|
300
|
+
#css label
|
|
301
|
+
@labelChoix.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
302
|
+
@labelChoix.set_margin_top(40)
|
|
303
|
+
@list.set_hexpand(true);
|
|
304
|
+
@labelEtape.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
305
|
+
@labelEtape.set_hexpand(true);
|
|
306
|
+
@texteContenu.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
307
|
+
@texteContenu.set_margin(4)
|
|
308
|
+
@labelChoix2.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
309
|
+
#css bouton
|
|
310
|
+
@boxContour.override_background_color(:normal, Fenetre::COULEUR_BLANC)
|
|
311
|
+
@boxTexte.override_background_color(:normal, Fenetre::COULEUR_BLEU)
|
|
312
|
+
@boxTexte.set_margin(3)
|
|
313
|
+
@boutonEtapePrec.set_hexpand(true);
|
|
314
|
+
@boutonEtapeSuiv.set_hexpand(true);
|
|
315
|
+
@boxInfo.set_margin(10)
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
##
|
|
319
|
+
## Met en place la partie de droite
|
|
320
|
+
##
|
|
321
|
+
##
|
|
322
|
+
##
|
|
323
|
+
def gestionDroite()
|
|
324
|
+
#choix technique
|
|
325
|
+
@tabTechnique.each{ |t|
|
|
326
|
+
@list.append_text("#{t}")
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@list.signal_connect('changed'){ |widget|
|
|
330
|
+
Header.penalite()
|
|
331
|
+
@techniqueChoisie=widget.active_text()
|
|
332
|
+
@techniqueObjet=@Techniques.creer(@techniqueChoisie)
|
|
333
|
+
@nbEtape= recuperationNbEtape()
|
|
334
|
+
@etapeEnCours=1
|
|
335
|
+
actualisation()
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
#etapes
|
|
339
|
+
@boutonEtapePrec.signal_connect('clicked'){
|
|
340
|
+
if @etapeEnCours-1 > 0
|
|
341
|
+
@etapeEnCours=@etapeEnCours-1
|
|
342
|
+
actualisation()
|
|
343
|
+
end
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@boutonEtapeSuiv.signal_connect('clicked'){
|
|
347
|
+
if @etapeEnCours+1 <= @nbEtape
|
|
348
|
+
@etapeEnCours=@etapeEnCours+1
|
|
349
|
+
actualisation()
|
|
350
|
+
end
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
@boxEtape.add(@boutonEtapePrec)
|
|
354
|
+
@boxEtape.add(@labelEtape)
|
|
355
|
+
@boxEtape.add(@boutonEtapeSuiv)
|
|
356
|
+
|
|
357
|
+
#explication
|
|
358
|
+
@boxExplication.set_hexpand(true)
|
|
359
|
+
@boxExplication.set_vexpand(true)
|
|
360
|
+
|
|
361
|
+
@texteContenu.set_line_wrap(true)
|
|
362
|
+
@boxTexte.add(@texteContenu)
|
|
363
|
+
@boxContour.pack_start(@boxTexte, :expand => true, :fill => true)
|
|
364
|
+
@boxExplication.pack_start(@boxContour, :expand => true, :fill => true)
|
|
365
|
+
|
|
366
|
+
#add a la box
|
|
367
|
+
@boxInfo.add(@labelChoix)
|
|
368
|
+
@boxInfo.add(@list)
|
|
369
|
+
@boxInfo.add(@labelChoix2)
|
|
370
|
+
@boxInfo.add(@boxEtape)
|
|
371
|
+
@boxInfo.add(@boxExplication)
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
##
|
|
375
|
+
## Réinitialise la grille
|
|
376
|
+
##
|
|
377
|
+
## @return self
|
|
378
|
+
##
|
|
379
|
+
def reinitialiser
|
|
380
|
+
for i in 0..8
|
|
381
|
+
for j in 0..8
|
|
382
|
+
if (@grilleDessin.cases[i][j].editable)
|
|
383
|
+
@grilleDessin.cases[i][j].nombre = nil
|
|
384
|
+
@grilleDessin.cases[i][j].indices = {"1" => false, "2" => false, "3" => false, "4" => false, "5" => false, "6" => false, "7" => false, "8" => false, "9" => false}
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
self.candidats
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
##
|
|
392
|
+
## Met en place la barre de menu
|
|
393
|
+
##
|
|
394
|
+
##
|
|
395
|
+
##
|
|
396
|
+
def gestionBarreMenu()
|
|
397
|
+
Fenetre::boutonMenu_barre.signal_connect('clicked'){
|
|
398
|
+
messageQuestion = Fenetre::creerPopup("1/2: Voulez-vous vraiment abandonner la partie et revenir au menu principal ?", "YES_NO")
|
|
399
|
+
if(messageQuestion.run() == Gtk::ResponseType::YES)
|
|
400
|
+
messageQuestion2 = Fenetre::creerPopup("2/2: Voulez-vous sauvegarder la partie actuelle?", "YES_NO")
|
|
401
|
+
if(messageQuestion2.run() == Gtk::ResponseType::YES)
|
|
402
|
+
sauvegarder()
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
Header.profil(@pseudo)
|
|
406
|
+
Core::changeTo("Menu", "pseudo": @pseudo)
|
|
407
|
+
messageQuestion2.destroy()
|
|
408
|
+
end
|
|
409
|
+
messageQuestion.destroy()
|
|
410
|
+
}
|
|
411
|
+
Fenetre::boutonSauvegarder_barre.signal_connect('clicked'){
|
|
412
|
+
sauvegarder()
|
|
413
|
+
}
|
|
414
|
+
Fenetre::boutonReinit_barre.signal_connect('clicked'){
|
|
415
|
+
# Réinitialise la grille (données)
|
|
416
|
+
@controller.reinitialiser
|
|
417
|
+
## Réinitialise la grille (affichage)
|
|
418
|
+
self.reinitialiser
|
|
419
|
+
@grilleDessin.redessiner
|
|
420
|
+
}
|
|
421
|
+
Fenetre::boutonQuitter_barre.signal_connect('clicked'){
|
|
422
|
+
messageQuestion = Fenetre::creerPopup("1/2: Voulez-vous vraiment abandonner la partie et quitter l'application?", "YES_NO")
|
|
423
|
+
|
|
424
|
+
if(messageQuestion.run() == Gtk::ResponseType::YES)
|
|
425
|
+
messageQuestion2 = Fenetre::creerPopup("2/2: Voulez-vous sauvegarder la partie actuelle?", "YES_NO")
|
|
426
|
+
if(messageQuestion2.run() == Gtk::ResponseType::YES)
|
|
427
|
+
sauvegarder()
|
|
428
|
+
end
|
|
429
|
+
Fenetre::detruire()
|
|
430
|
+
messageQuestion2.destroy()
|
|
431
|
+
|
|
432
|
+
end
|
|
433
|
+
messageQuestion.destroy()
|
|
434
|
+
}
|
|
435
|
+
Fenetre::boutonPauseChrono_barre.signal_connect('clicked'){
|
|
436
|
+
Header::pause = true
|
|
437
|
+
|
|
438
|
+
}
|
|
439
|
+
Fenetre::boutonPlayChrono_barre.signal_connect('clicked'){
|
|
440
|
+
if(Header::pause == true)
|
|
441
|
+
Header::pause = false
|
|
442
|
+
Header::chrono
|
|
443
|
+
end
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
Fenetre::boutonAnnuler_barre.signal_connect('clicked'){
|
|
447
|
+
}
|
|
448
|
+
Fenetre::boutonRetablir_barre.signal_connect('clicked'){
|
|
449
|
+
}
|
|
450
|
+
#disabled
|
|
451
|
+
Fenetre::boutonAnnuler_barre.set_sensitive(false)
|
|
452
|
+
Fenetre::boutonRetablir_barre.set_sensitive(false)
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
##
|
|
456
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
457
|
+
##
|
|
458
|
+
## @return self
|
|
459
|
+
##
|
|
460
|
+
def run()
|
|
461
|
+
self.creerGrille()
|
|
462
|
+
self.miseEnPlace()
|
|
463
|
+
|
|
464
|
+
Header::chrono
|
|
465
|
+
|
|
466
|
+
return self
|
|
467
|
+
end
|
|
468
|
+
end
|