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
data/app/view/Fenetre.rb
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
# => Author:: Valentin, DanAurea
|
|
2
|
+
# => Version:: 0.1
|
|
3
|
+
# => Copyright:: © 2016
|
|
4
|
+
# => License:: Distributes under the same terms as Ruby
|
|
5
|
+
|
|
6
|
+
require "optparse"
|
|
7
|
+
require "fileutils"
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
## Module regroupant les informations de base de chaque fenêtre
|
|
11
|
+
##
|
|
12
|
+
module Fenetre
|
|
13
|
+
|
|
14
|
+
## Définit la couleur blanche
|
|
15
|
+
COULEUR_BLANC = Gdk::RGBA.new(1,1,1,1)
|
|
16
|
+
## Définit la couleur verte
|
|
17
|
+
COULEUR_VERT = Gdk::RGBA.new(0, 1, 0, 1)
|
|
18
|
+
## Définit la couleur jaune
|
|
19
|
+
COULEUR_JAUNE = Gdk::RGBA.new(1, 1, 0, 1)
|
|
20
|
+
## Définit la couleur rouge
|
|
21
|
+
COULEUR_ROUGE = Gdk::RGBA.new(1, 0, 0, 1)
|
|
22
|
+
## Définit la couleur orange
|
|
23
|
+
COULEUR_ORANGE = Gdk::RGBA.new(1, 0.6, 0, 1)
|
|
24
|
+
## Définit la couleur bleue
|
|
25
|
+
COULEUR_BLEU = Gdk::RGBA.new(0.2, 0.59, 0.86, 1)
|
|
26
|
+
## Définit la taille du pseudo
|
|
27
|
+
SIZE_PSEUDO = 20
|
|
28
|
+
## Définit la taille du titre 'Statistiques'
|
|
29
|
+
SIZE_TITRE_STAT = 18
|
|
30
|
+
## Définit la taille du contenu des statistiques
|
|
31
|
+
SIZE_CONTENU_STAT = 15
|
|
32
|
+
## Définit la taille du titre 'Score'
|
|
33
|
+
SIZE_TITRE_SCORE = 18
|
|
34
|
+
## Définit la taille du contenu du score
|
|
35
|
+
SIZE_CONTENU_SCORE = 15
|
|
36
|
+
## Définit la taille du titre 'Règles'
|
|
37
|
+
SIZE_TITRE_REGLE = 15
|
|
38
|
+
## Définit la taille du contenu des règles
|
|
39
|
+
SIZE_CONTENU_REGLE = 14
|
|
40
|
+
## Définit la taille du titre 'Règlages'
|
|
41
|
+
SIZE_TITRE_REGLAGE = 15
|
|
42
|
+
## Définit la taille du titre
|
|
43
|
+
SIZE_TITRE = 40
|
|
44
|
+
## Définit la taille des labels des boutons
|
|
45
|
+
SIZE_LABEL_BOUTON = 20
|
|
46
|
+
## Définit la taille du titre du jeu
|
|
47
|
+
SIZE_TITRE_JEU = 18
|
|
48
|
+
## Définit la taille du titre de l'autre jeu
|
|
49
|
+
SIZE_AUTRE_JEU = 12
|
|
50
|
+
## Définit le menu
|
|
51
|
+
FONT_MENU = "Monospace"
|
|
52
|
+
|
|
53
|
+
## VI
|
|
54
|
+
@fenetre
|
|
55
|
+
@box
|
|
56
|
+
@fenetrePrecedente
|
|
57
|
+
@enteteFenetre
|
|
58
|
+
|
|
59
|
+
## VI barre menu
|
|
60
|
+
@boutonMenu_barre
|
|
61
|
+
@boutonSauvegarder_barre
|
|
62
|
+
@boutonReinit_barre
|
|
63
|
+
@boutonQuitter_barre
|
|
64
|
+
@boutonPauseChrono_barre
|
|
65
|
+
@boutonPlayChrono_barre
|
|
66
|
+
@boutonAnnuler_barre
|
|
67
|
+
@boutonRetablir_barre
|
|
68
|
+
|
|
69
|
+
## Création fenêtre de base
|
|
70
|
+
@fenetre = Gtk::Window.new(:toplevel)
|
|
71
|
+
@fenetre.set_name("mainWindow")
|
|
72
|
+
@fenetre.set_icon_from_file(Core::ROOTPROJECT + "assets/img/iconApp.png")
|
|
73
|
+
@fenetre.signal_connect('destroy') {
|
|
74
|
+
detruire()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@fenetreStyle = @fenetre.style_context
|
|
78
|
+
|
|
79
|
+
## Création de la header bar
|
|
80
|
+
@enteteFenetre = Gtk::HeaderBar.new()
|
|
81
|
+
@enteteFenetre.show_close_button = true
|
|
82
|
+
|
|
83
|
+
## Crée un conteneur pour le contenu
|
|
84
|
+
@box=Gtk::Box.new(:vertical, 0)
|
|
85
|
+
@fenetre.add(@box)
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
## Définit un accesseur pour le contexte de la fenêtre Gtk
|
|
89
|
+
##
|
|
90
|
+
## @return fenetre
|
|
91
|
+
##
|
|
92
|
+
def Fenetre.fenetre()
|
|
93
|
+
return @fenetre
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
##
|
|
98
|
+
## Définit un accesseur pour le contexte de l'entête de la fenêtre Gtk
|
|
99
|
+
##
|
|
100
|
+
## @return enteteFenetre
|
|
101
|
+
##
|
|
102
|
+
def Fenetre.enteteFenetre()
|
|
103
|
+
return @enteteFenetre
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
##
|
|
107
|
+
## Définit un accesseur pour le contexte de style de la fenêtre Gtk
|
|
108
|
+
##
|
|
109
|
+
## @return fenetreStyle
|
|
110
|
+
##
|
|
111
|
+
def Fenetre.fenetreStyle()
|
|
112
|
+
return @fenetreStyle
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
##
|
|
116
|
+
## Définit un accesseur pour le bouton de retour
|
|
117
|
+
##
|
|
118
|
+
## @return boutonRetour
|
|
119
|
+
##
|
|
120
|
+
def Fenetre.boutonRetour()
|
|
121
|
+
return @boutonRetour
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
##
|
|
125
|
+
## Définit un accesseur pour le bouton boutonMenu_barre
|
|
126
|
+
##
|
|
127
|
+
## @return boutonMenu_barre
|
|
128
|
+
##
|
|
129
|
+
def Fenetre.boutonMenu_barre()
|
|
130
|
+
return @boutonMenu_barre
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
## Définit un accesseur pour le bouton boutonSauvegarder_barre
|
|
135
|
+
##
|
|
136
|
+
## @return boutonSauvegarder_barre
|
|
137
|
+
##
|
|
138
|
+
def Fenetre.boutonSauvegarder_barre()
|
|
139
|
+
return @boutonSauvegarder_barre
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
##
|
|
143
|
+
## Définit un accesseur pour le bouton boutonReinit_barre
|
|
144
|
+
##
|
|
145
|
+
## @return boutonReinit_barre
|
|
146
|
+
##
|
|
147
|
+
def Fenetre.boutonReinit_barre()
|
|
148
|
+
return @boutonReinit_barre
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
##
|
|
152
|
+
## Définit un accesseur pour le bouton boutonQuitter_barre
|
|
153
|
+
##
|
|
154
|
+
## @return boutonQuitter_barre
|
|
155
|
+
##
|
|
156
|
+
def Fenetre.boutonQuitter_barre()
|
|
157
|
+
return @boutonQuitter_barre
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
##
|
|
161
|
+
## Définis un accesseur pour le bouton boutonPauseChrono_barre
|
|
162
|
+
##
|
|
163
|
+
## @return boutonPauseChrono_barre
|
|
164
|
+
##
|
|
165
|
+
def Fenetre.boutonPauseChrono_barre()
|
|
166
|
+
return @boutonPauseChrono_barre
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
##
|
|
170
|
+
## Définis un accesseur pour le bouton boutonPlayChrono_barre
|
|
171
|
+
##
|
|
172
|
+
## @return boutonPlayChrono_barre
|
|
173
|
+
##
|
|
174
|
+
def Fenetre.boutonPlayChrono_barre()
|
|
175
|
+
return @boutonPlayChrono_barre
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
##
|
|
179
|
+
## Définit un accesseur pour le bouton boutonAnnuler_barre
|
|
180
|
+
##
|
|
181
|
+
## @return boutonAnnuler_barre
|
|
182
|
+
##
|
|
183
|
+
def Fenetre.boutonAnnuler_barre()
|
|
184
|
+
return @boutonAnnuler_barre
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
##
|
|
188
|
+
## Définit un accesseur pour le bouton boutonRetablir_barre
|
|
189
|
+
##
|
|
190
|
+
## @return boutonRetablir_barre
|
|
191
|
+
##
|
|
192
|
+
def Fenetre.boutonRetablir_barre()
|
|
193
|
+
return @boutonRetablir_barre
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
##
|
|
197
|
+
## Applique une feuille css sur un widget
|
|
198
|
+
##
|
|
199
|
+
## widget Widget sur lequel appliquer
|
|
200
|
+
## chemin Chemin du fichier css
|
|
201
|
+
## fournisseur Gtk provider pour le css
|
|
202
|
+
## priorite Priorité du style par rapport au système
|
|
203
|
+
##
|
|
204
|
+
## @return Style appliqué
|
|
205
|
+
##
|
|
206
|
+
def Fenetre.css(**args)
|
|
207
|
+
if(args.has_key?(:fournisseur))
|
|
208
|
+
fournisseur = args[:fournisseur]
|
|
209
|
+
else
|
|
210
|
+
if(args.has_key?(:chemin))
|
|
211
|
+
chemin = Core::ROOTPROJECT + args[:chemin]
|
|
212
|
+
else
|
|
213
|
+
chemin = Core::ROOTPROJECT + "assets/css/style.css"
|
|
214
|
+
end
|
|
215
|
+
fournisseur = Gtk::CssProvider.new
|
|
216
|
+
fournisseur.load_from_path(chemin)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if(args.has_key?(:widget))
|
|
220
|
+
widget = args[:widget]
|
|
221
|
+
else
|
|
222
|
+
widget = @fenetre
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if(args.has_key?(:priorite))
|
|
226
|
+
priorite = Object.const_get("Gtk::StyleProvider::" + args[:priorite])
|
|
227
|
+
else
|
|
228
|
+
priorite = Object.const_get("Gtk::StyleProvider::PRIORITY_USER")
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
widgetStyle = widget.style_context
|
|
232
|
+
widgetStyle.add_provider(fournisseur, priorite)
|
|
233
|
+
|
|
234
|
+
return unless widget.respond_to?(:children)
|
|
235
|
+
widget.children.each do |child|
|
|
236
|
+
args[:widget] = child
|
|
237
|
+
self.css(args)
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
##
|
|
242
|
+
## Montre la fenêtre précédente
|
|
243
|
+
##
|
|
244
|
+
def Fenetre.fenetrePrecedente()
|
|
245
|
+
viderFenetre()
|
|
246
|
+
|
|
247
|
+
@fenetrePrecedente.each() do |elt|
|
|
248
|
+
@fenetre.add(elt)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
@fenetre.show_all
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
##
|
|
255
|
+
## Définit la fenêtre précédente
|
|
256
|
+
##
|
|
257
|
+
## @param fenetre Fenêtre précédente
|
|
258
|
+
##
|
|
259
|
+
def Fenetre.fenetrePrecedente=(fenetre)
|
|
260
|
+
@fenetrePrecedente = fenetre
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
##
|
|
264
|
+
## Accesseur sur le layout
|
|
265
|
+
##
|
|
266
|
+
def Fenetre.box()
|
|
267
|
+
return @box
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
##
|
|
271
|
+
## Vide la fenêtre pour préparer la mise à jour
|
|
272
|
+
##
|
|
273
|
+
def Fenetre.viderFenetre()
|
|
274
|
+
@fenetre.hide
|
|
275
|
+
# puts @fenetre.children[0]
|
|
276
|
+
@fenetre.children.each() do |child|
|
|
277
|
+
@fenetre.child.each() do |chil|
|
|
278
|
+
child.remove(chil)
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
##
|
|
285
|
+
## Permet de quitter l'application et de détruire la fenêtre
|
|
286
|
+
##
|
|
287
|
+
def Fenetre.detruire()
|
|
288
|
+
Gtk.main_quit()
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
##
|
|
292
|
+
## Applique un style css sur le widget
|
|
293
|
+
##
|
|
294
|
+
## @param widget Widget sur lequel appliquer un style
|
|
295
|
+
## @param provider
|
|
296
|
+
##
|
|
297
|
+
def Fenetre.appliquerStyle(widget, provider)
|
|
298
|
+
style_context = widget.style_context
|
|
299
|
+
style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
|
|
300
|
+
return unless widget.respond_to?(:children)
|
|
301
|
+
widget.children.each do |child|
|
|
302
|
+
apply_style(child, provider)
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
##
|
|
307
|
+
## Créer un label type à partir d'un string
|
|
308
|
+
##
|
|
309
|
+
## @param unNomDeLabel String représentant le texte du label
|
|
310
|
+
## @param uneTaille Taille de la police
|
|
311
|
+
##
|
|
312
|
+
## @return label
|
|
313
|
+
##
|
|
314
|
+
def Fenetre.creerLabelType(unNomDeLabel, uneTaille)
|
|
315
|
+
#Creation du Label
|
|
316
|
+
label=Gtk::Label.new()
|
|
317
|
+
label.set_markup("<span font_desc=\"#{FONT_MENU} #{uneTaille}\">#{unNomDeLabel}</span>")
|
|
318
|
+
label.set_justify(Gtk::Justification::CENTER)
|
|
319
|
+
return label
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
##
|
|
323
|
+
## Crée un popup du type demandé
|
|
324
|
+
##
|
|
325
|
+
## @param unTexte Le texte à afficher
|
|
326
|
+
## @param type Le type de popup
|
|
327
|
+
##
|
|
328
|
+
## @return L'objet dialog gtk
|
|
329
|
+
##
|
|
330
|
+
def Fenetre.creerPopup(unTexte, type)
|
|
331
|
+
messageErreur = Gtk::MessageDialog.new(
|
|
332
|
+
:parent => @fenetre,
|
|
333
|
+
:flags => Gtk::DialogFlags::DESTROY_WITH_PARENT,
|
|
334
|
+
:type => Gtk::MessageType::INFO,
|
|
335
|
+
:buttons => Object.const_get("Gtk::ButtonsType::" + type),
|
|
336
|
+
:message => unTexte)
|
|
337
|
+
return messageErreur
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
##
|
|
341
|
+
## Crée la box horizontale contenant les boutons Retour et Quitter des fenêtres du menu
|
|
342
|
+
##
|
|
343
|
+
## @return boxBottom
|
|
344
|
+
##
|
|
345
|
+
def Fenetre.creerBoxBottom()
|
|
346
|
+
#Création des boutons
|
|
347
|
+
@boutonRetour=Gtk::Button.new(:label => "Retour")
|
|
348
|
+
@boutonRetour.set_margin(40)
|
|
349
|
+
@boutonRetour.signal_connect_after('clicked'){
|
|
350
|
+
Core::back()
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
#Ajout des boutons
|
|
354
|
+
boxBottom=Gtk::Box.new(:horizontal, 0)
|
|
355
|
+
boxBottom.halign = :center
|
|
356
|
+
boxBottom.add(@boutonRetour)
|
|
357
|
+
return boxBottom
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
## Permet de créer la barre de menu du haut
|
|
361
|
+
##
|
|
362
|
+
## @return barreMenu
|
|
363
|
+
##
|
|
364
|
+
def Fenetre.creerBarreMenu()
|
|
365
|
+
barreMenu = Gtk::Toolbar.new()
|
|
366
|
+
barreMenu.set_toolbar_style(Gtk::ToolbarStyle::ICONS)
|
|
367
|
+
barreMenu.style_context.add_class("barre_menu")
|
|
368
|
+
|
|
369
|
+
@boutonMenu_barre = Gtk::ToolButton.new(:stock_id => Gtk::Stock::HOME)
|
|
370
|
+
@boutonMenu_barre.set_tooltip_text("Aller au menu principal")
|
|
371
|
+
@boutonMenu_barre.set_margin_right(10)
|
|
372
|
+
|
|
373
|
+
@boutonSauvegarder_barre = Gtk::ToolButton.new(:stock_id => Gtk::Stock::SAVE)
|
|
374
|
+
@boutonSauvegarder_barre.set_tooltip_text("Sauvegarder")
|
|
375
|
+
@boutonSauvegarder_barre.set_margin_right(10)
|
|
376
|
+
|
|
377
|
+
@boutonReinit_barre = Gtk::ToolButton.new(:stock_id => Gtk::Stock::CLEAR)
|
|
378
|
+
@boutonReinit_barre.set_tooltip_text("Réinitialiser la grille")
|
|
379
|
+
@boutonReinit_barre.set_margin_right(10)
|
|
380
|
+
|
|
381
|
+
@boutonQuitter_barre = Gtk::ToolButton.new(:stock_id => Gtk::Stock::QUIT)
|
|
382
|
+
@boutonQuitter_barre.set_tooltip_text("Quitter")
|
|
383
|
+
@boutonQuitter_barre.set_margin_right(10)
|
|
384
|
+
|
|
385
|
+
@boutonPauseChrono_barre = Gtk::ToolButton.new(:stock_id => Gtk::Stock::MEDIA_PAUSE)
|
|
386
|
+
@boutonPauseChrono_barre.set_tooltip_text("Mettre le jeu en pause")
|
|
387
|
+
@boutonPauseChrono_barre.set_margin_right(10)
|
|
388
|
+
|
|
389
|
+
@boutonPlayChrono_barre = Gtk::ToolButton.new(:stock_id => Gtk::Stock::MEDIA_PLAY)
|
|
390
|
+
@boutonPlayChrono_barre.set_tooltip_text("Reprendre le jeu")
|
|
391
|
+
@boutonPlayChrono_barre.set_margin_right(10)
|
|
392
|
+
|
|
393
|
+
@boutonAnnuler_barre=Gtk::ToolButton.new(:stock_id => Gtk::Stock::UNDO)
|
|
394
|
+
@boutonAnnuler_barre.set_tooltip_text("Annuler action")
|
|
395
|
+
@boutonAnnuler_barre.set_margin_right(10)
|
|
396
|
+
|
|
397
|
+
@boutonRetablir_barre=Gtk::ToolButton.new(:stock_id => Gtk::Stock::REDO)
|
|
398
|
+
@boutonRetablir_barre.set_tooltip_text("Rétablir action annulée")
|
|
399
|
+
@boutonRetablir_barre.set_margin_right(10)
|
|
400
|
+
|
|
401
|
+
barreMenu.insert(@boutonMenu_barre,0)
|
|
402
|
+
barreMenu.insert(@boutonSauvegarder_barre,1)
|
|
403
|
+
barreMenu.insert(@boutonReinit_barre,2)
|
|
404
|
+
barreMenu.insert(@boutonQuitter_barre,3)
|
|
405
|
+
barreMenu.insert(Gtk::SeparatorToolItem.new(),4)
|
|
406
|
+
barreMenu.insert(@boutonPauseChrono_barre,5)
|
|
407
|
+
barreMenu.insert(@boutonPlayChrono_barre,6)
|
|
408
|
+
barreMenu.insert(Gtk::SeparatorToolItem.new(),7)
|
|
409
|
+
barreMenu.insert(@boutonAnnuler_barre,8)
|
|
410
|
+
barreMenu.insert(@boutonRetablir_barre,9)
|
|
411
|
+
|
|
412
|
+
#enabled
|
|
413
|
+
@boutonMenu_barre.set_sensitive(true)
|
|
414
|
+
@boutonSauvegarder_barre.set_sensitive(true)
|
|
415
|
+
@boutonReinit_barre.set_sensitive(true)
|
|
416
|
+
@boutonQuitter_barre.set_sensitive(true)
|
|
417
|
+
@boutonPauseChrono_barre.set_sensitive(true)
|
|
418
|
+
@boutonPlayChrono_barre.set_sensitive(true)
|
|
419
|
+
@boutonAnnuler_barre.set_sensitive(true)
|
|
420
|
+
@boutonRetablir_barre.set_sensitive(true)
|
|
421
|
+
|
|
422
|
+
return barreMenu
|
|
423
|
+
end
|
|
424
|
+
end
|
|
@@ -0,0 +1,272 @@
|
|
|
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
|
+
|
|
8
|
+
##
|
|
9
|
+
## Classe FenetreApprentissage
|
|
10
|
+
##
|
|
11
|
+
class FenetreApprentissage < View
|
|
12
|
+
## VI box
|
|
13
|
+
@menuBarre
|
|
14
|
+
@boxMilieu
|
|
15
|
+
@boxGrille
|
|
16
|
+
@boxInfo
|
|
17
|
+
@boxTexte
|
|
18
|
+
@boxExplication
|
|
19
|
+
@boxEtape
|
|
20
|
+
|
|
21
|
+
# VI dessin
|
|
22
|
+
@grilleDessin
|
|
23
|
+
@scoreLabel
|
|
24
|
+
|
|
25
|
+
# VI info
|
|
26
|
+
@labelChoix
|
|
27
|
+
@list
|
|
28
|
+
@labelChoix2
|
|
29
|
+
@boutonEtapePrec
|
|
30
|
+
@boutonEtapeSuiv
|
|
31
|
+
@labelEtape
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# VI recup
|
|
35
|
+
@etapeEnCours
|
|
36
|
+
@nbEtape
|
|
37
|
+
@techniqueChoisie
|
|
38
|
+
@texteContenu
|
|
39
|
+
@tabTechnique
|
|
40
|
+
@techniqueObjet
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
## Initialize
|
|
44
|
+
##
|
|
45
|
+
##
|
|
46
|
+
def initialize()
|
|
47
|
+
@grilleDessin = nil
|
|
48
|
+
@scoreLabel = nil
|
|
49
|
+
|
|
50
|
+
#Recuperation de la classe technique
|
|
51
|
+
@etapeEnCours=0
|
|
52
|
+
@nbEtape=0
|
|
53
|
+
@techniqueChoisie=""
|
|
54
|
+
@texteContenu = Fenetre::creerLabelType("Bonjour, je suis là pour vous aider à apprendre des techniques!",Fenetre::SIZE_AUTRE_JEU)
|
|
55
|
+
|
|
56
|
+
#liste technique
|
|
57
|
+
@tabTechnique=[
|
|
58
|
+
"SCandidate",
|
|
59
|
+
"DSubset",
|
|
60
|
+
"SCell"
|
|
61
|
+
]
|
|
62
|
+
#box
|
|
63
|
+
@menuBarre = Fenetre::creerBarreMenu()
|
|
64
|
+
@boxMilieu = Gtk::Box.new(:horizontal, 50)
|
|
65
|
+
@boxGrille = Gtk::Box.new(:horizontal, 0)
|
|
66
|
+
@boxInfo = Gtk::Box.new(:vertical, 40)
|
|
67
|
+
@boxEtape = Gtk::Box.new(:horizontal, 30)
|
|
68
|
+
@boxExplication = Gtk::Box.new(:horizontal, 0)
|
|
69
|
+
@boxContour = Gtk::Box.new(:horizontal,0)
|
|
70
|
+
@boxTexte = Gtk::Box.new(:vertical,10)
|
|
71
|
+
|
|
72
|
+
#Choix technique
|
|
73
|
+
@labelChoix = Fenetre::creerLabelType("<u>Choix de la technique</u>", Fenetre::SIZE_TITRE_JEU)
|
|
74
|
+
@list = Gtk::ComboBoxText.new()
|
|
75
|
+
|
|
76
|
+
#information de la technique
|
|
77
|
+
@labelChoix2 = Fenetre::creerLabelType("Choississez une technique...", Fenetre::SIZE_AUTRE_JEU)
|
|
78
|
+
@boutonEtapePrec = Gtk::Button.new(:label => "Precedente")
|
|
79
|
+
@boutonEtapeSuiv = Gtk::Button.new(:label => " Suivante ")
|
|
80
|
+
@labelEtape = Fenetre::creerLabelType("Etape #{@etapeEnCours}/#{@nbEtape}", Fenetre::SIZE_AUTRE_JEU)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
##
|
|
84
|
+
## Crée le dessin de la grille
|
|
85
|
+
##
|
|
86
|
+
## @return Self
|
|
87
|
+
##
|
|
88
|
+
def creerGrille()
|
|
89
|
+
@grilleDessin = GrilleDessin.new(@grille, @config)
|
|
90
|
+
return self
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
##
|
|
94
|
+
## Met en place tout les éléments sur la page
|
|
95
|
+
##
|
|
96
|
+
##
|
|
97
|
+
def miseEnPlace()
|
|
98
|
+
#barre de menu
|
|
99
|
+
gestionBarreMenu()
|
|
100
|
+
|
|
101
|
+
#box grille
|
|
102
|
+
@boxGrille.add(@grilleDessin)
|
|
103
|
+
|
|
104
|
+
#box de droite
|
|
105
|
+
gestionDroite()
|
|
106
|
+
|
|
107
|
+
@boxMilieu.add(@boxGrille)
|
|
108
|
+
@boxMilieu.add(@boxInfo)
|
|
109
|
+
|
|
110
|
+
ajoutCss()
|
|
111
|
+
|
|
112
|
+
#add a la box
|
|
113
|
+
Fenetre::box.add(@menuBarre)
|
|
114
|
+
Fenetre::box.add(@boxMilieu)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
##
|
|
118
|
+
## Met en place la barre de menu
|
|
119
|
+
##
|
|
120
|
+
##
|
|
121
|
+
##
|
|
122
|
+
def gestionBarreMenu()
|
|
123
|
+
Fenetre::boutonMenu_barre.signal_connect('clicked'){
|
|
124
|
+
messageQuestion = Fenetre::creerPopup("Voulez-vous vraiment abandonner l'apprentissage et revenir au menu principal?", "YES_NO")
|
|
125
|
+
if(messageQuestion.run() == Gtk::ResponseType::YES)
|
|
126
|
+
Core::changeTo("Menu", "pseudo": @pseudo)
|
|
127
|
+
end
|
|
128
|
+
messageQuestion.destroy()
|
|
129
|
+
}
|
|
130
|
+
Fenetre::boutonSauvegarder_barre.signal_connect('clicked'){
|
|
131
|
+
}
|
|
132
|
+
Fenetre::boutonReinit_barre.signal_connect('clicked'){
|
|
133
|
+
}
|
|
134
|
+
Fenetre::boutonQuitter_barre.signal_connect('clicked'){
|
|
135
|
+
messageQuestion = Fenetre::creerPopup("Voulez-vous vraiment abandonner l'apprentissage et quitter l'application?", "YES_NO")
|
|
136
|
+
if(messageQuestion.run() == Gtk::ResponseType::YES)
|
|
137
|
+
Fenetre::detruire()
|
|
138
|
+
end
|
|
139
|
+
messageQuestion.destroy()
|
|
140
|
+
}
|
|
141
|
+
Fenetre::boutonPauseChrono_barre.signal_connect('clicked'){
|
|
142
|
+
Header::pause = true
|
|
143
|
+
}
|
|
144
|
+
Fenetre::boutonPlayChrono_barre.signal_connect('clicked'){
|
|
145
|
+
Header::pause = false
|
|
146
|
+
}
|
|
147
|
+
Fenetre::boutonAnnuler_barre.signal_connect('clicked'){
|
|
148
|
+
}
|
|
149
|
+
Fenetre::boutonRetablir_barre.signal_connect('clicked'){
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#disabled
|
|
153
|
+
Fenetre::boutonSauvegarder_barre.set_sensitive(false)
|
|
154
|
+
Fenetre::boutonReinit_barre.set_sensitive(false)
|
|
155
|
+
Fenetre::boutonAnnuler_barre.set_sensitive(false)
|
|
156
|
+
Fenetre::boutonRetablir_barre.set_sensitive(false)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
##
|
|
160
|
+
## Met en place la partie de droite
|
|
161
|
+
##
|
|
162
|
+
##
|
|
163
|
+
##
|
|
164
|
+
def gestionDroite()
|
|
165
|
+
#choix technique
|
|
166
|
+
@tabTechnique.each{ |t|
|
|
167
|
+
@list.append_text("#{t}")
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@list.signal_connect('changed'){ |widget|
|
|
171
|
+
@techniqueChoisie=widget.active_text()
|
|
172
|
+
@techniqueObjet=@Techniques.creer(@techniqueChoisie)
|
|
173
|
+
@nbEtape= recuperationNbEtape()
|
|
174
|
+
@etapeEnCours=1
|
|
175
|
+
actualisation()
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
#etapes
|
|
179
|
+
@boutonEtapePrec.signal_connect('clicked'){
|
|
180
|
+
if @etapeEnCours-1 > 0
|
|
181
|
+
@etapeEnCours=@etapeEnCours-1
|
|
182
|
+
actualisation()
|
|
183
|
+
end
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@boutonEtapeSuiv.signal_connect('clicked'){
|
|
187
|
+
if @etapeEnCours+1 <= @nbEtape
|
|
188
|
+
@etapeEnCours=@etapeEnCours+1
|
|
189
|
+
actualisation()
|
|
190
|
+
end
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@boxEtape.add(@boutonEtapePrec)
|
|
194
|
+
@boxEtape.add(@labelEtape)
|
|
195
|
+
@boxEtape.add(@boutonEtapeSuiv)
|
|
196
|
+
|
|
197
|
+
#explication
|
|
198
|
+
@boxExplication.set_hexpand(true)
|
|
199
|
+
@boxExplication.set_vexpand(true)
|
|
200
|
+
|
|
201
|
+
@texteContenu.set_line_wrap(true)
|
|
202
|
+
@boxTexte.add(@texteContenu)
|
|
203
|
+
@boxContour.pack_start(@boxTexte, :expand => true, :fill => true)
|
|
204
|
+
@boxExplication.pack_start(@boxContour, :expand => true, :fill => true)
|
|
205
|
+
|
|
206
|
+
#add a la box
|
|
207
|
+
@boxInfo.add(@labelChoix)
|
|
208
|
+
@boxInfo.add(@list)
|
|
209
|
+
@boxInfo.add(@labelChoix2)
|
|
210
|
+
@boxInfo.add(@boxEtape)
|
|
211
|
+
@boxInfo.add(@boxExplication)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
##
|
|
215
|
+
## actualisation informations
|
|
216
|
+
##
|
|
217
|
+
def actualisation()
|
|
218
|
+
@labelChoix2.set_text("Explication de #{@techniqueChoisie}")
|
|
219
|
+
@labelEtape.set_text("Etape #{@etapeEnCours}/#{@nbEtape}")
|
|
220
|
+
recuperationEtape()
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
##
|
|
224
|
+
## Recuperatuon du nombre d'etapes pour le tutoriel
|
|
225
|
+
##
|
|
226
|
+
##
|
|
227
|
+
def recuperationNbEtape()
|
|
228
|
+
@nbEtape=@techniqueObjet.combienEtape()
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
## Recuperatuon du texte de l'etape en cours
|
|
233
|
+
##
|
|
234
|
+
##
|
|
235
|
+
def recuperationEtape()
|
|
236
|
+
string=@techniqueObjet.etape(@etapeEnCours)
|
|
237
|
+
@texteContenu.set_text(string)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
##
|
|
241
|
+
## Ajoute les classes css au widget
|
|
242
|
+
##
|
|
243
|
+
def ajoutCss()
|
|
244
|
+
#css label
|
|
245
|
+
@labelChoix.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
246
|
+
@labelChoix.set_margin_top(40)
|
|
247
|
+
@list.set_hexpand(true);
|
|
248
|
+
@labelEtape.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
249
|
+
@labelEtape.set_hexpand(true);
|
|
250
|
+
@texteContenu.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
251
|
+
@texteContenu.set_margin(4)
|
|
252
|
+
@labelChoix2.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
253
|
+
#css bouton
|
|
254
|
+
@boxContour.override_background_color(:normal, Fenetre::COULEUR_BLANC)
|
|
255
|
+
@boxTexte.override_background_color(:normal, Fenetre::COULEUR_BLEU)
|
|
256
|
+
@boxTexte.set_margin(3)
|
|
257
|
+
@boutonEtapePrec.set_hexpand(true);
|
|
258
|
+
@boutonEtapeSuiv.set_hexpand(true);
|
|
259
|
+
@boxInfo.set_margin(10)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
##
|
|
263
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
264
|
+
##
|
|
265
|
+
## @return self
|
|
266
|
+
##
|
|
267
|
+
def run()
|
|
268
|
+
self.creerGrille()
|
|
269
|
+
self.miseEnPlace()
|
|
270
|
+
return self
|
|
271
|
+
end
|
|
272
|
+
end
|