p2pool: fix [Simple] console scrollbar bug

Something todo with the height multiplier for [P2Pool Simple]'s
console was causing weird behavior when changing to other tabs.
With the console a bit bigger now, the scrollbar no longer shows
and there is less glitchy resizing when switching to other tabs.
This commit is contained in:
hinto-janaiyo 2022-12-10 22:10:10 -05:00
parent 1b999e3d9b
commit b65b7a14d8
No known key found for this signature in database
GPG key ID: B1C5A64B80691E45
2 changed files with 6 additions and 10 deletions

View file

@ -37,14 +37,13 @@ impl P2pool {
//---------------------------------------------------------------------------------------------------- [Simple] Console //---------------------------------------------------------------------------------------------------- [Simple] Console
ui.group(|ui| { ui.group(|ui| {
if self.simple { if self.simple {
let height = height / 2.5; let height = height / 2.4;
let width = width - SPACE; let width = width - SPACE;
ui.style_mut().override_text_style = Some(Monospace); ui.style_mut().override_text_style = Some(Monospace);
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| { egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into())); ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
egui::ScrollArea::vertical().stick_to_bottom(true).max_width(width).max_height(height).auto_shrink([false; 2]).show_viewport(ui, |ui, _| { egui::ScrollArea::vertical().stick_to_bottom(true).max_width(width).max_height(height).auto_shrink([false; 2]).show_viewport(ui, |ui, _| {
let lock = api.lock().unwrap(); ui.add_sized([width, height], TextEdit::multiline(&mut api.lock().unwrap().output.as_str()));
ui.add_sized([width, height], TextEdit::multiline(&mut lock.output.as_str()));
}); });
}); });
//---------------------------------------------------------------------------------------------------- [Advanced] Console //---------------------------------------------------------------------------------------------------- [Advanced] Console

View file

@ -35,23 +35,20 @@ use log::*;
impl Xmrig { impl Xmrig {
pub fn show(&mut self, pool_vec: &mut Vec<(String, Pool)>, regex: &Regexes, process: &Arc<Mutex<Process>>, api: &Arc<Mutex<PubXmrigApi>>, buffer: &mut String, width: f32, height: f32, ctx: &egui::Context, ui: &mut egui::Ui) { pub fn show(&mut self, pool_vec: &mut Vec<(String, Pool)>, regex: &Regexes, process: &Arc<Mutex<Process>>, api: &Arc<Mutex<PubXmrigApi>>, buffer: &mut String, width: f32, height: f32, ctx: &egui::Context, ui: &mut egui::Ui) {
let text_edit = height / 25.0; let text_edit = height / 25.0;
//---------------------------------------------------------------------------------------------------- Console //---------------------------------------------------------------------------------------------------- [Simple] Console
if self.simple {
ui.group(|ui| { ui.group(|ui| {
if self.simple {
let height = height / 1.5; let height = height / 1.5;
let width = width - SPACE; let width = width - SPACE;
ui.style_mut().override_text_style = Some(Monospace); ui.style_mut().override_text_style = Some(Monospace);
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| { egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into())); ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
egui::ScrollArea::vertical().stick_to_bottom(true).max_width(width).max_height(height).auto_shrink([false; 2]).show_viewport(ui, |ui, _| { egui::ScrollArea::vertical().stick_to_bottom(true).max_width(width).max_height(height).auto_shrink([false; 2]).show_viewport(ui, |ui, _| {
let lock = api.lock().unwrap(); ui.add_sized([width, height], TextEdit::multiline(&mut api.lock().unwrap().output.as_str()));
ui.add_sized([width, height], TextEdit::multiline(&mut lock.output.as_str()));
}); });
}); });
});
//---------------------------------------------------------------------------------------------------- [Advanced] Console //---------------------------------------------------------------------------------------------------- [Advanced] Console
} else { } else {
ui.group(|ui| {
let height = height / 2.8; let height = height / 2.8;
let width = width - SPACE; let width = width - SPACE;
ui.style_mut().override_text_style = Some(Monospace); ui.style_mut().override_text_style = Some(Monospace);
@ -70,8 +67,8 @@ impl Xmrig {
let mut process = process.lock().unwrap(); // Lock let mut process = process.lock().unwrap(); // Lock
if process.is_alive() { process.input.push(buffer); } // Push only if alive if process.is_alive() { process.input.push(buffer); } // Push only if alive
} }
});
} }
});
//---------------------------------------------------------------------------------------------------- Config //---------------------------------------------------------------------------------------------------- Config
if !self.simple { if !self.simple {