Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,15 @@ def is_file_dir(string):
return os.path.isdir(string)


def _is_image(path): # TODO: replace with filetype to do more intelligent introspection
return os.path.isfile(path) and \
os.path.splitext(path)[1] in [".png", ".jpeg", ".jpg", ".tga", ".dds"]


def get_file_icon(path):
if _is_image(path):
return Gio.FileIcon.new(Gio.file_new_for_path(path))

return (
Gio.file_new_for_path(path)
.query_info(
Expand Down