Skip to content

Commit

Permalink
Merge pull request #121 from who-biz/cursive-update-0.17
Browse files Browse the repository at this point in the history
Update cursive dep to 0.17, tableview to 0.14.0
  • Loading branch information
johanneshahn authored Dec 22, 2023
2 parents 7f530ea + d0f1951 commit 6f04b01
Show file tree
Hide file tree
Showing 9 changed files with 592 additions and 391 deletions.
949 changes: 578 additions & 371 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ blake2-rfc = "0.2"
chrono = "0.4.31"
clap = { version = "2.31", features = ["yaml"] }
ctrlc = { version = "3.1", features = ["termination"] }
cursive_table_view = "0.13.2"
cursive_table_view = "0.14.0"
humansize = "1.1.0"
serde = "1"
futures = "0.3.28"
Expand All @@ -59,7 +59,7 @@ epic_servers = { path = "./servers", version = "3.5.0" }
epic_util = { path = "./util", version = "3.5.0" }
epic_chain = { path = "./chain", version = "3.5.0" }

cursive = { version = "0.16", default-features = false, features = [
cursive = { version = "0.17", default-features = false, features = [
"pancurses-backend",
] }

Expand Down
3 changes: 1 addition & 2 deletions src/bin/tui/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
// limitations under the License.

use cursive::theme::{BaseColor, Color, ColorStyle};
use cursive::traits::Identifiable;
use cursive::view::View;
use cursive::view::{Nameable, View};
use cursive::views::ResizedView;
use cursive::{Cursive, Printer};

Expand Down
3 changes: 1 addition & 2 deletions src/bin/tui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
use cursive::align::HAlign;
use cursive::direction::Orientation;
use cursive::event::{EventResult, Key};
use cursive::view::Identifiable;
use cursive::view::View;
use cursive::view::{Nameable, View};
use cursive::views::{
LinearLayout, OnEventView, ResizedView, SelectView, StackView, TextView, ViewRef,
};
Expand Down
5 changes: 2 additions & 3 deletions src/bin/tui/mining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use std::cmp::Ordering;
use crate::tui::chrono::prelude::{NaiveDateTime, TimeZone, Utc};
use cursive::direction::Orientation;
use cursive::event::Key;
use cursive::traits::{Boxable, Identifiable};
use cursive::view::View;
use cursive::view::{Nameable, Resizable, View};
use cursive::views::{
Button, Dialog, LinearLayout, OnEventView, Panel, ResizedView, StackView, TextView,
};
Expand Down Expand Up @@ -365,11 +364,11 @@ impl TUIStatusListener for TUIMiningView {
} else {
"NaN".to_owned()
};

let stratum_network_difficulty = format!(
"Current Difficulty: Cuckatoo: {}, ProgPow: {}, RandomX: {}",
cuckoo_diff, progpow_diff, randomx_diff,
);
// let stratum_edge_bits = format!("Cuckoo Size: {}", stratum_stats.edge_bits);

c.call_on_name("stratum_config_status", |t: &mut TextView| {
t.set_content(stratum_enabled);
Expand Down
4 changes: 2 additions & 2 deletions src/bin/tui/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ use chrono::prelude::*;

use cursive::direction::Orientation;
use cursive::event::Key;
use cursive::traits::{Boxable, Identifiable};
use cursive::view::View;
use cursive::view::{Nameable, Resizable};
use cursive::views::{Dialog, LinearLayout, OnEventView, ResizedView, TextView};
use cursive::Cursive;
use cursive::View;

use crate::tui::constants::{MAIN_MENU, TABLE_PEER_STATUS, VIEW_PEER_SYNC};
use crate::tui::types::TUIStatusListener;
Expand Down
5 changes: 3 additions & 2 deletions src/bin/tui/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
use chrono::prelude::Utc;
use cursive::direction::Orientation;
use cursive::traits::Identifiable;
use cursive::view::View;
use cursive::view::{Nameable, View};
use cursive::views::{LinearLayout, ResizedView, TextView};
use cursive::Cursive;

Expand Down Expand Up @@ -253,6 +252,7 @@ impl TUIStatusListener for TUIStatusView {
let cuckoo_diff = stats.chain_stats.total_difficulty.to_num(PoWType::Cuckatoo);
let progpow_diff = stats.chain_stats.total_difficulty.to_num(PoWType::ProgPow);
let randomx_diff = stats.chain_stats.total_difficulty.to_num(PoWType::RandomX);

let head_total_difficulty = format!(
"Cuckatoo: {}, ProgPow: {}, RandomX: {}",
cuckoo_diff, progpow_diff, randomx_diff,
Expand Down Expand Up @@ -286,6 +286,7 @@ impl TUIStatusListener for TUIStatusView {
.to_num(PoWType::Cuckatoo);
let progpow_header_diff = stats.header_stats.total_difficulty.to_num(PoWType::ProgPow);
let randomx_header_diff = stats.header_stats.total_difficulty.to_num(PoWType::RandomX);

let header_total_difficulty = format!(
"Cuckatoo: {}, ProgPow: {}, RandomX: {}",
cuckoo_header_diff, progpow_header_diff, randomx_header_diff,
Expand Down
7 changes: 2 additions & 5 deletions src/bin/tui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ use cursive::theme::PaletteColor::{
Background, Highlight, HighlightInactive, Primary, Shadow, View,
};
use cursive::theme::{BaseColor, BorderStyle, Color, Theme};
use cursive::traits::Boxable;
use cursive::traits::Identifiable;
use cursive::utils::markup::StyledString;
use cursive::view::{Nameable, Resizable};
use cursive::views::{BoxedView, CircularFocus, Dialog, LinearLayout, Panel, StackView, TextView};
use cursive::{CursiveRunnable, CursiveRunner};
use std::sync::mpsc;
Expand Down Expand Up @@ -119,9 +118,7 @@ impl UI {
let controller_tx_clone = epic_ui.controller_tx.clone();
epic_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,
))));
c.add_layer(CircularFocus::new(Dialog::around(TextView::new(content))).wrap_tab());
controller_tx_clone
.send(ControllerMessage::Shutdown)
.unwrap();
Expand Down
3 changes: 1 addition & 2 deletions src/bin/tui/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
//! Version and build info
use cursive::direction::Orientation;
use cursive::traits::Identifiable;
use cursive::view::View;
use cursive::view::{Nameable, View};
use cursive::views::{LinearLayout, ResizedView, TextView};
use cursive::Cursive;

Expand Down

0 comments on commit 6f04b01

Please sign in to comment.