mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-07 05:44:35 +02:00
Redid basic mode logic and separated CPU
* Separated CPU into CPU legend and graph * Redid how I did maximizing with basic mode
This commit is contained in:
parent
01b37368b2
commit
6d0b7035d3
126
src/app.rs
126
src/app.rs
@ -17,10 +17,12 @@ const MAX_SEARCH_LENGTH: usize = 200;
|
|||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum WidgetPosition {
|
pub enum WidgetPosition {
|
||||||
Cpu,
|
Cpu,
|
||||||
|
CpuLegend,
|
||||||
Mem,
|
Mem,
|
||||||
Disk,
|
Disk,
|
||||||
Temp,
|
Temp,
|
||||||
Network,
|
Network,
|
||||||
|
NetworkLegend,
|
||||||
Process,
|
Process,
|
||||||
ProcessSearch,
|
ProcessSearch,
|
||||||
BasicCpu,
|
BasicCpu,
|
||||||
@ -34,19 +36,28 @@ impl WidgetPosition {
|
|||||||
WidgetPosition::Disk
|
WidgetPosition::Disk
|
||||||
| WidgetPosition::Process
|
| WidgetPosition::Process
|
||||||
| WidgetPosition::ProcessSearch
|
| WidgetPosition::ProcessSearch
|
||||||
| WidgetPosition::Temp => true,
|
| WidgetPosition::Temp
|
||||||
|
| WidgetPosition::CpuLegend => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_widget_graph(self) -> bool {
|
||||||
|
match self {
|
||||||
|
WidgetPosition::Cpu | WidgetPosition::Network | WidgetPosition::Mem => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_pretty_name(self) -> String {
|
pub fn get_pretty_name(self) -> String {
|
||||||
|
use WidgetPosition::*;
|
||||||
match self {
|
match self {
|
||||||
WidgetPosition::Cpu | WidgetPosition::BasicCpu => "CPU",
|
Cpu | BasicCpu | CpuLegend => "CPU",
|
||||||
WidgetPosition::Mem | WidgetPosition::BasicMem => "Memory",
|
Mem | BasicMem => "Memory",
|
||||||
WidgetPosition::Disk => "Disks",
|
Disk => "Disks",
|
||||||
WidgetPosition::Temp => "Temperature",
|
Temp => "Temperature",
|
||||||
WidgetPosition::Network | WidgetPosition::BasicNet => "Network",
|
Network | BasicNet | NetworkLegend => "Network",
|
||||||
WidgetPosition::Process | WidgetPosition::ProcessSearch => "Processes",
|
Process | ProcessSearch => "Processes",
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
@ -375,10 +386,7 @@ impl App {
|
|||||||
self.dd_err = None;
|
self.dd_err = None;
|
||||||
} else if self.is_filtering_or_searching() {
|
} else if self.is_filtering_or_searching() {
|
||||||
match self.current_widget_selected {
|
match self.current_widget_selected {
|
||||||
WidgetPosition::Cpu
|
WidgetPosition::Cpu | WidgetPosition::CpuLegend => {
|
||||||
if self.is_expanded && self.app_config_fields.use_basic_mode =>
|
|
||||||
{
|
|
||||||
self.current_widget_selected = WidgetPosition::BasicCpu;
|
|
||||||
self.cpu_state.is_showing_tray = false;
|
self.cpu_state.is_showing_tray = false;
|
||||||
}
|
}
|
||||||
WidgetPosition::Process | WidgetPosition::ProcessSearch => {
|
WidgetPosition::Process | WidgetPosition::ProcessSearch => {
|
||||||
@ -387,9 +395,6 @@ impl App {
|
|||||||
self.process_search_state.search_state.is_enabled = false;
|
self.process_search_state.search_state.is_enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WidgetPosition::Cpu => {
|
|
||||||
self.cpu_state.is_showing_tray = false;
|
|
||||||
}
|
|
||||||
WidgetPosition::Mem => {
|
WidgetPosition::Mem => {
|
||||||
self.mem_state.is_showing_tray = false;
|
self.mem_state.is_showing_tray = false;
|
||||||
}
|
}
|
||||||
@ -401,14 +406,22 @@ impl App {
|
|||||||
} else if self.is_expanded {
|
} else if self.is_expanded {
|
||||||
self.is_expanded = false;
|
self.is_expanded = false;
|
||||||
self.is_resized = true;
|
self.is_resized = true;
|
||||||
|
if self.app_config_fields.use_basic_mode {
|
||||||
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
|
WidgetPosition::Cpu | WidgetPosition::CpuLegend => WidgetPosition::BasicCpu,
|
||||||
|
WidgetPosition::Mem => WidgetPosition::BasicMem,
|
||||||
|
WidgetPosition::Network => WidgetPosition::BasicNet,
|
||||||
|
_ => self.current_widget_selected,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_filtering_or_searching(&self) -> bool {
|
fn is_filtering_or_searching(&self) -> bool {
|
||||||
match self.current_widget_selected {
|
match self.current_widget_selected {
|
||||||
WidgetPosition::Cpu => self.cpu_state.is_showing_tray,
|
WidgetPosition::Cpu | WidgetPosition::CpuLegend => self.cpu_state.is_showing_tray,
|
||||||
WidgetPosition::Mem => self.mem_state.is_showing_tray,
|
// WidgetPosition::Mem => self.mem_state.is_showing_tray,
|
||||||
WidgetPosition::Network => self.net_state.is_showing_tray,
|
// WidgetPosition::Network => self.net_state.is_showing_tray,
|
||||||
WidgetPosition::Process | WidgetPosition::ProcessSearch => {
|
WidgetPosition::Process | WidgetPosition::ProcessSearch => {
|
||||||
self.process_search_state.search_state.is_enabled
|
self.process_search_state.search_state.is_enabled
|
||||||
}
|
}
|
||||||
@ -464,7 +477,7 @@ impl App {
|
|||||||
|
|
||||||
pub fn on_space(&mut self) {
|
pub fn on_space(&mut self) {
|
||||||
match self.current_widget_selected {
|
match self.current_widget_selected {
|
||||||
WidgetPosition::Cpu => {
|
WidgetPosition::CpuLegend => {
|
||||||
let curr_posn = self
|
let curr_posn = self
|
||||||
.app_scroll_positions
|
.app_scroll_positions
|
||||||
.cpu_scroll_state
|
.cpu_scroll_state
|
||||||
@ -496,8 +509,9 @@ impl App {
|
|||||||
self.search_with_name();
|
self.search_with_name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WidgetPosition::Cpu => {
|
WidgetPosition::Cpu | WidgetPosition::CpuLegend => {
|
||||||
self.cpu_state.is_showing_tray = true;
|
self.cpu_state.is_showing_tray = true;
|
||||||
|
self.current_widget_selected = WidgetPosition::CpuLegend
|
||||||
}
|
}
|
||||||
// WidgetPosition::Mem => {
|
// WidgetPosition::Mem => {
|
||||||
// self.mem_state.is_showing_tray = true;
|
// self.mem_state.is_showing_tray = true;
|
||||||
@ -650,6 +664,15 @@ impl App {
|
|||||||
self.is_resized = true;
|
self.is_resized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.app_config_fields.use_basic_mode {
|
||||||
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
|
WidgetPosition::BasicCpu => WidgetPosition::Cpu,
|
||||||
|
WidgetPosition::BasicMem => WidgetPosition::Mem,
|
||||||
|
WidgetPosition::BasicNet => WidgetPosition::Network,
|
||||||
|
_ => self.current_widget_selected,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,6 +1088,9 @@ impl App {
|
|||||||
'K' => self.move_widget_selection_up(),
|
'K' => self.move_widget_selection_up(),
|
||||||
'J' => self.move_widget_selection_down(),
|
'J' => self.move_widget_selection_down(),
|
||||||
' ' => self.on_space(),
|
' ' => self.on_space(),
|
||||||
|
'+' => {}
|
||||||
|
'-' => {}
|
||||||
|
'=' => {}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,6 +1150,12 @@ impl App {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
self.current_widget_selected = match self.current_widget_selected {
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
|
WidgetPosition::Cpu if self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::CpuLegend
|
||||||
|
}
|
||||||
|
WidgetPosition::CpuLegend if !self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::Cpu
|
||||||
|
}
|
||||||
WidgetPosition::Process => WidgetPosition::Network,
|
WidgetPosition::Process => WidgetPosition::Network,
|
||||||
WidgetPosition::ProcessSearch => WidgetPosition::Network,
|
WidgetPosition::ProcessSearch => WidgetPosition::Network,
|
||||||
WidgetPosition::Disk => WidgetPosition::Mem,
|
WidgetPosition::Disk => WidgetPosition::Mem,
|
||||||
@ -1131,6 +1163,16 @@ impl App {
|
|||||||
_ => self.current_widget_selected,
|
_ => self.current_widget_selected,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else if self.is_expanded {
|
||||||
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
|
WidgetPosition::Cpu if self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::CpuLegend
|
||||||
|
}
|
||||||
|
WidgetPosition::CpuLegend if !self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::Cpu
|
||||||
|
}
|
||||||
|
_ => self.current_widget_selected,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.reset_multi_tap_keys();
|
self.reset_multi_tap_keys();
|
||||||
@ -1149,11 +1191,27 @@ impl App {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
self.current_widget_selected = match self.current_widget_selected {
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
|
WidgetPosition::Cpu if !self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::CpuLegend
|
||||||
|
}
|
||||||
|
WidgetPosition::CpuLegend if self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::Cpu
|
||||||
|
}
|
||||||
WidgetPosition::Mem => WidgetPosition::Temp,
|
WidgetPosition::Mem => WidgetPosition::Temp,
|
||||||
WidgetPosition::Network => WidgetPosition::Process,
|
WidgetPosition::Network => WidgetPosition::Process,
|
||||||
_ => self.current_widget_selected,
|
_ => self.current_widget_selected,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else if self.is_expanded {
|
||||||
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
|
WidgetPosition::Cpu if !self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::CpuLegend
|
||||||
|
}
|
||||||
|
WidgetPosition::CpuLegend if self.app_config_fields.left_legend => {
|
||||||
|
WidgetPosition::Cpu
|
||||||
|
}
|
||||||
|
_ => self.current_widget_selected,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.reset_multi_tap_keys();
|
self.reset_multi_tap_keys();
|
||||||
@ -1213,7 +1271,7 @@ impl App {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
self.current_widget_selected = match self.current_widget_selected {
|
self.current_widget_selected = match self.current_widget_selected {
|
||||||
WidgetPosition::Cpu => WidgetPosition::Mem,
|
WidgetPosition::Cpu | WidgetPosition::CpuLegend => WidgetPosition::Mem,
|
||||||
WidgetPosition::Mem => WidgetPosition::Network,
|
WidgetPosition::Mem => WidgetPosition::Network,
|
||||||
WidgetPosition::Temp => WidgetPosition::Disk,
|
WidgetPosition::Temp => WidgetPosition::Disk,
|
||||||
WidgetPosition::Disk => WidgetPosition::Process,
|
WidgetPosition::Disk => WidgetPosition::Process,
|
||||||
@ -1261,7 +1319,7 @@ impl App {
|
|||||||
.disk_scroll_state
|
.disk_scroll_state
|
||||||
.current_scroll_position = 0
|
.current_scroll_position = 0
|
||||||
}
|
}
|
||||||
WidgetPosition::Cpu => {
|
WidgetPosition::CpuLegend => {
|
||||||
self.app_scroll_positions
|
self.app_scroll_positions
|
||||||
.cpu_scroll_state
|
.cpu_scroll_state
|
||||||
.current_scroll_position = 0
|
.current_scroll_position = 0
|
||||||
@ -1294,7 +1352,7 @@ impl App {
|
|||||||
.disk_scroll_state
|
.disk_scroll_state
|
||||||
.current_scroll_position = self.canvas_data.disk_data.len() as u64 - 1
|
.current_scroll_position = self.canvas_data.disk_data.len() as u64 - 1
|
||||||
}
|
}
|
||||||
WidgetPosition::Cpu => {
|
WidgetPosition::CpuLegend => {
|
||||||
self.app_scroll_positions
|
self.app_scroll_positions
|
||||||
.cpu_scroll_state
|
.cpu_scroll_state
|
||||||
.current_scroll_position = self.canvas_data.cpu_data.len() as u64 - 1;
|
.current_scroll_position = self.canvas_data.cpu_data.len() as u64 - 1;
|
||||||
@ -1312,7 +1370,7 @@ impl App {
|
|||||||
WidgetPosition::Process => self.change_process_position(-1),
|
WidgetPosition::Process => self.change_process_position(-1),
|
||||||
WidgetPosition::Temp => self.change_temp_position(-1),
|
WidgetPosition::Temp => self.change_temp_position(-1),
|
||||||
WidgetPosition::Disk => self.change_disk_position(-1),
|
WidgetPosition::Disk => self.change_disk_position(-1),
|
||||||
WidgetPosition::Cpu => self.change_cpu_table_position(-1), // TODO: [PO?] Temporary, may change if we add scaling
|
WidgetPosition::CpuLegend => self.change_cpu_table_position(-1), // TODO: [PO?] Temporary, may change if we add scaling
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
self.app_scroll_positions.scroll_direction = ScrollDirection::UP;
|
self.app_scroll_positions.scroll_direction = ScrollDirection::UP;
|
||||||
@ -1326,7 +1384,7 @@ impl App {
|
|||||||
WidgetPosition::Process => self.change_process_position(1),
|
WidgetPosition::Process => self.change_process_position(1),
|
||||||
WidgetPosition::Temp => self.change_temp_position(1),
|
WidgetPosition::Temp => self.change_temp_position(1),
|
||||||
WidgetPosition::Disk => self.change_disk_position(1),
|
WidgetPosition::Disk => self.change_disk_position(1),
|
||||||
WidgetPosition::Cpu => self.change_cpu_table_position(1), // TODO: [PO?] Temporary, may change if we add scaling
|
WidgetPosition::CpuLegend => self.change_cpu_table_position(1), // TODO: [PO?] Temporary, may change if we add scaling
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
self.app_scroll_positions.scroll_direction = ScrollDirection::DOWN;
|
self.app_scroll_positions.scroll_direction = ScrollDirection::DOWN;
|
||||||
@ -1395,4 +1453,24 @@ impl App {
|
|||||||
.current_scroll_position = (current_posn as i64 + num_to_change_by) as u64;
|
.current_scroll_position = (current_posn as i64 + num_to_change_by) as u64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn handle_scroll_up(&mut self) {
|
||||||
|
if self.current_widget_selected.is_widget_graph() {
|
||||||
|
self.zoom_in();
|
||||||
|
} else if self.current_widget_selected.is_widget_table() {
|
||||||
|
self.decrement_position_count();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn handle_scroll_down(&mut self) {
|
||||||
|
if self.current_widget_selected.is_widget_graph() {
|
||||||
|
self.zoom_out();
|
||||||
|
} else if self.current_widget_selected.is_widget_table() {
|
||||||
|
self.increment_position_count();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn zoom_out(&mut self) {}
|
||||||
|
|
||||||
|
fn zoom_in(&mut self) {}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ impl Painter {
|
|||||||
.constraints([Constraint::Percentage(100)].as_ref())
|
.constraints([Constraint::Percentage(100)].as_ref())
|
||||||
.split(f.size());
|
.split(f.size());
|
||||||
match &app_state.current_widget_selected {
|
match &app_state.current_widget_selected {
|
||||||
WidgetPosition::Cpu | WidgetPosition::BasicCpu => {
|
WidgetPosition::Cpu | WidgetPosition::BasicCpu | WidgetPosition::CpuLegend => {
|
||||||
let cpu_chunk = Layout::default()
|
let cpu_chunk = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.margin(0)
|
.margin(0)
|
||||||
@ -272,7 +272,9 @@ impl Painter {
|
|||||||
WidgetPosition::Temp => {
|
WidgetPosition::Temp => {
|
||||||
self.draw_temp_table(&mut f, app_state, rect[0], true);
|
self.draw_temp_table(&mut f, app_state, rect[0], true);
|
||||||
}
|
}
|
||||||
WidgetPosition::Network | WidgetPosition::BasicNet => {
|
WidgetPosition::Network
|
||||||
|
| WidgetPosition::BasicNet
|
||||||
|
| WidgetPosition::NetworkLegend => {
|
||||||
self.draw_network_graph(&mut f, &app_state, rect[0]);
|
self.draw_network_graph(&mut f, &app_state, rect[0]);
|
||||||
}
|
}
|
||||||
WidgetPosition::Process | WidgetPosition::ProcessSearch => {
|
WidgetPosition::Process | WidgetPosition::ProcessSearch => {
|
||||||
|
@ -17,7 +17,7 @@ use tui::{
|
|||||||
widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Row, Table, Widget},
|
widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Row, Table, Widget},
|
||||||
};
|
};
|
||||||
|
|
||||||
const CPU_SELECT_LEGEND_HEADER: [&str; 2] = ["CPU", "Show (Space)"];
|
const CPU_SELECT_LEGEND_HEADER: [&str; 2] = ["CPU", "Show"];
|
||||||
const CPU_LEGEND_HEADER: [&str; 2] = ["CPU", "Use%"];
|
const CPU_LEGEND_HEADER: [&str; 2] = ["CPU", "Use%"];
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref CPU_LEGEND_HEADER_LENS: Vec<usize> = CPU_LEGEND_HEADER
|
static ref CPU_LEGEND_HEADER_LENS: Vec<usize> = CPU_LEGEND_HEADER
|
||||||
@ -92,22 +92,22 @@ impl CpuGraphWidget for Painter {
|
|||||||
" CPU ".to_string()
|
" CPU ".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let border_style = match app_state.current_widget_selected {
|
||||||
|
WidgetPosition::Cpu => self.colours.highlighted_border_style,
|
||||||
|
_ => self.colours.border_style,
|
||||||
|
};
|
||||||
|
|
||||||
Chart::default()
|
Chart::default()
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(&title)
|
.title(&title)
|
||||||
.title_style(if app_state.is_expanded {
|
.title_style(if app_state.is_expanded {
|
||||||
self.colours.highlighted_border_style
|
border_style
|
||||||
} else {
|
} else {
|
||||||
self.colours.widget_title_style
|
self.colours.widget_title_style
|
||||||
})
|
})
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_style(match app_state.current_widget_selected {
|
.border_style(border_style),
|
||||||
WidgetPosition::Cpu | WidgetPosition::BasicCpu => {
|
|
||||||
self.colours.highlighted_border_style
|
|
||||||
}
|
|
||||||
_ => self.colours.border_style,
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
.x_axis(x_axis)
|
.x_axis(x_axis)
|
||||||
.y_axis(y_axis)
|
.y_axis(y_axis)
|
||||||
@ -167,7 +167,7 @@ impl CpuGraphWidget for Painter {
|
|||||||
Row::StyledData(
|
Row::StyledData(
|
||||||
cpu_string_row.iter(),
|
cpu_string_row.iter(),
|
||||||
match app_state.current_widget_selected {
|
match app_state.current_widget_selected {
|
||||||
WidgetPosition::Cpu => {
|
WidgetPosition::CpuLegend => {
|
||||||
if itx as u64
|
if itx as u64
|
||||||
== app_state
|
== app_state
|
||||||
.app_scroll_positions
|
.app_scroll_positions
|
||||||
@ -225,6 +225,11 @@ impl CpuGraphWidget for Painter {
|
|||||||
"".to_string()
|
"".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let title_and_border_style = match app_state.current_widget_selected {
|
||||||
|
WidgetPosition::CpuLegend => self.colours.highlighted_border_style,
|
||||||
|
_ => self.colours.border_style,
|
||||||
|
};
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
Table::new(
|
Table::new(
|
||||||
if app_state.cpu_state.is_showing_tray {
|
if app_state.cpu_state.is_showing_tray {
|
||||||
@ -238,19 +243,9 @@ impl CpuGraphWidget for Painter {
|
|||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(&title)
|
.title(&title)
|
||||||
.title_style(if app_state.is_expanded {
|
.title_style(title_and_border_style)
|
||||||
self.colours.highlighted_border_style
|
|
||||||
} else {
|
|
||||||
match app_state.current_widget_selected {
|
|
||||||
WidgetPosition::Cpu => self.colours.highlighted_border_style,
|
|
||||||
_ => self.colours.border_style,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_style(match app_state.current_widget_selected {
|
.border_style(title_and_border_style),
|
||||||
WidgetPosition::Cpu => self.colours.highlighted_border_style,
|
|
||||||
_ => self.colours.border_style,
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
.header_style(self.colours.table_header_style)
|
.header_style(self.colours.table_header_style)
|
||||||
.widths(
|
.widths(
|
||||||
|
@ -79,9 +79,7 @@ impl MemGraphWidget for Painter {
|
|||||||
})
|
})
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_style(match app_state.current_widget_selected {
|
.border_style(match app_state.current_widget_selected {
|
||||||
WidgetPosition::Mem | WidgetPosition::BasicMem => {
|
WidgetPosition::Mem => self.colours.highlighted_border_style,
|
||||||
self.colours.highlighted_border_style
|
|
||||||
}
|
|
||||||
_ => self.colours.border_style,
|
_ => self.colours.border_style,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
@ -71,9 +71,7 @@ impl NetworkGraphWidget for Painter {
|
|||||||
})
|
})
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_style(match app_state.current_widget_selected {
|
.border_style(match app_state.current_widget_selected {
|
||||||
WidgetPosition::Network | WidgetPosition::BasicNet => {
|
WidgetPosition::Network => self.colours.highlighted_border_style,
|
||||||
self.colours.highlighted_border_style
|
|
||||||
}
|
|
||||||
_ => self.colours.border_style,
|
_ => self.colours.border_style,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
@ -268,8 +268,8 @@ fn main() -> error::Result<()> {
|
|||||||
|
|
||||||
fn handle_mouse_event(event: MouseEvent, app: &mut App) {
|
fn handle_mouse_event(event: MouseEvent, app: &mut App) {
|
||||||
match event {
|
match event {
|
||||||
MouseEvent::ScrollUp(_x, _y, _modifiers) => app.decrement_position_count(),
|
MouseEvent::ScrollUp(_x, _y, _modifiers) => app.handle_scroll_up(),
|
||||||
MouseEvent::ScrollDown(_x, _y, _modifiers) => app.increment_position_count(),
|
MouseEvent::ScrollDown(_x, _y, _modifiers) => app.handle_scroll_down(),
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user