Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TGFileDialog new option to open / save to a folder, instead of a file #7237

Merged
merged 12 commits into from Feb 25, 2021

Conversation

ferdymercury
Copy link
Collaborator

@ferdymercury ferdymercury commented Feb 18, 2021

@phsft-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@bellenot bellenot self-assigned this Feb 18, 2021
@bellenot
Copy link
Member

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-fedora31/noimt.
Running on root-fedora-31-2.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:13:33.227Z] /home/sftnight/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:65: error: expression cannot be used as a function

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-performance-centos8-multicore/default.
Running on null:/data/sftnight/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:15:59.615Z] /data/sftnight/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:65: error: expression cannot be used as a function

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-ubuntu16/nortcxxmod.
Running on sft-ubuntu-1604-1.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:16:43.395Z] FAILED: /usr/bin/ccache /usr/bin/c++ -DVECCORE_ENABLE_VC -I/mnt/build/workspace/root-pullrequests-build/root/gui/gui/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/unix/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clingutils/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/textinput/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/thread/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/zip/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/rint/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/meta/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/gui/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/cont/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/inc -Iginclude -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/gpad/inc -I/mnt/build/workspace/root-pullrequests-build/root/hist/hist/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/imt/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/multiproc/inc -Iexternals/mnt/build/workspace/root-pullrequests-build/install/include -I/mnt/build/workspace/root-pullrequests-build/root/math/matrix/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/graf/inc -I/mnt/build/workspace/root-pullrequests-build/root/io/io/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/res -I/mnt/build/workspace/root-pullrequests-build/root/builtins -I/usr/include/freetype2 -I/usr/include/x86_64-linux-gnu/freetype2 -I/mnt/build/workspace/root-pullrequests-build/root/gui/ged/inc -I/mnt/build/workspace/root-pullrequests-build/root/net/net/inc -fdiagnostics-color=always -std=c++11 -pipe -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -fPIC -std=c++11 -MD -MT gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o -MF gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o.d -o gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o -c /mnt/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx
  • [2021-02-18T07:16:43.395Z] /mnt/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:65: error: expression cannot be used as a function

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:20:26.526Z] FAILED: gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o
  • [2021-02-18T07:20:28.516Z] /home/sftnight/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:65: error: expression cannot be used as a function

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-fedora30/cxx14.
Running on root-fedora30-2.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:21:47.948Z] FAILED: gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o
  • [2021-02-18T07:21:49.241Z] /home/sftnight/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:65: error: expression cannot be used as a function

@phsft-bot
Copy link
Collaborator

Build failed on mac11.0/cxx17.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:26:20.301Z] FAILED: gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o
  • [2021-02-18T07:26:20.875Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:27: error: called object type 'TGCheckButton *' is not a function or function pointer

@phsft-bot
Copy link
Collaborator

Build failed on mac1014/python3.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:40:43.137Z] FAILED: gui/gui/CMakeFiles/Gui.dir/src/TGFileDialog.cxx.o
  • [2021-02-18T07:40:44.076Z] /Volumes/HD2/build/workspace/root-pullrequests-build/root/gui/gui/src/TGFileDialog.cxx:704:27: error: called object type 'TGCheckButton *' is not a function or function pointer

@phsft-bot
Copy link
Collaborator

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-02-18T07:37:49.142Z] C:\build\workspace\root-pullrequests-build\root\gui\gui\src\TGFileDialog.cxx(703,64): error C2064: term does not evaluate to a function taking 1 arguments [C:\build\workspace\root-pullrequests-build\build\gui\gui\Gui.vcxproj]

@bellenot
Copy link
Member

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@bellenot
Copy link
Member

I'll have to try it before to review, but before that, may I ask what is the real use case? We only had one question on the forum so far, with an alternative solution...

@ferdymercury
Copy link
Collaborator Author

ferdymercury commented Feb 18, 2021

There were two more forum posts also:
https://root-forum.cern.ch/t/select-directory-with-tgfiledialog/20481
https://root-forum.cern.ch/t/set-up-working-directory/2528

The alternative solution involves defining extra derived classes, etc, which is a bit of a burden.

Selecting a folder is useful, for example when you save all open canvases as .png files. You want to select a output folder, and then the script does: for(auto c: gROOT->GetListOfCanvases()) c->SaveAs(outputFolder + "/" + c->GetName()+".png");
Another example is when want to store all DICOM files of a CT scan that you are simulating. The result is always splitted in N files, one per slice, not a single file. Thus it only makes sense to have a TGFileDialog that allows you to select a directory, not a file.

I think this functionality is generic enough to be used by more users. In fact, QtFileDialog has exactly this kind of property:

QFileDialog dialog;
dialog.setFileMode(QFileDialog::DirectoryOnly);
dialog.setOption(QFileDialog::ShowDirsOnly, false);

See https://forum.qt.io/topic/62138/qfiledialog-choose-directories-only-but-show-files-as-well/13

@bellenot
Copy link
Member

OK, thanks. I'll take care of it as soon as I can

gui/gui/inc/TGFileDialog.h Outdated Show resolved Hide resolved
gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
@ferdymercury
Copy link
Collaborator Author

Thanks for the feedback. I think I fixed them now.

gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
ferdymercury and others added 2 commits February 24, 2021 17:44
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
gui/gui/src/TGFileDialog.cxx Outdated Show resolved Hide resolved
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
@bellenot
Copy link
Member

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@bellenot
Copy link
Member

@ferdymercury Thanks for this contribution! Test failures are unrelated, so let's merge

Copy link
Member

@bellenot bellenot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the nice improvement!

@bellenot bellenot merged commit 59b234c into root-project:master Feb 25, 2021
@ferdymercury ferdymercury deleted the patch-4 branch February 25, 2021 12:16
nicknagi pushed a commit to nicknagi/root that referenced this pull request Mar 30, 2021
…root-project#7237)

* add directory selection as one dialog mode

* implement folder dialog type

* add extra security to prevent nullptr access

* fix typo in last commit

* redundant check to make clang tidy analyzer happy

* correctly handle double-click, and disable button if file is selected

* fix directory name when double click

* align member

* follow coding conventions

* split two lines to avoid long lines

Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>

* avoid long lines, split

* simplify if clauses

Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>

Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Fixed in 6.24/00
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

3 participants