Skip to content

Commit

Permalink
refactor: big change 🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
Joker2770 committed Dec 17, 2024
1 parent b387623 commit 1ba8218
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ edition = "2021"

[dependencies]
chrono = "0.4.39"
eframe = "0.29.0"
egui = "0.29.0"
eframe = "0.29.1"
egui = "0.29.1"
egui_file = "0.19.0"
goblin = "0.9.2"
probe-rs = { git = "https://github.com/probe-rs/probe-rs.git" }
probe-rs = "0.25.0"

[profile.dev]
codegen-units = 1 # better optimizations
Expand Down
11 changes: 5 additions & 6 deletions src/flash_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

pub mod m_flash_opts {
use crate::probe_rs_invoke::probe_rs_integration::ProbeRsHandler;
use eframe::egui;
use egui_file::FileDialog;
use probe_rs::flashing;
use std::{
Expand All @@ -39,7 +38,7 @@ pub mod m_flash_opts {
}

impl FlashProgram {
pub fn ui(&mut self, ctx: &eframe::egui::Context, ui: &mut egui::Ui) {
pub fn ui(&mut self, ctx: &eframe::egui::Context, ui: &mut eframe::egui::Ui) {
if let None = self.probe_rs_handler.borrow_mut() {
self.probe_rs_handler = Some(ProbeRsHandler::default());
}
Expand All @@ -50,7 +49,7 @@ pub mod m_flash_opts {
if 0 >= h.probes_list.len() {
h.get_probes_list();
}
egui::ComboBox::from_label("probe")
eframe::egui::ComboBox::from_label("probe")
.selected_text(format!("{}", self.probe_selected_idx))
.show_ui(ui, |ui| {
for (i, p) in h.probes_list.iter().enumerate() {
Expand Down Expand Up @@ -79,7 +78,7 @@ pub mod m_flash_opts {

ui.horizontal(|ui| {
if let Some(h) = self.probe_rs_handler.borrow_mut() {
egui::ComboBox::from_label("target")
eframe::egui::ComboBox::from_label("target")
.selected_text(format!("{}", self.target_chip_name))
.show_ui(ui, |ui| {
for t in h.chips_list.iter() {
Expand All @@ -102,7 +101,7 @@ pub mod m_flash_opts {
});

ui.add(
egui::TextEdit::singleline(&mut self.filter_s)
eframe::egui::TextEdit::singleline(&mut self.filter_s)
.hint_text("chips filter")
.desired_width(100.0),
);
Expand Down Expand Up @@ -172,7 +171,7 @@ pub mod m_flash_opts {
}
}

egui::ComboBox::from_label("File Format")
eframe::egui::ComboBox::from_label("File Format")
.selected_text(format!("{:?}", self.file_format_selected))
.show_ui(ui, |ui| {
ui.selectable_value(
Expand Down
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ mod probe_opts;
mod probe_rs_invoke;
mod rtt_opts;

use eframe::egui;
use flash_opts::m_flash_opts::FlashProgram;
use probe_opts::m_probe_opts::ProbeOperations;
use rtt_opts::m_rtt_opts::RTTIO;

fn main() -> eframe::Result {
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([650.0, 480.0]),
viewport: eframe::egui::ViewportBuilder::default().with_inner_size([650.0, 480.0]),
..Default::default()
};
eframe::run_native(
Expand All @@ -49,7 +48,7 @@ struct MyApp {

impl eframe::App for MyApp {
fn update(&mut self, ctx: &eframe::egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
eframe::egui::CentralPanel::default().show(ctx, |ui| {
ui.horizontal(|ui| {
ui.selectable_value(
&mut self.stack_window,
Expand Down
21 changes: 10 additions & 11 deletions src/rtt_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
pub mod m_rtt_opts {
use crate::probe_rs_invoke::probe_rs_integration::ProbeRsHandler;
use chrono::Local;
use eframe::egui;
use egui_file::FileDialog;
use probe_rs::rtt::ScanRegion;
use std::{
Expand Down Expand Up @@ -48,7 +47,7 @@ pub mod m_rtt_opts {
}

impl RTTIO {
pub fn ui(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) {
pub fn ui(&mut self, ctx: &eframe::egui::Context, ui: &mut eframe::egui::Ui) {
if let None = self.probe_rs_handler.borrow_mut() {
self.probe_rs_handler = Some(ProbeRsHandler::default());
}
Expand All @@ -59,7 +58,7 @@ pub mod m_rtt_opts {
}

ui.horizontal(|ui| {
egui::ComboBox::from_label("probe")
eframe::egui::ComboBox::from_label("probe")
.selected_text(format!("{}", self.probe_selected_idx))
.show_ui(ui, |ui| {
if let Some(h) = self.probe_rs_handler.borrow() {
Expand Down Expand Up @@ -91,7 +90,7 @@ pub mod m_rtt_opts {

ui.horizontal(|ui| {
if let Some(h) = self.probe_rs_handler.borrow_mut() {
egui::ComboBox::from_label("target")
eframe::egui::ComboBox::from_label("target")
.selected_text(format!("{}", self.target_chip_name))
.show_ui(ui, |ui| {
for t in h.chips_list.iter() {
Expand All @@ -114,7 +113,7 @@ pub mod m_rtt_opts {
});

ui.add(
egui::TextEdit::singleline(&mut self.filter_s)
eframe::egui::TextEdit::singleline(&mut self.filter_s)
.hint_text("chips filter")
.desired_width(100.0),
);
Expand Down Expand Up @@ -149,7 +148,7 @@ pub mod m_rtt_opts {

ui.horizontal(|ui| {
if let Some(h) = self.probe_rs_handler.borrow_mut() {
egui::ComboBox::from_label("core")
eframe::egui::ComboBox::from_label("core")
.selected_text(format!("{}", self.cur_target_core_idx))
.show_ui(ui, |ui| {
for c in 0..h.target_cores_num {
Expand Down Expand Up @@ -229,7 +228,7 @@ pub mod m_rtt_opts {
h.get_up_channels_size();
}
ui.add(
egui::Slider::new(
eframe::egui::Slider::new(
&mut self.retry_rtt_attach_time_out,
0..=10000,
)
Expand Down Expand Up @@ -258,7 +257,7 @@ pub mod m_rtt_opts {
ui.horizontal(|ui| {
if let Some(h) = self.probe_rs_handler.borrow_mut() {
if let Some(_rtt) = h.rtt.borrow() {
egui::ComboBox::from_label("channel")
eframe::egui::ComboBox::from_label("channel")
.selected_text(format!("{}", self.cur_target_channel_idx))
.show_ui(ui, |ui| {
for c in 0..h.up_chs_size {
Expand Down Expand Up @@ -313,17 +312,17 @@ pub mod m_rtt_opts {

ui.add_space(4.0);
ui.separator();
let text_style = egui::TextStyle::Body;
let text_style = eframe::egui::TextStyle::Body;
let row_height = ui.text_style_height(&text_style);
egui::ScrollArea::vertical()
eframe::egui::ScrollArea::vertical()
.stick_to_bottom(true)
.auto_shrink(false)
.show_rows(ui, row_height, self.n_items, |ui, row_range| {
let row_start = row_range.start;
self.n_display_row = row_range.len();
for row in row_range {
if let Some(t) = self.log_buf.get(row - row_start) {
let label = egui::Label::new(t).extend();
let label = eframe::egui::Label::new(t).extend();
ui.add(label);
}
}
Expand Down

0 comments on commit 1ba8218

Please sign in to comment.