more gobject tweaks
This commit is contained in:
parent
658282d09d
commit
9f1efa8802
@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import webbrowser
|
|
||||||
import sys
|
|
||||||
webbrowser.open(sys.argv[1])
|
|
||||||
@ -32,7 +32,6 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import xdg.BaseDirectory
|
import xdg.BaseDirectory
|
||||||
import gobject
|
import gobject
|
||||||
gobject.threads_init()
|
|
||||||
|
|
||||||
PROGRAM_NAME = "Deluge"
|
PROGRAM_NAME = "Deluge"
|
||||||
PROGRAM_VERSION = "0.5.4"
|
PROGRAM_VERSION = "0.5.4"
|
||||||
|
|||||||
@ -48,7 +48,6 @@ import tab_details
|
|||||||
|
|
||||||
class DelugeGTK:
|
class DelugeGTK:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gobject.threads_init()
|
|
||||||
self.ipc_manager = ipc_manager.Manager(self)
|
self.ipc_manager = ipc_manager.Manager(self)
|
||||||
#Start the Deluge Manager:
|
#Start the Deluge Manager:
|
||||||
self.manager = core.Manager(common.CLIENT_CODE, common.CLIENT_VERSION,
|
self.manager = core.Manager(common.CLIENT_CODE, common.CLIENT_VERSION,
|
||||||
@ -116,42 +115,42 @@ class DelugeGTK:
|
|||||||
self.update_interface = True
|
self.update_interface = True
|
||||||
|
|
||||||
def new_release_check():
|
def new_release_check():
|
||||||
import urllib
|
import urllib
|
||||||
new_release = urllib.urlopen("http://download.deluge-torrent.org/version").read().strip()
|
new_release = urllib.urlopen("http://download.deluge-torrent.org/version").read().strip()
|
||||||
if new_release > common.PROGRAM_VERSION:
|
if new_release > common.PROGRAM_VERSION:
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
dialog = gtk.MessageDialog(parent = None,
|
dialog = 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_YES_NO,
|
buttons = gtk.BUTTONS_YES_NO,
|
||||||
message_format=_("There is a newer version of Deluge. Would you like to be taken to our download site?"),
|
message_format=_("There is a newer version of Deluge. Would you like to be taken to our download site?"),
|
||||||
type=gtk.MESSAGE_QUESTION)
|
type=gtk.MESSAGE_QUESTION)
|
||||||
dialog.set_title('New Release!')
|
dialog.set_title('New Release!')
|
||||||
result = dialog.run()
|
result = dialog.run()
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
if result == gtk.RESPONSE_YES:
|
if result == gtk.RESPONSE_YES:
|
||||||
common.open_url_in_browser('http://download.deluge-torrent.org')
|
common.open_url_in_browser('http://download.deluge-torrent.org')
|
||||||
elif result == gtk.RESPONSE_NO:
|
elif result == gtk.RESPONSE_NO:
|
||||||
pass
|
pass
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
|
|
||||||
def send_info():
|
def send_info():
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def _run_script():
|
def _run_script():
|
||||||
import urllib
|
import urllib
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
pygtk = '%i.%i.%i' %(gtk.pygtk_version[0],gtk.pygtk_version[1],gtk.pygtk_version[2])
|
pygtk = '%i.%i.%i' %(gtk.pygtk_version[0],gtk.pygtk_version[1],gtk.pygtk_version[2])
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
|
|
||||||
urllib.urlopen("http://download.deluge-torrent.org/stats.php?processor=" + \
|
urllib.urlopen("http://download.deluge-torrent.org/stats.php?processor=" + \
|
||||||
platform.machine() + "&python=" + platform.python_version() \
|
platform.machine() + "&python=" + platform.python_version() \
|
||||||
+ "&os=" + platform.system() + "&pygtk=" + pygtk)
|
+ "&os=" + platform.system() + "&pygtk=" + pygtk)
|
||||||
|
|
||||||
f = open(os.path.join(common.CONFIG_DIR, 'infosent'), 'w')
|
f = open(os.path.join(common.CONFIG_DIR, 'infosent'), 'w')
|
||||||
f.write("")
|
f.write("")
|
||||||
f.close
|
f.close
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
info_file = os.path.join(common.CONFIG_DIR, 'infosent')
|
info_file = os.path.join(common.CONFIG_DIR, 'infosent')
|
||||||
@ -1354,6 +1353,7 @@ 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()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user