mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Contact Sheet II: footer buttons as FooterButton after the craft-libs move
craft-libs a46af76 on main takes ParamDialog::extra_buttons as FooterButton.
This commit is contained in:
1 parent
0bf5d22fed
commit
37fb9b92b6
2 files changed
+6
-3
No files matched your search
@@ -301,7 +301,7 @@ fn alerts(h: &H) -> Vec<String> {
|
||||
|
||||
#[test]
|
||||
fn the_dialog_has_load_save_and_reset_buttons() {
|
||||
let labels: Vec<String> = super::super::footer_buttons().into_iter().map(|(id, label)| format!("{id}:{}", label.as_str())).collect();
|
||||
let labels: Vec<String> = super::super::footer_buttons().into_iter().map(|(id, button)| format!("{id}:{}", button.label().as_str())).collect();
|
||||
assert_eq!(labels, ["load:Load…", "save:Save…", "reset:Reset…"]);
|
||||
let (h, _) = opened();
|
||||
for label in ["Load…", "Save…", "Reset…"] {
|
||||
|
||||
@@ -11,6 +11,7 @@ use craft::ui::dialog::{DialogId, PromptAnswer, PromptChoice, StandardPrompt};
|
||||
use craft::ui::patterns::form_dialogs::{CustomContext, DialogFields, FieldValue, HostedParamDialog, NumberUnit, Param, ParamKind, ParamResult};
|
||||
use craft::ui::runtime::env::{Label, UnitKind};
|
||||
use craft::ui::runtime::requests::PathKind;
|
||||
use craft::ui::sections::{DialogRole, FooterButton};
|
||||
use photocraft_engine::prefs::Unit;
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
@@ -163,8 +164,10 @@ pub(crate) fn command_params(map: &mut Map<String, Value>) {
|
||||
mod settings_file;
|
||||
|
||||
/// The footer buttons after OK and Cancel, as `(action, label)`.
|
||||
pub(crate) fn footer_buttons() -> Vec<(String, Label)> {
|
||||
[("load", tl!("Load…")), ("save", tl!("Save…")), ("reset", tl!("Reset…"))].map(|(id, label)| (id.to_owned(), Label::from(label))).into()
|
||||
pub(crate) fn footer_buttons() -> Vec<(String, FooterButton)> {
|
||||
[("load", tl!("Load…")), ("save", tl!("Save…")), ("reset", tl!("Reset…"))]
|
||||
.map(|(id, label)| (id.to_owned(), FooterButton::new(label, DialogRole::Other)))
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Every open of the dialog has the same id, so Load…'s pick and Reset…'s question, answered after the dialog closed,
|
||||
|
||||
Reference in new issue
Block a user