Change the edit icon used in Imaginate

This commit is contained in:
Keavon Chambers
2023-04-03 14:16:46 -07:00
parent 0a9427fe6e
commit a0a5f02e2a
2 changed files with 31 additions and 41 deletions

View File

@@ -713,44 +713,35 @@ pub fn imaginate_properties(document_node: &DocumentNode, node_id: NodeId, conte
ImaginateServerStatus::Unavailable => "Unavailable",
ImaginateServerStatus::Connected => "Connected",
};
let widgets = vec![
vec![
WidgetHolder::text_widget("Server"),
let mut widgets = vec![
WidgetHolder::text_widget("Server"),
WidgetHolder::unrelated_separator(),
IconButton::new("Settings", 24)
.tooltip("Preferences: Imaginate")
.on_update(|_| DialogMessage::RequestPreferencesDialog.into())
.widget_holder(),
WidgetHolder::unrelated_separator(),
WidgetHolder::bold_text(status),
WidgetHolder::related_separator(),
IconButton::new("Reload", 24)
.tooltip("Refresh connection status")
.on_update(|_| PortfolioMessage::ImaginateCheckServerStatus.into())
.widget_holder(),
];
if context.persistent_data.imaginate_server_status == ImaginateServerStatus::Unavailable {
widgets.extend([
WidgetHolder::unrelated_separator(),
IconButton::new("Settings", 24)
.tooltip("Preferences: Imaginate")
.on_update(|_| DialogMessage::RequestPreferencesDialog.into())
TextButton::new("Server Help")
.tooltip("Learn how to connect Imaginate to an image generation server")
.on_update(|_| {
FrontendMessage::TriggerVisitLink {
url: "https://github.com/GraphiteEditor/Graphite/discussions/1089".to_string(),
}
.into()
})
.widget_holder(),
WidgetHolder::unrelated_separator(),
WidgetHolder::bold_text(status),
],
if context.persistent_data.imaginate_server_status == ImaginateServerStatus::Unavailable {
vec![
WidgetHolder::unrelated_separator(),
TextButton::new("Help")
.tooltip("Learn how to connect Imaginate to an image generation server")
.on_update(|_| {
FrontendMessage::TriggerVisitLink {
url: "https://github.com/GraphiteEditor/Graphite/discussions/1089".to_string(),
}
.into()
})
.widget_holder(),
]
} else {
vec![]
},
vec![
WidgetHolder::related_separator(),
IconButton::new("Reload", 24)
.tooltip("Refresh connection status")
.on_update(|_| PortfolioMessage::ImaginateCheckServerStatus.into())
.widget_holder(),
],
]
.into_iter()
.flatten()
.collect();
]);
}
LayoutGroup::Row { widgets }.with_tooltip("Connection status to the server that computes generated images")
};
@@ -758,7 +749,7 @@ pub fn imaginate_properties(document_node: &DocumentNode, node_id: NodeId, conte
panic!("Invalid status input")
};
let NodeInput::Value {tagged_value: TaggedValue::RcImage( cached_data),..} = cached_value else {
panic!("Invalid cached image input, recieved {:?}, index: {}", cached_value, cached_index)
panic!("Invalid cached image input, received {:?}, index: {}", cached_value, cached_index)
};
let &NodeInput::Value {tagged_value: TaggedValue::F64( percent_complete),..} = complete_value else {
panic!("Invalid percent complete input")
@@ -987,8 +978,8 @@ pub fn imaginate_properties(document_node: &DocumentNode, node_id: NodeId, conte
CheckboxInput::new(!dimensions_is_auto || transform_not_connected)
.icon("Edit")
.tooltip({
let message = "Set a custom resolution instead of using the frame's rounded dimensions";
let manual_message = "Set a custom resolution instead of using the frame's rounded dimensions.\n\
let message = "Set a custom resolution instead of using the input's dimensions (rounded to the nearest 64)";
let manual_message = "Set a custom resolution instead of using the input's dimensions (rounded to the nearest 64).\n\
\n\
(Resolution must be set manually while the 'Transform' input is disconnected.)";