Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple gui for inspection #137

Merged
merged 15 commits into from
Nov 26, 2023
Merged
Prev Previous commit
Next Next commit
Add UNIX timescale
  • Loading branch information
ChristopherRabotin committed Nov 26, 2023
commit 081d9d2ab53a7edd8fc05e3c46c604a2be63a510
175 changes: 112 additions & 63 deletions src/bin/anise-gui/ui.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ use hifitime::TimeScale;

#[derive(Default)]
pub struct UiApp {
pub selected_time_scale: TimeScale,
selected_time_scale: TimeScale,
show_unix: bool,
almanac: Almanac,
path: Option<String>,
}
@@ -110,12 +111,11 @@ impl eframe::App for UiApp {
ui.label("File type");
ui.label(label);
});
ui.spacing();
ui.horizontal(|ui| {
ui.label("CRC32");
ui.text_edit_singleline(&mut format!("{crc}"));
});
ui.spacing();

ui.horizontal(|ui| {
ui.label("Time scale");
egui::ComboBox::new("attention", "")
@@ -134,9 +134,13 @@ impl eframe::App for UiApp {
format!("{ts}"),
);
}
})
});

ui.checkbox(
&mut self.show_unix,
"Show UNIX timestamps (in seconds)",
);
});
ui.spacing();

// Now diplay the data
if label == "DAF/PCK" {
@@ -145,9 +149,9 @@ impl eframe::App for UiApp {
.column(Column::auto().at_least(125.0).resizable(true))
.column(Column::auto().at_least(225.0).resizable(true))
.column(Column::auto().at_least(225.0).resizable(true))
.column(Column::auto().at_least(150.0).resizable(true))
.column(Column::auto().at_least(50.0).resizable(true))
.column(Column::auto().at_least(50.0).resizable(true))
.column(Column::auto().at_least(200.0).resizable(true))
.column(Column::auto().at_least(150.0).resizable(true))
.column(Column::remainder())
.header(20.0, |mut header| {
header.col(|ui| {
@@ -160,16 +164,16 @@ impl eframe::App for UiApp {
ui.heading("End epoch");
});
header.col(|ui| {
ui.heading("Validity");
ui.heading("Frame");
});
header.col(|ui| {
ui.heading("Kind");
ui.heading("Inertial frame");
});
header.col(|ui| {
ui.heading("Frame");
ui.heading("Validity");
});
header.col(|ui| {
ui.heading("Inertial frame");
ui.heading("Kind");
});
})
.body(|mut body| {
@@ -194,38 +198,45 @@ impl eframe::App for UiApp {
});

row.col(|ui| {
ui.label(
summary
.start_epoch()
.to_gregorian_str(
if self.show_unix {
ui.text_edit_singleline(
&mut format!(
"{}",
summary
.start_epoch()
.to_unix_seconds()
),
);
} else {
ui.label(
summary
.start_epoch()
.to_gregorian_str(
self.selected_time_scale,
),
);
);
};
});

row.col(|ui| {
ui.label(
summary
.end_epoch()
.to_gregorian_str(
if self.show_unix {
ui.text_edit_singleline(
&mut format!(
"{}",
summary
.end_epoch()
.to_unix_seconds()
),
);
} else {
ui.label(
summary
.end_epoch()
.to_gregorian_str(
self.selected_time_scale,
),
);
});

row.col(|ui| {
ui.label(format!(
"{}",
summary.end_epoch()
- summary.start_epoch()
));
});

row.col(|ui| {
ui.label(format!(
"{}",
summary.data_type().unwrap()
));
);
};
});

row.col(
@@ -265,6 +276,21 @@ impl eframe::App for UiApp {
}
},
);

row.col(|ui| {
ui.label(format!(
"{}",
summary.end_epoch()
- summary.start_epoch()
));
});

row.col(|ui| {
ui.label(format!(
"{}",
summary.data_type().unwrap()
));
});
});
}
});
@@ -275,8 +301,8 @@ impl eframe::App for UiApp {
.column(Column::auto().at_least(225.0).resizable(true))
.column(Column::auto().at_least(225.0).resizable(true))
.column(Column::auto().at_least(150.0).resizable(true))
.column(Column::auto().at_least(50.0).resizable(true))
.column(Column::auto().at_least(50.0).resizable(true))
.column(Column::auto().at_least(200.0).resizable(true))
.column(Column::auto().at_least(150.0).resizable(true))
.column(Column::remainder())
.header(20.0, |mut header| {
header.col(|ui| {
@@ -288,17 +314,18 @@ impl eframe::App for UiApp {
header.col(|ui| {
ui.heading("End epoch");
});

header.col(|ui| {
ui.heading("Validity");
ui.heading("Target");
});
header.col(|ui| {
ui.heading("Kind");
ui.heading("Center");
});
header.col(|ui| {
ui.heading("Target");
ui.heading("Validity");
});
header.col(|ui| {
ui.heading("Center");
ui.heading("Kind");
});
})
.body(|mut body| {
@@ -323,53 +350,75 @@ impl eframe::App for UiApp {
});

row.col(|ui| {
ui.label(
summary
.start_epoch()
.to_gregorian_str(
if self.show_unix {
ui.text_edit_singleline(
&mut format!(
"{}",
summary
.start_epoch()
.to_unix_seconds()
),
);
} else {
ui.label(
summary
.start_epoch()
.to_gregorian_str(
self.selected_time_scale,
),
);
);
};
});

row.col(|ui| {
ui.label(
summary
.end_epoch()
.to_gregorian_str(
if self.show_unix {
ui.text_edit_singleline(
&mut format!(
"{}",
summary
.end_epoch()
.to_unix_seconds()
),
);
} else {
ui.label(
summary
.end_epoch()
.to_gregorian_str(
self.selected_time_scale,
),
);
);
};
});

row.col(|ui| {
ui.label(format!(
"{}",
summary.end_epoch()
- summary.start_epoch()
"{} ({})",
summary.target_frame(),
summary.target_id
));
});

row.col(|ui| {
ui.label(format!(
"{}",
summary.data_type().unwrap()
"{} ({})",
summary.center_frame(),
summary.center_id
));
});

row.col(|ui| {
ui.label(format!(
"{} ({})",
summary.target_frame(),
summary.target_id
"{}",
summary.end_epoch()
- summary.start_epoch()
));
});

row.col(|ui| {
ui.label(format!(
"{} ({})",
summary.center_frame(),
summary.center_id
"{}",
summary.data_type().unwrap()
));
});
});