Show warning when external commands not found.

This commit is contained in:
Alex Dedul 2007-08-10 20:58:44 +00:00
parent 2a09f50ecb
commit 33718d5e03
1 changed files with 15 additions and 3 deletions

View File

@ -29,7 +29,7 @@
# this exception statement from your version. If you delete this exception # this exception statement from your version. If you delete this exception
# statement from all source files in the program, then also delete it here. # statement from all source files in the program, then also delete it here.
import os.path import os
import xdg.BaseDirectory import xdg.BaseDirectory
PROGRAM_NAME = "Deluge" PROGRAM_NAME = "Deluge"
@ -156,8 +156,20 @@ def exec_command(executable, *parameters):
from subprocess import Popen from subprocess import Popen
command = [executable] command = [executable]
command.extend(parameters) command.extend(parameters)
Popen(command) try:
Popen(command)
except OSError:
import gtk
warning = gtk.MessageDialog(parent = None,
flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons= gtk.BUTTONS_OK,
message_format='%s %s %s' % (_("External command"),
executable, _("not found")),
type = gtk.MESSAGE_WARNING)
warning.run()
warning.destroy()
def exec_deluge_command(script, *parameters): def exec_deluge_command(script, *parameters):
"""Execute deluge's command like browser.py, update.py and others""" """Execute deluge's command like browser.py, update.py and others"""