Skip to content

gui: elide long filenames with tooltip in document list#1457

Merged
apyrgio merged 1 commit intofreedomofpress:mainfrom
moaaz-ae:fix/issue-143
Apr 15, 2026
Merged

gui: elide long filenames with tooltip in document list#1457
apyrgio merged 1 commit intofreedomofpress:mainfrom
moaaz-ae:fix/issue-143

Conversation

@moaaz-ae
Copy link
Copy Markdown
Contributor

@moaaz-ae moaaz-ae commented Apr 9, 2026

When a file with a very long name is selected, the application window would resize awkwardly or push elements out of the viewport.

For example (on Fedora Linux), without this fix, the "Start another conversion" button gets pushed completely off-screen when selecting a file with a long filename, making it impossible for the user to trigger another conversion. See the "Before" image below.

This PR improves the UI by:

  1. Using QFontMetrics.elidedText() with ElideMiddle to shorten the displayed filename if it exceeds the available width.
  2. Adding a tooltip to the filename label so that the full path is still visible on hover.

Fixes #143

Before

image

After

image

Comment thread dangerzone/gui/main_window.py Outdated
@almet
Copy link
Copy Markdown
Member

almet commented Apr 9, 2026

Thanks a lot for the changes, that looks great. I've added a small question, and then we can merge!

@apyrgio
Copy link
Copy Markdown
Contributor

apyrgio commented Apr 15, 2026

The addition of ellipsis is a welcome one, and I'll merge it once the tests pass. One thing I didn't manage to reproduce though is the push of the "Start another conversion" button to the right.

Truth is, I have tested it only on a Fedora container, not a VM, but since it works in your machine and is in the correct direction, I think it's safe to merge.

@moaaz-ae
Copy link
Copy Markdown
Contributor Author

If this helps with reproduction:

OS: Fedora 43
Desktop Environment: GNOME (wayland)
Scaling Factor: 1.0
System Font: Adwaita Sans 11
Install Method: RPM (dangerzone-0.10.0-1.fc43.x86_64)
Window State: Default size
Filename: This_is_an_extremely_long_filename_created_specifically_to_hit_the_absolute_maximum_limit_of_two_hundred_and_fifty_five_characters_on_a_standard_linux_filesystem_like_ext4_if_you_add_one_more_character_to_this_string_the_system_will_throw.pdf

@apyrgio
Copy link
Copy Markdown
Contributor

apyrgio commented Apr 15, 2026

Ok, I tried it out in a Fedora 43 VM as well, using Gnome, but I still can't reproduce it.

But, wait a sec:

Install Method: RPM (dangerzone-0.10.0-1.fc43.x86_64)

The "Start another conversion" button is not present in the 0.10.0 release yet. So... could it be that this is what you're observing?

In any case, the tests have passed, so I'll merge this PR.

@apyrgio apyrgio merged commit fa113b4 into freedomofpress:main Apr 15, 2026
21 of 23 checks passed
@moaaz-ae moaaz-ae deleted the fix/issue-143 branch April 15, 2026 10:37
@moaaz-ae
Copy link
Copy Markdown
Contributor Author

The version was actually the problem. Feel a bit silly for missing that. Thanks for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Word-wrap the document filename label

3 participants