Added images.

This commit is contained in:
Antoni Boucher 2015-08-07 23:28:24 -04:00
parent fedf9d9c72
commit 2be0743378
4 changed files with 33 additions and 1 deletions

View File

@ -20,7 +20,9 @@
"""The directory browser page."""
import os
import pkg_resources
import qutebrowser
from qutebrowser.utils import jinja
@ -38,6 +40,11 @@ def dirbrowser(url):
# pylint: disable=no-member
# https://bitbucket.org/logilab/pylint/issue/490/
folder = pkg_resources.resource_filename(qutebrowser.__name__,
'img/folder.png')
file = pkg_resources.resource_filename(qutebrowser.__name__,
'img/file.png')
def is_file(file):
return os.path.isfile(os.path.join(url, file))
@ -56,5 +63,6 @@ def dirbrowser(url):
for file in all_files if is_dir(file)],
key=lambda v: v['name'].lower())
html = template.render(title=title, url=url, icon='', parent=parent,
files=files, directories=directories)
files=files, directories=directories, folder=folder,
file=file)
return html

View File

@ -17,6 +17,26 @@
font-size: 118%;
font-weight: bold;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
ul > li {
background-repeat: no-repeat;
line-height: 22px;
padding-left: 25px;
}
ul > li {
background-image: url('{{folder}}');
}
ul.files > li {
background-image: url('{{file}}');
}
{% endblock %}
{% block content %}
@ -29,11 +49,15 @@
{% if parent %}
<li><a href="{{parent}}">..</a></li>
{% endif %}
</ul>
<ul class="folders">
{% for item in directories %}
<li><a href="file://{{item.absname}}">{{item.name}}</a></li>
{% endfor %}
</ul>
<ul class="files">
{% for item in files %}
<li><a href="file://{{item.absname}}">{{item.name}}</a></li>
{% endfor %}

BIN
qutebrowser/img/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
qutebrowser/img/folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B