@@ -105,10 +105,20 @@ def show_image(self, image, **options):
105
105
return self .show_file (self .save_image (image ), ** options )
106
106
107
107
def show_file (self , file , ** options ):
108
- """Display the given file. """
108
+ """Display given file"""
109
109
os .system (self .get_command (file , ** options ))
110
110
return 1
111
111
112
+ def _remove_file_after_delay (self , file ):
113
+ subprocess .Popen (
114
+ [
115
+ sys .executable ,
116
+ "-c" ,
117
+ "import os, sys, time; time.sleep(20); os.remove(sys.argv[1])" ,
118
+ file ,
119
+ ]
120
+ )
121
+
112
122
113
123
# --------------------------------------------------------------------
114
124
@@ -147,14 +157,7 @@ def get_command(self, file, **options):
147
157
def show_file (self , file , ** options ):
148
158
"""Display given file"""
149
159
subprocess .call (["open" , "-a" , "Preview.app" , file ])
150
- subprocess .Popen (
151
- [
152
- sys .executable ,
153
- "-c" ,
154
- "import os, sys, time; time.sleep(20); os.remove(sys.argv[1])" ,
155
- file ,
156
- ]
157
- )
160
+ self ._remove_file_after_delay (file )
158
161
return 1
159
162
160
163
@@ -181,8 +184,9 @@ def get_command_ex(self, file, **options):
181
184
return command , executable
182
185
183
186
def show_file (self , file , ** options ):
187
+ """Display given file"""
184
188
subprocess .Popen (["xdg-open" , file ])
185
- os . remove (file )
189
+ self . _remove_file_after_delay (file )
186
190
return 1
187
191
188
192
@@ -199,6 +203,7 @@ def get_command_ex(self, file, title=None, **options):
199
203
return command , executable
200
204
201
205
def show_file (self , file , ** options ):
206
+ """Display given file"""
202
207
args = ["display" ]
203
208
if "title" in options :
204
209
args += ["-name" , options ["title" ]]
@@ -218,6 +223,7 @@ def get_command_ex(self, file, **options):
218
223
return command , executable
219
224
220
225
def show_file (self , file , ** options ):
226
+ """Display given file"""
221
227
subprocess .Popen (["gm" , "display" , file ])
222
228
os .remove (file )
223
229
return 1
@@ -232,6 +238,7 @@ def get_command_ex(self, file, **options):
232
238
return command , executable
233
239
234
240
def show_file (self , file , ** options ):
241
+ """Display given file"""
235
242
subprocess .Popen (["eog" , "-n" , file ])
236
243
os .remove (file )
237
244
return 1
@@ -252,6 +259,7 @@ def get_command_ex(self, file, title=None, **options):
252
259
return command , executable
253
260
254
261
def show_file (self , file , ** options ):
262
+ """Display given file"""
255
263
args = ["xv" ]
256
264
if "title" in options :
257
265
args += ["-name" , options ["title" ]]
0 commit comments