need to go back to spawning for python 2.4 compatibilitiy
This commit is contained in:
parent
6c168a3e56
commit
f0b3293dad
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import webbrowser
|
||||||
|
import sys
|
||||||
|
webbrowser.open(sys.argv[1])
|
|
@ -31,8 +31,7 @@
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import xdg.BaseDirectory
|
import xdg.BaseDirectory
|
||||||
import gobject
|
|
||||||
gobject.threads_init()
|
|
||||||
PROGRAM_NAME = "Deluge"
|
PROGRAM_NAME = "Deluge"
|
||||||
PROGRAM_VERSION = "0.5.4"
|
PROGRAM_VERSION = "0.5.4"
|
||||||
|
|
||||||
|
@ -124,11 +123,11 @@ def open_url_in_browser(link):
|
||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open(link)
|
webbrowser.open(link)
|
||||||
else:
|
else:
|
||||||
import webbrowser
|
import os, sys
|
||||||
import gtk
|
py_version = sys.version[:3]
|
||||||
gtk.gdk.threads_enter()
|
file = os.path.join(INSTALL_PREFIX, 'lib', 'python' \
|
||||||
webbrowser.open(link)
|
+ py_version, 'site-packages', 'deluge', 'browser.py')
|
||||||
gtk.gdk.threads_leave()
|
os.spawnlp(os.P_NOWAIT, 'python', 'python', file, link)
|
||||||
|
|
||||||
def is_url(url):
|
def is_url(url):
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import urllib
|
||||||
|
import platform
|
||||||
|
import gtk
|
||||||
|
import os
|
||||||
|
import common
|
||||||
|
|
||||||
|
pygtk = '%i.%i.%i' %(gtk.pygtk_version[0],gtk.pygtk_version[1],gtk.pygtk_version[2])
|
||||||
|
|
||||||
|
urllib.urlopen("http://download.deluge-torrent.org/stats.php?processor=" + \
|
||||||
|
platform.machine() + "&python=" + platform.python_version() \
|
||||||
|
+ "&os=" + platform.system() + "&pygtk=" + pygtk)
|
||||||
|
|
||||||
|
f = open(os.path.join(common.CONFIG_DIR, 'infosent'), 'w')
|
||||||
|
f.write("")
|
||||||
|
f.close
|
|
@ -115,43 +115,26 @@ class DelugeGTK:
|
||||||
self.update_interface = True
|
self.update_interface = True
|
||||||
|
|
||||||
def new_release_check():
|
def new_release_check():
|
||||||
import urllib
|
import sys
|
||||||
new_release = urllib.urlopen("http://download.deluge-torrent.org/version").read().strip()
|
py_version = sys.version[:3]
|
||||||
if new_release > common.PROGRAM_VERSION:
|
file = os.path.join(common.INSTALL_PREFIX, 'lib', 'python' \
|
||||||
gtk.gdk.threads_enter()
|
+ py_version, 'site-packages', 'deluge', 'update.py')
|
||||||
dialog = gtk.MessageDialog(parent = None,
|
os.spawnlp(os.P_NOWAIT, 'python', 'python', file,
|
||||||
flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
common.PROGRAM_VERSION)
|
||||||
buttons = gtk.BUTTONS_YES_NO,
|
|
||||||
message_format=_("There is a newer version of Deluge. Would you like to be taken to our download site?"),
|
|
||||||
type=gtk.MESSAGE_QUESTION)
|
|
||||||
dialog.set_title('New Release!')
|
|
||||||
result = dialog.run()
|
|
||||||
dialog.destroy()
|
|
||||||
if result == gtk.RESPONSE_YES:
|
|
||||||
common.open_url_in_browser('http://download.deluge-torrent.org')
|
|
||||||
elif result == gtk.RESPONSE_NO:
|
|
||||||
pass
|
|
||||||
gtk.gdk.threads_leave()
|
|
||||||
|
|
||||||
|
|
||||||
def send_info():
|
def send_info():
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def _run_script():
|
def _run_script():
|
||||||
import urllib
|
import sys
|
||||||
import platform
|
|
||||||
|
py_version = sys.version[:3]
|
||||||
pygtk = '%i.%i.%i' %(gtk.pygtk_version[0],gtk.pygtk_version[1],gtk.pygtk_version[2])
|
|
||||||
gtk.gdk.threads_enter()
|
file = os.path.join(common.INSTALL_PREFIX, 'lib', 'python' \
|
||||||
urllib.urlopen("http://download.deluge-torrent.org/stats.php?processor=" + \
|
+ py_version, 'site-packages', 'deluge', 'info.py')
|
||||||
platform.machine() + "&python=" + platform.python_version() \
|
os.spawnlp(os.P_NOWAIT, 'python', 'python', file,
|
||||||
+ "&os=" + platform.system() + "&pygtk=" + pygtk)
|
common.PROGRAM_VERSION)
|
||||||
|
|
||||||
f = open(os.path.join(common.CONFIG_DIR, 'infosent'), 'w')
|
|
||||||
f.write("")
|
|
||||||
f.close
|
|
||||||
gtk.gdk.threads_leave()
|
|
||||||
|
|
||||||
info_file = os.path.join(common.CONFIG_DIR, 'infosent')
|
info_file = os.path.join(common.CONFIG_DIR, 'infosent')
|
||||||
|
|
||||||
# Check if we've done this within the last week
|
# Check if we've done this within the last week
|
||||||
|
@ -1352,7 +1335,6 @@ class DelugeGTK:
|
||||||
|
|
||||||
## For testing purposes, create a copy of the interface
|
## For testing purposes, create a copy of the interface
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
gobject.threads_init()
|
|
||||||
interface = DelugeGTK()
|
interface = DelugeGTK()
|
||||||
interface.start()
|
interface.start()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import urllib
|
||||||
|
import sys
|
||||||
|
|
||||||
|
new_release = urllib.urlopen("http://download.deluge-torrent.org/version").read().strip()
|
||||||
|
if new_release > sys.argv[1]:
|
||||||
|
import gtk
|
||||||
|
import pygtk
|
||||||
|
dialog = gtk.MessageDialog(parent = None,
|
||||||
|
flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
buttons = gtk.BUTTONS_YES_NO,
|
||||||
|
message_format=_("There is a newer version of Deluge. Would you like to be taken to our download site?"),
|
||||||
|
type=gtk.MESSAGE_QUESTION)
|
||||||
|
dialog.set_title('New Release!')
|
||||||
|
import time
|
||||||
|
#give main client time to get up and running so we dont get placed in the
|
||||||
|
#background and hidden. also sleep this long for blocklist import
|
||||||
|
time.sleep(20)
|
||||||
|
result = dialog.run()
|
||||||
|
dialog.destroy()
|
||||||
|
if result == gtk.RESPONSE_YES:
|
||||||
|
import os
|
||||||
|
os.spawnlp(os.P_NOWAIT, 'python', 'python', '-c', "import webbrowser; webbrowser.open('http://download.deluge-torrent.org/')")
|
||||||
|
elif result == gtk.RESPONSE_NO:
|
||||||
|
pass
|
Loading…
Reference in New Issue