mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-06 00:23:32 +00:00
add spawning to deal with 2.5 being stupid with threading
This commit is contained in:
parent
1a05d470a2
commit
507f8a4139
4
src/browser.py
Normal file
4
src/browser.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import webbrowser
|
||||||
|
import sys
|
||||||
|
webbrowser.open(sys.argv[1])
|
@ -1,4 +1,5 @@
|
|||||||
# dcommon.py
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (C) Zach Tibbitts 2006 <zach@collegegeek.org>
|
# Copyright (C) Zach Tibbitts 2006 <zach@collegegeek.org>
|
||||||
#
|
#
|
||||||
@ -119,22 +120,15 @@ def get_pixmap(fname):
|
|||||||
return os.path.join(PIXMAP_DIR, fname)
|
return os.path.join(PIXMAP_DIR, fname)
|
||||||
|
|
||||||
def open_url_in_browser(link):
|
def open_url_in_browser(link):
|
||||||
import webbrowser
|
import platform
|
||||||
|
if platform.system() == "Windows":
|
||||||
# why this method with causes up to 1 minutes delays when opening url in
|
import webbrowser
|
||||||
# deluge ? when you run it from console - works instantly. maybe it has
|
webbrowser.open(link)
|
||||||
# something to do with libtorrent's threads or with boost mt/nomt ?
|
else:
|
||||||
|
import os, sys
|
||||||
#import threading
|
version = sys.version[:3]
|
||||||
#class LaunchBrowser(threading.Thread):
|
file = '/usr/lib/python' + version + '/site-packages/deluge/browser.py'
|
||||||
# def run(self):
|
os.spawnlp(os.P_NOWAIT, 'python', 'python', file, link)
|
||||||
# try:
|
|
||||||
# webbrowser.open(link)
|
|
||||||
# except webbrowser.Error:
|
|
||||||
# print _("Error: no webbrowser found")
|
|
||||||
#LaunchBrowser().start()
|
|
||||||
|
|
||||||
webbrowser.open(link)
|
|
||||||
|
|
||||||
def is_url(url):
|
def is_url(url):
|
||||||
import re
|
import re
|
||||||
|
Loading…
x
Reference in New Issue
Block a user