* Rename KNOWN_FILE_EXTENSION to KNOWN_FILE_EXTENSIONS. * KNOWN_FILE_MIME_TYPES was never used for dictionary lookups (it was only iterated over), so convert it to a list of two-element tuples. * Convert the guessed mimetype to lowercase once instead of every time through the loop of KNOWN_FILE_MIME_TYPES. * Look up the filename's extension in the KNOWN_FILE_EXTENSIONS dictionary instead of iterating over it and testing with .endswith(). Signed-off-by: Daniel Harding <firstname.lastname@example.org>
The utils.file_icon() and supporting utils.ident_file_type() functions did not really belong in the utils module because they have to do with the QT UI. The utils.file_icon() function was only used in one place, in the qtutils.icon_file() function, so inline its functionality there, and move ident_file_type() from utils to qtutils. Signed-off-by: Daniel Harding <email@example.com>
Change some of the icon functions to return icon names that get passed to a single call to resources.icon() in create_treeitem() instead of calling resources.icon() every time an icon is specified. Signed-off-by: Daniel Harding <firstname.lastname@example.org>
daf997b added a new smaller staged icon for the status widget, but create_treeitem() was not updated to use the new icon when called with check=False. Update create_treeitem() to use the smaller icon. Signed-off-by: Daniel Harding <email@example.com>
git-cola has an icon for untracked files, but it wasn't being used, because the StatusTreeWidget was not providing the correct argument to qtutils.create_treeitem(). Change StatusTreeWidget.set_untracked() to pass untracked=True to StatusTreeWidget._set_subtree(), which will pass that value on to qtutils.create_treeitem(), causing the desired icon to be used. Signed-off-by: Daniel Harding <firstname.lastname@example.org>
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.