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,198 @@
|
|
|
1
|
+
# => Contient la classe FenetreMenu pour la fenêtre du menu principal
|
|
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 FenetreMenu contenant le squelette du menu
|
|
10
|
+
##
|
|
11
|
+
class FenetreMenu < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
# VI bouton
|
|
16
|
+
@boutonCharger
|
|
17
|
+
@boutonNouveau
|
|
18
|
+
@boutonStat
|
|
19
|
+
@boutonScore
|
|
20
|
+
@boutonReglage
|
|
21
|
+
@boutonRegle
|
|
22
|
+
@boutonAPropos
|
|
23
|
+
@boutonQuitter
|
|
24
|
+
# VI label
|
|
25
|
+
@titreLabel
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
## Initialize
|
|
29
|
+
##
|
|
30
|
+
def initialize()
|
|
31
|
+
# VI box
|
|
32
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
33
|
+
@boxBottom = Gtk::Box.new(:horizontal, 0)
|
|
34
|
+
# VI bouton
|
|
35
|
+
@boutonCharger = Gtk::ToggleButton.new(:label => "Reprendre une partie")
|
|
36
|
+
@boutonNouveau = Gtk::Button.new(:label => "Nouvelle partie")
|
|
37
|
+
@boutonStat = Gtk::Button.new(:label => "Statistiques")
|
|
38
|
+
@boutonScore = Gtk::Button.new(:label => "Meilleurs scores")
|
|
39
|
+
@boutonReglage = Gtk::Button.new(:label => "Réglages")
|
|
40
|
+
@boutonRegle = Gtk::Button.new(:label => "Règles de base")
|
|
41
|
+
@boutonAPropos = Gtk::Button.new(:label => " About ")
|
|
42
|
+
@boutonQuitter = Gtk::Button.new(:label => "Quitter")
|
|
43
|
+
# VI label
|
|
44
|
+
@titreLabel = Fenetre::creerLabelType("<u>Menu Principal</u>",Fenetre::SIZE_TITRE)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
##
|
|
48
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
49
|
+
##
|
|
50
|
+
##
|
|
51
|
+
def miseEnPlace()
|
|
52
|
+
creerBoxTop()
|
|
53
|
+
creerBoxBottom()
|
|
54
|
+
ajoutCss()
|
|
55
|
+
Fenetre::box.add(@boxTop)
|
|
56
|
+
Fenetre::box.add(@boxBottom)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
##
|
|
60
|
+
## Créer la box verticale contenant les boutons du menu et le titre
|
|
61
|
+
##
|
|
62
|
+
##
|
|
63
|
+
def creerBoxTop()
|
|
64
|
+
#Action des boutons
|
|
65
|
+
@boutonCharger.signal_connect('clicked'){
|
|
66
|
+
charger
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@boutonNouveau.signal_connect('clicked'){
|
|
70
|
+
Core::changeTo("NouvellePartie", "pseudo": @pseudo)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@boutonStat.signal_connect('clicked'){
|
|
74
|
+
Core::changeTo("Statistiques", "pseudo": @pseudo)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@boutonScore.signal_connect('clicked'){
|
|
78
|
+
Core::changeTo("Scores", "pseudo": @pseudo)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@boutonReglage.signal_connect('clicked'){
|
|
82
|
+
Core::changeTo("Reglages", "pseudo": @pseudo)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@boutonRegle.signal_connect('clicked'){
|
|
86
|
+
Core::changeTo("Regles", "pseudo": @pseudo)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#add des boutons à la box
|
|
90
|
+
@boxTop.add(@titreLabel)
|
|
91
|
+
if(partieExiste(@pseudo))
|
|
92
|
+
@boxTop.add(@boutonCharger)
|
|
93
|
+
else
|
|
94
|
+
@boxTop.add(Fenetre::creerLabelType(" ",10))
|
|
95
|
+
end
|
|
96
|
+
@boxTop.add(@boutonNouveau)
|
|
97
|
+
@boxTop.add(@boutonStat)
|
|
98
|
+
@boxTop.add(@boutonScore)
|
|
99
|
+
@boxTop.add(@boutonReglage)
|
|
100
|
+
@boxTop.add(@boutonRegle)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
##
|
|
104
|
+
## Créer la box horizontale contenant les boutons a propos et quitter
|
|
105
|
+
##
|
|
106
|
+
##
|
|
107
|
+
def creerBoxBottom()
|
|
108
|
+
#Action des boutons
|
|
109
|
+
@boutonAPropos.signal_connect('clicked'){
|
|
110
|
+
aPropos()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@boutonQuitter.signal_connect('clicked'){
|
|
114
|
+
Fenetre::detruire()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#add des boutons à la box
|
|
118
|
+
@boxBottom.halign = :center
|
|
119
|
+
@boxBottom.add(@boutonAPropos)
|
|
120
|
+
@boxBottom.add(@boutonQuitter)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
##
|
|
124
|
+
## Ajoute les classes css au widget
|
|
125
|
+
##
|
|
126
|
+
def ajoutCss()
|
|
127
|
+
#css label
|
|
128
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
129
|
+
@titreLabel.set_margin_top(30)
|
|
130
|
+
#css bouton
|
|
131
|
+
@boutonCharger.set_margin(10)
|
|
132
|
+
@boutonCharger.set_margin_left(100)
|
|
133
|
+
@boutonCharger.set_margin_right(100)
|
|
134
|
+
@boutonCharger.set_margin_top(15)
|
|
135
|
+
@boutonNouveau.set_margin(10)
|
|
136
|
+
@boutonNouveau.set_margin_left(100)
|
|
137
|
+
@boutonNouveau.set_margin_right(100)
|
|
138
|
+
@boutonStat.set_margin(10)
|
|
139
|
+
@boutonStat.set_margin_left(100)
|
|
140
|
+
@boutonStat.set_margin_right(100)
|
|
141
|
+
@boutonScore.set_margin(10)
|
|
142
|
+
@boutonScore.set_margin_left(100)
|
|
143
|
+
@boutonScore.set_margin_right(100)
|
|
144
|
+
@boutonReglage.set_margin(10)
|
|
145
|
+
@boutonReglage.set_margin_left(100)
|
|
146
|
+
@boutonReglage.set_margin_right(100)
|
|
147
|
+
@boutonRegle.set_margin(10)
|
|
148
|
+
@boutonRegle.set_margin_left(100)
|
|
149
|
+
@boutonRegle.set_margin_right(100)
|
|
150
|
+
@boutonAPropos.set_margin(40)
|
|
151
|
+
@boutonQuitter.set_margin(40)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
##
|
|
155
|
+
## Créer la popup A propos pour l'explication du projet et des programmeurs
|
|
156
|
+
##
|
|
157
|
+
##
|
|
158
|
+
def aPropos()
|
|
159
|
+
fenetre = Gtk::AboutDialog.new()
|
|
160
|
+
fenetre.set_program_name("Projet sudoku")
|
|
161
|
+
fenetre.set_version("1.0")
|
|
162
|
+
fenetre.set_copyright("(c) DogeTeam - Groupe B")
|
|
163
|
+
fenetre.set_authors(["JEAN Marvin => Chef de projet", "COUSIN Brandon => Architecte", "PAVARD Valentin => Interface GUI", "DURAN Alizée => Documentaliste", "GUENVER Yann => Développeur", "TABOT Alexandre => Développeur", "BUSSEREAU Keryann => Développeur", "BODINEAU Bastien => Développeur"])
|
|
164
|
+
fenetre.set_comments("Dans le cadre du module 176EN001 intitulé Génie Logiciel 2 :\n Application à la conception à l'université du Maine, nous devons réaliser une interface à aides visuelles à la réalisation d’un Sudoku. Cela permet d’aider un utilisateur à résoudre un Sudoku sans réfléchir. La grille du Sudoku sera générée sur ordinateur.")
|
|
165
|
+
fenetre.set_transient_for(Fenetre::fenetre)
|
|
166
|
+
fenetre.set_window_position(Gtk::WindowPosition::CENTER_ALWAYS)
|
|
167
|
+
fenetre.set_title("Sudoku - A propos")
|
|
168
|
+
fenetre.set_default_size(400,400)
|
|
169
|
+
fenetre.border_width=0
|
|
170
|
+
fenetre.set_resizable(false)
|
|
171
|
+
|
|
172
|
+
fenetre.signal_connect('destroy') {
|
|
173
|
+
fenetre.hide()
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
begin
|
|
177
|
+
logo =GdkPixbuf::Pixbuf.new(:file => Core::ROOTPROJECT + "assets/img/logoS.jpeg", :width => 200, :height => 200)
|
|
178
|
+
fenetre.set_logo(logo)
|
|
179
|
+
rescue IOError => e
|
|
180
|
+
puts e
|
|
181
|
+
puts "Impossible de charger l'image du A Propos"
|
|
182
|
+
exit
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
fenetre.run()
|
|
186
|
+
fenetre.destroy()
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
##
|
|
190
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
191
|
+
##
|
|
192
|
+
## @return self
|
|
193
|
+
##
|
|
194
|
+
def run
|
|
195
|
+
self.miseEnPlace()
|
|
196
|
+
return self
|
|
197
|
+
end
|
|
198
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# => Contient la classe FenetreNiveau pour la fenêtre de choix de la difficulté
|
|
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 FenetreNiveau
|
|
10
|
+
##
|
|
11
|
+
class FenetreNiveau < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
# VI bouton
|
|
16
|
+
@boutonFacile
|
|
17
|
+
@boutonMoyen
|
|
18
|
+
@boutonDifficile
|
|
19
|
+
# VI label
|
|
20
|
+
@titreLabel
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
## Initialize
|
|
24
|
+
##
|
|
25
|
+
def initialize()
|
|
26
|
+
# VI box
|
|
27
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
28
|
+
@boxBottom = Fenetre::creerBoxBottom()
|
|
29
|
+
# VI bouton
|
|
30
|
+
@boutonFacile = Gtk::Button.new(:label => "Facile")
|
|
31
|
+
@boutonMoyen = Gtk::Button.new(:label => "Moyen")
|
|
32
|
+
@boutonDifficile = Gtk::Button.new(:label => "Difficile")
|
|
33
|
+
# VI label
|
|
34
|
+
@titreLabel = Fenetre::creerLabelType("<u>Choix difficulté</u>", Fenetre::SIZE_TITRE)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
39
|
+
##
|
|
40
|
+
##
|
|
41
|
+
def miseEnPlace()
|
|
42
|
+
creerBoxTop()
|
|
43
|
+
ajoutCss()
|
|
44
|
+
Fenetre::box.add(@boxTop)
|
|
45
|
+
Fenetre::box.add(@boxBottom)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
## Créer la box verticale contenant les boutons des choix de la difficulté et le titre
|
|
50
|
+
##
|
|
51
|
+
##
|
|
52
|
+
def creerBoxTop()
|
|
53
|
+
#Action des boutons
|
|
54
|
+
@boutonFacile.signal_connect('clicked'){
|
|
55
|
+
supprimerPartieExistante(@pseudo)
|
|
56
|
+
Core::changeTo("JeuLibre", "pseudo": @pseudo, :difficulte=>Jeu::FACILE)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@boutonMoyen.signal_connect('clicked'){
|
|
60
|
+
supprimerPartieExistante(@pseudo)
|
|
61
|
+
Core::changeTo("JeuLibre", "pseudo": @pseudo, :difficulte=>Jeu::MOYEN)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@boutonDifficile.signal_connect('clicked'){
|
|
65
|
+
supprimerPartieExistante(@pseudo)
|
|
66
|
+
Core::changeTo("JeuLibre", "pseudo": @pseudo, :difficulte=>Jeu::DIFFICILE)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#add des boutons à la box
|
|
70
|
+
@boxTop.add(@titreLabel)
|
|
71
|
+
@boxTop.add(@boutonFacile)
|
|
72
|
+
@boxTop.add(@boutonMoyen)
|
|
73
|
+
@boxTop.add(@boutonDifficile)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
##
|
|
77
|
+
## Ajoute les classes css au widget
|
|
78
|
+
##
|
|
79
|
+
def ajoutCss()
|
|
80
|
+
#css label
|
|
81
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
82
|
+
@titreLabel.set_margin_top(30)
|
|
83
|
+
#css bouton
|
|
84
|
+
@boutonFacile.set_margin_top(70)
|
|
85
|
+
@boutonFacile.set_margin_bottom(40)
|
|
86
|
+
@boutonFacile.set_margin_left(100)
|
|
87
|
+
@boutonFacile.set_margin_right(100)
|
|
88
|
+
@boutonMoyen.set_margin_bottom(40)
|
|
89
|
+
@boutonMoyen.set_margin_left(100)
|
|
90
|
+
@boutonMoyen.set_margin_right(100)
|
|
91
|
+
@boutonDifficile.set_margin_bottom(40)
|
|
92
|
+
@boutonDifficile.set_margin_left(100)
|
|
93
|
+
@boutonDifficile.set_margin_right(100)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
##
|
|
97
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
98
|
+
##
|
|
99
|
+
## @return self
|
|
100
|
+
##
|
|
101
|
+
def run()
|
|
102
|
+
self.miseEnPlace()
|
|
103
|
+
return self
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# => Contient la classe FenetreNouvellePartie qui propose le mode aventure ou apprentissage
|
|
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 FenetreNouvellePartie
|
|
10
|
+
##
|
|
11
|
+
class FenetreNouvellePartie < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
# VI bouton
|
|
16
|
+
@boutonApprentissage
|
|
17
|
+
@boutonJeuLibre
|
|
18
|
+
# VI label
|
|
19
|
+
@titreLabel
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
## Initialize
|
|
23
|
+
##
|
|
24
|
+
def initialize()
|
|
25
|
+
# VI box
|
|
26
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
27
|
+
@boxBottom = Fenetre::creerBoxBottom()
|
|
28
|
+
# VI bouton
|
|
29
|
+
@boutonApprentissage = Gtk::Button.new(:label => "Apprentissage avec aides")
|
|
30
|
+
@boutonJeuLibre = Gtk::Button.new(:label => "Jeu libre")
|
|
31
|
+
# VI label
|
|
32
|
+
@titreLabel = Fenetre::creerLabelType("<u>Nouvelle partie</u>",Fenetre::SIZE_TITRE)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
37
|
+
##
|
|
38
|
+
##
|
|
39
|
+
def miseEnPlace()
|
|
40
|
+
creerBoxTop()
|
|
41
|
+
ajoutCss()
|
|
42
|
+
Fenetre::box.add(@boxTop)
|
|
43
|
+
Fenetre::box.add(@boxBottom)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
## Créer la box verticale contenant les boutons des choix du mode de jeu et le titre
|
|
48
|
+
##
|
|
49
|
+
##
|
|
50
|
+
def creerBoxTop()
|
|
51
|
+
#Action des boutons
|
|
52
|
+
@boutonApprentissage.signal_connect('clicked'){
|
|
53
|
+
Core::changeTo("Apprentissage", "pseudo": @pseudo)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@boutonJeuLibre.signal_connect('clicked'){
|
|
57
|
+
Core::changeTo("Niveau", "pseudo": @pseudo)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#add des boutons à la box
|
|
61
|
+
@boxTop.add(@titreLabel)
|
|
62
|
+
@boxTop.add(@boutonApprentissage)
|
|
63
|
+
@boxTop.add(@boutonJeuLibre)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
##
|
|
67
|
+
## Ajoute les classes css au widget
|
|
68
|
+
##
|
|
69
|
+
def ajoutCss()
|
|
70
|
+
#css label
|
|
71
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
72
|
+
@titreLabel.set_margin_top(30)
|
|
73
|
+
#css bouton
|
|
74
|
+
@boutonApprentissage.set_margin_top(100)
|
|
75
|
+
@boutonApprentissage.set_margin_bottom(50)
|
|
76
|
+
@boutonApprentissage.set_margin_left(100)
|
|
77
|
+
@boutonApprentissage.set_margin_right(100)
|
|
78
|
+
@boutonJeuLibre.set_margin_bottom(50)
|
|
79
|
+
@boutonJeuLibre.set_margin_left(100)
|
|
80
|
+
@boutonJeuLibre.set_margin_right(100)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
##
|
|
84
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
85
|
+
##
|
|
86
|
+
## @return self
|
|
87
|
+
##
|
|
88
|
+
def run()
|
|
89
|
+
self.miseEnPlace()
|
|
90
|
+
return self
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# => Contient la classe FenetrePrincipale qui affiche l'image d'intro
|
|
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 FenetrePrincipale
|
|
10
|
+
##
|
|
11
|
+
class FenetrePrincipale < View
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
15
|
+
##
|
|
16
|
+
##
|
|
17
|
+
def miseEnPlace()
|
|
18
|
+
begin
|
|
19
|
+
image = Gtk::Image.new(:file => Core::ROOTPROJECT + "assets/img/sudokuIntro.jpg")
|
|
20
|
+
rescue IOError => e
|
|
21
|
+
puts e
|
|
22
|
+
puts "Impossible de charger l'image de depart"
|
|
23
|
+
exit
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
#Creation des Boutons
|
|
27
|
+
event_box=Gtk::EventBox.new.add(image)
|
|
28
|
+
event_box.signal_connect('button_press_event'){
|
|
29
|
+
Core::changeTo("Pseudo")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#add des boutons à la box
|
|
33
|
+
Fenetre::box.add(event_box)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
38
|
+
##
|
|
39
|
+
## @return self
|
|
40
|
+
##
|
|
41
|
+
def run
|
|
42
|
+
self.miseEnPlace()
|
|
43
|
+
return self
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# => Contient la classe FenetrePseudo representant une fenetre pour le choix du pseudo
|
|
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 FenetrePseudo
|
|
10
|
+
##
|
|
11
|
+
class FenetrePseudo < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
# VI bouton
|
|
16
|
+
@entryPseudo
|
|
17
|
+
@boutonValider
|
|
18
|
+
@boutonQuitter
|
|
19
|
+
# VI label
|
|
20
|
+
@titreLabel
|
|
21
|
+
@pseudoLabel
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
## Initialize
|
|
25
|
+
##
|
|
26
|
+
def initialize()
|
|
27
|
+
# VI box
|
|
28
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
29
|
+
@boxBottom = Gtk::Box.new(:horizontal, 0)
|
|
30
|
+
# VI bouton
|
|
31
|
+
@entryPseudo = Gtk::Entry.new()
|
|
32
|
+
@boutonValider = Gtk::Button.new(:label => "Valider")
|
|
33
|
+
@boutonQuitter = Gtk::Button.new(:label => "Quitter")
|
|
34
|
+
# VI label
|
|
35
|
+
@titreLabel = Fenetre::creerLabelType("<u>Choix du pseudo</u>", Fenetre::SIZE_TITRE)
|
|
36
|
+
@pseudoLabel = Fenetre::creerLabelType("Votre pseudo : ", Fenetre::SIZE_PSEUDO)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
41
|
+
##
|
|
42
|
+
##
|
|
43
|
+
def miseEnPlace()
|
|
44
|
+
creerBoxTop()
|
|
45
|
+
creerBoxBottom()
|
|
46
|
+
ajoutCss()
|
|
47
|
+
Fenetre::box.add(@boxTop)
|
|
48
|
+
Fenetre::box.add(@boxBottom)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
##
|
|
52
|
+
## Créer la box verticale contenant la demande de pseudo et le titre
|
|
53
|
+
##
|
|
54
|
+
##
|
|
55
|
+
def creerBoxTop()
|
|
56
|
+
#Action des boutons
|
|
57
|
+
@entryPseudo.set_max_length(15)
|
|
58
|
+
@entryPseudo.signal_connect("activate"){
|
|
59
|
+
actionBoutonValider(@entryPseudo)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#add des boutons à la box
|
|
63
|
+
@boxTop.add(@titreLabel)
|
|
64
|
+
@boxTop.add(@pseudoLabel)
|
|
65
|
+
@boxTop.add(@entryPseudo)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
##
|
|
69
|
+
#Creer la box horizontal contenant les boutons valider et quitter
|
|
70
|
+
def creerBoxBottom()
|
|
71
|
+
#Action des boutons
|
|
72
|
+
@boutonValider.signal_connect('button_press_event'){
|
|
73
|
+
actionBoutonValider(@entryPseudo)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@boutonQuitter.signal_connect('clicked'){
|
|
77
|
+
Fenetre::detruire()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#add des boutons à la box
|
|
81
|
+
@boxBottom.halign = :center
|
|
82
|
+
@boxBottom.valign = :center
|
|
83
|
+
@boxBottom.add(@boutonQuitter)
|
|
84
|
+
@boxBottom.add(@boutonValider)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
## Ajoute les classes css au widget
|
|
89
|
+
##
|
|
90
|
+
def ajoutCss()
|
|
91
|
+
#css label
|
|
92
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
93
|
+
@titreLabel.set_margin_top(30)
|
|
94
|
+
@pseudoLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
95
|
+
@pseudoLabel.set_margin_top(80)
|
|
96
|
+
@pseudoLabel.set_margin_bottom(30)
|
|
97
|
+
#css bouton
|
|
98
|
+
@entryPseudo.set_margin_left(100)
|
|
99
|
+
@entryPseudo.set_margin_right(100)
|
|
100
|
+
@boutonValider.set_margin(40)
|
|
101
|
+
@boutonValider.set_margin_top(60)
|
|
102
|
+
@boutonQuitter.set_margin(40)
|
|
103
|
+
@boutonQuitter.set_margin_top(60)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
##
|
|
107
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
108
|
+
##
|
|
109
|
+
## @return self
|
|
110
|
+
##
|
|
111
|
+
def run
|
|
112
|
+
self.miseEnPlace()
|
|
113
|
+
return self
|
|
114
|
+
end
|
|
115
|
+
end
|