Do not automatically remove temporary ImageShow files on Unix#6045
Do not automatically remove temporary ImageShow files on Unix#6045hugovk merged 6 commits intopython-pillow:mainfrom
Conversation
There was a problem hiding this comment.
-
I have tested the functionality (Ubuntu 20.04): show() function worked well for all the viewers except GmDisplayViewer. In case of single file the image was sometimes shown and sometimes not shown. For multiple images, in my case 3 images, only two images showed up. I do not have any good explanation for such behavior of GmDisplayViewer...
-
Good news: the temporary image files get deleted on reboot (Ubuntu 20.04)
-
Code:
(a) I think there is a backwards compatibility issue with viewers interface, I'm talking here about get_command() function. This function is redundant for Mac and Unix viewers. There is also a consistency issue if one compares Windows viewer implementation vs Mac and Unix.
(b) I would say that DRY principle is violated for Unix viewers image_show() method.
(c) Unix viewers get_command_ex() method became redundant, and it doesn't reflect the actually implemented functionality.
(d) get_command() method does not reflect actually implemented functionality.
Summary: the key thing here is to make a decision about viewers interface: either implement the new approach to all the viewers, or stick with the old interface, and apply it to all the viewers.
|
|
In the Viewer class viewers interface is defined. As per this definition the get_command() is expected to return specific viewer's display command, the return value of the get_command() function is expected to be used by show_file() method. Question: What is the purpose of get_command() and get_command_ex() in this PR? |
|
I am confused by your comment. I have proposed minimal changes to
Are you just having a conversation about ImageShow in general, rather than reviewing my changes here? It's ok if you are, I just don't feel like that's clear. If you're asking why |
|
|
Sorry, I forgot to switch to my regular account 😄 |
hugovk
left a comment
There was a problem hiding this comment.
ImageShow.show()does not returnTrueandFalselike the docstring states, it returns 0 and 1.
>>> True == 1
True
>>> False == 0
True
>>>;)
Returning True or False is nicer. 👍
Let's include in the release notes too the fact they're no longer automatically* removed, so people know it's their job to clear it out if for example they show lots of images and don't reboot often.
(* Shall we rename "manually" -> "automatically" in the PR title?)
|
Thanks! |
Helps #5945 and #5976. Alternative to #6021
Three changes here.
ImageShow.show()does not returnTrueandFalselike the docstring states, it returns 0 and 1. This PR updates the return values to match the docstring.display -titlelooks preferable todisplay -name.