elementary / files

File browser designed for elementary OS
https://elementary.io
GNU General Public License v3.0
323 stars 75 forks source link

Templates folder: In "New >" menu, the hierarchy of templates is flattened #2491

Open teamcons opened 2 weeks ago

teamcons commented 2 weeks ago

What Happened?

I have a folder in Templates which contains a folder named "data science", with:

  1. a few python files, as well as:
  2. the folder "Supervised ML"
  3. the folder "Unsupervised ML", themselves with Python templates

The menu "New..." presents Supervised and Unsupervised along the other folder templates, not in a menu below "data science" as expected.

Steps to Reproduce

place populated folders and subfolders in Templates check via the "New" menu how they appear, and if anything is missing

Expected Behavior

Show all templates, respect hierarchy of templates

OS Version

8.x (Early Access)

Session Type

Secure Session (Wayland)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response

jeremypw commented 1 week ago

I am not seeing any difference between OS7.1 and OS8 regarding which entries appear. Folders inside Templates will not be shown if they contain no files or only hidden files. I havent tried it with Python or .docx files but there is no reason to think those are treated differently. I'll try to reproduce your situation more closely.

jeremypw commented 1 week ago

I can confirm that all entries in the templates part of the context menu are at the same level and do not follow the hierarchy of the Templates folder. This is the same as OS7.1. Not sure whether it followed the hierarchy in the past? Anyway, this is a separate issue to entries not appearing at all so needs to be raised in a separate report.

teamcons commented 1 week ago

I am not seeing any difference between OS7.1 and OS8 regarding which entries appear. Folders inside Templates will not be shown if they contain no files or only hidden files. I havent tried it with Python or .docx files but there is no reason to think those are treated differently. I'll try to reproduce your situation more closely.

I am not expecting empty folders or hidden files to show up, but templates files in the digital drawings folder it is mostly krita files (.kra)

other docx templates elsewhere also shows up, so it is definitively strange (and a bit disruptive:..)

I can confirm that all entries in the templates part of the context menu are at the same level and do not follow the hierarchy of the Templates folder. This is the same as OS7.1. Not sure whether it followed the hierarchy in the past? Anyway, this is a separate issue to entries not appearing at all so needs to be raised in a separate report.

Another issue has been filed for the missing entries, and this has been edited to focus on the flattened hierarchy. missing entries is quite more disruptive

jeremypw commented 1 week ago

Thanks for splitting the issues. Just had a look at the relevant code and files do not get added to template list if the list exceeds 32 items at the moment. Is that the case for you? Not sure why that limit was chosen - presumably to limit the size of the context menu. If the menu were not flattened then it would not be such an issue I guess.

teamcons commented 1 week ago

There are ten file templates in the data science directory, in total, including all subfolders

In total, all folders and subfolders included, we have 31 templates files, so even if i slorped everything in the base folder without dividing it should appear

i removed the data science folder (the one whose hierarchy is flattened), because it is unused and not to be used in the foreseeable future. this caused the missing templates in https://github.com/elementary/files/issues/2493 to appear normally

jeremypw commented 1 week ago

It sounds like it is something to do the total number of templates then. Strange that it is less than MAX_TEMPLATES in the code. The simplest solution would be to increase the maximum items to 64 or more.

The flattening of the hierarchy only applies to folders for me. i.e. all folders appear at the top level. Templates appear either in the top-level or in the submenu of the folder item.

teamcons commented 1 week ago

Ah... There seem to be a confusion here. My issue is that all folders are at top level. The files are in the right folders.

"top level" were the words i was missing (non native english, my apologies)

The flattening of the hierarchy only applies to folders for me. i.e. all folders appear at the top level. Templates appear either in the top-level or in the submenu of the folder item.

So this would be the issue. Not being able to organize folders beyond top level

the missing entries https://github.com/elementary/files/issues/2493 could be because folders are counted in the max items limit ?

jeremypw commented 1 week ago

Yes, I checked the code again and the total number of items in the templates list, including folders, is compared to MAX_TEMPLATES.