mirror of
https://github.com/enso-org/enso.git
synced 2025-01-04 14:37:37 +03:00
Correctly propagate project name updates from Breadcrumbs
to ProjectName
. (https://github.com/enso-org/ide/pull/907)
The FRP from the Breadcrumbs was incorrectly connected to the FRP of the ProjectName and updates were not propagated correctly.
Original commit: 60b4c8fdc5
This commit is contained in:
parent
8d16c4768e
commit
0d64d3034b
@ -399,8 +399,8 @@ impl Breadcrumbs {
|
|||||||
|
|
||||||
// === Project Name ===
|
// === Project Name ===
|
||||||
|
|
||||||
eval frp.project_name((name) model.project_name.frp.name(name));
|
eval frp.input.project_name((name) model.project_name.set_name.emit(name));
|
||||||
frp.source.project_name <+ model.project_name.frp.output.name;
|
frp.source.project_name <+ model.project_name.output.name;
|
||||||
|
|
||||||
|
|
||||||
// === GUI Update ===
|
// === GUI Update ===
|
||||||
|
@ -30,8 +30,10 @@ use logger::enabled::Logger;
|
|||||||
// === Constants ===
|
// === Constants ===
|
||||||
// =================
|
// =================
|
||||||
|
|
||||||
/// Project name used as a placeholder in `ProjectName` view when it's initialized.
|
// This is a default value for the project name when it is created. The project name should
|
||||||
pub const UNKNOWN_PROJECT_NAME : &str = "Unknown";
|
// always be initialized externally for the current project. If this value is visible in the UI,
|
||||||
|
// it was not set to the correct project name due to some bug.
|
||||||
|
const UNINITIALIZED_PROJECT_NAME: &str = "Project Name Uninitialized";
|
||||||
/// Default line height for project names.
|
/// Default line height for project names.
|
||||||
pub const LINE_HEIGHT : f32 = TEXT_SIZE * 1.5;
|
pub const LINE_HEIGHT : f32 = TEXT_SIZE * 1.5;
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ mod background {
|
|||||||
ensogl::define_endpoints! {
|
ensogl::define_endpoints! {
|
||||||
Input {
|
Input {
|
||||||
/// Set the project name.
|
/// Set the project name.
|
||||||
name (String),
|
set_name (String),
|
||||||
/// Reset the project name to the one before editing.
|
/// Reset the project name to the one before editing.
|
||||||
cancel_editing (),
|
cancel_editing (),
|
||||||
/// Commit current project name.
|
/// Commit current project name.
|
||||||
@ -148,7 +150,7 @@ impl ProjectNameModel {
|
|||||||
scene.views.main.remove_shape_view(&view);
|
scene.views.main.remove_shape_view(&view);
|
||||||
scene.views.breadcrumbs.add_shape_view(&view);
|
scene.views.breadcrumbs.add_shape_view(&view);
|
||||||
|
|
||||||
let project_name = Rc::new(RefCell::new(UNKNOWN_PROJECT_NAME.to_string()));
|
let project_name = default();
|
||||||
Self{app,logger,view,style,display_object,text_field,project_name}.init()
|
Self{app,logger,view,style,display_object,text_field,project_name}.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +200,7 @@ impl ProjectNameModel {
|
|||||||
|
|
||||||
fn rename(&self, name:impl Str) {
|
fn rename(&self, name:impl Str) {
|
||||||
let name = name.into();
|
let name = name.into();
|
||||||
|
debug!(self.logger, "Renaming: '{name}'.");
|
||||||
self.update_text_field_content(&name);
|
self.update_text_field_content(&name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,8 +284,8 @@ impl ProjectName {
|
|||||||
// === Input Commands ===
|
// === Input Commands ===
|
||||||
|
|
||||||
eval_ frp.input.cancel_editing(model.reset_name());
|
eval_ frp.input.cancel_editing(model.reset_name());
|
||||||
eval frp.input.name((name) {model.rename(name)});
|
eval frp.input.set_name((name) {model.rename(name)});
|
||||||
frp.output.source.name <+ frp.input.name;
|
frp.output.source.name <+ frp.input.set_name;
|
||||||
|
|
||||||
|
|
||||||
// === Commit ===
|
// === Commit ===
|
||||||
@ -332,6 +335,7 @@ impl ProjectName {
|
|||||||
}
|
}
|
||||||
|
|
||||||
frp.deselect();
|
frp.deselect();
|
||||||
|
frp.input.set_name.emit(UNINITIALIZED_PROJECT_NAME.to_string());
|
||||||
|
|
||||||
Self{frp,model}
|
Self{frp,model}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user