diff options
Diffstat (limited to 'src/canvas')
-rw-r--r-- | src/canvas/dialogs/help_dialog.rs | 4 | ||||
-rw-r--r-- | src/canvas/screens.rs | 3 | ||||
-rw-r--r-- | src/canvas/screens/config_screen.rs | 57 | ||||
-rw-r--r-- | src/canvas/widgets/battery_display.rs | 2 | ||||
-rw-r--r-- | src/canvas/widgets/mem_graph.rs | 1 | ||||
-rw-r--r-- | src/canvas/widgets/process_table.rs | 6 |
6 files changed, 69 insertions, 4 deletions
diff --git a/src/canvas/dialogs/help_dialog.rs b/src/canvas/dialogs/help_dialog.rs index 2b148f16..fe0f1c52 100644 --- a/src/canvas/dialogs/help_dialog.rs +++ b/src/canvas/dialogs/help_dialog.rs @@ -1,5 +1,6 @@ use unicode_width::UnicodeWidthStr; +use crate::{app::App, canvas::Painter, constants}; use tui::{ backend::Backend, layout::{Alignment, Rect}, @@ -7,8 +8,6 @@ use tui::{ widgets::{Block, Borders, Paragraph}, }; -use crate::{app::App, canvas::Painter, constants}; - const HELP_BASE: &str = " Help ── Esc to close "; pub trait HelpDialog { @@ -17,6 +16,7 @@ pub trait HelpDialog { ); } +// TODO: [REFACTOR] Make generic dialog boxes to build off of instead? impl HelpDialog for Painter { fn draw_help_dialog<B: Backend>( &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, diff --git a/src/canvas/screens.rs b/src/canvas/screens.rs new file mode 100644 index 00000000..e17aa573 --- /dev/null +++ b/src/canvas/screens.rs @@ -0,0 +1,3 @@ +pub mod config_screen; + +pub use config_screen::*; diff --git a/src/canvas/screens/config_screen.rs b/src/canvas/screens/config_screen.rs new file mode 100644 index 00000000..6aa22493 --- /dev/null +++ b/src/canvas/screens/config_screen.rs @@ -0,0 +1,57 @@ +use crate::{app::App, canvas::Painter, constants}; +use tui::{ + backend::Backend, + layout::Constraint, + layout::Direction, + layout::Layout, + layout::{Alignment, Rect}, + terminal::Frame, + widgets::{Block, Borders, Paragraph}, +}; + +pub trait ConfigScreen { + fn draw_config_screen<B: Backend>( + &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, + ); +} + +impl ConfigScreen for Painter { + fn draw_config_screen<B: Backend>( + &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, + ) { + let config_block = Block::default() + .title(&" Config ") + .title_style(self.colours.border_style) + .style(self.colours.border_style) + .borders(Borders::ALL) + .border_style(self.colours.border_style); + + f.render_widget(config_block, draw_loc); + + // let margined_draw_locs = Layout::default() + // .margin(2) + // .direction(Direction::Horizontal) + // .constraints( + // [ + // Constraint::Percentage(33), + // Constraint::Percentage(34), + // Constraint::Percentage(33), + // ] + // .as_ref(), + // ) + // .split(draw_loc) + // .into_iter() + // .map(|loc| { + // // Required to properly margin in *between* the rectangles. + // Layout::default() + // .horizontal_margin(1) + // .constraints([Constraint::Percentage(100)].as_ref()) + // .split(loc)[0] + // }) + // .collect::<Vec<Rect>>(); + + // for dl in margined_draw_locs { + // f.render_widget(Block::default().borders(Borders::ALL), dl); + // } + } +} diff --git a/src/canvas/widgets/battery_display.rs b/src/canvas/widgets/battery_display.rs index 3e4ca3e9..e50ed515 100644 --- a/src/canvas/widgets/battery_display.rs +++ b/src/canvas/widgets/battery_display.rs @@ -223,7 +223,7 @@ impl BatteryDisplayWidget for Painter { .block(Block::default()) .divider(tui::symbols::line::VERTICAL) .style(self.colours.text_style) - .highlight_style(self.colours.currently_selected_text_style) + .highlight_style(self.colours.currently_selected_text_style) //FIXME: [HIGHLIGHT] THIS IS BROKEN ON TUI's SIDE, override this with your own style... .select(battery_widget_state.currently_selected_battery_index), tab_draw_loc, ); diff --git a/src/canvas/widgets/mem_graph.rs b/src/canvas/widgets/mem_graph.rs index 7accfa55..bdc0b0b7 100644 --- a/src/canvas/widgets/mem_graph.rs +++ b/src/canvas/widgets/mem_graph.rs @@ -78,6 +78,7 @@ impl MemGraphWidget for Painter { .graph_type(tui::widgets::GraphType::Line), ); + // FIXME: [SWAP] Hide this if denominator is 0... let swap_label = format!( "SWP:{}{}", app_state.canvas_data.swap_label_percent, app_state.canvas_data.swap_label_frac diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs index 9adb318a..89a27ba9 100644 --- a/src/canvas/widgets/process_table.rs +++ b/src/canvas/widgets/process_table.rs @@ -413,7 +413,7 @@ impl ProcessTableWidget for Painter { } }); - // TODO: gotop's "x out of y" thing is really nice to help keep track of the scroll position. + // TODO: gotop's "x out of y" thing is really nice to help keep track of the scroll position. Add to everything? f.render_stateful_widget( Table::new(process_headers.iter(), process_rows) .block(process_block) @@ -531,6 +531,8 @@ impl ProcessTableWidget for Painter { let query = proc_widget_state.get_current_search_query().as_str(); let grapheme_indices = UnicodeSegmentation::grapheme_indices(query, true); + // TODO: [CURSOR] blank cursor if not selected + // TODO: [CURSOR] blinking cursor? let query_with_cursor = build_query( is_on_widget, grapheme_indices, @@ -579,6 +581,8 @@ impl ProcessTableWidget for Painter { self.colours.text_style }; + // FIXME: [MOUSE] Mouse support for these in search + // FIXME: [MOVEMENT] Movement support for these in search let option_text = vec![ Text::raw("\n"), Text::styled( |