use external browser always for active port test

This commit is contained in:
Marcos Pinto 2007-12-26 19:27:52 +00:00
commit dacebd2eec
2 changed files with 21 additions and 14 deletions

View file

@ -153,10 +153,10 @@ def get_logo(size):
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.svg"), \ return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.svg"), \
size, size) size, size)
def open_url_in_browser(link): def open_url_in_browser(link, force_ext=None):
import pref import pref
config = pref.Preferences(os.path.join(os.path.expanduser("~"), 'deluge', "prefs.state")) config = pref.Preferences(os.path.join(os.path.expanduser("~"), 'deluge', "prefs.state"))
if config.get("use_internal"): if config.get("use_internal") and not force_ext:
import browser import browser
browser.Browser(link) browser.Browser(link)
else: else:
@ -195,19 +195,26 @@ def exec_command(executable, *parameters):
import os import os
command = [executable] command = [executable]
command.extend(parameters) command.extend(parameters)
try: if windows_check():
os.WEXITSTATUS(os.system(command[0] + " \"%s\"" %command[1])) try:
except OSError: from subprocess import Popen
import gtk Popen(command)
except:
pass
else:
try:
os.WEXITSTATUS(os.system(command[0] + " \"%s\"" %command[1]))
except OSError:
import gtk
warning = gtk.MessageDialog(parent = None, warning = gtk.MessageDialog(parent = None,
flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons= gtk.BUTTONS_OK, buttons= gtk.BUTTONS_OK,
message_format='%s %s %s' % (_("External command"), message_format='%s %s %s' % (_("External command"),
executable, _("not found")), executable, _("not found")),
type = gtk.MESSAGE_WARNING) type = gtk.MESSAGE_WARNING)
warning.run() warning.run()
warning.destroy() warning.destroy()
def send_info(): def send_info():
import threading import threading

View file

@ -334,7 +334,7 @@ class PreferencesDlg:
self.plugins.configure_plugin(plugin_name, self.dialog) self.plugins.configure_plugin(plugin_name, self.dialog)
def TestPort(self, widget): def TestPort(self, widget):
common.open_url_in_browser('http://www.deluge-torrent.org/test-port.php?port=%s' % self.active_port) common.open_url_in_browser('http://www.deluge-torrent.org/test-port.php?port=%s' % self.active_port, "force_ext")
def toggle_ui(self, widget): def toggle_ui(self, widget):
value = widget.get_active() value = widget.get_active()