Opened 19 years ago
Last modified 9 years ago
#2695 new enhancement
[PATCH] Pretty icons for various file types.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | next-major-releases |
Component: | version control/browser | Version: | 0.9.3 |
Severity: | normal | Keywords: | patch icons mime-types |
Cc: | m@…, choll@…, trac@…, itamarost@…, Thijs Triemstra | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I'd like to propose using different icons for various file-types in the browser view.
The Silk icon set at http://www.famfamfam.com/lab/icons/silk/ is "licensed under a Creative Commons Attribution 2.5 License and contains good icons for a number of file-types, including:
- http://www.famfamfam.com/lab/icons/silk/icons/folder.png a folder icon
- http://www.famfamfam.com/lab/icons/silk/icons/folder_delete.png folder "deny"
- http://www.famfamfam.com/lab/icons/silk/icons/page_white.png a default file icon
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_delete.png file "deny"
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_acrobat.png Acrobat/PDF
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_actionscript.png Action Script
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_c.png C
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_cplusplus.png C++
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_csharp.png C#
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_code.png Code/Markup
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_coldfusion.png Cold Fusion
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_excel.png Excel
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_flash.png Flash
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_gear.png Settings/Config (gear)
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_h.png .h
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_paint.png Paint
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_php.png PHP
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_ruby.png Ruby
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_visualstudio.png Visual Studio
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_word.png Word
- http://www.famfamfam.com/lab/icons/silk/icons/page_white_world.png World/Globe
- …and others.
Even if no one likes my idea for the different file types, the basic folder, file, and deny icons could be used.
I've started hacking this together in my own Trac install, but I'm not a python developer, so I'm not sure if it's worth anything to anyone else. I'll be posting a first-attempt patch in just a moment.
Attachments (6)
Change History (23)
by , 19 years ago
Attachment: | pretty_icons.diff added |
---|
comment:1 by , 19 years ago
Anyway, as I was saying, my grasp of Python is somewhat limited. I learned while putting this much together that there's no switch/select case type of structure in Python, so I imitated an idiom I discovered along the way.
I started with 'Rakefile' because I can match the whole file name against a string. From here I could use some help matching against file extensions, perhaps with regular expressions. I'd also considered working with mime_types to determine which CSS class should be applied.
Ideally, IMO, the icon mapping would occur in some misc. configuration file that could be easily updated, but my knowledge of Python and Trac internals prevented me from getting that far. Anyone want to lend some help and/or pointers?
Thanks!
follow-up: 5 comment:2 by , 19 years ago
Cc: | added |
---|
I think it would be nice-to-have. Though icons should be set according to the files mime-type.
comment:3 by , 19 years ago
Cc: | added |
---|
I agree it would be nice to have. And yes it should be set according to mime-types.
by , 19 years ago
Attachment: | pretty_icons_2nd_pass.diff added |
---|
My second attempt at this; still far from perfect, I know… I'm looking for any suggestiong anyone may have :)
comment:4 by , 19 years ago
Cc: | added |
---|---|
Summary: | Pretty icons for various file types. → [PATCH] Pretty icons for various file types. |
comment:5 by , 18 years ago
Replying to Markus Tacker <m@tacker.org>:
I think it would be nice-to-have. Though icons should be set according to the files mime-type.
Yes, I think that if implemented, we should follow the Freedesktop Icon Naming Specification since this would allow for easier integration of icon sets following that standard (such as Tango).
comment:6 by , 18 years ago
Keywords: | icons mime-types added |
---|---|
Milestone: | → 0.12 |
Owner: | changed from | to
Severity: | trivial → normal |
Would be nice even for 0.12
follow-up: 8 comment:7 by , 15 years ago
Cc: | added |
---|
Indeed would be nice.
I wonder if this idea could be combined with another idea I had - enabling icon overlays in browser listing as function of (mime-type, item properties, permissions, more?).
Few use cases to better explain what I mean:
- For files with svn:needs-lock: overlay the file icon with a lock icon (could be even cooler if the repository layer checks the lock status and chooses between a locked or unlocked!)
- Together with #6474: "Virtual" folders and files (resulting from external definitions) overlaid with a "link" icon.
- For items with "access denied" for active user: Overlay with "no-entry" icon.
- You get the idea…
what do you think?
follow-up: 9 comment:8 by , 15 years ago
Replying to itamaro:
what do you think?
Excellent ideas. Except maybe for the "access denied" icon, as those entries are actually hidden completely on purpose.
Go for it!
follow-up: 10 comment:9 by , 15 years ago
comment:10 by , 15 years ago
Replying to itamaro:
Any ideas on how to implement icon overlaying? Is it in the level of Genshi? jQuery? Or some Python magic in the web_ui?
I would use .png
overlays with transparency, and use CSS classes to add them to selected entries. Of course, you'll need some Python-fu in web_ui.py
to retrieve the image and overlay info (mime type, svn:needs-lock
, svn:externals
).
comment:11 by , 15 years ago
By the way, in order to make this work, every time a folder is rendered it will be needed to loop over all the items and get their metadata (mime-type etc.).
In folders with many items this may cause a significant performance penalty, unless this information is cached during repository syncs.
From what I've seen, at the moment this information is not cached (unless I misunderstood something). Are there any plans to extend versioncontrol caching to include this? If not, I guess a different ticket is needed for this… (or an alternative solution I missed)
comment:12 by , 15 years ago
You're quite right - however you might as well ignore that aspect of things for the first approach, and make the whole feature enabled via a config option. So for small repositories where it doesn't matter much, you have the feature without the need to change the cache, and for bigger repositories, you can turn the feature off while waiting for the cache enhancements ;-)
Currently, only changeset information is cached, no per node information. That needs to be done with extreme caution, think about VCS backends like Subversion which branch by copying… it's currently cheap, as we only record the copy directory operation as expressed in the changeset, but if we would from that blindly store all the corresponding tree in order to cache the properties, that would quickly kill your disk ;-) (well, at least once your repository is in the 10000s of files and you have dozens of branches and hundreds of tags). Some old brainstorming on the topic can be found in VcRefactoring#NewRepositoryCache, although I didn't address the issue of properties.
by , 15 years ago
Attachment: | overlay-example.png added |
---|
Screenshot of source browser with lock-overlay for svn:needs-lock file
by , 15 years ago
Attachment: | overlays-poc.patch added |
---|
Initial overlay-icons proof-of-concept patch
comment:13 by , 15 years ago
Posted an initial patch (overlays-poc.patch) that overlays a lock icon () over files with svn:needs-lock property set.
I'm not too comfortable messing with the CSS and templates, so I'd appreciate your feedback on this take, as well as any improvement ideas / tips.
By the way, is this "overlaying feature" on-topic for this ticket? Or should I create another ticket for it?
follow-up: 15 comment:14 by , 15 years ago
I haven't tested the patch yet, but the visual aspect is very nice. I'm wondering about the performance impact, though. IIRC, get_properties()
directly hits the repository, as that information isn't cached, so for many files, I suspect that there's a noticeable slowdown.
comment:15 by , 14 years ago
Cc: | added |
---|
Replying to rblank:
I haven't tested the patch yet, but the visual aspect is very nice. I'm wondering about the performance impact, though. IIRC,
get_properties()
directly hits the repository, as that information isn't cached, so for many files, I suspect that there's a noticeable slowdown.
Perhaps that should be configurable and up to the user, perhaps we can introduce 3 or 4 more, like the svn:needs-lock property?
comment:16 by , 10 years ago
Owner: | removed |
---|
comment:17 by , 9 years ago
Keywords: | patch added |
---|
First attempt, patched against Trac trunk.