diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 6f7163c09..69857f6ad 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -56,13 +56,15 @@ 2 2 - + True - Ask me where to save each download - True + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + 1 2 + 1 + 2 @@ -78,15 +80,13 @@ - + True - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Ask me where to save each download + True - 1 2 - 1 - 2 @@ -127,15 +127,7 @@ 1 2 - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum simultaneous active torrents: - - - - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -150,6 +142,14 @@ + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum simultaneous active torrents: + + @@ -224,29 +224,6 @@ True 2 2 - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Queue torrents to bottom when they begin seeding - True - - - 2 - - - - - True - Stop seeding torrents when their share ratio reaches: - True - - - 1 - 2 - - True @@ -265,6 +242,29 @@ + + + True + Stop seeding torrents when their share ratio reaches: + True + + + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Queue torrents to bottom when they begin seeding + True + + + 2 + + @@ -360,13 +360,53 @@ - + True - Test Port + Try from: + + + + + True + to: + + + 2 + 3 + + + + + True + True + 0.5 + 0 0 65535 1 10 10 + + + 1 + 2 + + + + + True + True + 0.5 + 0 0 65535 1 10 10 3 4 + + + + + True + Active port: + + + 1 + 2 1 2 @@ -384,57 +424,17 @@ - + True - Active port: - - - 1 - 2 - 1 - 2 - - - - - True - True - 0.5 - 0 0 65535 1 10 10 + Test Port 3 4 + 1 + 2 - - - True - True - 0.5 - 0 0 65535 1 10 10 - - - 1 - 2 - - - - - True - to: - - - 2 - 3 - - - - - True - Try from: - - @@ -456,6 +456,45 @@ 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 + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Enable UPnP support + True + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>UPnP</b> + True + + + label_item + + + + + False + 2 + + True @@ -474,7 +513,7 @@ 2 2 - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -490,7 +529,7 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Max number of DHT connections: @@ -501,7 +540,7 @@ - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -517,7 +556,7 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK <b>DHT</b> @@ -530,7 +569,7 @@ False - 2 + 3 @@ -545,7 +584,7 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 12 - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -567,45 +606,6 @@ - - False - 3 - - - - - 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 - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Enable UPnP support - True - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>UPnP</b> - True - - - label_item - - - False 4 @@ -671,129 +671,25 @@ 5 3 - + True + <i>(-1 is unlimited)</i> + True - 2 3 - 2 - 3 - - True - - - 2 - 3 - 1 - 2 - - - - + True KB/s 2 3 - 4 - 5 - - - - - - True - True - 10 - 1 - -1 -1 1024 1 10 10 - - - 1 - 2 - 4 - 5 - - - - - - True - 0 - Maximum Upload Rate: - - - 4 - 5 - - - - - True - True - 10 - 1 - -1 -1 100 1 10 10 - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - Maximum Connections - - - 1 - 2 - - - - - True - 0 - Upload Slots - - - 2 - 3 - - - - - True - 0 - Maximum Download Rate: - - 3 4 - - - - - True - True - 10 - 1 - -1 -1 100 1 10 10 - - - 1 - 2 - 2 - 3 @@ -814,26 +710,130 @@ - + + True + True + 10 + 1 + -1 -1 100 1 10 10 + + + 1 + 2 + 2 + 3 + + + + + + True + 0 + Maximum Download Rate: + + + 3 + 4 + + + + + True + 0 + Upload Slots + + + 2 + 3 + + + + + True + 0 + Maximum Connections + + + 1 + 2 + + + + + True + True + 10 + 1 + -1 -1 100 1 10 10 + + + 1 + 2 + 1 + 2 + + + + + + True + 0 + Maximum Upload Rate: + + + 4 + 5 + + + + + True + True + 10 + 1 + -1 -1 1024 1 10 10 + + + 1 + 2 + 4 + 5 + + + + + True KB/s 2 3 - 3 - 4 + 4 + 5 - + True - <i>(-1 is unlimited)</i> - True + 2 3 + 1 + 2 + + + + + True + + + 2 + 3 + 2 + 3 @@ -918,6 +918,17 @@ True 2 2 + + + True + Enable system tray icon + True + True + + + 2 + + True @@ -931,17 +942,6 @@ 12 - - - True - Enable system tray icon - True - True - - - 2 - - @@ -980,15 +980,19 @@ 1 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - GUI update interval + seconds + + 2 + 3 + + - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -1004,16 +1008,12 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - seconds + 0 + GUI update interval - - 2 - 3 - - diff --git a/setup.py b/setup.py index 70397f42f..03d85eb1a 100644 --- a/setup.py +++ b/setup.py @@ -156,7 +156,7 @@ class write_data_install_path(cmd.Command): def run(self): conf_filename = os.path.join(self.lib_build_dir, - 'deluge', 'dcommon.py') + 'deluge', 'common.py') conf_file = open(conf_filename, 'r') data = conf_file.read() @@ -180,8 +180,8 @@ class unwrite_data_install_path(cmd.Command): def run(self): dest = os.path.join(self.lib_build_dir, - 'deluge', 'dcommon.py') - shutil.copyfile('src/dcommon.py', dest) + 'deluge', 'common.py') + shutil.copyfile('src/common.py', dest) class build_trans(cmd.Command): description = 'Compile .po files into .mo files' diff --git a/src/dcommon.py b/src/common.py similarity index 100% rename from src/dcommon.py rename to src/common.py diff --git a/src/dgtk.py b/src/dgtk.py index 727f09663..083ff3f6a 100644 --- a/src/dgtk.py +++ b/src/dgtk.py @@ -18,10 +18,10 @@ # 51 Franklin Street, Fifth Floor # Boston, MA 02110-1301, USA. -# Similar to dcommon, this contains any common functions +# Similar to common, this contains any common functions # related to gtk that are needed by the client -import dcommon +import common import gettext import pygtk pygtk.require('2.0') diff --git a/src/dialogs.py b/src/dialogs.py index 0abbaeb42..8e02170db 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -18,7 +18,7 @@ # 51 Franklin Street, Fifth Floor # Boston, MA 02110-1301, USA. -import dcommon, dgtk +import common, dgtk import gtk, gtk.glade import os, os.path @@ -26,9 +26,9 @@ import os, os.path class PreferencesDlg: def __init__(self, parent, preferences): - self.glade = gtk.glade.XML(dcommon.get_glade_file("preferences_dialog.glade"), domain='deluge') + self.glade = gtk.glade.XML(common.get_glade_file("preferences_dialog.glade"), domain='deluge') self.dialog = self.glade.get_widget("pref_dialog") - self.dialog.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png")) self.glade.signal_autoconnect({ 'tray_toggle': self.tray_toggle, }) @@ -37,23 +37,34 @@ class PreferencesDlg: def show(self): # Load settings into dialog - self.glade.get_widget("chk_use_tray").set_active(self.preferences.get("enable_system_tray", bool, default=True)) - self.glade.get_widget("chk_min_on_close").set_active(self.preferences.get("close_to_tray", bool, default=False)) - if(self.preferences.get("use_default_dir", bool, False)): - self.glade.get_widget("radio_save_all_to").set_active(True) - else: - self.glade.get_widget("radio_ask_save").set_active(True) - self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path", str, default=os.path.expandvars('$HOME'))) - self.glade.get_widget("chk_autoseed").set_active(self.preferences.get("auto_end_seeding", bool, default=False)) - self.glade.get_widget("ratio_spinner").set_value(self.preferences.get("end_seed_ratio", float, default=0.0)) - self.glade.get_widget("chk_compact").set_active(self.preferences.get("use_compact_storage", bool, default=False)) - self.glade.get_widget("active_port_label").set_text(str(self.parent.manager.get_state()['port'])) - self.glade.get_widget("spin_port_min").set_value(self.preferences.get("tcp_port_range_lower", int, default=6881)) - self.glade.get_widget("spin_port_max").set_value(self.preferences.get("tcp_port_range_upper", int, default=6889)) - self.glade.get_widget("spin_max_upload").set_value(self.preferences.get("max_upload_rate", int, default=-1)) - self.glade.get_widget("spin_num_upload").set_value(self.preferences.get("max_number_uploads", int, default=-1)) - self.glade.get_widget("spin_max_download").set_value(self.preferences.get("max_download_rate", int, default=-1)) - self.glade.get_widget("spin_num_download").set_value(self.preferences.get("max_number_downloads", int, default=-1)) + try: + self.glade.get_widget("chk_use_tray").set_active(self.preferences.get("enable_system_tray", bool, default=True)) + self.glade.get_widget("chk_min_on_close").set_active(self.preferences.get("close_to_tray", bool, default=False)) + if(self.preferences.get("use_default_dir", bool, False)): + self.glade.get_widget("radio_save_all_to").set_active(True) + else: + self.glade.get_widget("radio_ask_save").set_active(True) + self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path", str, default=os.path.expandvars('$HOME'))) + self.glade.get_widget("chk_autoseed").set_active(self.preferences.get("auto_end_seeding", bool, default=False)) + self.glade.get_widget("ratio_spinner").set_value(self.preferences.get("end_seed_ratio", float, default=0.0)) + self.glade.get_widget("chk_compact").set_active(self.preferences.get("use_compact_storage", bool, default=False)) + self.glade.get_widget("active_port_label").set_text(str(self.parent.manager.get_state()['port'])) + self.glade.get_widget("spin_port_min").set_value(self.preferences.get("tcp_port_range_lower", int, default=6881)) + self.glade.get_widget("spin_port_max").set_value(self.preferences.get("tcp_port_range_upper", int, default=6889)) + self.glade.get_widget("spin_max_upload").set_value(self.preferences.get("max_upload_rate", int, default=-1)) + self.glade.get_widget("spin_num_upload").set_value(self.preferences.get("max_number_uploads", int, default=-1)) + self.glade.get_widget("spin_max_download").set_value(self.preferences.get("max_download_rate", int, default=-1)) + self.glade.get_widget("spin_num_download").set_value(self.preferences.get("max_number_downloads", int, default=-1)) + + self.glade.get_widget("spin_torrents").set_value(self.preferences.get("max_number_torrents", int, default=-1)) + self.glade.get_widget("chk_seedbottom").set_active(self.preferences.get("queue_seeds_to_bottom", bool, default=False)) + self.glade.get_widget("chk_upnp").set_active(self.preferences.get("enable_upnp", bool, default=True)) + self.glade.get_widget("chk_dht").set_active(self.preferences.get("enable_dht", bool, default=True)) + self.glade.get_widget("spin_dht").set_value(self.preferences.get("dht_connections", int, default=80)) + self.glade.get_widget("chk_pex").set_active(self.preferences.get("enable_pex", bool, default=True)) + self.glade.get_widget("spin_gui").set_value(self.preferences.get("gui_update_interval", float, default=1.0)) + except KeyError: + pass # Now, show the dialog self.dialog.show() r = self.dialog.run() @@ -73,7 +84,13 @@ class PreferencesDlg: self.preferences.set("max_number_uploads", self.glade.get_widget("spin_num_upload").get_value()) self.preferences.set("max_download_rate", self.glade.get_widget("spin_max_download").get_value()) self.preferences.set("max_number_downloads", self.glade.get_widget("spin_num_download").get_value()) - + self.preferences.set("max_number_torrents", self.glade.get_widget("spin_torrents").get_value()) + self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active()) + self.preferences.set("enable_upnp", self.glade.get_widget("chk_upnp").get_active()) + self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) + self.preferences.set("dht_connections", self.glade.get_widget("spin_dht").get_value()) + self.preferences.set("enable_pex", self.glade.get_widget("chk_pex").get_active()) + self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value()) def tray_toggle(self, obj): if obj.get_active(): @@ -86,9 +103,9 @@ class PreferencesDlg: class PluginDlg: def __init__(self, parent, plugins): - self.glade = gtk.glade.XML(dcommon.get_glade_file("plugin_dialog.glade"), domain='deluge') + self.glade = gtk.glade.XML(common.get_glade_file("plugin_dialog.glade"), domain='deluge') self.dialog = self.glade.get_widget("plugin_dialog") - self.dialog.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png")) self.view = self.glade.get_widget("plugin_view") self.store = gtk.ListStore(str, bool) self.view.set_model(self.store) @@ -159,16 +176,16 @@ class PluginDlg: def show_about_dialog(parent=None): - gtk.about_dialog_set_url_hook(dcommon.open_url_in_browser) - abt = gtk.glade.XML(dcommon.get_glade_file("aboutdialog.glade")).get_widget("aboutdialog") - abt.set_name(dcommon.PROGRAM_NAME) - abt.set_version(dcommon.PROGRAM_VERSION) + gtk.about_dialog_set_url_hook(common.open_url_in_browser) + abt = gtk.glade.XML(common.get_glade_file("aboutdialog.glade")).get_widget("aboutdialog") + abt.set_name(common.PROGRAM_NAME) + abt.set_version(common.PROGRAM_VERSION) abt.set_authors(["Zach Tibbits", "A. Zakai"]) abt.set_artists(["Andrew Wedderburn"]) abt.set_website("http://deluge-torrent.org") - abt.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + abt.set_icon_from_file(common.get_pixmap("deluge32.png")) abt.set_logo(gtk.gdk.pixbuf_new_from_file( - dcommon.get_pixmap("deluge-about.png"))) + common.get_pixmap("deluge-about.png"))) abt.show_all() abt.run() abt.hide_all() @@ -216,7 +233,7 @@ def show_file_open_dialog(parent=None, title=None): f1.add_pattern("*") chooser.add_filter(f1) - chooser.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + chooser.set_icon_from_file(common.get_pixmap("deluge32.png")) chooser.set_property("skip-taskbar-hint", True) response = chooser.run() @@ -232,7 +249,7 @@ def show_directory_chooser_dialog(parent=None, title=None): title = _("Choose a download directory") chooser = gtk.FileChooserDialog(title, parent, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) - chooser.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + chooser.set_icon_from_file(common.get_pixmap("deluge32.png")) chooser.set_property("skip-taskbar-hint", True) if chooser.run() == gtk.RESPONSE_OK: result = chooser.get_filename() diff --git a/src/interface.py b/src/interface.py index 9813f6add..97fe99bed 100644 --- a/src/interface.py +++ b/src/interface.py @@ -21,7 +21,7 @@ # Boston, MA 02110-1301, USA. import sys, os, os.path, urllib -import core, dcommon, dgtk, ipc_manager, dialogs +import core, common, dgtk, ipc_manager, dialogs import plugins, pref import pygtk pygtk.require('2.0') @@ -63,7 +63,7 @@ DEFAULT_PREFS = { class DelugeGTK: def __init__(self): APP = 'deluge' - DIR = os.path.join(dcommon.INSTALL_PREFIX, 'share', 'locale') + DIR = os.path.join(common.INSTALL_PREFIX, 'share', 'locale') locale.setlocale(locale.LC_ALL, '') locale.bindtextdomain(APP, DIR) locale.textdomain(APP) @@ -75,7 +75,7 @@ class DelugeGTK: self.ipc_manager = ipc_manager.Manager(self) self.torrent_file_queue = [] #Load up a config file: - self.conf_file = os.path.join(dcommon.CONFIG_DIR, 'deluge.conf') + self.conf_file = os.path.join(common.CONFIG_DIR, 'deluge.conf') if os.path.isdir(self.conf_file): print 'Weird, the file I was trying to write to, %s, is an existing directory'%(self.conf_file) sys.exit(0) @@ -86,33 +86,33 @@ class DelugeGTK: #Start the Deluge Manager: p = "DE" v = "0500" - s = "%s %s"%(dcommon.PROGRAM_NAME, dcommon.PROGRAM_VERSION) + s = "%s %s"%(common.PROGRAM_NAME, common.PROGRAM_VERSION) #try: - # self.manager = core.Manager(p, v, s, dcommon.CONFIG_DIR) + # self.manager = core.Manager(p, v, s, common.CONFIG_DIR) #except: # # If something goes wrong while restoring the session, then load # # a blank state rather than crash and exit - # self.manager = core.Manager(p, v, s, dcommon.CONFIG_DIR, blank_slate=True) + # self.manager = core.Manager(p, v, s, common.CONFIG_DIR, blank_slate=True) # self.something_screwed_up = True - self.manager = core.Manager(p, v, s, dcommon.CONFIG_DIR) + self.manager = core.Manager(p, v, s, common.CONFIG_DIR) self.something_screwed_up = False #else: self.something_screwed_up = False self.plugins = plugins.PluginManager(self.manager, self) - self.plugins.add_plugin_dir(dcommon.PLUGIN_DIR) - if os.path.isdir(os.path.join(dcommon.CONFIG_DIR , 'plugins')): - self.plugins.add_plugin_dir(os.path.join(dcommon.CONFIG_DIR, 'plugins')) + self.plugins.add_plugin_dir(common.PLUGIN_DIR) + if os.path.isdir(os.path.join(common.CONFIG_DIR , 'plugins')): + self.plugins.add_plugin_dir(os.path.join(common.CONFIG_DIR, 'plugins')) self.plugins.scan_for_plugins() self.config = pref.Preferences(self.conf_file, DEFAULT_PREFS) #Set up the interface: - self.wtree = gtk.glade.XML(dcommon.get_glade_file("delugegtk.glade"), domain=APP) + self.wtree = gtk.glade.XML(common.get_glade_file("delugegtk.glade"), domain=APP) self.window = self.wtree.get_widget("main_window") self.window.hide() self.toolbar = self.wtree.get_widget("tb_middle") self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL,[('text/uri-list', 0, 80)], gtk.gdk.ACTION_COPY) self.window.connect("delete_event", self.close) self.window.connect("drag_data_received", self.on_drag_data) - self.window.set_title(dcommon.PROGRAM_NAME) - self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + self.window.set_title(common.PROGRAM_NAME) + self.window.set_icon_from_file(common.get_pixmap("deluge32.png")) self.notebook = self.wtree.get_widget("torrent_info") self.statusbar = self.wtree.get_widget("statusbar") @@ -198,7 +198,7 @@ class DelugeGTK: }) def build_tray_icon(self): - self.tray_icon = gtk.status_icon_new_from_file(dcommon.get_pixmap("deluge32.png")) + self.tray_icon = gtk.status_icon_new_from_file(common.get_pixmap("deluge32.png")) self.tray_menu = gtk.Menu() item_show = gtk.MenuItem(_("Show / Hide Window")) @@ -255,7 +255,7 @@ class DelugeGTK: def build_torrent_table(self): ## Create the torrent listview self.torrent_view = self.wtree.get_widget("torrent_view") - self.torrent_glade = gtk.glade.XML(dcommon.get_glade_file("torrent_menu.glade"), domain='deluge') + self.torrent_glade = gtk.glade.XML(common.get_glade_file("torrent_menu.glade"), domain='deluge') self.torrent_menu = self.torrent_glade.get_widget("torrent_menu") self.torrent_glade.signal_autoconnect({ "start_pause": self.start_pause, "update_tracker": self.update_tracker, @@ -272,12 +272,12 @@ class DelugeGTK: def size(column, cell, model, iter, data): size = long(model.get_value(iter, data)) - size_str = dcommon.fsize(size) + size_str = common.fsize(size) cell.set_property('text', size_str) def rate(column, cell, model, iter, data): rate = int(model.get_value(iter, data)) - rate_str = dcommon.frate(rate) + rate_str = common.frate(rate) cell.set_property('text', rate_str) def peer(column, cell, model, iter, data): @@ -293,7 +293,7 @@ class DelugeGTK: elif time == 0: time_str = "-" else: - time_str = dcommon.ftime(time) + time_str = common.ftime(time) cell.set_property('text', time_str) def ratio(column, cell, model, iter, data): @@ -349,7 +349,7 @@ class DelugeGTK: unique_id = model.get_value(model.get_iter(path), 0) state = self.manager.get_torrent_state(unique_id) # A new torrent has been selected, need to update parts of interface - self.text_summary_total_size.set_text(dcommon.fsize(state["total_size"])) + self.text_summary_total_size.set_text(common.fsize(state["total_size"])) self.text_summary_pieces.set_text(str(state["pieces"])) self.text_summary_tracker.set_text(str(state["tracker"])) #self.text_summary_compact_allocation.set_text(str(state[""])) @@ -362,7 +362,7 @@ class DelugeGTK: assert(len(all_files) == len(file_filter)) i=0 for f in all_files: - self.file_store.append([not file_filter[i], f['path'], dcommon.fsize(f['size']), + self.file_store.append([not file_filter[i], f['path'], common.fsize(f['size']), f['offset'], '%.2f%%'%f['progress']]) i=i+1 @@ -527,7 +527,7 @@ class DelugeGTK: dlrate = int(state['download_rate']) ulrate = int(state['upload_rate']) try: - eta = dcommon.get_eta(state["total_size"], state["total_done"], state["download_rate"]) + eta = common.get_eta(state["total_size"], state["total_done"], state["download_rate"]) except ZeroDivisionError: eta = -1 share = float(self.calc_share_ratio(unique_id, state)) @@ -585,8 +585,8 @@ class DelugeGTK: # Update Statusbar and Tray Tips core_state = self.manager.get_state() connections = core_state['num_peers'] - dlrate = dcommon.frate(core_state['download_rate']) - ulrate = dcommon.frate(core_state['upload_rate']) + dlrate = common.frate(core_state['download_rate']) + ulrate = common.frate(core_state['upload_rate']) self.statusbar_temp_msg = '%s: %s %s: %s %s: %s'%( _('Connections'), connections, _('Download'), @@ -655,25 +655,25 @@ class DelugeGTK: if tab == 0: #Details Pane self.wtree.get_widget("summary_name").set_text(state['name']) - self.text_summary_total_size.set_text(dcommon.fsize(state["total_size"])) + self.text_summary_total_size.set_text(common.fsize(state["total_size"])) self.text_summary_pieces.set_text(str(state["pieces"])) - self.text_summary_total_downloaded.set_text(dcommon.fsize(state["total_done"])) + self.text_summary_total_downloaded.set_text(common.fsize(state["total_done"])) #self.text_summary_total_uploaded.set_text() - self.text_summary_download_rate.set_text(dcommon.frate(state["download_rate"])) - self.text_summary_upload_rate.set_text(dcommon.frate(state["upload_rate"])) - self.text_summary_seeders.set_text(dcommon.fseed(state)) - self.text_summary_peers.set_text(dcommon.fpeer(state)) + self.text_summary_download_rate.set_text(common.frate(state["download_rate"])) + self.text_summary_upload_rate.set_text(common.frate(state["upload_rate"])) + self.text_summary_seeders.set_text(common.fseed(state)) + self.text_summary_peers.set_text(common.fpeer(state)) self.wtree.get_widget("progressbar").set_fraction(float(state['progress'])) - self.wtree.get_widget("progressbar").set_text(dcommon.fpcnt(state["progress"])) + self.wtree.get_widget("progressbar").set_text(common.fpcnt(state["progress"])) self.text_summary_share_ratio.set_text('%.3f'%(self.calc_share_ratio(self.get_selected_torrent(), state))) - self.text_summary_downloaded_this_session.set_text(dcommon.fsize(state["total_download"])) - self.text_summary_uploaded_this_session.set_text(dcommon.fsize(state["total_upload"])) + self.text_summary_downloaded_this_session.set_text(common.fsize(state["total_download"])) + self.text_summary_uploaded_this_session.set_text(common.fsize(state["total_upload"])) self.text_summary_tracker.set_text(str(state["tracker"])) #self.text_summary_tracker_response.set_text(str(state[""])) self.text_summary_tracker_status.set_text(str(state["tracker_ok"])) self.text_summary_next_announce.set_text(str(state["next_announce"])) #self.text_summary_compact_allocation.set_text(str(state[""])) - self.text_summary_eta.set_text(dcommon.estimate_eta(state)) + self.text_summary_eta.set_text(common.estimate_eta(state)) elif tab == 1: #Peers List def biographer(model, path, iter, dictionary): assert(model.get_value(iter, 0) not in dictionary.keys()) @@ -720,15 +720,15 @@ class DelugeGTK: self.peer_store.set(self.peer_store.get_iter_from_string(curr_ips[peer['ip']]), 1, unicode(peer['client'], 'Latin-1'), 2, '%.2f%%'%peer["peer_has"], - 3, dcommon.frate(peer["download_speed"]), - 4, dcommon.frate(peer["upload_speed"])) + 3, common.frate(peer["download_speed"]), + 4, common.frate(peer["upload_speed"])) for peer in new_peer_info: if peer['ip'] not in curr_ips.keys() and peer['client'] is not "": self.peer_store.append([peer["ip"], unicode(peer["client"], 'Latin-1'), '%.2f%%'%peer["peer_has"], - dcommon.frate(peer["download_speed"]), - dcommon.frate(peer["upload_speed"])]) + common.frate(peer["download_speed"]), + common.frate(peer["upload_speed"])]) #print new_ips #print curr_ips #print new_peer_info @@ -781,8 +781,8 @@ class DelugeGTK: try: unique_id = self.manager.add_torrent(torrent, path, self.config.get('use_compact_storage', bool, default=False)) except core.InsufficientFreeSpaceError, err: - nice_need = dcommon.fsize(err.needed_space) - nice_free = dcommon.fsize(err.free_space) + nice_need = common.fsize(err.needed_space) + nice_free = common.fsize(err.free_space) if append: @@ -798,7 +798,7 @@ class DelugeGTK: def add_torrent_url_clicked(self, obj=None): dlg = gtk.Dialog(title=_("Add torrent from URL"), parent=self.window, buttons=(gtk.STOCK_CANCEL, 0, gtk.STOCK_OK, 1)) - dlg.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + dlg.set_icon_from_file(common.get_pixmap("deluge32.png")) label = gtk.Label(_("Enter the URL of the .torrent to download")) entry = gtk.Entry() @@ -819,10 +819,10 @@ class DelugeGTK: def remove_torrent_clicked(self, obj=None): torrent = self.get_selected_torrent() if torrent is not None: - glade = gtk.glade.XML(dcommon.get_glade_file("dgtkpopups.glade"), domain='deluge') + glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade"), domain='deluge') asker = glade.get_widget("remove_torrent_dlg") - asker.set_icon_from_file(dcommon.get_pixmap("deluge32.png")) + asker.set_icon_from_file(common.get_pixmap("deluge32.png")) warning = glade.get_widget("warning") warning.set_text(" ")