Skip to content

Commit

Permalink
Twix CompletionEdit (#1478)
Browse files Browse the repository at this point in the history
* add widgets crate

* add completion edit

* add segmented control

* animations

* correct opening and closing of popup

* polish completion edit

* fix bug on retyping after selected but without closing popup

* fix transition

* fix tab focus

* highlight invalid search

* fix test

* fix behavior panel

* Add raw NAO config to twix configuration

* remove dbg!

* fix focus

* make close_me clearer

* remove animate_to function

* make ids in enum plot nicer

---------

Co-authored-by: okiwi6 <oleflb>
Co-authored-by: Rasmus Mecklenburg <[email protected]>
  • Loading branch information
oleflb and rmburg authored Dec 5, 2024
1 parent 985776c commit a4989ab
Show file tree
Hide file tree
Showing 27 changed files with 2,021 additions and 871 deletions.
1,856 changes: 1,136 additions & 720 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[workspace]
resolver = "2"
members = [
"crates/aliveness",
"crates/approx_derive",
Expand All @@ -21,6 +20,7 @@ members = [
"crates/geometry",
"crates/hardware",
"crates/hulk",
"crates/hulk_widgets",
"crates/hulk_imagine",
"crates/hulk_manifest",
"crates/hulk_nao",
Expand Down Expand Up @@ -53,7 +53,9 @@ members = [
"tools/hula/types",
"tools/pepsi",
"tools/twix",
"tools/widget_gallery",
]
resolver = "2"
# HuLA and Aliveness are built independently by yocto
exclude = ["tools/aliveness", "tools/breeze", "tools/hula"]

Expand Down Expand Up @@ -99,10 +101,11 @@ coordinate_systems = { path = "crates/coordinate_systems" }
ctrlc = { version = "3.2.3", features = ["termination"] }
derive_more = "0.99.17"
dirs = "5.0.1"
eframe = { version = "0.28.1", features = ["persistence"] }
egui_dock = { version = "0.13.0", features = ["serde"] }
egui_extras = { version = "0.28.1", features = ["image"] }
egui_plot = "0.28.1"
eframe = { version = "0.29.1", features = ["persistence"] }
egui = { version = "0.29.1", features = ["persistence"] }
egui_dock = { version = "0.14.0", features = ["serde"] }
egui_extras = { version = "0.29.1", features = ["image"] }
egui_plot = "0.29.0"
energy_optimization = { path = "crates/energy_optimization" }
enum-iterator = "1.4.1"
enum_dispatch = "0.3.11"
Expand All @@ -111,7 +114,6 @@ fern = { version = "0.6.1", features = ["colored"] }
filtering = { path = "crates/filtering" }
framework = { path = "crates/framework" }
futures-util = "0.3.24"
fuzzy-matcher = "0.3.7"
geometry = { path = "crates/geometry" }
gilrs = "0.10.1"
glob = "0.3.0"
Expand All @@ -120,6 +122,7 @@ home = "0.5.4"
hula-types = { path = "tools/hula/types" }
hulk = { path = "crates/hulk" }
hulk_manifest = { path = "crates/hulk_manifest" }
hulk_widgets = { path = "crates/hulk_widgets" }
i2cdev = "0.5.1"
image = "0.24.4"
indicatif = "0.17.2"
Expand All @@ -138,6 +141,7 @@ nao = { path = "crates/nao" }
nao_camera = { path = "crates/nao_camera" }
ndarray = { version = "0.15.6", features = ["serde"] }
nix = { version = "0.28", features = ["ioctl"] }
nucleo-matcher = "0.3.1"
num-derive = "0.4.2"
num-traits = "0.2"
object_detection = { path = "crates/object_detection" }
Expand Down
24 changes: 15 additions & 9 deletions crates/hulk_replayer/src/labels.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;

use eframe::egui::{
pos2, vec2, Align, Layout, Rect, Response, RichText, Sense, TextStyle, Ui, Widget,
pos2, vec2, Align, Layout, Rect, Response, RichText, Sense, TextStyle, Ui, UiBuilder, Widget,
};

use framework::Timing;
Expand Down Expand Up @@ -43,14 +43,20 @@ impl Widget for Labels<'_> {
left_top,
pos2(ui.max_rect().right(), left_top.y + row_height),
);
let mut child_ui = ui.child_ui(child_rect, Layout::top_down(Align::Min), None);
child_ui.set_height(row_height);
child_ui.label(RichText::new(label_content.name).strong());
let text_height = ui.style().text_styles.get(&TextStyle::Body).unwrap().size;
if child_ui.available_height() >= text_height {
child_ui.label(format!("{} frames", label_content.number_of_frames));
}
maximum_width = maximum_width.max(child_ui.min_size().x);
ui.scope_builder(
UiBuilder::new()
.max_rect(child_rect)
.layout(Layout::top_down(Align::Min)),
|ui| {
ui.set_height(row_height);
ui.label(RichText::new(label_content.name).strong());
let text_height = ui.style().text_styles.get(&TextStyle::Body).unwrap().size;
if ui.available_height() >= text_height {
ui.label(format!("{} frames", label_content.number_of_frames));
}
maximum_width = maximum_width.max(ui.min_size().x);
},
);
}

ui.allocate_rect(
Expand Down
13 changes: 9 additions & 4 deletions crates/hulk_replayer/src/timeline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;

use eframe::egui::{vec2, Align, Layout, Rect, Response, Ui, Vec2, Widget};
use eframe::egui::{vec2, Align, Layout, Rect, Response, Ui, UiBuilder, Vec2, Widget};

use framework::Timing;

Expand Down Expand Up @@ -43,8 +43,6 @@ impl Widget for Timeline<'_> {
ui.max_rect().left_top(),
vec2(ui.available_width(), ticks_height(ui)),
);
let mut ticks_ui =
ui.child_ui(ticks_rect, Layout::top_down_justified(Align::Min), None);
ui.advance_cursor_after_rect(ticks_rect);

let response = ui.add(Frames::new(
Expand All @@ -55,7 +53,14 @@ impl Widget for Timeline<'_> {
original_item_spacing,
));

Ticks::new(self.frame_range, self.viewport_range, self.position).ui(&mut ticks_ui);
ui.scope_builder(
UiBuilder::new()
.max_rect(ticks_rect)
.layout(Layout::top_down_justified(Align::Min)),
|ui| {
Ticks::new(self.frame_range, self.viewport_range, self.position).ui(ui);
},
);

response
})
Expand Down
12 changes: 12 additions & 0 deletions crates/hulk_widgets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "hulk_widgets"
version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true

[dependencies]
communication = { workspace = true }
egui = { workspace = true }
egui_extras = { workspace = true }
nucleo-matcher = { workspace = true }
Loading

0 comments on commit a4989ab

Please sign in to comment.