spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.22k stars 1.59k forks source link

Put directories at top of file listing when sorting by name #15512

Open battaglia01 opened 3 years ago

battaglia01 commented 3 years ago

Issue Report Checklist

Problem Description

When sorting by name, directories are all mixed in with everything by name, which is different from the way most OS's do it, which is to have all the directories at the top (sorted by name) and then all files (also sorted by name). It may be best if this were some kind of setting you could change, since some people may also want it the way it is, but it would be nice if the directory-first setting were available somehow.

The way things are now is also kind of an eye strain because .py files, .pyc files, and folders are all small black icons which are difficult to differentiate from one another at a glance, although you do have the little ">" there to expand folders.

What steps reproduce the problem?

  1. Open the "Files" pane
  2. Sort by name
  3. Folders are mixed in with files

What is the expected output? What do you see instead?

  1. If sorted by name alphabetically, directories are first and then files.
  2. If sorted reverse-alphabetically, you have files first and then directories.
  3. Currently, the sorting behavior is correct for everything else - size, type, date modified. Only sorting by name differs from the usual.

Versions

Dependencies


# Mandatory:
applaunchservices >=0.1.7     :  0.2.1 (OK)
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  7.22.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  22.3.0 (OK)
nbconvert >=4.0               :  6.0.7 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.8.1 (OK)
pylint >=1.0                  :  2.7.4 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2           :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=0.5.7             :  1.0.2 (OK)
qtconsole >=5.0.3             :  5.0.3 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.8.3                 :  0.9.7 (OK)
setuptools >=39.0.0           :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                :  3.5.3 (OK)
spyder_kernels >=2.0.1;<2.1.0 :  2.0.1 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
zmq >=17                      :  20.0.0 (OK)

# Optional:
cython >=0.21                 :  0.29.23 (OK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.20.1 (OK)
pandas >=1.1.1                :  1.2.4 (OK)
scipy >=0.17.0                :  1.6.2 (OK)
sympy >=0.7.3                 :  1.8 (OK)
ccordoba12 commented 3 years ago

Hey @battaglia01, thanks for reporting. You have a valid point here.

Unfortunately, we are swamped at the moment, so we won't be able to address it in several months, perhaps a year. So, if you would like to see this fixed in the short term, we'd really appreciate your help with it. Otherwise, you'll have to wait for us.

battaglia01 commented 3 years ago

I'm sure this is a one line fix - where is the relevant sorting routine stored?

On Wed, May 5, 2021, 4:42 PM Carlos Cordoba @.***> wrote:

Hey @battaglia01 https://github.com/battaglia01, thanks for reporting. You have a valid point here.

Unfortunately, we are swamped at the moment, so we won't be able to address it in several months, perhaps a year. So, if you would like to see this fixed in the short term, we'd really appreciate your help with it. Otherwise, you'll have to wait for us.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/15512#issuecomment-832993313, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZFMQP2EYPUGXRUGVD7FLTMGUTNANCNFSM44D5HX2Q .

battaglia01 commented 3 years ago

Er, this is not at all easy to do, and is a much deeper problem with Qt's QFileSystemModel that many have talked about. See also:

https://forum.qt.io/topic/113138/sorting-folders-first-qfilesystemmodel-with-directory-filter https://stackoverflow.com/questions/10789284/qfilesystemmodel-sorting-dirsfirst https://stackoverflow.com/questions/20006775/how-to-sort-folders-above-files-with-qsortfilterproxymodel

Maybe if someone wants to do this, they can start there, but sheesh.