Skip to content

Commit

Permalink
list_item2 migration (part 3): rename list_item2 to list_item (r…
Browse files Browse the repository at this point in the history
…erun-io#6378)

### What

Pure renaming.

Part of a mini-series:
- rerun-io#6376
- rerun-io#6377
- rerun-io#6378


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6378?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6378?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/6378)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
abey79 authored May 22, 2024
1 parent 2bca710 commit d6344d3
Show file tree
Hide file tree
Showing 24 changed files with 172 additions and 173 deletions.
6 changes: 3 additions & 3 deletions crates/re_data_ui/src/editors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ fn edit_marker_shape_ui(
for marker in MarkerShape::ALL {
let response = ctx
.re_ui
.list_item2()
.list_item()
.selected(edit_marker == marker)
.show_flat(
ui,
re_ui::list_item2::LabelContent::new(marker.to_string())
re_ui::list_item::LabelContent::new(marker.to_string())
.min_desired_width(item_width)
.with_icon_fn(|_re_ui, ui, rect, visuals| {
paint_marker(ui, marker.into(), rect, visuals.text_color());
Expand All @@ -296,7 +296,7 @@ fn edit_marker_shape_ui(
};

re_ui::full_span::full_span_scope(ui, background_x_range, |ui| {
re_ui::list_item2::list_item_scope(ui, "marker_shape", list_ui);
re_ui::list_item::list_item_scope(ui, "marker_shape", list_ui);
});
});

Expand Down
18 changes: 9 additions & 9 deletions crates/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use re_entity_db::{EntityTree, InstancePath};
use re_log_types::{ApplicationId, ComponentPath, EntityPath, TimeInt, Timeline};
use re_ui::{icons, list_item2, SyntaxHighlighting};
use re_ui::{icons, list_item, SyntaxHighlighting};
use re_viewer_context::{HoverHighlight, Item, SpaceViewId, UiLayout, ViewerContext};

use super::DataUi;
Expand Down Expand Up @@ -414,12 +414,12 @@ pub fn component_path_button_to(
ui.style_mut().wrap = Some(false);

// wrap lone item
list_item2::list_item_scope(ui, "component_path_tooltip", |ui| {
list_item2::ListItem::new(ctx.re_ui)
list_item::list_item_scope(ui, "component_path_tooltip", |ui| {
list_item::ListItem::new(ctx.re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::LabelContent::new(if is_static {
list_item::LabelContent::new(if is_static {
"Static component"
} else {
"Temporal component"
Expand Down Expand Up @@ -634,7 +634,7 @@ pub fn data_source_button_ui(
cursor_interact_with_selectable(ctx, response, item)
}

/// This uses [`list_item2::ListItem::show_hierarchical`], meaning it comes with built-in
/// This uses [`list_item::ListItem::show_hierarchical`], meaning it comes with built-in
/// indentation.
pub fn store_id_button_ui(
ctx: &ViewerContext<'_>,
Expand All @@ -652,7 +652,7 @@ pub fn store_id_button_ui(
///
/// You can set `include_app_id` to hide the App Id, but usually you want to show it.
///
/// This uses [`list_item2::ListItem::show_hierarchical`], meaning it comes with built-in
/// This uses [`list_item::ListItem::show_hierarchical`], meaning it comes with built-in
/// indentation.
pub fn entity_db_button_ui(
ctx: &ViewerContext<'_>,
Expand Down Expand Up @@ -690,7 +690,7 @@ pub fn entity_db_button_ui(
re_log_types::StoreKind::Blueprint => &icons::BLUEPRINT,
};

let item_content = list_item2::LabelContent::new(title)
let item_content = list_item::LabelContent::new(title)
.with_icon_fn(|_re_ui, ui, rect, visuals| {
// Color icon based on whether this is the active recording or not:
let color = if ctx.store_context.is_active(&store_id) {
Expand Down Expand Up @@ -721,13 +721,13 @@ pub fn entity_db_button_ui(
});

let mut list_item =
list_item2::ListItem::new(ctx.re_ui).selected(ctx.selection().contains_item(&item));
list_item::ListItem::new(ctx.re_ui).selected(ctx.selection().contains_item(&item));

if ctx.hovered().contains_item(&item) {
list_item = list_item.force_hovered(true);
}

let response = list_item2::list_item_scope(ui, "entity db button", |ui| {
let response = list_item::list_item_scope(ui, "entity db button", |ui| {
list_item
.show_hierarchical(ui, item_content)
.on_hover_ui(|ui| {
Expand Down
36 changes: 18 additions & 18 deletions crates/re_space_view_time_series/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use re_types::{
blueprint::components::Corner2D, components::Range1D, datatypes::TimeRange,
SpaceViewClassIdentifier, View,
};
use re_ui::list_item2;
use re_ui::list_item;
use re_viewer_context::external::re_entity_db::{
EditableAutoValue, EntityProperties, TimeSeriesAggregator,
};
Expand Down Expand Up @@ -157,12 +157,12 @@ impl SpaceViewClass for TimeSeriesSpaceView {
) -> Result<(), SpaceViewSystemExecutionError> {
let state = state.downcast_mut::<TimeSeriesSpaceViewState>()?;

list_item2::list_item_scope(ui, "time_series_selection_ui", |ui| {
list_item2::ListItem::new(ctx.re_ui)
list_item::list_item_scope(ui, "time_series_selection_ui", |ui| {
list_item::ListItem::new(ctx.re_ui)
.interactive(false)
.show_hierarchical(
ui,
list_item2::PropertyContent::new("Zoom aggregation").value_fn(|_, ui, _| {
list_item::PropertyContent::new("Zoom aggregation").value_fn(|_, ui, _| {
let mut agg_mode = *root_entity_properties.time_series_aggregator.get();

egui::ComboBox::from_id_source("aggregation_mode")
Expand Down Expand Up @@ -636,11 +636,11 @@ fn legend_ui(ctx: &ViewerContext<'_>, space_view_id: SpaceViewId, ui: &mut egui:
//

let mut edit_visibility = visible;
list_item2::ListItem::new(re_ui)
list_item::ListItem::new(re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::PropertyContent::new("Visible").value_bool_mut(&mut edit_visibility.0),
list_item::PropertyContent::new("Visible").value_bool_mut(&mut edit_visibility.0),
);
if visible != edit_visibility {
ctx.save_blueprint_component(&blueprint_path, &edit_visibility);
Expand All @@ -651,11 +651,11 @@ fn legend_ui(ctx: &ViewerContext<'_>, space_view_id: SpaceViewId, ui: &mut egui:
//

let mut edit_corner = corner;
list_item2::ListItem::new(re_ui)
list_item::ListItem::new(re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::PropertyContent::new("Corner").value_fn(|_, ui, _| {
list_item::PropertyContent::new("Corner").value_fn(|_, ui, _| {
egui::ComboBox::from_id_source("legend_corner")
.selected_text(format!("{corner}"))
.show_ui(ui, |ui| {
Expand Down Expand Up @@ -690,13 +690,13 @@ fn legend_ui(ctx: &ViewerContext<'_>, space_view_id: SpaceViewId, ui: &mut egui:
}
};

list_item2::ListItem::new(ctx.re_ui)
list_item::ListItem::new(ctx.re_ui)
.interactive(false)
.show_hierarchical_with_children(
ui,
"time_series_selection_ui_legend",
true,
list_item2::LabelContent::new("Legend"),
list_item::LabelContent::new("Legend"),
sub_prop_ui,
);
}
Expand Down Expand Up @@ -727,11 +727,11 @@ fn axis_ui(
//

let mut auto_range = y_range.is_none();
list_item2::ListItem::new(re_ui)
list_item::ListItem::new(re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::PropertyContent::new("Default range").value_fn(|_, ui, _| {
list_item::PropertyContent::new("Default range").value_fn(|_, ui, _| {
ui.horizontal(|ui| {
ctx.re_ui.radio_value(ui, &mut auto_range, true, "Auto");
ctx.re_ui.radio_value(ui, &mut auto_range, false, "Manual");
Expand All @@ -749,11 +749,11 @@ fn axis_ui(
//

if !auto_range {
list_item2::ListItem::new(re_ui)
list_item::ListItem::new(re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::PropertyContent::new("").value_fn(|_, ui, _| {
list_item::PropertyContent::new("").value_fn(|_, ui, _| {
let mut range_edit = y_range
.unwrap_or_else(|| y_range.unwrap_or(state.saved_y_axis_range.into()));

Expand Down Expand Up @@ -792,11 +792,11 @@ fn axis_ui(
//

let mut edit_locked = y_lock_zoom;
list_item2::ListItem::new(re_ui)
list_item::ListItem::new(re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::PropertyContent::new("Zoom lock").value_bool_mut(&mut edit_locked.0 .0),
list_item::PropertyContent::new("Zoom lock").value_bool_mut(&mut edit_locked.0 .0),
)
.on_hover_text(
"If enabled, the Y axis range will remain locked to the specified range when zooming.",
Expand All @@ -806,13 +806,13 @@ fn axis_ui(
}
};

list_item2::ListItem::new(ctx.re_ui)
list_item::ListItem::new(ctx.re_ui)
.interactive(false)
.show_hierarchical_with_children(
ui,
"time_series_selection_ui_y_axis",
true,
list_item2::LabelContent::new("Y Axis"),
list_item::LabelContent::new("Y Axis"),
sub_prop_ui,
);
}
Expand Down
20 changes: 10 additions & 10 deletions crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use re_log_types::{
external::re_types_core::ComponentName, ComponentPath, EntityPath, EntityPathPart,
ResolvedTimeRange, TimeInt, TimeReal,
};
use re_ui::list_item2;
use re_ui::list_item;
use re_viewer_context::{
CollapseScope, HoverHighlight, Item, RecordingConfig, TimeControl, TimeView, UiLayout,
ViewerContext,
Expand Down Expand Up @@ -434,7 +434,7 @@ impl TimePanel {

// All the entity rows and their data density graphs:
re_ui::full_span::full_span_scope(ui, (0.0..=time_x_left).into(), |ui| {
list_item2::list_item_scope(ui, "streams_tree", |ui| {
list_item::list_item_scope(ui, "streams_tree", |ui| {
self.tree_ui(
ctx,
viewport_blueprint,
Expand Down Expand Up @@ -597,17 +597,17 @@ impl TimePanel {
.set_open(ui.ctx(), true);
}

let list_item2::ShowCollapsingResponse {
let list_item::ShowCollapsingResponse {
item_response: response,
body_response,
} = list_item2::ListItem::new(ctx.re_ui)
} = list_item::ListItem::new(ctx.re_ui)
.selected(is_selected)
.force_hovered(is_item_hovered)
.show_hierarchical_with_children(
ui,
CollapseScope::StreamsTree.entity(tree.path.clone()),
default_open,
list_item2::LabelContent::new(text)
list_item::LabelContent::new(text)
.with_icon(guess_instance_path_icon(
ctx,
&InstancePath::from(tree.path.clone()),
Expand Down Expand Up @@ -742,7 +742,7 @@ impl TimePanel {
let short_component_name = component_path.component_name.short_name();
let item = TimePanelItem::component_path(component_path.clone());

let response = list_item2::ListItem::new(ctx.re_ui)
let response = list_item::ListItem::new(ctx.re_ui)
.selected(ctx.selection().contains_item(&item.to_item()))
.force_hovered(
ctx.selection_state()
Expand All @@ -751,7 +751,7 @@ impl TimePanel {
)
.show_hierarchical(
ui,
list_item2::LabelContent::new(short_component_name)
list_item::LabelContent::new(short_component_name)
.with_icon(if is_static {
&re_ui::icons::COMPONENT_STATIC
} else {
Expand Down Expand Up @@ -786,12 +786,12 @@ impl TimePanel {
timeline.name()
)));
} else {
list_item2::list_item_scope(ui, "hover tooltip", |ui| {
list_item2::ListItem::new(ctx.re_ui)
list_item::list_item_scope(ui, "hover tooltip", |ui| {
list_item::ListItem::new(ctx.re_ui)
.interactive(false)
.show_flat(
ui,
list_item2::LabelContent::new(format!(
list_item::LabelContent::new(format!(
"{} component, logged {}",
if is_static { "Static" } else { "Temporal" },
if total_num_messages == 1 {
Expand Down
6 changes: 3 additions & 3 deletions crates/re_ui/examples/re_ui_example/drag_and_drop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashSet;

use re_ui::list_item2;
use re_ui::list_item;

#[derive(Hash, Clone, Copy, PartialEq, Eq)]
struct ItemId(u32);
Expand Down Expand Up @@ -34,10 +34,10 @@ impl ExampleDragAndDrop {
//

let label = format!("Item {}", item_id.0);
let response = list_item2::ListItem::new(re_ui)
let response = list_item::ListItem::new(re_ui)
.selected(self.selected_items.contains(item_id))
.draggable(true)
.show_flat(ui, list_item2::LabelContent::new(&label));
.show_flat(ui, list_item::LabelContent::new(&label));

//
// Handle item selection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};

use egui::NumExt;

use re_ui::{list_item2, ReUi};
use re_ui::{list_item, ReUi};

#[derive(Hash, Clone, Copy, PartialEq, Eq)]
struct ItemId(u32);
Expand Down Expand Up @@ -276,15 +276,15 @@ impl HierarchicalDragAndDrop {
item_id: ItemId,
children: &Vec<ItemId>,
) {
let response = list_item2::ListItem::new(re_ui)
let response = list_item::ListItem::new(re_ui)
.selected(self.selected(item_id))
.draggable(true)
.drop_target_style(self.target_container == Some(item_id))
.show_hierarchical_with_children(
ui,
item_id,
true,
list_item2::LabelContent::new(format!("Container {item_id:?}")).subdued(true),
list_item::LabelContent::new(format!("Container {item_id:?}")).subdued(true),
|re_ui, ui| {
self.container_children_ui(re_ui, ui, children);
},
Expand Down Expand Up @@ -319,10 +319,10 @@ impl HierarchicalDragAndDrop {
}

fn leaf_ui(&self, re_ui: &crate::ReUi, ui: &mut egui::Ui, item_id: ItemId, label: &str) {
let response = list_item2::ListItem::new(re_ui)
let response = list_item::ListItem::new(re_ui)
.selected(self.selected(item_id))
.draggable(true)
.show_hierarchical(ui, list_item2::LabelContent::new(label));
.show_hierarchical(ui, list_item::LabelContent::new(label));

self.handle_interaction(ui, item_id, false, &response, None);
}
Expand Down
10 changes: 4 additions & 6 deletions crates/re_ui/examples/re_ui_example/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod drag_and_drop;
mod hierarchical_drag_and_drop;
mod right_panel;

use re_ui::{list_item2, toasts, CommandPalette, ReUi, UICommand, UICommandSender};
use re_ui::{list_item, toasts, CommandPalette, ReUi, UICommand, UICommandSender};

/// Sender that queues up the execution of a command.
pub struct CommandSender(std::sync::mpsc::Sender<UICommand>);
Expand Down Expand Up @@ -233,12 +233,10 @@ impl eframe::App for ExampleApp {
ui.ctx(),
|| re_ui::modal::Modal::new("Modal window").full_span_content(true),
|_, ui, _| {
list_item2::list_item_scope(ui, "modal demo", |ui| {
list_item::list_item_scope(ui, "modal demo", |ui| {
for idx in 0..10 {
list_item2::ListItem::new(&self.re_ui).show_flat(
ui,
list_item2::LabelContent::new(format!("Item {idx}")),
);
list_item::ListItem::new(&self.re_ui)
.show_flat(ui, list_item::LabelContent::new(format!("Item {idx}")));
}
});
},
Expand Down
Loading

0 comments on commit d6344d3

Please sign in to comment.