Update to cursive 0.16 (#3547)
* Update to cursive 0.16 * Switch to upstream table view * Use TableView::set_items_stable Co-authored-by: Quentin Le Sceller <q.lesceller@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ use crate::tui::constants::{
|
||||
use crate::tui::types::TUIStatusListener;
|
||||
|
||||
use crate::servers::{DiffBlock, ServerStats, WorkerStats};
|
||||
use crate::tui::table::{TableView, TableViewItem};
|
||||
use cursive_table_view::{TableView, TableViewItem};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
enum StratumWorkerColumn {
|
||||
@@ -333,7 +333,7 @@ impl TUIStatusListener for TUIMiningView {
|
||||
let _ = c.call_on_name(
|
||||
TABLE_MINING_DIFF_STATUS,
|
||||
|t: &mut TableView<DiffBlock, DiffColumn>| {
|
||||
t.set_items(diff_stats);
|
||||
t.set_items_stable(diff_stats);
|
||||
},
|
||||
);
|
||||
let stratum_stats = stats.stratum_stats.clone();
|
||||
@@ -388,7 +388,7 @@ impl TUIStatusListener for TUIMiningView {
|
||||
let _ = c.call_on_name(
|
||||
TABLE_MINING_STATUS,
|
||||
|t: &mut TableView<WorkerStats, StratumWorkerColumn>| {
|
||||
t.set_items(worker_stats);
|
||||
t.set_items_stable(worker_stats);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ mod menu;
|
||||
mod mining;
|
||||
mod peers;
|
||||
mod status;
|
||||
pub mod table;
|
||||
mod types;
|
||||
pub mod ui;
|
||||
mod version;
|
||||
|
||||
@@ -29,8 +29,8 @@ use cursive::views::{Dialog, LinearLayout, OnEventView, ResizedView, TextView};
|
||||
use cursive::Cursive;
|
||||
|
||||
use crate::tui::constants::{MAIN_MENU, TABLE_PEER_STATUS, VIEW_PEER_SYNC};
|
||||
use crate::tui::table::{TableView, TableViewItem};
|
||||
use crate::tui::types::TUIStatusListener;
|
||||
use cursive_table_view::{TableView, TableViewItem};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum PeerColumn {
|
||||
@@ -190,7 +190,7 @@ impl TUIStatusListener for TUIPeerView {
|
||||
let _ = c.call_on_name(
|
||||
TABLE_PEER_STATUS,
|
||||
|t: &mut TableView<PeerStats, PeerColumn>| {
|
||||
t.set_items(stats.peer_stats.clone());
|
||||
t.set_items_stable(stats.peer_stats.clone());
|
||||
},
|
||||
);
|
||||
let _ = c.call_on_name("peers_total", |t: &mut TextView| {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+3
-4
@@ -29,8 +29,7 @@ use cursive::utils::markup::StyledString;
|
||||
use cursive::views::{
|
||||
CircularFocus, Dialog, LinearLayout, Panel, SelectView, StackView, TextView, ViewRef,
|
||||
};
|
||||
use cursive::Cursive;
|
||||
use cursive::CursiveExt;
|
||||
use cursive::{CursiveRunnable, CursiveRunner};
|
||||
use std::sync::mpsc;
|
||||
use std::{thread, time};
|
||||
|
||||
@@ -44,7 +43,7 @@ use grin_core::global;
|
||||
use grin_util::logger::LogEntry;
|
||||
|
||||
pub struct UI {
|
||||
cursive: Cursive,
|
||||
cursive: CursiveRunner<CursiveRunnable>,
|
||||
ui_rx: mpsc::Receiver<UIMessage>,
|
||||
ui_tx: mpsc::Sender<UIMessage>,
|
||||
controller_tx: mpsc::Sender<ControllerMessage>,
|
||||
@@ -72,7 +71,7 @@ impl UI {
|
||||
let (ui_tx, ui_rx) = mpsc::channel::<UIMessage>();
|
||||
|
||||
let mut grin_ui = UI {
|
||||
cursive: Cursive::default(),
|
||||
cursive: cursive::default().into_runner(),
|
||||
ui_tx,
|
||||
ui_rx,
|
||||
controller_tx,
|
||||
|
||||
Reference in New Issue
Block a user