From dacebd2eec2341aecdf5adcc119f70138b8e44e4 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 26 Dec 2007 19:27:52 +0000 Subject: [PATCH] use external browser always for active port test --- src/common.py | 33 ++++++++++++++++++++------------- src/dialogs.py | 2 +- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/common.py b/src/common.py index 33b5bd108..c56442055 100644 --- a/src/common.py +++ b/src/common.py @@ -153,10 +153,10 @@ def get_logo(size): return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.svg"), \ size, size) -def open_url_in_browser(link): +def open_url_in_browser(link, force_ext=None): import pref 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 browser.Browser(link) else: @@ -195,19 +195,26 @@ def exec_command(executable, *parameters): import os command = [executable] command.extend(parameters) - try: - os.WEXITSTATUS(os.system(command[0] + " \"%s\"" %command[1])) - except OSError: - import gtk + if windows_check(): + try: + from subprocess import Popen + Popen(command) + except: + pass + else: + try: + os.WEXITSTATUS(os.system(command[0] + " \"%s\"" %command[1])) + 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"), + 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() + type = gtk.MESSAGE_WARNING) + warning.run() + warning.destroy() def send_info(): import threading diff --git a/src/dialogs.py b/src/dialogs.py index 4d0990a8b..e4780e519 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -334,7 +334,7 @@ class PreferencesDlg: self.plugins.configure_plugin(plugin_name, self.dialog) 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): value = widget.get_active()