From 929d165d8d1e3f0c49f3204a2aef679e2a91a0b6 Mon Sep 17 00:00:00 2001 From: NafisFaysal Date: Sat, 18 Nov 2017 21:25:58 +0600 Subject: [PATCH 1/4] add eog support for Ubuntu Image Viewer --- PIL/ImageShow.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py index f59ba9bad..686e1b488 100644 --- a/PIL/ImageShow.py +++ b/PIL/ImageShow.py @@ -156,12 +156,16 @@ else: # implementations + # The default Image Viewer of Ubuntu using the command "eog" in the terminal. + # Reference: https://help.gnome.org/users/eog/stable/commandline.html.en + class DisplayViewer(UnixViewer): def get_command_ex(self, file, **options): - command = executable = "display" + command = executable = "display" or "eog" return command, executable - if which("display"): + + if which("display" or "eog"): register(DisplayViewer) class XVViewer(UnixViewer): From 2bb78e54f3c1c35b168c3b20b6c15bcbe1b6806a Mon Sep 17 00:00:00 2001 From: NafisFaysal Date: Sun, 19 Nov 2017 02:00:57 +0600 Subject: [PATCH 2/4] add eog support for Ubuntu Image Viewer --- PIL/ImageShow.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py index 686e1b488..2e930819d 100644 --- a/PIL/ImageShow.py +++ b/PIL/ImageShow.py @@ -156,17 +156,20 @@ else: # implementations - # The default Image Viewer of Ubuntu using the command "eog" in the terminal. - # Reference: https://help.gnome.org/users/eog/stable/commandline.html.en - class DisplayViewer(UnixViewer): def get_command_ex(self, file, **options): - command = executable = "display" or "eog" + command = executable = "display" return command, executable + class EogViewer(UnixViewer): + def get_command_ex(self, file, **options): + command = executable = "eog" + return command, executable - if which("display" or "eog"): - register(DisplayViewer) + if which("display"): + register + elif which("eog"): + register(EogViewer) class XVViewer(UnixViewer): def get_command_ex(self, file, title=None, **options): From 3a1f532acff652a44a038bd046fdb4fdd7254d4a Mon Sep 17 00:00:00 2001 From: NafisFaysal Date: Sun, 19 Nov 2017 02:08:46 +0600 Subject: [PATCH 3/4] add eog support for Ubuntu Image Viewer --- PIL/ImageShow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py index 2e930819d..3f8732c56 100644 --- a/PIL/ImageShow.py +++ b/PIL/ImageShow.py @@ -167,7 +167,7 @@ else: return command, executable if which("display"): - register + register(DisplayViewer) elif which("eog"): register(EogViewer) From 09f3fbe9b4a3e919c761cac3071f384bacdb4754 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 22 Nov 2017 12:13:13 +0200 Subject: [PATCH 4/4] Reorder/refactor for consistency --- PIL/ImageShow.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py index 3f8732c56..bf8c67eb5 100644 --- a/PIL/ImageShow.py +++ b/PIL/ImageShow.py @@ -101,6 +101,7 @@ class Viewer(object): # -------------------------------------------------------------------- + if sys.platform == "win32": class WindowsViewer(Viewer): @@ -161,14 +162,15 @@ else: command = executable = "display" return command, executable + if which("display"): + register(DisplayViewer) + class EogViewer(UnixViewer): def get_command_ex(self, file, **options): command = executable = "eog" return command, executable - if which("display"): - register(DisplayViewer) - elif which("eog"): + if which("eog"): register(EogViewer) class XVViewer(UnixViewer):