GithubHelp home page GithubHelp logo

karlch / vimiv-qt Goto Github PK

View Code? Open in Web Editor NEW
175.0 175.0 15.0 20.63 MB

An image viewer with vim-like keybindings

Home Page: https://karlch.github.io/vimiv-qt/

License: GNU General Public License v3.0

C 2.03% Shell 0.09% Python 86.61% Gherkin 10.56% Makefile 0.22% Roff 0.50%
image-viewer python qt5 vim

vimiv-qt's People

Contributors

buzzingwires avatar dependabot-preview[bot] avatar dependabot[bot] avatar jameslivulpi avatar jcjgraf avatar karlch avatar pyup-bot avatar sanjayankur31 avatar schyzophrene-asynchrone avatar thomasrockhu-codecov avatar xfzv avatar xlucn avatar yutsuten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vimiv-qt's Issues

Add option to hide library at startup

Instead of using the library to open images, the user can also use the :open command. Some may prefer this and therefore never want to see the library.

Fix completion for shell escaped paths

When completing on paths with spaces or with tilde, the shell escaping which allows proper opening of paths with spaces, destroys completion for further paths.

This makes it impossible to complete on, e.g. ~/Images/ or 'path with spaces'/.

The relevant completion code is in vimiv/completion/completionmodels.py and is implemented in the PathModel class. Particularly relevant is the call to shlex.quote which creates the escaped paths in the first place.

Manipulated image overlay sometimes hidden

I have observed that the overlay which displays the manipulated image sometimes does not show at all. The exact reason and reproducibility is yet to be found but this should obviously never happen.

Don't raise if keybind section is not specified

Currently if a keybind section such as [GLOBAL] is not specified in keys.conf file then we get the following error:

Traceback (most recent call last):
  File "/home/pedro/.local/bin/vimiv", line 11, in <module>
    load_entry_point('vimiv==0.1.0', 'gui_scripts', 'vimiv')()
  File "/home/pedro/.local/pipx/venvs/vimiv/lib/python3.7/site-packages/vimiv/vimiv.py", line 249, in main
    startup(sys.argv[1:])
  File "/home/pedro/.local/pipx/venvs/vimiv/lib/python3.7/site-packages/vimiv/vimiv.py", line 59, in startup
    keyfile.parse(args)
  File "/home/pedro/.local/pipx/venvs/vimiv/lib/python3.7/site-packages/vimiv/config/keyfile.py", line 31, in parse
    _read(keyfile)
  File "/home/pedro/.local/pipx/venvs/vimiv/lib/python3.7/site-packages/vimiv/config/keyfile.py", line 66, in _read
    section = parser[mode.name.upper()]
  File "/usr/lib/python3.7/configparser.py", line 958, in __getitem__
    raise KeyError(key)
KeyError: 'GLOBAL'

vimiv should have a set of default that can be overriden by config files and avoid giving errors if they are not specified (a similar behaviour happens in the vimiv.conf file where if a setting is not specified then a warning is raised) Thanks!

Consider using type annotations

They could help clarify quite some parts of the code, especially when using the objreg and other tools that make it rather difficult to see what's coming out.

As I haven't used type annotations yet, further reading as to when and how much to use them is required. Any opinions and hints are welcome.

UI blocks when processing working directory changes

When the working directory changes the UI blocks as time.sleep is used directly in the main thread (_process method in utils.working_directory.WorkingDirectoryHandler). The sleep should either be removed or replaced by a proper async callback which would need to make sure the callback is still valid after the changes which could have happened in the meantime, e.g. new working directory opened.

Reasons why the sleep exists in the first place:

  • Files may be written in parts and we are only interested in the final result
  • Tools like mogrify create temporary files we don't care about

Bar not shown in command mode

I disable the statusbar on startup. When I enter command mode, the bar does not show up and I cannot see what I type, even if I toggle the bar while vimiv is running. Switching to fullscreen mode and back, after showing the bar seems to fix the issue.

Expected behavior: the bar should always show up when I type something in command mode.

[19:38:46] DEBUG: Start: vimiv --log-level debug
[19:38:46] DEBUG: Overriding 'monitor_filesystem' with 'True'
[19:38:46] DEBUG: Overriding 'shuffle' with 'False'
[19:38:46] DEBUG: Overriding 'startup_library' with 'False'
[19:38:46] DEBUG: Overriding 'style' with 'papercolor'
[19:38:46] DEBUG: Overriding 'search.ignore_case' with 'True'
[19:38:46] DEBUG: Overriding 'search.incremental' with 'True'
[19:38:46] DEBUG: Overriding 'image.autoplay' with 'True'
[19:38:46] DEBUG: Overriding 'image.autowrite' with 'True'
[19:38:46] DEBUG: Overriding 'image.overzoom' with '1.0'
[19:38:46] DEBUG: Overriding 'library.width' with '0.3'
[19:38:46] DEBUG: Overriding 'library.show_hidden' with 'False'
[19:38:46] DEBUG: Overriding 'library.file_check_amount' with '30'
[19:38:46] DEBUG: Overriding 'thumbnail.size' with '128'
[19:38:46] DEBUG: Overriding 'slideshow.delay' with '2.0'
[19:38:46] DEBUG: Overriding 'slideshow.indicator' with 'slideshow:'
[19:38:46] DEBUG: Overriding 'statusbar.collapse_home' with 'True'
[19:38:46] DEBUG: Overriding 'statusbar.show' with 'False'
[19:38:46] DEBUG: Overriding 'statusbar.message_timeout' with '5000'
[19:38:46] DEBUG: Overriding 'statusbar.left' with '{mode}'
[19:38:46] DEBUG: Overriding 'statusbar.left_image' with '{mode}'
[19:38:46] DEBUG: Overriding 'statusbar.left_thumbnail' with '{mode}'
[19:38:46] DEBUG: Overriding 'statusbar.center_thumbnail' with 'thumbnail-size}'
[19:38:46] DEBUG: Overriding 'statusbar.center' with '{slideshow-indicator} {slideshow-delay}'
[19:38:46] DEBUG: Overriding 'statusbar.right' with '{keys} {pwd}'
[19:38:46] DEBUG: Overriding 'title.fallback' with 'vimiv'
[19:38:46] DEBUG: Overriding 'title.image' with 'vimiv - {basename}'
[19:38:46] DEBUG: Read configuration from ........./.config/vimiv/vimiv.conf
[19:38:46] DEBUG: Read keybindings from '......./.config/vimiv/keys.conf'
[19:38:46] DEBUG: Initializing early objects
[19:38:46] DEBUG: Registering object '<vimiv.utils.slideshow.Slideshow object at 0x7f8a245611f8>'
[19:38:46] DEBUG: Registering object '<vimiv.imutils.imstorage.Storage object at 0x7f8a24561168>'
[19:38:46] DEBUG: Registering object '<vimiv.imutils.imtransform.Transform object at 0x7f8a205e7128>'
[19:38:46] DEBUG: Registering object '<vimiv.imutils.immanipulate.Manipulator object at 0x7f8a24561678>'
[19:38:46] DEBUG: Registering object '<vimiv.imutils.imfile_handler.ImageFileHandler object at 0x7f8a24561708>'
[19:38:47] DEBUG: Initializing UI
[19:38:47] DEBUG: Registering object '<vimiv.gui.commandline.CommandLine object at 0x7f8a2060bb88>'
[19:38:47] DEBUG: Registering object '<vimiv.gui.bar.Bar object at 0x7f8a2060b5e8>'
[19:38:47] DEBUG: Registering object '<vimiv.gui.image.ScrollableImage object at 0x7f8a2060bdc8>'
[19:38:47] DEBUG: Registering object '<vimiv.gui.thumbnail.ThumbnailView object at 0x7f8a2060bee8>'
[19:38:47] DEBUG: Creating function for status module 'active_name'
[19:38:47] DEBUG: Creating function for status module 'running_indicator'
[19:38:47] DEBUG: Creating function for status module 'delay'
[19:38:47] DEBUG: Creating function for status module 'unprocessed_keys'
[19:38:47] DEBUG: Creating function for status module 'get_index'
[19:38:47] DEBUG: Creating function for status module 'total'
[19:38:47] DEBUG: Creating function for status module 'basename'
[19:38:47] DEBUG: Creating function for status module '_get_zoom_level'
[19:38:47] DEBUG: Registering object '<vimiv.gui.library.Library object at 0x7f8a2053d168>'
[19:38:47] DEBUG: Registering object '<vimiv.gui.manipulate.Manipulate object at 0x7f8a2053d3a8>'
[19:38:47] DEBUG: Registering object '<vimiv.gui.completionwidget.CompletionView object at 0x7f8a2053d708>'
[19:38:47] DEBUG: Registering object '<vimiv.completion.completer.Completer object at 0x7f8a2053d798>'
[19:38:47] DEBUG: Registering object '<vimiv.gui.mainwindow.MainWindow object at 0x7f8a2060b558>'
[19:38:47] DEBUG: Opening paths
[19:38:47] DEBUG: Startup completed
[19:38:50] DEBUG: Creating function for command 'command'
[19:38:50] DEBUG: Leaving mode image
[19:38:50] DEBUG: Mode.COMMAND widget focused
[19:38:50] DEBUG: Entered mode Mode.COMMAND
[19:38:50] DEBUG: Creating function for status module 'pwd'
[19:38:50] DEBUG: Ran 'command' succesfully
[19:38:51] DEBUG: Creating function for command 'leave_commandline'
[19:38:51] DEBUG: Leaving mode command
[19:38:51] DEBUG: Mode.IMAGE widget focused
[19:38:51] DEBUG: Entered mode Mode.IMAGE
[19:38:51] DEBUG: Ran 'leave-commandline' succesfully
[19:38:52] DEBUG: Creating function for command 'set'
[19:38:52] DEBUG: Ran 'set statusbar.show!' succesfully
[19:38:52] DEBUG: Leaving mode image
[19:38:52] DEBUG: Mode.COMMAND widget focused
[19:38:52] DEBUG: Entered mode Mode.COMMAND
[19:38:52] DEBUG: Ran 'command' succesfully
[19:38:53] DEBUG: Leaving mode command
[19:38:53] DEBUG: Mode.IMAGE widget focused
[19:38:53] DEBUG: Entered mode Mode.IMAGE
[19:38:53] DEBUG: Ran 'leave-commandline' succesfully
[19:38:54] DEBUG: Creating function for command 'fullscreen'
[19:38:54] DEBUG: Ran 'fullscreen' succesfully
[19:38:56] DEBUG: Ran 'fullscreen' succesfully
[19:38:56] DEBUG: Leaving mode image
[19:38:56] DEBUG: Mode.COMMAND widget focused
[19:38:56] DEBUG: Entered mode Mode.COMMAND
[19:38:56] DEBUG: Ran 'command' succesfully
[19:38:59] DEBUG: Leaving mode command
[19:38:59] DEBUG: Mode.IMAGE widget focused
[19:38:59] DEBUG: Entered mode Mode.IMAGE
[19:38:59] DEBUG: Ran 'leave-commandline' succesfully
[19:39:00] DEBUG: Creating function for command 'quit'
[19:39:00] DEBUG: Ran 'quit' succesfully

Plug-in support

Similar to vim, a general plug-in infrastructure would be an amazing feature.

This would require:

  • A plug-in infrastructure in the code
  • An idea of plug-in management (config, packaging, installing, ...)
  • A few default plug-ins to get started

Ideas for default plug-ins:

  • Printing support
  • Image editing features

Printing support

As requested in karlch/vimiv#68 printing support with a simple :print command which displays the standard QT print dialog makes sense and should not be too difficult.

Lossless transformation of images

The jpegtran tool shows that it is possible to do lossless transformation of jpeg images. It would be nice if vimiv did this as well. As we already use a C extension for brightness and co., this might be possible in there as well.

Reset exif orientation tag when saving an image

When saving an image from vimiv the thumbnail exif orientation tag has been applied. Therefore, when saving and not resetting, the image is later loaded with the wrong orientation as the tag is applied twice: once on the saved image, once when loading. Therefore the orienatation tag of the exif data should be reset when saving an image.

This would require changing the piexif.transplant call in the _copy_exif method in imutils.imfile_handler and reading into the documentation of piexif to see how to do this.

Increase slideshow delay binding overrides dot command

The binding to increase the slideshow delay in image mode is . which is also bound to repeat-command. This hides repeat-command in image mode. As the dot command is more well known from vim, the slideshow delay should have a different binding.

Technically this requires changing the binding in config/configcommands.py to something else. To keep everything consistent the decrease keybinding should also be changed. Possibly also the binding to toggle the slideshow defined in utils/slideshow.py has to be changed to keep consistency.

Mouse support

Although this is not the main scope of vimiv, simple mouse support should be given. This includes:

  • Binding mouse clicks to commands
  • Binding scroll events to commands (same as click event?)

Update completion once commands changed

When for example an alias is added, it will not pop up in the completion until a different completion model than command was used, as the completion model is not regenerated. This should be changed, probably using a signal - slot based approach.

Idea: there is a commands_changed signal which is emitted once a new alias was added with the :alias command, it could also be used in other places once there is the need for it, and the completer reloads the completion model once this signal was emitted.

False positives with QImageReader.canRead

In some cases, e.g. with .tar.gz files, the function utils.files.is_image which uses QImageReader(filename).canRead returns True but actually reading the image fails later. The solution can be to either:

  • improve the is_image function (better)
  • catch the exception and handle it later (worse)

Rethink manipulate mode

The current version of manipulate mode with one function to enhance brightness and contrast always applied to the original image seems difficult to extend. Main problem is storing the initial image and the edited version in memory. When more functions are added each would have to keep an image "all manipulations minus this function" in memory and apply changes to this. There must be a better way โ„ข๏ธ. Maybe we can get some ideas from Gimp or other image editing programs.

Any ideas are very welcome ๐Ÿ˜„

Solid default style

The default style should work well with most monitor sizes and have colors that are acceptable for most setups. It may make sense to have a default light and a default dark theme.

Path completion for multiple paths

As it is now possible to handle multiple paths in e.g. :open, the completion should start with new suggestions once a space is entered after the first complete path.

This requires an update to the PathModel class in vimiv/completion/completionmodels.py. Currently the implementation is in the on_text_changed method but with multiple paths some refactoring and splitting into multiple methods may become necessary.

Different image sorting than by name

Currently images are always sorted by name / path. There could be different sorting, e.g. case-sensitive vs. case-insensitive, by time (exif, access, ...) and so forth.

Implementation could be a new setting image.order or similar, which has different options. The options would be converted to a function that takes the image path an returns the sort key so it can be passed to sorted.

Therefore there would be two main steps:

  • Write a new ImageOrder setting
  • Use the setting value in the calls to sorted, one in utils.files.listdir for library, opening in the beginning, one in api.commands._CommandArguments.parse_args for path-like commands

Thanks for the initial idea in karlch/vimiv#79

Plugin ideas

This issue is a collection of ideas for plugins. If you have any idea for a plugin you would like to see, feel free to comment here and I can add it to the list.

  • A plugin manager to install, update and clean up plugins
  • Ctrl P or similar as fuzzy file finder
  • A theme manager to install, update and configure themes
  • Map displaying the exif coordinates of the current image

Add option for fuzzy completion matching

There is already a class in vimiv/api/completion that allows fuzzy filtering. There could be an option to use this class as a base instead of the standard text filter to allow fuzzy matching of commands, paths, ...

Make completion suggestions mode dependent

Currently the different completion models only trigger on the text in the command line, irrespectively of the current mode. This leads to showing completion of commands that may not be available at all. An example of this is the :undelete command in manipulate mode. Once typing :undelete the completion model switches to the corresponding trash model but the command will finally fail as :undelete is not available in manipulate mode.

This would require updating the logic of api.completion.get_module to include the mode, passing the mode in completion.completer and including the modes for which a module is valid in the module class.

Manipulate reset when transforming image

The changes to brightness and contrast are lost if an image is transformed (rotated, flipped) afterwards.

Steps to reproduce:

  • Enter manipulate mode gm
  • Change brightness, e.g. by K
  • Accept changes <Return>
  • Rotate the image <

Add keybinding cheatsheet

A keybinding cheatsheet similar to the old one available here would be great. It could include the main keybindings which are not expected to change.

EDIT:
I would like to change the requirements. The cheatsheet should be auto-generated in python as much as possible, although maybe not auto-commited in the gh-pages branch so we can take a look at it first. Once this is done, we could also think about adding cheatsheets for different layouts like Dvorak as pointed out by MCP in a PM.

Command chaining

Chaining multiple commands in the commandline and in keybindings could be useful. This would allow things like:

:tag-load my_tag && open %m

which would load a tag and open all images in the tag at once. This would then automatically also allow aliasing chained commands like this one to e.g. tag-open.

For doing so the command runner in vimiv/commands/runners.py, mainly the function run, would have to be updated to split the command and run all splits. This would also have to properly deal with the case that one command fails, i.e. do not continue any later commands. This requires some changes to the exception handling as currently all command-like errors are caught and logged and the runner returns without error.

Marking sometimes hides filename in library

When the filename in the library is long and the file is marked, it sometimes vanishes completely instead of being elided appropriately.

The logic happens in gui.library.LibraryDelegate in the elided method.

Add nice __repr__ methods for main classes

For logging purposes defining a nice __repr__ method would be nice to have. This is especially useful for classes that are registered in the object registry using api.objreg.register. Adding the methods should be simple, finding the classes in the registry could use a grep in the vimiv folder like grep -r "api.objreg.register".

Improve zoom and scaling performance

Using Qt.SmoothTransformation to rescale the pixmap in gui/image.py creates nice results, but is horribly slow.

Random thoughts:

  • Scale the painter directly, downside: the quality is very bad
  • First scale quickly, then, once scaling is done, reload the displayed part of the image as a smooth transformation

Missing files

Before the first release a few more files are needed:

  • .desktop
  • .appdata
  • man page
  • Contributing.md
  • icons

Don't reset zoom level when reloading an image

Let's say I've opened an image and zoom in to say 200%. Now if I modify that imagine from outside vimiv then vimiv correctly picks up the change but sets zoom level back to 100%. I believe the correct behaviour would be to respect the current zoom level and not reset it.

Website for documentation

There should be a github pages website for documentation. It would be nice to generate as much of the documentation directly from the code as possible.

Things that could be documented in the code:

  • commands
  • settings
  • styles
  • statusbar modules

Additional documentation to think about:

  • homepage
  • introduction
  • usage
  • screenshots
  • for developers (style, tests, basic code structure, ...)
  • changelog

Additional completions

Ideas for additional completion models:

  • command arguments
  • path completion for external commands
  • special completion for :mark

Marks/Tags

There should be a way to mark a list of images and saving this list under a name. It might also be nice to mark single images or library directories and saving them to a "quickmark" similar to qutebrowser's quickmark system.

Ideas:

  • The lists are saved to $XDG_DATA_HOME/vimiv/Tags
  • The lists could support a substructure, meaning it could be possible to group multiple lists into directories under $XDG_DATA_HOME/vimiv/Tags/dirname
  • The quickmarks are saved to $XDG_DATA_HOME/vimiv/quickmarks

Commands:

  • tag and quickmark with positional arguments action and name
  • action is one of add, load and delete
  • name is the name of the tag/quickmark

Search

Search should be implemented for image, library and thumbnail mode.

Corresponding settings:

  • incsearch
  • searchcase

Corresponding styles:

  • library.search.highlighted.bg
  • library.search.highlighted.fg
  • thumbnail.search.highlighted.bg

Add command to display all keybindings in current mode

The command, e.g. :keybindings, would display a widget which lists all keybindings for the current mode in the form of binding: command. For formatting a table style makes sense.

The easiest implementation is probably a pop-up window similar to the version pop-up implemented in gui.version_popup. All currently valid keybindings as binding-command dictionary can be retrieved via:

from vimiv import api
...
bindings = api.keybindings.get(api.modes.current())
for binding, command in bindings.items():
    ...

The actual command would be implemented by gui.mainwindow, similar to the :version command.

Additional manipulations

Ideas for manipulations that could be implemented:

  • saturation
  • sharpness
  • blur
  • gamma
  • colorize

These are definitely not high-priority as vimiv is mostly supposed to be an image-viewer but could be nice to have.

Move to previous search binding overrides paste commands

The binding for search-prev P overrides the bindings for the differente paste commands paste-name Pp and paste-name --primary PP. As the search binding is certainly more used, the different paste bindings should either be changed or removed. Finding something fitting and mnemonic might be difficult as both p and P are already used.

Removing them only requires deleting the two binding lines in utils.clipboard above the paste_name function definition. Replacing them requires changing the binding in the before mentioned lines and therefore coming up with a good binding.

Camera integration

It would be nice to have some sort of integration with cameras to e.g. import all files from the camera. This is probably rather heavy and should be implemented as a plugin as it almost certainly comes with additional dependencies.

Exif support

Saving an image should not change the exif tags. Additionally exif could be used for:

  • an autorotate command which rotates images depending on their exif orientation
  • a command to rename images using the corresponding exif tags to get date info and maybe more
  • additional statusbar modules

CI

Setting up CI would be nice to have. Possibly combined with docker to run tests on different supported systems automatically.

Remove deleted images from marked list

When images are deleted, the marked path becomes invalid and should therefore be removed from the list of marked images. A possible implementation could be to additionally monitor all marked images in the working directory handler in vimiv/utils/working_directory.py.

Improve logging

The current usage of logging is a bit inconsistent and could be improved by:

  • Using the log levels consistently according to the python docs
  • Adding further debug statements
  • Refining the statusbar log handler, it is currently not very useful, as the messages are often removed very quickly

Display image metadata

Displaying the metadata of an image directly could be nice to have. This could be done using an overlay which can be opened using a command, e.g. :metadata and closed with <Escape> as well as when the image changed, i.e. new_image_opened was emitted.

See this issue of the GTK version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.