From 2122066614a0160423a59ea5b45a226fe6da140e Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Thu, 12 Dec 2024 09:25:22 +0100 Subject: [PATCH] Demo: mention ImFileDialog limitations (cf #294) --- .../imgui_bundle/demos_cpp/demo_widgets.cpp | 14 ++++++++++++-- .../imgui_bundle/demos_python/demo_widgets.py | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/bindings/imgui_bundle/demos_cpp/demo_widgets.cpp b/bindings/imgui_bundle/demos_cpp/demo_widgets.cpp index 5cb6b725..4e73c57b 100644 --- a/bindings/imgui_bundle/demos_cpp/demo_widgets.cpp +++ b/bindings/imgui_bundle/demos_cpp/demo_widgets.cpp @@ -1,5 +1,6 @@ // Part of ImGui Bundle - MIT License - Copyright (c) 2022-2024 Pascal Thomet - https://github.com/pthom/imgui_bundle #include "hello_imgui/hello_imgui.h" +#include "hello_imgui/icons_font_awesome_4.h" #include "imspinner/imspinner.h" #include "imgui_toggle/imgui_toggle.h" #include "imgui_toggle/imgui_toggle_presets.h" @@ -298,9 +299,18 @@ void DemoImFileDialog() ImGuiMd::RenderUnindented(R"( # ImFileDialog - [ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui, with images preview. - *Not (yet) adapted for High DPI resolution under windows* + [ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui. )"); + ImGui::SameLine(); + ImGui::Text(ICON_FA_EXCLAMATION_TRIANGLE); + ImGui::SetItemTooltip( + "It is advised to use Portable File Dialogs instead, which offer native dialogs on each platform, " + "as well as notifications and messages.\n\n" + "Known limitations of ImFileDialog:\n" + " * Not adapted for High DPI resolution under windows\n" + " * No support for multi-selection\n" + " * Will not work under python with a pure python backend (requires to use `immapp.run()`)" + ); if (ImGui::Button("Open file")) ifd::FileDialog::Instance().Open( diff --git a/bindings/imgui_bundle/demos_python/demo_widgets.py b/bindings/imgui_bundle/demos_python/demo_widgets.py index cd5184d7..63579015 100644 --- a/bindings/imgui_bundle/demos_python/demo_widgets.py +++ b/bindings/imgui_bundle/demos_python/demo_widgets.py @@ -9,6 +9,7 @@ immapp, ImVec4, im_cool_bar, + icons_fontawesome, ) from imgui_bundle import imgui_command_palette as imcmd from imgui_bundle import portable_file_dialogs as pfd @@ -270,14 +271,24 @@ def demo_imfile_dialog(): if not has_submodule("im_file_dialog"): return from imgui_bundle import im_file_dialog as ifd - imgui_md.render_unindented( """ # ImFileDialog - [ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui, with images preview. - *Not (yet) adapted for High DPI resolution under windows* + [ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui. """ ) + # Warning / low support + imgui.same_line() + imgui.text(icons_fontawesome.ICON_FA_EXCLAMATION_TRIANGLE) + imgui.set_item_tooltip(""" + It is advised to use Portable File Dialogs instead, which offer native dialogs on each platform, + as well as notifications and messages. + + Known limitations of ImFileDialog: + * Not adapted for High DPI resolution under windows + * No support for multi-selection + * Will not work under python with a pure python backend (requires to use `immapp.run()`) + """) if imgui.button("Open file"): ifd.FileDialog.instance().open(