mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-21 19:53:05 +00:00
refactor: move widgets out of the app folder nesting (#917)
Moves the widget folder away from being nested in the app hierarchy.
This commit is contained in:
parent
8338a30752
commit
913c9ed5c6
21 changed files with 24 additions and 24 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
|||
*.log
|
||||
|
||||
# Flamegraph stuff
|
||||
flamegraphs/
|
||||
rust-unmangle
|
||||
*.svg
|
||||
*.data
|
||||
|
|
|
@ -13,7 +13,7 @@ use typed_builder::*;
|
|||
use unicode_segmentation::{GraphemeCursor, UnicodeSegmentation};
|
||||
use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
|
||||
|
||||
use self::widgets::{ProcWidget, ProcWidgetMode};
|
||||
use crate::widgets::{ProcWidget, ProcWidgetMode};
|
||||
use crate::{
|
||||
constants,
|
||||
data_conversion::ConvertedData,
|
||||
|
@ -29,7 +29,6 @@ pub mod layout_manager;
|
|||
mod process_killer;
|
||||
pub mod query;
|
||||
pub mod states;
|
||||
pub mod widgets;
|
||||
|
||||
use frozen_state::FrozenState;
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ use std::{collections::HashMap, time::Instant};
|
|||
|
||||
use unicode_segmentation::GraphemeCursor;
|
||||
|
||||
use super::widgets::{
|
||||
BatteryWidgetState, CpuWidgetState, DiskTableWidget, MemWidgetState, NetWidgetState,
|
||||
ProcWidget, TempWidgetState,
|
||||
};
|
||||
use crate::{
|
||||
app::{layout_manager::BottomWidgetType, query::*},
|
||||
constants,
|
||||
widgets::{
|
||||
BatteryWidgetState, CpuWidgetState, DiskTableWidget, MemWidgetState, NetWidgetState,
|
||||
ProcWidget, TempWidgetState,
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -10,8 +10,9 @@ use tui::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
app::{widgets::ProcWidgetMode, App, KillSignal},
|
||||
app::{App, KillSignal},
|
||||
canvas::Painter,
|
||||
widgets::ProcWidgetMode,
|
||||
};
|
||||
|
||||
const DD_BASE: &str = " Confirm Kill Process ── Esc to close ";
|
||||
|
|
|
@ -8,13 +8,14 @@ use tui::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
app::{layout_manager::WidgetDirection, widgets::CpuWidgetState, App},
|
||||
app::{layout_manager::WidgetDirection, App},
|
||||
canvas::{drawing_utils::should_hide_x_label, Painter},
|
||||
components::{
|
||||
data_table::{DrawInfo, SelectionState},
|
||||
time_graph::{GraphData, TimeGraph},
|
||||
},
|
||||
data_conversion::CpuWidgetData,
|
||||
widgets::CpuWidgetState,
|
||||
};
|
||||
|
||||
const AVG_POSITION: usize = 1;
|
||||
|
|
|
@ -130,6 +130,7 @@ impl<'a> TimeGraph<'a> {
|
|||
let y_axis = self.generate_y_axis();
|
||||
|
||||
// This is some ugly manual loop unswitching. Maybe unnecessary.
|
||||
// TODO: Optimize this step. Cut out unneeded points.
|
||||
let data = if self.use_dot {
|
||||
graph_data
|
||||
.iter()
|
||||
|
|
|
@ -422,6 +422,7 @@ impl<'a> Widget for TimeChart<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
// Probably better to move the dataset inside.
|
||||
for dataset in &self.datasets {
|
||||
Canvas::default()
|
||||
.background_color(self.style.bg.unwrap_or(Color::Reset))
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
use kstring::KString;
|
||||
|
||||
use crate::app::data_farmer::DataCollection;
|
||||
use crate::app::data_harvester::cpu::CpuDataType;
|
||||
use crate::app::{
|
||||
data_harvester::temperature::TemperatureType,
|
||||
widgets::{DiskWidgetData, TempWidgetData},
|
||||
data_farmer::DataCollection,
|
||||
data_harvester::{cpu::CpuDataType, temperature::TemperatureType},
|
||||
AxisScaling,
|
||||
};
|
||||
use crate::components::tui_widget::time_chart::Point;
|
||||
use crate::units::data_units::DataUnit;
|
||||
use crate::utils::gen_util::*;
|
||||
use crate::{app::AxisScaling, units::data_units::DataUnit};
|
||||
use crate::widgets::{DiskWidgetData, TempWidgetData};
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct ConvertedBatteryData {
|
||||
|
|
|
@ -61,6 +61,7 @@ pub mod constants;
|
|||
pub mod data_conversion;
|
||||
pub mod options;
|
||||
pub mod units;
|
||||
pub mod widgets;
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
pub type Pid = usize;
|
||||
|
|
|
@ -13,18 +13,15 @@ use serde::{Deserialize, Serialize};
|
|||
use typed_builder::*;
|
||||
|
||||
use crate::{
|
||||
app::{
|
||||
layout_manager::*,
|
||||
widgets::{
|
||||
BatteryWidgetState, CpuWidgetState, DiskTableWidget, MemWidgetState, NetWidgetState,
|
||||
ProcWidget, ProcWidgetMode, TempWidgetState,
|
||||
},
|
||||
*,
|
||||
},
|
||||
app::{layout_manager::*, *},
|
||||
canvas::{canvas_colours::CanvasColours, ColourScheme},
|
||||
constants::*,
|
||||
units::data_units::DataUnit,
|
||||
utils::error::{self, BottomError},
|
||||
widgets::{
|
||||
BatteryWidgetState, CpuWidgetState, DiskTableWidget, MemWidgetState, NetWidgetState,
|
||||
ProcWidget, ProcWidgetMode, TempWidgetState,
|
||||
},
|
||||
};
|
||||
|
||||
pub mod layout_options;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// FIXME: Move this outside of app, along with components?
|
||||
|
||||
pub mod process_table;
|
||||
pub use process_table::*;
|
||||
|
|
@ -862,7 +862,7 @@ fn sort_skip_pid_asc(column: &ProcColumn, data: &mut [ProcWidgetData], order: So
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::app::widgets::MemUsage;
|
||||
use crate::widgets::MemUsage;
|
||||
|
||||
#[test]
|
||||
fn test_proc_sort() {
|
Loading…
Reference in a new issue