diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 49e129483..7a0441ea2 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -1617,6 +1617,56 @@ HTTP W/ Auth 1 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Deluge will check our servers and will tell you if a newer version has been released + Be alerted about new releases + 0 + True + + + False + False + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Updates</b> + True + + + label_item + + + + + 2 + + diff --git a/src/dialogs.py b/src/dialogs.py index f72238a37..a6a30c97e 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -67,6 +67,7 @@ class PreferencesDlg: self.glade.get_widget("chk_random_port").set_active(self.preferences.get("random_port")) self.glade.get_widget("chk_natpmp").set_active(self.preferences.get("use_natpmp")) self.glade.get_widget("chk_utpex").set_active(self.preferences.get("use_utpex")) + self.glade.get_widget("chk_new_releases").set_active(self.preferences.get("new_releases")) self.glade.get_widget("chk_use_tray").set_active(self.preferences.get("enable_system_tray")) self.glade.get_widget("chk_min_on_close").set_active(self.preferences.get("close_to_tray")) self.glade.get_widget("chk_lock_tray").set_active(self.preferences.get("lock_tray")) @@ -143,6 +144,7 @@ class PreferencesDlg: self.preferences.set("tracker_proxy", self.glade.get_widget("chk_tracker_proxy").get_active()) self.preferences.set("dht_proxy", self.glade.get_widget("chk_dht_proxy").get_active()) self.preferences.set("use_upnp", self.glade.get_widget("chk_upnp").get_active()) + self.preferences.set("new_releases", self.glade.get_widget("chk_new_releases").get_active()) self.preferences.set("random_port", self.glade.get_widget("chk_random_port").get_active()) self.preferences.set("use_natpmp", self.glade.get_widget("chk_natpmp").get_active()) self.preferences.set("use_utpex", self.glade.get_widget("chk_utpex").get_active()) diff --git a/src/interface.py b/src/interface.py index c4c50d2c0..a9eb6fb4b 100644 --- a/src/interface.py +++ b/src/interface.py @@ -119,6 +119,16 @@ class DelugeGTK: # Boolean set to true if window is not minimized and is "visible" self.update_interface = True + + def new_release_check(): + import os, sys + py_version = sys.version[:3] + file = '/usr/lib/python' + py_version + '/site-packages/deluge/update.py' + os.spawnlp(os.P_NOWAIT, 'python', 'python', file, '0.5.3') + + if self.config.get("new_releases"): + new_release_check() + def connect_signals(self): self.wtree.signal_autoconnect({ @@ -153,7 +163,7 @@ class DelugeGTK: "queue_up": self.q_torrent_up, "queue_down": self.q_torrent_down }) - + def notebook_switch_page(self, notebook, page, page_num): # Force an update when user changes the notebook tab self.update_torrent_info_widget(None, page_num) @@ -1309,7 +1319,6 @@ class DelugeGTK: self.update() return False - def load_window_geometry(self): x = self.config.get('window_x_pos') y = self.config.get('window_y_pos') @@ -1347,7 +1356,6 @@ class DelugeGTK: self.manager.quit() gtk.main_quit() - ## For testing purposes, create a copy of the interface if __name__ == "__main__": interface = DelugeGTK() diff --git a/src/pref.py b/src/pref.py index f1ef71a74..93da578d1 100644 --- a/src/pref.py +++ b/src/pref.py @@ -98,6 +98,7 @@ DEFAULT_PREFS = { "use_natpmp" : False, "use_upnp" : False, "use_utpex" : True, + "new_releases" : True, "window_height" : 480, "window_maximized" : False, "window_pane_position" : -1, diff --git a/src/update.py b/src/update.py new file mode 100644 index 000000000..c0776aaa8 --- /dev/null +++ b/src/update.py @@ -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