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.)";

View File

@ -1,4 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12">
<path d="M10,9c0,1.1-0.9,2-2,2H3c-1.1,0-2-0.9-2-2V6c0-1.1,0.9-2,2-2l1-1H3C1.3,3,0,4.3,0,6v3c0,1.7,1.3,3,3,3h5c1.7,0,3-1.3,3-3V6l-1,1V9z" />
<path d="M11.4,0.8l-0.2-0.2C10.9,0.2,10.3,0,9.8,0s-1,0.2-1.4,0.6L4.2,4.8C3.4,5.6,3,6.6,3,7.7V9h1.3c1.1,0,2.1-0.4,2.8-1.2l4.2-4.2C12.2,2.8,12.2,1.5,11.4,0.8z M6.5,7.1C6,7.5,5.5,7.8,4.9,7.9L4.1,7.1C4.2,6.5,4.5,6,4.9,5.5l2.8-2.8l1.6,1.6L6.5,7.1z M10.7,2.9l-0.4,0.4L8.7,1.7l0.4-0.4C9.3,1.1,9.6,1,9.8,1s0.5,0.1,0.7,0.3l0.2,0.2C11.1,1.9,11.1,2.5,10.7,2.9z" />
<path d="M11.4,1.8l-1.2-1.2C9.9,0.2,9.3,0,8.8,0s-1,0.2-1.4,0.6L1.6,6.4c-0.4,0.4-0.7,1-0.8,1.5L0,12l4.1-0.8c0.6-0.1,1.1-0.4,1.5-0.8l5.8-5.8C12.2,3.8,12.2,2.5,11.4,1.8z M4.9,9.7c-0.3,0.3-0.6,0.5-1,0.5l-0.1,0L1.8,8.2l0-0.1c0.1-0.4,0.3-0.7,0.5-1l4-4l2.6,2.6L4.9,9.7z M10.7,3.9L9.6,4.9L7.1,2.4l1.1-1.1C8.3,1.1,8.6,1,8.8,1s0.5,0.1,0.7,0.3l1.2,1.2C11.1,2.9,11.1,3.5,10.7,3.9z" />
</svg>

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 442 B