feat: current progress - connect panel layout, manual checkbox, serial enum

This commit is contained in:
lennlouisgeek
2026-05-19 23:44:09 +08:00
parent 83faa0be1e
commit a7b617419d
11 changed files with 788 additions and 46 deletions

View File

@@ -22,8 +22,8 @@ pub const ENGINEERING_DARK: AppTheme = AppTheme {
panel_deep: egui::Color32::from_rgb(14, 18, 24),
border: egui::Color32::from_rgb(53, 75, 92),
border_soft: egui::Color32::from_rgb(36, 53, 66),
text: egui::Color32::from_rgb(210, 218, 232),
text_dim: egui::Color32::from_rgb(155, 168, 190),
text: egui::Color32::from_rgb(242, 246, 252),
text_dim: egui::Color32::from_rgb(206, 216, 230),
accent: egui::Color32::from_rgb(255, 118, 47),
accent_hot: egui::Color32::from_rgb(255, 169, 77),
radius: 2,
@@ -43,7 +43,7 @@ pub fn apply_theme(ctx: &egui::Context, theme: &AppTheme) {
visuals.widgets.noninteractive.bg_fill = theme.panel_strong;
visuals.widgets.noninteractive.bg_stroke = egui::Stroke::new(1.0, theme.border_soft);
visuals.widgets.noninteractive.fg_stroke = egui::Stroke::new(1.0, theme.text_dim);
visuals.widgets.noninteractive.fg_stroke = egui::Stroke::new(1.0, theme.text);
visuals.widgets.inactive.bg_fill = theme.panel_strong;
visuals.widgets.inactive.bg_stroke = egui::Stroke::new(1.0, theme.border_soft);
visuals.widgets.inactive.fg_stroke = egui::Stroke::new(1.0, theme.text);
@@ -76,6 +76,46 @@ pub fn apply_theme(ctx: &egui::Context, theme: &AppTheme) {
ctx.set_global_style(style);
}
pub fn apply_fonts(ctx: &egui::Context) {
let mut fonts = egui::FontDefinitions::default();
fonts.font_data.insert(
"Hack-Bold".to_owned(),
egui::FontData::from_static(include_bytes!("../static/Hack-Bold.ttf")).into(),
);
if let Ok(font_data) = std::fs::read(r"C:\Windows\Fonts\msyh.ttc") {
fonts.font_data.insert(
"Microsoft-YaHei".to_owned(),
egui::FontData::from_owned(font_data).into(),
);
}
fonts
.families
.entry(egui::FontFamily::Proportional)
.or_default()
.insert(0, "Hack-Bold".to_owned());
fonts
.families
.entry(egui::FontFamily::Proportional)
.or_default()
.push("Microsoft-YaHei".to_owned());
fonts
.families
.entry(egui::FontFamily::Monospace)
.or_default()
.insert(0, "Hack-Bold".to_owned());
fonts
.families
.entry(egui::FontFamily::Monospace)
.or_default()
.push("Microsoft-YaHei".to_owned());
ctx.set_fonts(fonts);
}
pub fn panel_frame(ctx: &egui::Context) -> egui::Frame {
let style = ctx.global_style();
egui::Frame::window(&style)