Skip to content

Commit 07c90c3

Browse files
committed
use egui-phosphor icons
1 parent 0290334 commit 07c90c3

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

Cargo.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ csv = "1.1.6"
1313
eframe = { version = "0.24.0", features = ["persistence"] }
1414
egui_extras = { version = "0.24.0" }
1515
egui_plot = "0.24.0"
16+
egui-phosphor = "0.3.1"
1617
hex = "0.4"
1718
image = { version = "0.24", default-features = false, features = ["png"] }
1819
itertools-num = "0.1"

src/gui.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,14 +683,14 @@ impl MyApp {
683683
ui.label("Number of plots [#]: ");
684684

685685
ui.horizontal(|ui| {
686-
if ui.button("<").clicked() {
686+
if ui.button(egui::RichText::new(egui_phosphor::regular::ARROW_FAT_LEFT.to_string())).clicked() {
687687
self.serial_devices.number_of_plots[self.device_idx] =
688688
(self.serial_devices.number_of_plots[self.device_idx] - 1).clamp(1, 10);
689689
}
690690
ui.add(egui::DragValue::new(&mut self.serial_devices.number_of_plots[self.device_idx])
691691
.clamp_range(1..=10))
692692
.on_hover_text("Select the number of plots to be shown.");
693-
if ui.button(">").clicked() {
693+
if ui.button(egui::RichText::new(egui_phosphor::regular::ARROW_FAT_RIGHT.to_string())).clicked() {
694694
self.serial_devices.number_of_plots[self.device_idx] =
695695
(self.serial_devices.number_of_plots[self.device_idx] + 1).clamp(1, 10);
696696
}
@@ -714,7 +714,7 @@ impl MyApp {
714714
ui.end_row();
715715
ui.end_row();
716716

717-
if ui.button("Save CSV")
717+
if ui.button(egui::RichText::new(format!("{} Save CSV", egui_phosphor::regular::FLOPPY_DISK)))
718718
.on_hover_text("Save Plot Data to CSV.")
719719
.clicked() || ui.input_mut(|i| i.consume_shortcut(&SAVE_FILE_SHORTCUT))
720720
{
@@ -738,15 +738,15 @@ impl MyApp {
738738
};
739739

740740
if ui
741-
.button("Save Plot")
741+
.button(egui::RichText::new(format!("{} Save Plot", egui_phosphor::regular::FLOPPY_DISK)))
742742
.on_hover_text("Save an image of the Plot.")
743743
.clicked() || ui.input_mut(|i| i.consume_shortcut(&SAVE_PLOT_SHORTCUT))
744744

745745
{
746746
ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot);
747747
}
748748
ui.end_row();
749-
if ui.button("Clear Data")
749+
if ui.button(egui::RichText::new(format!("{} Clear Data", egui_phosphor::regular::X)))
750750
.on_hover_text("Clear Data from Plot.")
751751
.clicked() || ui.input_mut(|i| i.consume_shortcut(&CLEAR_PLOT_SHORTCUT)) {
752752
print_to_console(

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::thread;
1212
use std::time::Duration;
1313

1414
use eframe::egui::{vec2, ViewportBuilder, Visuals};
15-
use eframe::icon_data;
15+
use eframe::{egui, icon_data};
1616
use preferences::AppInfo;
1717

1818
use crate::data::{DataContainer, Packet};
@@ -205,6 +205,9 @@ fn main() {
205205
"Serial Monitor",
206206
options,
207207
Box::new(|_cc| {
208+
let mut fonts = egui::FontDefinitions::default();
209+
egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular);
210+
_cc.egui_ctx.set_fonts(fonts);
208211
_cc.egui_ctx.set_visuals(Visuals::dark());
209212
Box::new(MyApp::new(
210213
gui_print_lock,

0 commit comments

Comments
 (0)