more chrono warnings, update cursive lib (#3778)

This commit is contained in:
Yeastplume
2024-01-29 12:50:45 +00:00
committed by GitHub
parent d1b7ae5352
commit c5efaa4e7c
12 changed files with 472 additions and 359 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
// limitations under the License.
use cursive::theme::{BaseColor, Color, ColorStyle};
use cursive::traits::Identifiable;
use cursive::traits::Nameable;
use cursive::view::View;
use cursive::views::ResizedView;
use cursive::{Cursive, Printer};
+1 -1
View File
@@ -17,7 +17,7 @@
use cursive::align::HAlign;
use cursive::direction::Orientation;
use cursive::event::Key;
use cursive::view::Identifiable;
use cursive::view::Nameable;
use cursive::view::View;
use cursive::views::{
LinearLayout, OnEventView, ResizedView, SelectView, StackView, TextView, ViewRef,
+3 -3
View File
@@ -19,7 +19,7 @@ use std::cmp::Ordering;
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
use cursive::direction::Orientation;
use cursive::event::Key;
use cursive::traits::{Boxable, Identifiable};
use cursive::traits::{Nameable, Resizable};
use cursive::view::View;
use cursive::views::{
Button, Dialog, LinearLayout, OnEventView, Panel, ResizedView, StackView, TextView,
@@ -72,7 +72,7 @@ impl TableViewItem<StratumWorkerColumn> for WorkerStats {
0,
)
.unwrap_or_default();
let datetime: DateTime<Utc> = DateTime::from_utc(naive_datetime, Utc);
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive_datetime, Utc);
match column {
StratumWorkerColumn::Id => self.id.clone(),
@@ -129,7 +129,7 @@ impl TableViewItem<DiffColumn> for DiffBlock {
fn to_column(&self, column: DiffColumn) -> String {
let naive_datetime =
NaiveDateTime::from_timestamp_opt(self.time as i64, 0).unwrap_or_default();
let datetime: DateTime<Utc> = DateTime::from_utc(naive_datetime, Utc);
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive_datetime, Utc);
match column {
DiffColumn::Height => self.block_height.to_string(),
+1 -1
View File
@@ -23,7 +23,7 @@ use humansize::{file_size_opts::CONVENTIONAL, FileSize};
use cursive::direction::Orientation;
use cursive::event::Key;
use cursive::traits::{Boxable, Identifiable};
use cursive::traits::{Nameable, Resizable};
use cursive::view::View;
use cursive::views::{Dialog, LinearLayout, OnEventView, ResizedView, TextView};
use cursive::Cursive;
+6 -3
View File
@@ -16,7 +16,7 @@
use chrono::prelude::Utc;
use cursive::direction::Orientation;
use cursive::traits::Identifiable;
use cursive::traits::Nameable;
use cursive::view::View;
use cursive::views::{LinearLayout, ResizedView, TextView};
use cursive::Cursive;
@@ -71,8 +71,11 @@ impl TUIStatusView {
SyncStatus::TxHashsetDownload(stat) => {
if stat.total_size > 0 {
let percent = stat.downloaded_size * 100 / stat.total_size;
let start = stat.prev_update_time.timestamp_nanos();
let fin = Utc::now().timestamp_nanos();
let start = stat
.prev_update_time
.timestamp_nanos_opt()
.unwrap_or_default();
let fin = Utc::now().timestamp_nanos_opt().unwrap_or_default();
let dur_ms = (fin - start) as f64 * NANO_TO_MILLIS;
Cow::Owned(format!("Sync step 2/7: Downloading {}(MB) chain state for state sync: {}% at {:.1?}(kB/s)",
+2 -5
View File
@@ -23,8 +23,7 @@ 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::traits::{Nameable, Resizable};
use cursive::utils::markup::StyledString;
use cursive::views::{
CircularFocus, Dialog, LinearLayout, Panel, SelectView, StackView, TextView, ViewRef,
@@ -124,9 +123,7 @@ impl UI {
let controller_tx_clone = grin_ui.controller_tx.clone();
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,
))));
c.add_layer(CircularFocus::new(Dialog::around(TextView::new(content))).wrap_tab());
controller_tx_clone
.send(ControllerMessage::Shutdown)
.unwrap();
+1 -1
View File
@@ -15,7 +15,7 @@
//! Version and build info
use cursive::direction::Orientation;
use cursive::traits::Identifiable;
use cursive::traits::Nameable;
use cursive::view::View;
use cursive::views::{LinearLayout, ResizedView, TextView};