mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
fix: add shutting down dialog to TUI (#3101)
* fix: add shutting down dialog to the TUI
This commit is contained in:
parent
1f5de6beb9
commit
67057ab36d
1 changed files with 6 additions and 3 deletions
|
@ -26,7 +26,7 @@ use cursive::theme::{BaseColor, BorderStyle, Color, Theme};
|
||||||
use cursive::traits::Boxable;
|
use cursive::traits::Boxable;
|
||||||
use cursive::traits::Identifiable;
|
use cursive::traits::Identifiable;
|
||||||
use cursive::utils::markup::StyledString;
|
use cursive::utils::markup::StyledString;
|
||||||
use cursive::views::{LinearLayout, Panel, StackView, TextView, ViewBox};
|
use cursive::views::{CircularFocus, Dialog, LinearLayout, Panel, StackView, TextView, ViewBox};
|
||||||
use cursive::Cursive;
|
use cursive::Cursive;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
|
||||||
|
@ -108,7 +108,11 @@ impl UI {
|
||||||
|
|
||||||
// Configure a callback (shutdown, for the first test)
|
// Configure a callback (shutdown, for the first test)
|
||||||
let controller_tx_clone = grin_ui.controller_tx.clone();
|
let controller_tx_clone = grin_ui.controller_tx.clone();
|
||||||
grin_ui.cursive.add_global_callback('q', move |_| {
|
grin_ui.cursive.add_global_callback('q', move |c| {
|
||||||
|
let content = StyledString::styled("Shutting down...", Color::Light(BaseColor::Yellow));
|
||||||
|
c.add_layer(CircularFocus::wrap_tab(Dialog::around(TextView::new(
|
||||||
|
content,
|
||||||
|
))));
|
||||||
controller_tx_clone
|
controller_tx_clone
|
||||||
.send(ControllerMessage::Shutdown)
|
.send(ControllerMessage::Shutdown)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -174,7 +178,6 @@ impl Controller {
|
||||||
match message {
|
match message {
|
||||||
ControllerMessage::Shutdown => {
|
ControllerMessage::Shutdown => {
|
||||||
self.ui.stop();
|
self.ui.stop();
|
||||||
println!("Shutdown in progress, please wait");
|
|
||||||
server.stop();
|
server.stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue