Skip to content

Commit 323d1bc

Browse files
committed
Migrate to egui v0.29.1
Not too many breaking changes. I updated egui-nav and egui-tabs as well. Fixes: #315 Changelog-Fixed: Fixed crash when navigating in debug mode Changelog-Changed: Migrated to egui v0.29.1 Signed-off-by: William Casarin <[email protected]>
1 parent 2543978 commit 323d1bc

File tree

11 files changed

+401
-122
lines changed

11 files changed

+401
-122
lines changed

Cargo.lock

+377-96
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+11-14
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ description = "A multiplatform nostr client"
1414
crate-type = ["lib", "cdylib"]
1515

1616
[workspace.dependencies]
17-
egui = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", features = ["serde"] }
18-
eframe = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "eframe", default-features = false, features = [ "wgpu", "wayland", "x11", "android-native-activity" ] }
19-
egui_extras = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "egui_extras", features = ["all_loaders"] }
17+
egui = { version = "0.29.1", features = ["serde"] }
18+
eframe = { version = "0.29.1", default-features = false, features = [ "wgpu", "wayland", "x11", "android-native-activity" ] }
19+
egui_extras = { version = "0.29.1", features = ["all_loaders"] }
2020
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "71154e4100775f6932ee517da4350c433ba14ec7" }
2121

2222
[dependencies]
@@ -25,20 +25,17 @@ egui = { workspace = true }
2525
eframe = { workspace = true }
2626
egui_extras = { workspace = true }
2727
ehttp = "0.2.0"
28-
egui_tabs = { git = "https://github.com/damus-io/egui-tabs", branch = "egui-0.28" }
29-
egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "867fb6e057a4cc0a13716d59d6d332a4c90607ea" }
30-
egui_virtual_list = { git = "https://github.com/jb55/hello_egui", branch = "egui-0.28", package = "egui_virtual_list" }
28+
egui_tabs = "0.2.0"
29+
egui_nav = "0.2.0"
30+
egui_virtual_list = "0.5.0"
3131
reqwest = { version = "0.12.4", default-features = false, features = [ "rustls-tls-native-roots" ] }
3232
image = { version = "0.25", features = ["jpeg", "png", "webp"] }
3333
log = "0.4.17"
3434
poll-promise = { version = "0.3.0", features = ["tokio"] }
3535
serde_derive = "1"
3636
serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
3737
tracing = "0.1.40"
38-
#wasm-bindgen = "0.2.83"
3938
nostrdb = { workspace = true }
40-
#nostrdb = { path = "/Users/jb55/dev/github/damus-io/nostrdb-rs" }
41-
#nostrdb = "0.3.4"
4239
enostr = { path = "enostr" }
4340
serde_json = "1.0.89"
4441
env_logger = "0.10.0"
@@ -142,8 +139,8 @@ path = "src/bin/notedeck.rs"
142139
name = "ui_preview"
143140
path = "src/ui_preview/main.rs"
144141

145-
[patch.crates-io]
146-
egui = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb" }
147-
eframe = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "eframe" }
148-
emath = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "emath" }
149-
egui_extras = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "egui_extras" }
142+
#[patch.crates-io]
143+
#egui = "0.29.1"
144+
#eframe = "0.29.1"
145+
#emath = "0.29.1"
146+
#egui_extras = "0.29.1"

src/app_style.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn create_themed_visuals(theme: ColorTheme, default: Visuals) -> Visuals {
235235
}
236236
}
237237

238-
pub static DECK_ICON_SIZE: f32 = 24.0;
238+
//pub static DECK_ICON_SIZE: f32 = 24.0;
239239

240240
pub fn deck_icon_font_sized(size: f32) -> FontId {
241241
egui::FontId::new(size, emoji_font_family())

src/deck_state.rs

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ fn available_characters(ui: &egui::Ui, family: egui::FontFamily) -> Vec<char> {
5858
.font(&egui::FontId::new(10.0, family)) // size is arbitrary for getting the characters
5959
.characters()
6060
.iter()
61+
.map(|(chr, _v)| chr)
6162
.filter(|chr| !chr.is_whitespace() && !chr.is_ascii_control())
6263
.copied()
6364
.collect()

src/decks.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ use crate::{
1414

1515
static FALLBACK_PUBKEY: &str = "aa733081e4f0f79dd43023d8983265593f2b41a988671cfcef3f489b91ad93fe";
1616

17-
pub enum DecksAction {
18-
Switch(usize),
19-
Removing(usize),
20-
}
17+
//pub enum DecksAction {
18+
// Switch(usize),
19+
// Removing(usize),
20+
//}
2121

2222
pub struct DecksCache {
2323
pub account_to_decks: HashMap<Pubkey, Decks>,

src/nav.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> RenderNavRe
248248
let col_id = get_active_columns(&app.accounts, &app.decks_cache).get_column_id_at_index(col);
249249
// TODO(jb55): clean up this router_mut mess by using Router<R> in egui-nav directly
250250

251-
let nav_response = Nav::new(app.columns().column(col).router().routes().clone())
251+
let nav_response = Nav::new(&app.columns().column(col).router().routes().clone())
252252
.navigating(app.columns_mut().column_mut(col).router_mut().navigating)
253253
.returning(app.columns_mut().column_mut(col).router_mut().returning)
254254
.id_source(egui::Id::new(col_id))
@@ -258,7 +258,7 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> RenderNavRe
258258
&mut app.img_cache,
259259
get_active_columns_mut(&app.accounts, &mut app.decks_cache),
260260
app.accounts.get_selected_account().map(|a| &a.pubkey),
261-
nav.routes_arr(),
261+
nav.routes(),
262262
)
263263
.show(ui),
264264
NavUiType::Body => render_nav_body(ui, app, nav.routes().last().expect("top"), col),

src/ui/note/contents.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn image_carousel(
244244

245245
ui.add_sized([width, height], |ui: &mut egui::Ui| {
246246
egui::ScrollArea::horizontal()
247-
.id_source(carousel_id)
247+
.id_salt(carousel_id)
248248
.show(ui, |ui| {
249249
ui.horizontal(|ui| {
250250
for image in images {

src/ui/profile/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a> ProfileView<'a> {
5050
let scroll_id = egui::Id::new(("profile_scroll", self.col_id, self.pubkey));
5151

5252
ScrollArea::vertical()
53-
.id_source(scroll_id)
53+
.id_salt(scroll_id)
5454
.show(ui, |ui| {
5555
let txn = Transaction::new(self.ndb).expect("txn");
5656
if let Ok(profile) = self.ndb.get_profile_by_pubkey(&txn, self.pubkey.bytes()) {

src/ui/relay.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'a> RelayView<'a> {
6565
.inner_margin(Margin::symmetric(0.0, 4.0))
6666
.show(ui, |ui| {
6767
egui::ScrollArea::horizontal()
68-
.id_source(index)
68+
.id_salt(index)
6969
.max_width(
7070
ui.max_rect().width()
7171
- get_right_side_width(relay_info.status),

src/ui/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a> ThreadView<'a> {
7373
);
7474

7575
egui::ScrollArea::vertical()
76-
.id_source(self.id_source)
76+
.id_salt(self.id_source)
7777
.animated(false)
7878
.auto_shrink([false, false])
7979
.scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::AlwaysVisible)

src/ui/timeline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn timeline_ui(
9797
};
9898

9999
egui::ScrollArea::vertical()
100-
.id_source(scroll_id)
100+
.id_salt(scroll_id)
101101
.animated(false)
102102
.auto_shrink([false, false])
103103
.scroll_bar_visibility(ScrollBarVisibility::AlwaysVisible)

0 commit comments

Comments
 (0)