Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
training-session
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rust
training-session
Commits
a5658be1
Commit
a5658be1
authored
1 year ago
by
thibault.capt
Browse files
Options
Downloads
Patches
Plain Diff
add new interface gui
parent
c220a38e
No related branches found
No related tags found
1 merge request
!1
Tui
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.toml
+3
-1
3 additions, 1 deletion
Cargo.toml
src/gui.rs
+70
-0
70 additions, 0 deletions
src/gui.rs
src/main.rs
+3
-2
3 additions, 2 deletions
src/main.rs
with
76 additions
and
3 deletions
Cargo.toml
+
3
−
1
View file @
a5658be1
...
@@ -7,3 +7,5 @@ edition = "2021"
...
@@ -7,3 +7,5 @@ edition = "2021"
[dependencies]
[dependencies]
termion
=
"2.0.1"
termion
=
"2.0.1"
crossterm
=
"0.25.0"
cursive
=
"0.15.0"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/gui.rs
0 → 100644
+
70
−
0
View file @
a5658be1
use
cursive
::
Cursive
;
use
cursive
::
CursiveExt
;
use
cursive
::
views
::{
TextView
,
Dialog
,
LinearLayout
,
Button
};
use
crate
::
training
::
Training
;
pub
struct
App
{
cursive
:
Cursive
,
training_list
:
Vec
<
Training
>
,
}
impl
App
{
pub
fn
new
()
->
Self
{
let
mut
cursive
=
Cursive
::
default
();
let
training_list
=
Vec
::
new
();
// Créez une vue TextView pour afficher la liste des entraînements
let
training_view
=
TextView
::
new
(
"Liste des entraînements"
);
// Créez un bouton pour lire tous les entraînements
let
btn_list
=
Button
::
new
(
"Voir"
,
|
s
|
{
// Vous pouvez ajouter votre logique d'ajout ici
s
.add_layer
(
Dialog
::
info
(
"Fonctionnalité non implémentée"
));
});
// Créez un bouton pour ajouter un nouveau entraînement
let
btn_add
=
Button
::
new
(
"Ajouter"
,
|
s
|
{
// Vous pouvez ajouter votre logique d'ajout ici
s
.add_layer
(
Dialog
::
info
(
"Fonctionnalité non implémentée"
));
});
// Créez un bouton pour modifier un entraînement
let
btn_update
=
Button
::
new
(
"Modifier"
,
|
s
|
{
// Vous pouvez ajouter votre logique d'ajout ici
s
.add_layer
(
Dialog
::
info
(
"Fonctionnalité non implémentée"
));
});
// Créez un bouton pour supprimer un entraînement
let
btn_delete
=
Button
::
new
(
"Supprimer"
,
|
s
|
{
// Vous pouvez ajouter votre logique d'ajout ici
s
.add_layer
(
Dialog
::
info
(
"Fonctionnalité non implémentée"
));
});
// Créez un bouton pour supprimer un entraînement
let
btn_exit
=
Button
::
new
(
"Quitter"
,
|
s
|
{
// Vous pouvez ajouter votre logique d'ajout ici
s
.quit
();
});
// Créez un LinearLayout pour organiser la vue TextView et le bouton
let
layout
=
LinearLayout
::
vertical
()
.child
(
training_view
)
.child
(
btn_list
)
.child
(
btn_add
)
.child
(
btn_update
)
.child
(
btn_delete
)
.child
(
btn_exit
);
cursive
.add_layer
(
layout
);
cursive
.add_global_callback
(
'q'
,
|
s
|
s
.quit
());
App
{
cursive
,
training_list
}
}
pub
fn
run
(
&
mut
self
)
{
self
.cursive
.run
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main.rs
+
3
−
2
View file @
a5658be1
mod
training
;
mod
training
;
mod
participant
;
mod
participant
;
mod
terminal
;
//mod terminal;
mod
gui
;
use
terminal
::
App
;
use
gui
::
App
;
fn
main
()
{
fn
main
()
{
let
mut
app
=
App
::
new
();
let
mut
app
=
App
::
new
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment