-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
IDLE: Path Browser vertical spacing is too small, causing the text to be cut off #122392
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
Comments
There is a GH project page for I temporarily fixed browser line spacing a decade ago in #66818 by increasing tree.py line 202 (first after So browser line spacing is a duplicate issue. However, since using Treeview is still in the future, I will consider patching tree.py to calculate the line spacing. Such code might be reusable with Treeview. Currently the browsers use the same system font as used for the menus, which is not changed by user font selections. As long as this is true, spacing could be calculated on startup rather than just for each browser. My current idea is to write a line, say, 'sys.path' (with descending chars) in a text widget and get the height of the bounding box. I will do some experiments next. I would need help with code and review for these issues. How familiar are you with tkinter? Any experience with ttk styles? Removing unneeded icons is #69277. That will definitely be easier with Treeview. The browser icons are folder.git, minusnode.gif, openfolder.gif, and plusnode.gif in idlelib.Icons. They fit within 16x16 pixels. Such files could be replaced if someone 'paints' new ones from scratch, without directly copying from elsewhere, and contributes them. Do you have anything in mind? Adding new icons, possibly blank for files and functions might be an alternative to simply removing the python icon. |
Please copy the following into a file and run it.
I see (2, 2, 8, 16) (10, 2, 8, 16) (18, 2, 8, 16). Although the font in the tk window is not the same as the module browser window, the height of Ãny is the same as far as I can tell, and the spacing of 16 + 4 = 20 pixels is more than adequate. Change dy in your tree.py to the reported height plus a bit and then try module browser on this or other .py file. I going to repeat with text written on a canvas. |
I see (2, 2, 7, 13) (9, 2, 7, 13) (16, 2, 7, 13). dy=25 is fine for me
I've used ttk to create some simple utility GUIs before. They were quite simple, so I didn't use many components. One example (ignore the non-English parts) is this GitHub project. Although the appearance differs from the default tkinter style, that's because I used the sv-ttk modulehttps://github.com/rdbende/Sun-Valley-ttk-theme for styling, which is just a ttk/tcl theme. It's entirely written with ttk I have a radical idea: path browser is create a new window to preview folders by clicking to view subfolders or files, which is basically the same as the file Explorer that comes with the system. We can use import os
import sys
import subprocess
def path_browser(path):
system = sys.platform()
if system == "win32":
os.startfile(path)
elif system == "darwin":
subprocess.Popen(["open", path])
elif system == "linux":
subprocess.Popen(["xdg-open", path])
else:
raise OSError("Unsupported operating system")
folder_path = "/path/to/your/folder"
path_browser(folder_path) Other places that use the path browser also use |
Since 13 is shorter than 16, it puzzles me that you need a greater height to avoid overlap. I did a similar test as above with canvas.create_text and got a height of 17. But this is only used for extra label text in stackviewer. The browsers display object text as labels within windows on the canvas. I believe this is to get event binding (but I believe this could be done with canvas texts). Try this code.
I get (2, 2, 27, 21). I should really have dy = 21 = 17 + 4 padding, set to work on Windows. The 1 pixel overlap is visible with careful observation of selection highlighting. What is your OS, what is printed, and do you see overlap with this code with dy=20? |
This is making more sense. How about with 23? |
Thanks. The bounding box height looks like it will work. I am thinking of the best way to get it. |
Based on the above discussion, after I looked at the source code and found that we can set the size of This value is not used in the first row, so we can set its initial value to I've created a PR to fix this, it should help. |
After my last comment, I did an experiment very similar to the PR, but was not satisfied. I decided to try using ttk.Treeview and let ttk do the spacing. I got as far as adding top-level items, with good result, before I needed to replace my system. I now have a 4k monitor and see the problem this issue is about; hence I can test fixes. Since I do not expect to have a complete replacement ready before the 3.14.0a1 release in, perhaps, 10 days, I will merge Xiaokang's first PR if requested changes are made and it then gets enough testing. Not allowing spacing to be reduced below the current value should make it fairly safe. |
I've done revising it, but I'm not sure if this is what you meant. |
No, I think it's just that the underline isn't visible because of the occlusion. |
Underscores, as their name implies, are at least 2 pixels down from the main bottom line of the text. They are visible for me with the patch. |
Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors. --------- Co-authored-by: Terry Jan Reedy <[email protected]>
…22392) (pythonGH-124975) Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors. --------- (cherry picked from commit c5df1cb) Co-authored-by: Zhikang Yan <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
…22392) (pythonGH-124975) Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors. --------- (cherry picked from commit c5df1cb) Co-authored-by: Zhikang Yan <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
GH-124975) (#125062) gh-122392: IDLE - Fix overlapping lines in browsers (GH-122392) (GH-124975) Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors. --------- (cherry picked from commit c5df1cb) Co-authored-by: Zhikang Yan <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
GH-124975) (#125061) gh-122392: IDLE - Fix overlapping lines in browsers (GH-122392) (GH-124975) Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors. --------- (cherry picked from commit c5df1cb) Co-authored-by: Zhikang Yan <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
Bug description:
Noise: @terryjreedy
The vertical spacing is too small, causing the text to be cut off. I'm not sure if this issue exists on other systems as well. Currently, I may not create a PR to fix it because I haven't found where the related code is and what the cause of the bug is. IDLE is a program with a long history; the folder icons here are very "retro"
old, and the code is quite heavy.Operating systems tested on:
Windows or all
Linked PRs
The text was updated successfully, but these errors were encountered: