diff --git a/LICENSE b/LICENSE index 0e7548892..4856598ea 100644 --- a/LICENSE +++ b/LICENSE @@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -348,4 +348,3 @@ Public License instead of this License. but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. - diff --git a/README b/README index ff051790e..6801e2d5f 100644 --- a/README +++ b/README @@ -12,9 +12,8 @@ Homepage: http://deluge-torrent.org Installation Instructions: ========================== -First, make sure you have the proper bulid -dependencies installed. On a normal Debian -or Ubuntu system, those dependencies are: +First, make sure you have the proper bulid dependencies installed. On a normal +Debian or Ubuntu system, those dependencies are: g++ python-all-dev @@ -31,16 +30,13 @@ libboost-serialization-dev libssl-dev zlib1g-dev -But the names of the packages may vary -depending on your OS / distro. +But the names of the packages may vary depending on your OS / distro. -Once you have the needed libraries installed, -build Deluge by running: +Once you have the needed libraries installed, build Deluge by running: python setup.py build -You shouldn't get any errors. Then run, as -root (or by using sudo): +You shouldn't get any errors. Then run, as root (or by using sudo): python setup.py install @@ -52,17 +48,12 @@ You can then run Deluge by executing: Notes: -1) On some distributions, boost libraries are - renamed to have "-mt" at the end (boost_thread_mt - instead of boost_thread, for example), the "mt" - indicating "multithreaded". In some cases it - appears the distros lack symlinks to connect - things. The solution is to either add symlinks - from the short names to those with "-mt", or to - alter setup.py to look for the "-mt" versions. +1) On some distributions, boost libraries are renamed to have "-mt" at the end +(boost_thread_mt instead of boost_thread, for example), the "mt" indicating +"multithreaded". In some cases it appears the distros lack symlinks to connect +things. The solution is to either add symlinks from the short names to those +with "-mt", or to alter setup.py to look for the "-mt" versions. -2) After upgrading your Deluge installation, it - may fail to start. If this happens to you, you - need to remove your ~/.config/deluge directory - to allow Deluge to rebuild it's configuration - file. +2) After upgrading your Deluge installation, it may fail to start. If this +happens to you, you need to remove your ~/.config/deluge directory to allow +Deluge to rebuild it's configuration file. diff --git a/README.Packagers b/README.Packagers index e09adbb1e..0571c81f6 100644 --- a/README.Packagers +++ b/README.Packagers @@ -1,11 +1,8 @@ - -NOTE: Deluge 0.5.1 uses an unstable build of libtorrent. This -build differs from a clean libtorrent source checkout and has -been hacked in order to get it to work properly with Deluge. -As a result, Deluge will likely not build properly against a -vanilla libtorrent 0.12 installation or a nightly build of -libtorrent 0.13. It is recommended that you build against our -included libtorrent, as our build will not conflict with any -installed libtorrent. +NOTE: Deluge 0.5.1 uses an unstable build of libtorrent. This build differs +from a clean libtorrent source checkout and has been hacked in order to get it +to work properly with Deluge. As a result, Deluge will likely not build +properly against a vanilla libtorrent 0.12 installation or a nightly build of +libtorrent 0.13. It is recommended that you build against our included +libtorrent, as our build will not conflict with any installed libtorrent. - zachtib diff --git a/plugins/DesiredRatio/__init__.py b/plugins/DesiredRatio/__init__.py index e1f868a6d..3e0bf6296 100644 --- a/plugins/DesiredRatio/__init__.py +++ b/plugins/DesiredRatio/__init__.py @@ -32,103 +32,103 @@ def enable(core, interface): ### The Plugin ### DEFAULT_PREFS = { - "ratios": [1.0, 1.5, 2.0, 3.0] + "ratios": [1.0, 1.5, 2.0, 3.0] } import deluge import gtk, gtk.glade class DesiredRatio: - - def __init__(self, path, core, interface): - self.path = path - self.core = core - self.interface = interface - self.set_ratios = {} - self.callback_ids = [] + + def __init__(self, path, core, interface): + self.path = path + self.core = core + self.interface = interface + self.set_ratios = {} + self.callback_ids = [] - # Setup preferences - self.config = deluge.pref.Preferences(filename=deluge.common.CONFIG_DIR + "/desired_ratio.conf", global_defaults=False, defaults=DEFAULT_PREFS) + # Setup preferences + self.config = deluge.pref.Preferences(filename=deluge.common.CONFIG_DIR + "/desired_ratio.conf", global_defaults=False, defaults=DEFAULT_PREFS) # Connect to events for the torrent menu so we know when to build and remove our sub-menu - self.callback_ids.append(self.interface.torrent_menu.connect_after("realize", self.torrent_menu_show)) - self.callback_ids.append(self.interface.torrent_menu.connect("show", self.torrent_menu_show)) - self.callback_ids.append(self.interface.torrent_menu.connect("hide", self.torrent_menu_hide)) + self.callback_ids.append(self.interface.torrent_menu.connect_after("realize", self.torrent_menu_show)) + self.callback_ids.append(self.interface.torrent_menu.connect("show", self.torrent_menu_show)) + self.callback_ids.append(self.interface.torrent_menu.connect("hide", self.torrent_menu_hide)) - def torrent_menu_show(self, widget, data=None): - # Get the selected torrent - self.unique_ID = self.interface.get_selected_torrent() + def torrent_menu_show(self, widget, data=None): + # Get the selected torrent + self.unique_ID = self.interface.get_selected_torrent() - # Make the sub-menu for the torrent menu - self.ratio_menuitem = gtk.MenuItem(_("_Desired Ratio")) + # Make the sub-menu for the torrent menu + self.ratio_menuitem = gtk.MenuItem(_("_Desired Ratio")) - self.ratio_menu = self.interface.build_menu_radio_list(self.config.get("ratios"), self.ratio_clicked, self.get_torrent_desired_ratio(), None, True, _("_Not Set"), 1) + self.ratio_menu = self.interface.build_menu_radio_list(self.config.get("ratios"), self.ratio_clicked, self.get_torrent_desired_ratio(), None, True, _("_Not Set"), 1) - self.ratio_menuitem.set_submenu(self.ratio_menu) - self.interface.torrent_menu.append(self.ratio_menuitem) + self.ratio_menuitem.set_submenu(self.ratio_menu) + self.interface.torrent_menu.append(self.ratio_menuitem) - self.ratio_menuitem.show_all() + self.ratio_menuitem.show_all() - def torrent_menu_hide(self, widget): - try: - self.interface.torrent_menu.remove(self.ratio_menuitem) - except AttributeError: - pass - - def update(self): - pass - - def unload(self): - # Disconnect all callbacks - for callback_id in self.callback_ids: - self.interface.torrent_menu.disconnect(callback_id) - - self.callback_ids = [] + def torrent_menu_hide(self, widget): + try: + self.interface.torrent_menu.remove(self.ratio_menuitem) + except AttributeError: + pass + + def update(self): + pass + + def unload(self): + # Disconnect all callbacks + for callback_id in self.callback_ids: + self.interface.torrent_menu.disconnect(callback_id) + + self.callback_ids = [] - # Reset all desired ratios in the core - for unique_ID, ratio in self.set_ratios.items(): - if ratio >= 1: - self.core.set_ratio(unique_ID, ratio) - - self.set_ratios = {} - - def ratio_clicked(self, widget): - value = widget.get_children()[0].get_text() - if value == _("Not Set"): - value = -1 - - if value == _("Other..."): - dialog_glade = gtk.glade.XML(deluge.common.get_glade_file("dgtkpopups.glade")) - speed_dialog = dialog_glade.get_widget("speed_dialog") - spin_speed = dialog_glade.get_widget("spin_speed") - spin_speed.set_value(self.get_torrent_desired_ratio()) - spin_speed.set_increments(0.1, 1.0) - spin_speed.set_digits(1) - spin_speed.set_range(1.0, 1000.0) - spin_speed.select_region(0, -1) - response = speed_dialog.run() - if response == 1: # OK Response - value = spin_speed.get_value() - else: - speed_dialog.destroy() - return - speed_dialog.destroy() - - value = float(value) # Make sure the value is a float - - # Set the ratio in the core and remember the setting - self.core.set_ratio(self.unique_ID, value) - self.set_ratios[self.unique_ID] = value - - # Update the ratios list if necessary - if value not in self.config.get("ratios") and value >= 1: - self.config.get("ratios").insert(0, value) - self.config.get("ratios").pop() - - def get_torrent_desired_ratio(self): - if self.set_ratios.has_key(self.unique_ID): - return self.set_ratios[self.unique_ID] - else: - return -1 + # Reset all desired ratios in the core + for unique_ID, ratio in self.set_ratios.items(): + if ratio >= 1: + self.core.set_ratio(unique_ID, ratio) + + self.set_ratios = {} + + def ratio_clicked(self, widget): + value = widget.get_children()[0].get_text() + if value == _("Not Set"): + value = -1 + + if value == _("Other..."): + dialog_glade = gtk.glade.XML(deluge.common.get_glade_file("dgtkpopups.glade")) + speed_dialog = dialog_glade.get_widget("speed_dialog") + spin_speed = dialog_glade.get_widget("spin_speed") + spin_speed.set_value(self.get_torrent_desired_ratio()) + spin_speed.set_increments(0.1, 1.0) + spin_speed.set_digits(1) + spin_speed.set_range(1.0, 1000.0) + spin_speed.select_region(0, -1) + response = speed_dialog.run() + if response == 1: # OK Response + value = spin_speed.get_value() + else: + speed_dialog.destroy() + return + speed_dialog.destroy() + + value = float(value) # Make sure the value is a float + + # Set the ratio in the core and remember the setting + self.core.set_ratio(self.unique_ID, value) + self.set_ratios[self.unique_ID] = value + + # Update the ratios list if necessary + if value not in self.config.get("ratios") and value >= 1: + self.config.get("ratios").insert(0, value) + self.config.get("ratios").pop() + + def get_torrent_desired_ratio(self): + if self.set_ratios.has_key(self.unique_ID): + return self.set_ratios[self.unique_ID] + else: + return -1 diff --git a/plugins/ExamplePlugin/plugin.py b/plugins/ExamplePlugin/plugin.py index 68c675562..61010d8ce 100644 --- a/plugins/ExamplePlugin/plugin.py +++ b/plugins/ExamplePlugin/plugin.py @@ -4,89 +4,89 @@ import deluge.common, deluge.pref, gtk, gtk.glade # This plugin is intended to be used with Deluge's default GTK interface class plugin_Example: # The plugin's class - ## Your plugin's contructor should follow this format - ## path = A string containing the path to the plugin - ## deluge_core = The active instance of the Deluge Manager - ## deluge_interface = The active instance of the Deluge Interface - def __init__(self, path, deluge_core, deluge_interface): - # Save the path, interface, and core so they can be used later - self.path = path - self.core = deluge_core - self.interface = deluge_interface + ## Your plugin's contructor should follow this format + ## path = A string containing the path to the plugin + ## deluge_core = The active instance of the Deluge Manager + ## deluge_interface = The active instance of the Deluge Interface + def __init__(self, path, deluge_core, deluge_interface): + # Save the path, interface, and core so they can be used later + self.path = path + self.core = deluge_core + self.interface = deluge_interface - # Create an options file and try to load existing Values - self.config_file = deluge.common.CONFIG_DIR + "/example.conf" - self.config = deluge.pref.Preferences() - try: - self.config.load(self.config_file) - except IOError: - # File does not exist - pass - - # Extract the configuration dialog from the gladefile - self.glade = gtk.glade.XML(path + "/example.glade") - self.dialog = self.glade.get_widget("dialog") - self.dialog.set_icon_from_file(self.path + "/example-plugin.png") - # Access the interface's toolbar - self.toolbar = self.interface.toolbar - # Make a toolbar button - icon = gtk.Image() - icon.set_from_file(self.path + "/example-plugin.png") # Toolbar items should be 22x22 pixel images - self.button = gtk.ToolButton(icon_widget=icon, label="Example Plugin") - self.button.connect("clicked", self.clicked) # Connect the signal handler for the button - self.toolbar.add(self.button) # Add button to toolbar - self.button.show_all() # Show the button - - - ## unload is called when the plugin is removed or Deluge is shut down - def unload(self): - self.toolbar.remove(self.button) # Remove the button from the toolbar - self.config.save(self.config_file) - - ## update will be called every UPDATE_INTERVAL (usually about 1 second) - def update(self): - # As this plugin doesn't need to do anything every interval, this - # function will remain empty - pass + # Create an options file and try to load existing Values + self.config_file = deluge.common.CONFIG_DIR + "/example.conf" + self.config = deluge.pref.Preferences() + try: + self.config.load(self.config_file) + except IOError: + # File does not exist + pass + + # Extract the configuration dialog from the gladefile + self.glade = gtk.glade.XML(path + "/example.glade") + self.dialog = self.glade.get_widget("dialog") + self.dialog.set_icon_from_file(self.path + "/example-plugin.png") + # Access the interface's toolbar + self.toolbar = self.interface.toolbar + # Make a toolbar button + icon = gtk.Image() + icon.set_from_file(self.path + "/example-plugin.png") # Toolbar items should be 22x22 pixel images + self.button = gtk.ToolButton(icon_widget=icon, label="Example Plugin") + self.button.connect("clicked", self.clicked) # Connect the signal handler for the button + self.toolbar.add(self.button) # Add button to toolbar + self.button.show_all() # Show the button + + + ## unload is called when the plugin is removed or Deluge is shut down + def unload(self): + self.toolbar.remove(self.button) # Remove the button from the toolbar + self.config.save(self.config_file) + + ## update will be called every UPDATE_INTERVAL (usually about 1 second) + def update(self): + # As this plugin doesn't need to do anything every interval, this + # function will remain empty + pass - ## This will be only called if your plugin is configurable - def configure(self): - entry1 = self.glade.get_widget("entry1") - entry2 = self.glade.get_widget("entry2") - try: - entry1.set_text(self.config.get("option1")) - entry2.set_text(self.config.get("option2")) - except: - entry1.set_text("") - entry2.set_text("") - self.dialog.show() - response = self.dialog.run() - self.dialog.hide() - if response: - self.config.set("option1", entry1.get_text()) - self.config.set("option2", entry2.get_text()) - - - - ## This will be called whenever self.button is clicked - def clicked(self, button): - # Build a dialog from scratch rather than from a glade file - dialog = gtk.Dialog(title="Example Plugin", parent=self.interface.window, - buttons=(gtk.STOCK_OK, 0)) - dialog.set_icon_from_file(self.path + "/example-plugin.png") - try: - text = "This is a popup notification from Example Plugin\n" + \ - "Your value for option1 is %s\n"%self.config.get("option1") + \ - "and option2 is %s"%self.config.get("option2") - except KeyError: - text = "This is a popup notification from Example Plugin\n" + \ - "If you had set options by configuring this plugin,\n" + \ - "they would appear here" - label = gtk.Label(text) - dialog.vbox.pack_start(label) - - dialog.show_all() - dialog.run() - dialog.hide() - dialog.destroy() - + ## This will be only called if your plugin is configurable + def configure(self): + entry1 = self.glade.get_widget("entry1") + entry2 = self.glade.get_widget("entry2") + try: + entry1.set_text(self.config.get("option1")) + entry2.set_text(self.config.get("option2")) + except: + entry1.set_text("") + entry2.set_text("") + self.dialog.show() + response = self.dialog.run() + self.dialog.hide() + if response: + self.config.set("option1", entry1.get_text()) + self.config.set("option2", entry2.get_text()) + + + + ## This will be called whenever self.button is clicked + def clicked(self, button): + # Build a dialog from scratch rather than from a glade file + dialog = gtk.Dialog(title="Example Plugin", parent=self.interface.window, + buttons=(gtk.STOCK_OK, 0)) + dialog.set_icon_from_file(self.path + "/example-plugin.png") + try: + text = "This is a popup notification from Example Plugin\n" + \ + "Your value for option1 is %s\n"%self.config.get("option1") + \ + "and option2 is %s"%self.config.get("option2") + except KeyError: + text = "This is a popup notification from Example Plugin\n" + \ + "If you had set options by configuring this plugin,\n" + \ + "they would appear here" + label = gtk.Label(text) + dialog.vbox.pack_start(label) + + dialog.show_all() + dialog.run() + dialog.hide() + dialog.destroy() + diff --git a/plugins/HelloWorld/__init__.py b/plugins/HelloWorld/__init__.py index 86d75ac4b..199f43a33 100644 --- a/plugins/HelloWorld/__init__.py +++ b/plugins/HelloWorld/__init__.py @@ -15,15 +15,15 @@ def enable(core, interface): class plugin_Hello: - def __init__(self, path, deluge_core, deluge_interface): - self.path = path - self.core = deluge_core - self.interface = deluge_interface - - def unload(self): - pass - - def update(self): - print "Hello, World!" + def __init__(self, path, deluge_core, deluge_interface): + self.path = path + self.core = deluge_core + self.interface = deluge_interface + + def unload(self): + pass + + def update(self): + print "Hello, World!" diff --git a/plugins/NetworkGraph/plugin.py b/plugins/NetworkGraph/plugin.py index c72bb1744..7c3973293 100644 --- a/plugins/NetworkGraph/plugin.py +++ b/plugins/NetworkGraph/plugin.py @@ -1,157 +1,157 @@ # netgraph plugin class plugin_NetGraph: - def __init__(self, path, deluge_core, deluge_interface): - import gtk - self.parent = deluge_interface - self.location = path - self.core = deluge_core + def __init__(self, path, deluge_core, deluge_interface): + import gtk + self.parent = deluge_interface + self.location = path + self.core = deluge_core - self.image = gtk.Image() + self.image = gtk.Image() - self.viewPort = gtk.Viewport() - self.viewPort.add(self.image) + self.viewPort = gtk.Viewport() + self.viewPort.add(self.image) - self.scrolledWindow = gtk.ScrolledWindow() - self.scrolledWindow.add(self.viewPort) - self.scrolledWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + self.scrolledWindow = gtk.ScrolledWindow() + self.scrolledWindow.add(self.viewPort) + self.scrolledWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - self.topWidget = self.scrolledWindow + self.topWidget = self.scrolledWindow - self.parentNotebook = self.parent.notebook -# print "Parent NOTEBOOK:", self.parentNotebook - self.parentNotebook.append_page(self.topWidget, gtk.Label("Graph")) -# print "My INDEX in parentNoteBook:", self.index + self.parentNotebook = self.parent.notebook +# print "Parent NOTEBOOK:", self.parentNotebook + self.parentNotebook.append_page(self.topWidget, gtk.Label("Graph")) +# print "My INDEX in parentNoteBook:", self.index - self.image.show() - self.viewPort.show() - self.scrolledWindow.show() + self.image.show() + self.viewPort.show() + self.scrolledWindow.show() - self.length = 60 + self.length = 60 - self.width = -1 - self.height = -1 + self.width = -1 + self.height = -1 - import pango + import pango - self.pangoContext = self.parent.window.get_pango_context() - self.pangoLayout = pango.Layout(self.pangoContext) + self.pangoContext = self.parent.window.get_pango_context() + self.pangoLayout = pango.Layout(self.pangoContext) - self.savedUpSpeeds = [] - self.savedDownSpeeds = [] + self.savedUpSpeeds = [] + self.savedDownSpeeds = [] - self.bootupRuns = 3 # This ensures that we pass the resizing phase, with scrollbars, etc. - # So the first time it is viewed, we are all ready + self.bootupRuns = 3 # This ensures that we pass the resizing phase, with scrollbars, etc. + # So the first time it is viewed, we are all ready - def unload(self): # Shutdown is called when the plugin is deactivated - numPages = self.parentNotebook.get_n_pages() - for page in range(numPages): - if self.parentNotebook.get_nth_page(page) == self.topWidget: - self.parentNotebook.remove_page(page) - break + def unload(self): # Shutdown is called when the plugin is deactivated + numPages = self.parentNotebook.get_n_pages() + for page in range(numPages): + if self.parentNotebook.get_nth_page(page) == self.topWidget: + self.parentNotebook.remove_page(page) + break - def update(self): - import gtk - session_info = self.core.get_state() - self.savedUpSpeeds.insert(0, session_info['upload_rate']) - if len(self.savedUpSpeeds) > self.length: - self.savedUpSpeeds.pop() - self.savedDownSpeeds.insert(0, session_info['download_rate']) - if len(self.savedDownSpeeds) > self.length: - self.savedDownSpeeds.pop() + def update(self): + import gtk + session_info = self.core.get_state() + self.savedUpSpeeds.insert(0, session_info['upload_rate']) + if len(self.savedUpSpeeds) > self.length: + self.savedUpSpeeds.pop() + self.savedDownSpeeds.insert(0, session_info['download_rate']) + if len(self.savedDownSpeeds) > self.length: + self.savedDownSpeeds.pop() - if not self.parentNotebook.get_nth_page(self.parentNotebook.get_current_page()) == \ - self.topWidget and not self.bootupRuns > 0: - return + if not self.parentNotebook.get_nth_page(self.parentNotebook.get_current_page()) == \ + self.topWidget and not self.bootupRuns > 0: + return - self.bootupRuns = max(self.bootupRuns - 1, 0) + self.bootupRuns = max(self.bootupRuns - 1, 0) - extraWidth = self.scrolledWindow.get_vscrollbar().get_allocation().width * 1.5 - extraHeight = self.scrolledWindow.get_hscrollbar().get_allocation().height * 1.5 - allocation = self.scrolledWindow.get_allocation() - allocation.width = int(allocation.width) - extraWidth - allocation.height = int(allocation.height) - extraHeight + extraWidth = self.scrolledWindow.get_vscrollbar().get_allocation().width * 1.5 + extraHeight = self.scrolledWindow.get_hscrollbar().get_allocation().height * 1.5 + allocation = self.scrolledWindow.get_allocation() + allocation.width = int(allocation.width) - extraWidth + allocation.height = int(allocation.height) - extraHeight - # Don't try to allocate a size too small, or you might crash - if allocation.width < 2 or allocation.height < 2: - return + # Don't try to allocate a size too small, or you might crash + if allocation.width < 2 or allocation.height < 2: + return -# savedDownSpeeds = [1,2,3,2,1] -# savedUpSpeeds = [5,8,0,0,1,2] +# savedDownSpeeds = [1,2,3,2,1] +# savedUpSpeeds = [5,8,0,0,1,2] -# allocation = self.image.get_allocation() -# allocation.width = 300 -# allocation.height = 200 +# allocation = self.image.get_allocation() +# allocation.width = 300 +# allocation.height = 200 - if not allocation.width == self.width or not allocation.height == self.height: -# print "New Pixmap!" - self.width = allocation.width - self.height = allocation.height + if not allocation.width == self.width or not allocation.height == self.height: +# print "New Pixmap!" + self.width = allocation.width + self.height = allocation.height - self.networkPixmap = gtk.gdk.Pixmap(None, self.width, self.height, 24) - self.image.set_from_pixmap(self.networkPixmap, None) - self.ctx = self.networkPixmap.cairo_create() + self.networkPixmap = gtk.gdk.Pixmap(None, self.width, self.height, 24) + self.image.set_from_pixmap(self.networkPixmap, None) + self.ctx = self.networkPixmap.cairo_create() - self.networkPixmap.draw_rectangle(self.image.get_style().white_gc,True, 0, 0, self.width, self.height) + self.networkPixmap.draw_rectangle(self.image.get_style().white_gc,True, 0, 0, self.width, self.height) - maxSpeed = max(max(self.savedDownSpeeds),max(self.savedUpSpeeds)) + maxSpeed = max(max(self.savedDownSpeeds),max(self.savedUpSpeeds)) - if maxSpeed == 0: - return + if maxSpeed == 0: + return - maxSpeed = maxSpeed*1.1 # Give some extra room on top + maxSpeed = maxSpeed*1.1 # Give some extra room on top - self.drawSpeedPoly(self.savedDownSpeeds, (0.5,1, 0.5, 1.0), maxSpeed, True) - self.drawSpeedPoly(self.savedDownSpeeds, (0, 0.75,0, 1.0), maxSpeed, False) + self.drawSpeedPoly(self.savedDownSpeeds, (0.5,1, 0.5, 1.0), maxSpeed, True) + self.drawSpeedPoly(self.savedDownSpeeds, (0, 0.75,0, 1.0), maxSpeed, False) - self.drawSpeedPoly(self.savedUpSpeeds, (0.33,0.33,1.0, 0.5), maxSpeed, True) - self.drawSpeedPoly(self.savedUpSpeeds, (0, 0, 1.0, 0.75), maxSpeed, False) + self.drawSpeedPoly(self.savedUpSpeeds, (0.33,0.33,1.0, 0.5), maxSpeed, True) + self.drawSpeedPoly(self.savedUpSpeeds, (0, 0, 1.0, 0.75), maxSpeed, False) - meanUpSpeed = sum(self.savedUpSpeeds) /len(self.savedUpSpeeds) - meanDownSpeed = sum(self.savedDownSpeeds)/len(self.savedDownSpeeds) - shownSpeed = max(meanUpSpeed, meanDownSpeed) - - import deluge.common + meanUpSpeed = sum(self.savedUpSpeeds) /len(self.savedUpSpeeds) + meanDownSpeed = sum(self.savedDownSpeeds)/len(self.savedDownSpeeds) + shownSpeed = max(meanUpSpeed, meanDownSpeed) + + import deluge.common - self.pangoLayout.set_text(deluge.common.fspeed(shownSpeed)) - self.networkPixmap.draw_layout(self.image.get_style().black_gc, - 4, - int(self.height - 1 - (self.height*shownSpeed/maxSpeed)), - self.pangoLayout) + self.pangoLayout.set_text(deluge.common.fspeed(shownSpeed)) + self.networkPixmap.draw_layout(self.image.get_style().black_gc, + 4, + int(self.height - 1 - (self.height*shownSpeed/maxSpeed)), + self.pangoLayout) - self.networkPixmap.draw_line(self.image.get_style().black_gc, - 0, int(self.height - (self.height*shownSpeed/maxSpeed)), - self.width, int(self.height - (self.height*shownSpeed/maxSpeed))) + self.networkPixmap.draw_line(self.image.get_style().black_gc, + 0, int(self.height - (self.height*shownSpeed/maxSpeed)), + self.width, int(self.height - (self.height*shownSpeed/maxSpeed))) - self.networkPixmap.draw_rectangle(self.image.get_style().black_gc,False, 0, 0, self.width-1, self.height-1) + self.networkPixmap.draw_rectangle(self.image.get_style().black_gc,False, 0, 0, self.width-1, self.height-1) - self.image.queue_draw() + self.image.queue_draw() - def tracePath(self, speeds, maxSpeed): - lineWidth = 4 + def tracePath(self, speeds, maxSpeed): + lineWidth = 4 - self.ctx.set_line_width(lineWidth) + self.ctx.set_line_width(lineWidth) - self.ctx.move_to(self.width + lineWidth,self.height + lineWidth) - self.ctx.line_to(self.width + lineWidth,int(self.height-(self.height*speeds[0]/maxSpeed))) + self.ctx.move_to(self.width + lineWidth,self.height + lineWidth) + self.ctx.line_to(self.width + lineWidth,int(self.height-(self.height*speeds[0]/maxSpeed))) - for i in range(len(speeds)): - self.ctx.line_to(int(self.width-1-((i*self.width)/(self.length-1))), - int(self.height-1-(self.height*speeds[i]/maxSpeed))) + for i in range(len(speeds)): + self.ctx.line_to(int(self.width-1-((i*self.width)/(self.length-1))), + int(self.height-1-(self.height*speeds[i]/maxSpeed))) - self.ctx.line_to(int(self.width-1-(((len(speeds)-1)*self.width)/(self.length-1))), - int(self.height)-1 + lineWidth) + self.ctx.line_to(int(self.width-1-(((len(speeds)-1)*self.width)/(self.length-1))), + int(self.height)-1 + lineWidth) - self.ctx.close_path() + self.ctx.close_path() - def drawSpeedPoly(self, speeds, color, maxSpeed, fill): + def drawSpeedPoly(self, speeds, color, maxSpeed, fill): - self.tracePath(speeds, maxSpeed) - self.ctx.set_source_rgba(color[0],color[1],color[2], color[3]) + self.tracePath(speeds, maxSpeed) + self.ctx.set_source_rgba(color[0],color[1],color[2], color[3]) - if fill: - self.ctx.fill() - else: - self.ctx.stroke() + if fill: + self.ctx.fill() + else: + self.ctx.stroke() diff --git a/plugins/NetworkHealth/plugin.py b/plugins/NetworkHealth/plugin.py index cfb5d286f..dbe95d218 100644 --- a/plugins/NetworkHealth/plugin.py +++ b/plugins/NetworkHealth/plugin.py @@ -1,24 +1,24 @@ class plugin_NetworkHealth: - def __init__(self, path, deluge_core, deluge_interface): - self.parent = deluge_interface # Using this, you can access the Deluge client - self.core = deluge_core - self.location = path + def __init__(self, path, deluge_core, deluge_interface): + self.parent = deluge_interface # Using this, you can access the Deluge client + self.core = deluge_core + self.location = path - self.counter = 30 - self.maxCount = self.counter - - def update(self): - session_info = self.core.get_state() - if not session_info['has_incoming_connections'] and \ - session_info['num_peers'] > 1: - message = "[No incoming connections]" - self.counter = self.counter - 1 - if self.counter < 0: - # self.parent.addMessage("No incoming connections: you may be behind a firewall or router. Perhaps you need to forward the relevant ports.", "W") - self.counter = self.maxCount*2 - self.maxCount = self.counter - else: - message = "[Health: OK]" - self.counter = self.maxCount + self.counter = 30 + self.maxCount = self.counter + + def update(self): + session_info = self.core.get_state() + if not session_info['has_incoming_connections'] and \ + session_info['num_peers'] > 1: + message = "[No incoming connections]" + self.counter = self.counter - 1 + if self.counter < 0: + # self.parent.addMessage("No incoming connections: you may be behind a firewall or router. Perhaps you need to forward the relevant ports.", "W") + self.counter = self.maxCount*2 + self.maxCount = self.counter + else: + message = "[Health: OK]" + self.counter = self.maxCount - self.parent.statusbar_temp_msg = self.parent.statusbar_temp_msg + ' ' + message + self.parent.statusbar_temp_msg = self.parent.statusbar_temp_msg + ' ' + message diff --git a/plugins/Scheduler/plugin.py b/plugins/Scheduler/plugin.py index cbe6a93d8..d739c13fe 100644 --- a/plugins/Scheduler/plugin.py +++ b/plugins/Scheduler/plugin.py @@ -1,243 +1,243 @@ import deluge.common, deluge.pref, gtk, copy, pickle, time class plugin_Scheduler: - def __init__(self, path, deluge_core, deluge_interface): - self.path = path - self.core = deluge_core - self.interface = deluge_interface + def __init__(self, path, deluge_core, deluge_interface): + self.path = path + self.core = deluge_core + self.interface = deluge_interface - self.days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] - self.conf_file = deluge.common.CONFIG_DIR + "/scheduler.conf" - self.config = deluge.pref.Preferences() - self.button_state_temp = [[0] * 7 for dummy in xrange(24)] - self.status = -1 + self.days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] + self.conf_file = deluge.common.CONFIG_DIR + "/scheduler.conf" + self.config = deluge.pref.Preferences() + self.button_state_temp = [[0] * 7 for dummy in xrange(24)] + self.status = -1 - #Load config - try: - reader = open(self.conf_file, "rb") - data = pickle.load(reader) - self.button_state = data[0] - self.dllimit = float(data[1][0]) - self.ullimit = float(data[1][1]) - reader.close() - except: - self.button_state = [[0] * 7 for dummy in xrange(24)] - self.dllimit = float(-1) - self.ullimit = float(-1) + #Load config + try: + reader = open(self.conf_file, "rb") + data = pickle.load(reader) + self.button_state = data[0] + self.dllimit = float(data[1][0]) + self.ullimit = float(data[1][1]) + reader.close() + except: + self.button_state = [[0] * 7 for dummy in xrange(24)] + self.dllimit = float(-1) + self.ullimit = float(-1) - def unload(self): - self.resume() - self.unlimit() + def unload(self): + self.resume() + self.unlimit() - def update(self): - time_now = time.localtime(time.time()) - - if self.status is not self.button_state[time_now[3]][time_now[6]]: - self.status = self.button_state[time_now[3]][time_now[6]] + def update(self): + time_now = time.localtime(time.time()) + + if self.status is not self.button_state[time_now[3]][time_now[6]]: + self.status = self.button_state[time_now[3]][time_now[6]] - if self.status == 0: - self.resume() - self.unlimit() - elif self.status == 1: - self.resume() - elif self.status == 2: - self.pause() + if self.status == 0: + self.resume() + self.unlimit() + elif self.status == 1: + self.resume() + elif self.status == 2: + self.pause() - if self.status == 1: - self.limit() + if self.status == 1: + self.limit() - def pause(self): - self.config.set("max_active_torrents", 0) - self.core.apply_queue() + def pause(self): + self.config.set("max_active_torrents", 0) + self.core.apply_queue() - def resume(self): - self.config.set("max_active_torrents", -1) - self.core.apply_queue() + def resume(self): + self.config.set("max_active_torrents", -1) + self.core.apply_queue() - def limit(self): - self.config.set("max_download_speed", float(self.dllimit)) - self.config.set("max_upload_speed", float(self.ullimit)) + def limit(self): + self.config.set("max_download_speed", float(self.dllimit)) + self.config.set("max_upload_speed", float(self.ullimit)) - def unlimit(self): - self.interface.apply_prefs() + def unlimit(self): + self.interface.apply_prefs() - #Configuration dialog - def configure(self): - global scheduler_select + #Configuration dialog + def configure(self): + global scheduler_select - self.button_state_temp = copy.deepcopy(self.button_state) + self.button_state_temp = copy.deepcopy(self.button_state) - #dialog - dialog = gtk.Dialog("Scheduler Settings") - dialog.set_default_size(600, 270) + #dialog + dialog = gtk.Dialog("Scheduler Settings") + dialog.set_default_size(600, 270) - #buttons - cancel_button = dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) - ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) - - #text - hover_text = gtk.Label() + #buttons + cancel_button = dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) + ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) + + #text + hover_text = gtk.Label() - dllimit_label = gtk.Label("Limit download to:") - ullimit_label = gtk.Label("Limit upload to:") + dllimit_label = gtk.Label("Limit download to:") + ullimit_label = gtk.Label("Limit upload to:") - #Select Widget - drawing = scheduler_select(self.button_state_temp, hover_text, self.days) + #Select Widget + drawing = scheduler_select(self.button_state_temp, hover_text, self.days) - #boxes - vbox_main = gtk.VBox() - hbox_main = gtk.HBox() - vbox_sub = gtk.VBox() - hbox_limit = gtk.HBox() + #boxes + vbox_main = gtk.VBox() + hbox_main = gtk.HBox() + vbox_sub = gtk.VBox() + hbox_limit = gtk.HBox() - #seperator - sep = gtk.HSeparator() + #seperator + sep = gtk.HSeparator() - #spinbuttons + #spinbuttons - dlinput = gtk.SpinButton() - dlinput.set_numeric(True) - dlinput.set_range(-1, 2048) - dlinput.set_increments(1, 10) - dlinput.set_value(float(self.dllimit)) + dlinput = gtk.SpinButton() + dlinput.set_numeric(True) + dlinput.set_range(-1, 2048) + dlinput.set_increments(1, 10) + dlinput.set_value(float(self.dllimit)) - ulinput = gtk.SpinButton() - ulinput.set_numeric(True) - ulinput.set_range(-1, 1024) - ulinput.set_increments(1, 10) - ulinput.set_value(float(self.ullimit)) + ulinput = gtk.SpinButton() + ulinput.set_numeric(True) + ulinput.set_range(-1, 1024) + ulinput.set_increments(1, 10) + ulinput.set_value(float(self.ullimit)) - #pack - dialog.vbox.pack_start(vbox_main) + #pack + dialog.vbox.pack_start(vbox_main) - vbox_main.pack_start(hbox_main) - vbox_main.pack_start(hover_text, False, True, 5) - vbox_main.pack_start(sep, False, True) - vbox_main.pack_start(hbox_limit, False, True, 5) + vbox_main.pack_start(hbox_main) + vbox_main.pack_start(hover_text, False, True, 5) + vbox_main.pack_start(sep, False, True) + vbox_main.pack_start(hbox_limit, False, True, 5) - hbox_main.pack_start(vbox_sub, False, True, 5) - hbox_main.pack_start(drawing) + hbox_main.pack_start(vbox_sub, False, True, 5) + hbox_main.pack_start(drawing) - hbox_limit.pack_start(dllimit_label, True, False) - hbox_limit.pack_start(dlinput, True, False) - hbox_limit.pack_start(ullimit_label, True, False) - hbox_limit.pack_start(ulinput, True, False) + hbox_limit.pack_start(dllimit_label, True, False) + hbox_limit.pack_start(dlinput, True, False) + hbox_limit.pack_start(ullimit_label, True, False) + hbox_limit.pack_start(ulinput, True, False) - for index in xrange(len(self.days)): - vbox_sub.pack_start(gtk.Label(self.days[index])) + for index in xrange(len(self.days)): + vbox_sub.pack_start(gtk.Label(self.days[index])) - #show - dialog.show_all() + #show + dialog.show_all() - #Save config - if dialog.run() == -5: - self.status = -1 - self.button_state = copy.deepcopy(drawing.button_state) - self.dllimit = float(dlinput.get_value()) - self.ullimit = float(ulinput.get_value()) - self.interface.apply_prefs() + #Save config + if dialog.run() == -5: + self.status = -1 + self.button_state = copy.deepcopy(drawing.button_state) + self.dllimit = float(dlinput.get_value()) + self.ullimit = float(ulinput.get_value()) + self.interface.apply_prefs() - writer = open(self.conf_file, "wb") - pickle.dump([drawing.button_state,[self.dllimit,self.ullimit]], writer) - writer.close() + writer = open(self.conf_file, "wb") + pickle.dump([drawing.button_state,[self.dllimit,self.ullimit]], writer) + writer.close() - dialog.destroy() + dialog.destroy() class scheduler_select(gtk.DrawingArea): - #connect signals - varaibles - def __init__(self, data, label, days): - gtk.DrawingArea.__init__(self) - self.set_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) + #connect signals - varaibles + def __init__(self, data, label, days): + gtk.DrawingArea.__init__(self) + self.set_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) - self.connect("expose_event", self.expose) - self.connect("button_press_event", self.mouse_down) - self.connect("button_release_event", self.mouse_up) - self.connect("motion_notify_event", self.mouse_hover) - self.connect("leave_notify_event", self.mouse_leave) + self.connect("expose_event", self.expose) + self.connect("button_press_event", self.mouse_down) + self.connect("button_release_event", self.mouse_up) + self.connect("motion_notify_event", self.mouse_hover) + self.connect("leave_notify_event", self.mouse_leave) - self.colors = [[115.0/255, 210.0/255, 22.0/255], [237.0/255, 212.0/255, 0.0/255], [204.0/255, 0.0/255, 0.0/255]] - self.button_state = data - self.button_state_temp = [[0] * 7 for dummy in xrange(24)] - self.start_point = [0,0] - self.hover_point = [-1,-1] - self.hover_label = label - self.hover_days = days - self.mouse_press = False + self.colors = [[115.0/255, 210.0/255, 22.0/255], [237.0/255, 212.0/255, 0.0/255], [204.0/255, 0.0/255, 0.0/255]] + self.button_state = data + self.button_state_temp = [[0] * 7 for dummy in xrange(24)] + self.start_point = [0,0] + self.hover_point = [-1,-1] + self.hover_label = label + self.hover_days = days + self.mouse_press = False - #redraw the whole thing - def expose(self, widget, event): - self.context = self.window.cairo_create() - self.context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) - self.context.clip() + #redraw the whole thing + def expose(self, widget, event): + self.context = self.window.cairo_create() + self.context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) + self.context.clip() - width = self.window.get_size()[0] - height = self.window.get_size()[1] + width = self.window.get_size()[0] + height = self.window.get_size()[1] - for y in xrange(7): - for x in xrange(24): - self.context.set_source_rgba(self.colors[self.button_state[x][y]][0], self.colors[self.button_state[x][y]][1], self.colors[self.button_state[x][y]][2], 0.7) - self.context.rectangle(width*(6*x/145.0+1/145.0), height*(6*y/43.0+1/43.0), 5*width/145.0, 5*height/43.0) - self.context.fill_preserve() - self.context.set_source_rgba(0.5, 0.5, 0.5, 0.5) - self.context.stroke() + for y in xrange(7): + for x in xrange(24): + self.context.set_source_rgba(self.colors[self.button_state[x][y]][0], self.colors[self.button_state[x][y]][1], self.colors[self.button_state[x][y]][2], 0.7) + self.context.rectangle(width*(6*x/145.0+1/145.0), height*(6*y/43.0+1/43.0), 5*width/145.0, 5*height/43.0) + self.context.fill_preserve() + self.context.set_source_rgba(0.5, 0.5, 0.5, 0.5) + self.context.stroke() - #coordinates --> which box - def get_point(self, event): - size = self.window.get_size() - x = int((event.x-size[0]*0.5/145.0)/(6*size[0]/145.0)) - y = int((event.y-size[1]*0.5/43.0)/(6*size[1]/43.0)) + #coordinates --> which box + def get_point(self, event): + size = self.window.get_size() + x = int((event.x-size[0]*0.5/145.0)/(6*size[0]/145.0)) + y = int((event.y-size[1]*0.5/43.0)/(6*size[1]/43.0)) - if x > 23: x = 23 - elif x < 0: x = 0 - if y > 6: y = 6 - elif y < 0: y = 0 + if x > 23: x = 23 + elif x < 0: x = 0 + if y > 6: y = 6 + elif y < 0: y = 0 - return [x,y] + return [x,y] - #mouse down - def mouse_down(self, widget, event): - self.mouse_press = True - self.start_point = self.get_point(event) - self.button_state_temp = copy.deepcopy(self.button_state) + #mouse down + def mouse_down(self, widget, event): + self.mouse_press = True + self.start_point = self.get_point(event) + self.button_state_temp = copy.deepcopy(self.button_state) - #if the same box -> change it - def mouse_up(self, widget, event): - self.mouse_press = False - end_point = self.get_point(event) + #if the same box -> change it + def mouse_up(self, widget, event): + self.mouse_press = False + end_point = self.get_point(event) - #change color on mouseclick depending on the button - if end_point[0] is self.start_point[0] and end_point[1] is self.start_point[1]: - if event.button == 1: - self.button_state[end_point[0]][end_point[1]] += 1 - if self.button_state[end_point[0]][end_point[1]] > 2: - self.button_state[end_point[0]][end_point[1]] = 0 - elif event.button == 3: - self.button_state[end_point[0]][end_point[1]] -= 1 - if self.button_state[end_point[0]][end_point[1]] < 0: - self.button_state[end_point[0]][end_point[1]] = 2 - self.queue_draw() - - #if box changed and mouse is pressed draw all boxes from start point to end point - #set hover text etc.. - def mouse_hover(self, widget, event): - if self.get_point(event) != self.hover_point: - self.hover_point = self.get_point(event) + #change color on mouseclick depending on the button + if end_point[0] is self.start_point[0] and end_point[1] is self.start_point[1]: + if event.button == 1: + self.button_state[end_point[0]][end_point[1]] += 1 + if self.button_state[end_point[0]][end_point[1]] > 2: + self.button_state[end_point[0]][end_point[1]] = 0 + elif event.button == 3: + self.button_state[end_point[0]][end_point[1]] -= 1 + if self.button_state[end_point[0]][end_point[1]] < 0: + self.button_state[end_point[0]][end_point[1]] = 2 + self.queue_draw() + + #if box changed and mouse is pressed draw all boxes from start point to end point + #set hover text etc.. + def mouse_hover(self, widget, event): + if self.get_point(event) != self.hover_point: + self.hover_point = self.get_point(event) - self.hover_label.set_text(self.hover_days[self.hover_point[1]] + " " + str(self.hover_point[0]) + ":00 - " + str(self.hover_point[0]) + ":59") + self.hover_label.set_text(self.hover_days[self.hover_point[1]] + " " + str(self.hover_point[0]) + ":00 - " + str(self.hover_point[0]) + ":59") - if self.mouse_press == True: - self.button_state = copy.deepcopy(self.button_state_temp) + if self.mouse_press == True: + self.button_state = copy.deepcopy(self.button_state_temp) - points = [[self.hover_point[0], self.start_point[0]], [self.hover_point[1], self.start_point[1]]] + points = [[self.hover_point[0], self.start_point[0]], [self.hover_point[1], self.start_point[1]]] - for x in xrange(min(points[0]), max(points[0])+1): - for y in xrange(min(points[1]), max(points[1])+1): - self.button_state[x][y] = self.button_state[self.start_point[0]][self.start_point[1]] + for x in xrange(min(points[0]), max(points[0])+1): + for y in xrange(min(points[1]), max(points[1])+1): + self.button_state[x][y] = self.button_state[self.start_point[0]][self.start_point[1]] - self.queue_draw() + self.queue_draw() - #clear hover text on mouse leave - def mouse_leave(self, widget, event): - self.hover_label.set_text("") - self.hover_point = [-1,-1] + #clear hover text on mouse leave + def mouse_leave(self, widget, event): + self.hover_label.set_text("") + self.hover_point = [-1,-1] diff --git a/plugins/TorrentSearch/plugin.py b/plugins/TorrentSearch/plugin.py index 34d610ad7..3ad3484f7 100644 --- a/plugins/TorrentSearch/plugin.py +++ b/plugins/TorrentSearch/plugin.py @@ -1,156 +1,156 @@ class plugin_Search: - def __init__(self, path, deluge_core, deluge_interface): - import gtk, gtk.glade, os - import deluge.common, deluge.dgtk, deluge.pref - self.core = deluge_core - self.interface = deluge_interface - self.conf_file = deluge.common.CONFIG_DIR + "/search.conf" - if not os.path.isfile(self.conf_file): - f = open(self.conf_file, mode='w') - f.flush() - f.close() - glade = gtk.glade.XML(path + "/searchdlg.glade") - self.dlg = glade.get_widget("search_dialog") - self.dlg.set_icon_from_file(deluge.common.get_pixmap("deluge32.png")) - self.view = glade.get_widget("search_view") - model = gtk.ListStore(str, str) - self.view.set_model(model) - deluge.dgtk.add_text_column(self.view, "Name", 0) - deluge.dgtk.add_text_column(self.view, "Search String", 1) - self.field_name = glade.get_widget("field_name") - self.field_search = glade.get_widget("field_search") - self.button_add = glade.get_widget("button_addsearch") - self.button_del = glade.get_widget("button_delsearch") - dic = { "add_clicked" : self.add_clicked, - "del_clicked" : self.del_clicked, - "row_clicked" : self.row_clicked, - "text_changed" : self.text_changed } - glade.signal_autoconnect(dic) - self.view.get_selection().set_select_function(self.row_clicked) - ### Note: All other plugins should use self.interface.toolbar - ### when adding items to the toolbar - self.se = '' - self.toolbar = self.interface.wtree.get_widget("tb_right") - self.engines = deluge.pref.Preferences(self.conf_file, False) - self.search_entry = gtk.Entry() - self.search_entry.connect("activate", self.torrent_search) - self.search_item = gtk.ToolItem() - self.search_item.add(self.search_entry) - self.search_icon = gtk.Image() - self.search_icon.set_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU) - self.menu_button = gtk.MenuToolButton(self.search_icon, "Choose an Engine") - self.menu_button.set_is_important(True) - self.menu_button.connect("clicked", self.torrent_search) - self.menu = gtk.Menu() - self.manage_item = gtk.ImageMenuItem("Manage Engines") - self.image = gtk.Image() - self.image.set_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU) - self.manage_item.set_image(self.image) - self.manage_item.connect("activate", self.configure) - self.menu.add(self.manage_item) - self.menu_button.set_menu(self.menu) - self.toolbar.insert(self.search_item, -1) - self.toolbar.insert(self.menu_button, -1) - self.populate_search_menu() - self.toolbar.show_all() - self.search_item.show_all() - self.menu_button.show_all() - self.menu.show_all() - - def unload(self): - self.engines.save(self.conf_file) - self.toolbar.remove(self.search_item) - self.toolbar.remove(self.menu_button) - - def text_changed(self, args): - a = (self.field_name.get_text() != "") - b = (self.field_search.get_text() != "") - if(a and b): - self.button_add.set_sensitive(1) - else: - self.button_add.set_sensitive(0) + def __init__(self, path, deluge_core, deluge_interface): + import gtk, gtk.glade, os + import deluge.common, deluge.dgtk, deluge.pref + self.core = deluge_core + self.interface = deluge_interface + self.conf_file = deluge.common.CONFIG_DIR + "/search.conf" + if not os.path.isfile(self.conf_file): + f = open(self.conf_file, mode='w') + f.flush() + f.close() + glade = gtk.glade.XML(path + "/searchdlg.glade") + self.dlg = glade.get_widget("search_dialog") + self.dlg.set_icon_from_file(deluge.common.get_pixmap("deluge32.png")) + self.view = glade.get_widget("search_view") + model = gtk.ListStore(str, str) + self.view.set_model(model) + deluge.dgtk.add_text_column(self.view, "Name", 0) + deluge.dgtk.add_text_column(self.view, "Search String", 1) + self.field_name = glade.get_widget("field_name") + self.field_search = glade.get_widget("field_search") + self.button_add = glade.get_widget("button_addsearch") + self.button_del = glade.get_widget("button_delsearch") + dic = { "add_clicked" : self.add_clicked, + "del_clicked" : self.del_clicked, + "row_clicked" : self.row_clicked, + "text_changed" : self.text_changed } + glade.signal_autoconnect(dic) + self.view.get_selection().set_select_function(self.row_clicked) + ### Note: All other plugins should use self.interface.toolbar + ### when adding items to the toolbar + self.se = '' + self.toolbar = self.interface.wtree.get_widget("tb_right") + self.engines = deluge.pref.Preferences(self.conf_file, False) + self.search_entry = gtk.Entry() + self.search_entry.connect("activate", self.torrent_search) + self.search_item = gtk.ToolItem() + self.search_item.add(self.search_entry) + self.search_icon = gtk.Image() + self.search_icon.set_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU) + self.menu_button = gtk.MenuToolButton(self.search_icon, "Choose an Engine") + self.menu_button.set_is_important(True) + self.menu_button.connect("clicked", self.torrent_search) + self.menu = gtk.Menu() + self.manage_item = gtk.ImageMenuItem("Manage Engines") + self.image = gtk.Image() + self.image.set_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU) + self.manage_item.set_image(self.image) + self.manage_item.connect("activate", self.configure) + self.menu.add(self.manage_item) + self.menu_button.set_menu(self.menu) + self.toolbar.insert(self.search_item, -1) + self.toolbar.insert(self.menu_button, -1) + self.populate_search_menu() + self.toolbar.show_all() + self.search_item.show_all() + self.menu_button.show_all() + self.menu.show_all() + + def unload(self): + self.engines.save(self.conf_file) + self.toolbar.remove(self.search_item) + self.toolbar.remove(self.menu_button) + + def text_changed(self, args): + a = (self.field_name.get_text() != "") + b = (self.field_search.get_text() != "") + if(a and b): + self.button_add.set_sensitive(1) + else: + self.button_add.set_sensitive(0) - def add_clicked(self, args): - self.view.get_model().append([self.field_name.get_text(), - self.field_search.get_text()]) - self.field_name.set_text("") - self.field_search.set_text("") - - def del_clicked(self, args): - (model, selection) = self.view.get_selection().get_selected() - model.remove(selection) - self.button_del.set_sensitive(0) - - def row_clicked(self, args): - self.button_del.set_sensitive(1) - return True - - def configure(self, widget=None): - import gtk, gtk.glade - from deluge import common - self.dlg.show_all() - model = self.view.get_model() - model.clear() - for name in self.engines.keys(): - self.view.get_model().append( (name, self.engines.get(name)) ) - self.button_add.set_sensitive(0) - self.button_del.set_sensitive(0) - result = self.dlg.run() - self.dlg.hide_all() - if result == 1: - self.engines.clear() - the_iter = model.get_iter_first() - while the_iter is not None: - self.engines.set(model.get_value(the_iter, 0), model.get_value(the_iter, 1)) - the_iter = model.iter_next(the_iter) - self.engines.save(self.conf_file) - self.populate_search_menu() - + def add_clicked(self, args): + self.view.get_model().append([self.field_name.get_text(), + self.field_search.get_text()]) + self.field_name.set_text("") + self.field_search.set_text("") + + def del_clicked(self, args): + (model, selection) = self.view.get_selection().get_selected() + model.remove(selection) + self.button_del.set_sensitive(0) + + def row_clicked(self, args): + self.button_del.set_sensitive(1) + return True + + def configure(self, widget=None): + import gtk, gtk.glade + from deluge import common + self.dlg.show_all() + model = self.view.get_model() + model.clear() + for name in self.engines.keys(): + self.view.get_model().append( (name, self.engines.get(name)) ) + self.button_add.set_sensitive(0) + self.button_del.set_sensitive(0) + result = self.dlg.run() + self.dlg.hide_all() + if result == 1: + self.engines.clear() + the_iter = model.get_iter_first() + while the_iter is not None: + self.engines.set(model.get_value(the_iter, 0), model.get_value(the_iter, 1)) + the_iter = model.iter_next(the_iter) + self.engines.save(self.conf_file) + self.populate_search_menu() + - - def update(self): - pass - - def torrent_search(self, widget=None): - from deluge import common - print "Searching with engine", self.se - url = self.engines.get(self.se) - entry = self.search_entry.get_text() - print 'URL =', url - print 'Entry =', entry - entry = entry.replace(' ', '+') - print 'URL =', url - print 'Entry =', entry - url = url.replace('${query}', entry) - print 'URL =', url - print 'Entry =', entry - common.open_url_in_browser(None, url) - - def populate_search_menu(self): - import gtk - self.menu_button.set_label("Choose an Engine") - for child in self.menu.get_children(): - self.menu.remove(child) - group = None - i = 0 - for engine in self.engines.keys(): - rmi = gtk.RadioMenuItem(None, engine) - rmi.eng_name = engine - rmi.connect("activate", self.select_search, rmi.eng_name) - if (group != None): - rmi.set_group(group) - else: - group = rmi - rmi.set_active(1) - self.menu.insert(rmi, i) - i = i + 1 - rmi.show() - self.menu.insert(self.manage_item, i) - self.menu.show() + + def update(self): + pass + + def torrent_search(self, widget=None): + from deluge import common + print "Searching with engine", self.se + url = self.engines.get(self.se) + entry = self.search_entry.get_text() + print 'URL =', url + print 'Entry =', entry + entry = entry.replace(' ', '+') + print 'URL =', url + print 'Entry =', entry + url = url.replace('${query}', entry) + print 'URL =', url + print 'Entry =', entry + common.open_url_in_browser(None, url) + + def populate_search_menu(self): + import gtk + self.menu_button.set_label("Choose an Engine") + for child in self.menu.get_children(): + self.menu.remove(child) + group = None + i = 0 + for engine in self.engines.keys(): + rmi = gtk.RadioMenuItem(None, engine) + rmi.eng_name = engine + rmi.connect("activate", self.select_search, rmi.eng_name) + if (group != None): + rmi.set_group(group) + else: + group = rmi + rmi.set_active(1) + self.menu.insert(rmi, i) + i = i + 1 + rmi.show() + self.menu.insert(self.manage_item, i) + self.menu.show() - def select_search(self, menuitem, engine_string): - self.menu_button.set_label("Search " + engine_string) - self.se = engine_string - + def select_search(self, menuitem, engine_string): + self.menu_button.set_label("Search " + engine_string) + self.se = engine_string + diff --git a/po/deluge.pot b/po/deluge.pot index 0b7a8d107..5e57c0223 100644 --- a/po/deluge.pot +++ b/po/deluge.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-07-05 19:06-0500\n" +"POT-Creation-Date: 2007-07-12 15:08-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,231 +16,252 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: glade/delugegtk.glade:203 -msgid "Downloaded:" -msgstr "" - -#: glade/delugegtk.glade:217 -msgid "Uploaded:" -msgstr "" - -#: glade/delugegtk.glade:235 -msgid "Seeders:" -msgstr "" - -#: glade/delugegtk.glade:253 -msgid "Share Ratio:" -msgstr "" - -#: glade/delugegtk.glade:272 glade/delugegtk.glade:291 -msgid "Speed:" -msgstr "" - -#: glade/delugegtk.glade:312 -msgid "Peers:" -msgstr "" - -#: glade/delugegtk.glade:333 -msgid "ETA:" -msgstr "" - -#: glade/delugegtk.glade:359 -msgid "Statistics" -msgstr "" - -#: glade/delugegtk.glade:482 -msgid "Name:" -msgstr "" - -#: glade/delugegtk.glade:501 -msgid "Total Size:" -msgstr "" - -#: glade/delugegtk.glade:522 -msgid "Pieces:" -msgstr "" - -#: glade/delugegtk.glade:544 -msgid "Tracker:" -msgstr "" - -#: glade/delugegtk.glade:565 -msgid "Tracker Status:" -msgstr "" - -#: glade/delugegtk.glade:586 -msgid "Next Announce:" -msgstr "" - -#: glade/delugegtk.glade:605 -msgid "Torrent Info" -msgstr "" - -#: glade/delugegtk.glade:631 -msgid "Details" -msgstr "" - -#: glade/delugegtk.glade:659 glade/delugegtk.glade:897 -#: glade/dgtkpopups.glade:37 src/interface.py:448 -msgid "Peers" -msgstr "" - -#: glade/delugegtk.glade:689 -msgid "Files" -msgstr "" - -#: glade/delugegtk.glade:730 -msgid "_File" -msgstr "" - -#: glade/delugegtk.glade:737 glade/tray_menu.glade:27 -msgid "_Add Torrent" -msgstr "" - -#: glade/delugegtk.glade:752 -msgid "Add _URL" -msgstr "" - -#: glade/delugegtk.glade:760 -msgid "_Clear Completed" -msgstr "" - -#: glade/delugegtk.glade:793 -msgid "_Edit" -msgstr "" - -#: glade/delugegtk.glade:810 -msgid "Pl_ugins" -msgstr "" - -#: glade/delugegtk.glade:829 -msgid "_Torrent" -msgstr "" - -#: glade/delugegtk.glade:836 -msgid "_View" -msgstr "" - -#: glade/delugegtk.glade:844 -msgid "_Toolbar" -msgstr "" - -#: glade/delugegtk.glade:853 -msgid "_Details" -msgstr "" - -#: glade/delugegtk.glade:862 -msgid "Columns" -msgstr "" - -#: glade/delugegtk.glade:870 glade/dgtkpopups.glade:10 src/interface.py:445 -#: src/interface.py:634 -msgid "Size" -msgstr "" - -#: glade/delugegtk.glade:879 glade/dgtkpopups.glade:19 src/interface.py:446 -msgid "Status" -msgstr "" - -#: glade/delugegtk.glade:888 glade/dgtkpopups.glade:28 src/interface.py:447 -msgid "Seeders" -msgstr "" - -#: glade/delugegtk.glade:906 src/interface.py:449 src/interface.py:632 -#: src/interface.py:884 src/interface.py:896 -msgid "Download" -msgstr "" - -#: glade/delugegtk.glade:915 src/interface.py:450 src/interface.py:885 -#: src/interface.py:897 -msgid "Upload" -msgstr "" - -#: glade/delugegtk.glade:924 glade/dgtkpopups.glade:64 -msgid "Time Remaining" -msgstr "" - -#: glade/delugegtk.glade:933 glade/dgtkpopups.glade:73 -msgid "Share Ratio" -msgstr "" - -#: glade/delugegtk.glade:950 -msgid "_Help" -msgstr "" - -#: glade/delugegtk.glade:1007 glade/delugegtk.glade:1008 +#: glade/delugegtk.glade:22 msgid "Add Torrent" msgstr "" -#: glade/delugegtk.glade:1021 glade/delugegtk.glade:1022 -#: glade/dgtkpopups.glade:81 +#: glade/delugegtk.glade:23 +msgid "Add" +msgstr "" + +#: glade/delugegtk.glade:36 glade/dgtkpopups.glade:6 msgid "Remove Torrent" msgstr "" -#: glade/delugegtk.glade:1034 +#: glade/delugegtk.glade:37 +msgid "Remove" +msgstr "" + +#: glade/delugegtk.glade:49 msgid "Clear Finished Torrents" msgstr "" -#: glade/delugegtk.glade:1035 glade/dgtkpopups.glade:254 -msgid "Clear Finished" +#: glade/delugegtk.glade:50 +msgid "Clear" msgstr "" -#: glade/delugegtk.glade:1057 -msgid "Start / Pause" +#: glade/delugegtk.glade:72 +msgid "Start or Pause torrent" msgstr "" -#: glade/delugegtk.glade:1058 +#: glade/delugegtk.glade:73 msgid "Start" msgstr "" -#: glade/delugegtk.glade:1071 +#: glade/delugegtk.glade:86 msgid "Queue Torrent Up" msgstr "" -#: glade/delugegtk.glade:1072 -msgid "Move Up" +#: glade/delugegtk.glade:87 +msgid "Up" msgstr "" -#: glade/delugegtk.glade:1085 +#: glade/delugegtk.glade:100 msgid "Queue Torrent Down" msgstr "" -#: glade/delugegtk.glade:1086 -msgid "Move Down" +#: glade/delugegtk.glade:101 +msgid "Down" msgstr "" -#: glade/delugegtk.glade:1107 glade/delugegtk.glade:1108 +#: glade/delugegtk.glade:122 +msgid "Change Deluge preferences" +msgstr "" + +#: glade/delugegtk.glade:123 msgid "Preferences" msgstr "" -#: glade/delugegtk.glade:1120 glade/delugegtk.glade:1121 -#: glade/dgtkpopups.glade:284 glade/plugin_dialog.glade:80 +#: glade/delugegtk.glade:135 +msgid "Open the plugins dialog" +msgstr "" + +#: glade/delugegtk.glade:136 glade/dgtkpopups.glade:209 +#: glade/plugin_dialog.glade:80 msgid "Plugins" msgstr "" -#: glade/dgtkpopups.glade:116 +#: glade/delugegtk.glade:185 +msgid "_File" +msgstr "" + +#: glade/delugegtk.glade:192 glade/tray_menu.glade:27 +msgid "_Add Torrent" +msgstr "" + +#: glade/delugegtk.glade:207 +msgid "Add _URL" +msgstr "" + +#: glade/delugegtk.glade:215 +msgid "_Clear Completed" +msgstr "" + +#: glade/delugegtk.glade:248 +msgid "_Edit" +msgstr "" + +#: glade/delugegtk.glade:265 +msgid "Pl_ugins" +msgstr "" + +#: glade/delugegtk.glade:284 +msgid "_Torrent" +msgstr "" + +#: glade/delugegtk.glade:291 +msgid "_View" +msgstr "" + +#: glade/delugegtk.glade:299 +msgid "_Toolbar" +msgstr "" + +#: glade/delugegtk.glade:308 +msgid "_Details" +msgstr "" + +#: glade/delugegtk.glade:317 +msgid "Columns" +msgstr "" + +#: glade/delugegtk.glade:325 src/interface.py:459 src/interface.py:625 +msgid "Size" +msgstr "" + +#: glade/delugegtk.glade:334 src/interface.py:460 +msgid "Status" +msgstr "" + +#: glade/delugegtk.glade:343 src/interface.py:461 +msgid "Seeders" +msgstr "" + +#: glade/delugegtk.glade:352 glade/delugegtk.glade:1093 src/interface.py:462 +msgid "Peers" +msgstr "" + +#: glade/delugegtk.glade:361 src/interface.py:463 src/interface.py:596 +#: src/interface.py:943 src/interface.py:957 +msgid "Down Speed" +msgstr "" + +#: glade/delugegtk.glade:370 src/interface.py:464 src/interface.py:597 +#: src/interface.py:944 src/interface.py:958 +msgid "Up Speed" +msgstr "" + +#: glade/delugegtk.glade:379 +msgid "Time Remaining" +msgstr "" + +#: glade/delugegtk.glade:388 +msgid "Share Ratio" +msgstr "" + +#: glade/delugegtk.glade:405 +msgid "_Help" +msgstr "" + +#: glade/delugegtk.glade:422 glade/delugegtk.glade:423 +msgid "Help translate this application" +msgstr "" + +#: glade/delugegtk.glade:535 +msgid "Next Announce:" +msgstr "" + +#: glade/delugegtk.glade:556 +msgid "Tracker Status:" +msgstr "" + +#: glade/delugegtk.glade:578 +msgid "Tracker:" +msgstr "" + +#: glade/delugegtk.glade:599 +msgid "Pieces:" +msgstr "" + +#: glade/delugegtk.glade:620 +msgid "Total Size:" +msgstr "" + +#: glade/delugegtk.glade:642 +msgid "Name:" +msgstr "" + +#: glade/delugegtk.glade:739 +msgid "Torrent Info" +msgstr "" + +#: glade/delugegtk.glade:793 +msgid "ETA:" +msgstr "" + +#: glade/delugegtk.glade:814 +msgid "Peers:" +msgstr "" + +#: glade/delugegtk.glade:835 glade/delugegtk.glade:856 +msgid "Speed:" +msgstr "" + +#: glade/delugegtk.glade:874 +msgid "Share Ratio:" +msgstr "" + +#: glade/delugegtk.glade:892 +msgid "Seeders:" +msgstr "" + +#: glade/delugegtk.glade:910 +msgid "Uploaded:" +msgstr "" + +#: glade/delugegtk.glade:928 +msgid "Downloaded:" +msgstr "" + +#: glade/delugegtk.glade:1040 +msgid "Statistics" +msgstr "" + +#: glade/delugegtk.glade:1065 +msgid "Details" +msgstr "" + +#: glade/delugegtk.glade:1123 +msgid "Files" +msgstr "" + +#: glade/dgtkpopups.glade:41 msgid "" "Are you sure you want to remove the selected torrent" "(s) from Deluge?" msgstr "" -#: glade/dgtkpopups.glade:140 +#: glade/dgtkpopups.glade:65 msgid "Delete downloaded files" msgstr "" -#: glade/dgtkpopups.glade:163 +#: glade/dgtkpopups.glade:88 msgid "Delete .torrent file" msgstr "" -#: glade/dgtkpopups.glade:230 +#: glade/dgtkpopups.glade:155 msgid "Show/Hide" msgstr "" -#: glade/dgtkpopups.glade:238 +#: glade/dgtkpopups.glade:163 msgid "Add a Torrent..." msgstr "" -#: glade/dgtkpopups.glade:335 +#: glade/dgtkpopups.glade:179 +msgid "Clear Finished" +msgstr "" + +#: glade/dgtkpopups.glade:260 msgid "Speed:" msgstr "" @@ -272,238 +293,250 @@ msgstr "" msgid "Ask where to save each download" msgstr "" -#: glade/preferences_dialog.glade:69 -msgid "Save all downloads to:" +#: glade/preferences_dialog.glade:74 glade/preferences_dialog.glade:88 +msgid "Select A Folder" msgstr "" #: glade/preferences_dialog.glade:100 +msgid "Move completed downloads to (*same partition only*):" +msgstr "" + +#: glade/preferences_dialog.glade:101 +msgid "Move completed downloads to:" +msgstr "" + +#: glade/preferences_dialog.glade:115 glade/preferences_dialog.glade:116 +msgid "Store all downloads in:" +msgstr "" + +#: glade/preferences_dialog.glade:135 msgid "Download Location" msgstr "" -#: glade/preferences_dialog.glade:132 glade/preferences_dialog.glade:145 +#: glade/preferences_dialog.glade:167 glade/preferences_dialog.glade:180 msgid "" "The number of active torrents that Deluge will run. Set to -1 for unlimited." msgstr "" -#: glade/preferences_dialog.glade:134 +#: glade/preferences_dialog.glade:169 msgid "Maximum simultaneous active torrents:" msgstr "" -#: glade/preferences_dialog.glade:165 +#: glade/preferences_dialog.glade:200 msgid "Torrents" msgstr "" -#: glade/preferences_dialog.glade:194 +#: glade/preferences_dialog.glade:229 msgid "" "Compact allocation will only allocate as much storage as it needs to keep " "the pieces downloaded so far." msgstr "" -#: glade/preferences_dialog.glade:195 +#: glade/preferences_dialog.glade:230 msgid "Use compact storage allocation" msgstr "" -#: glade/preferences_dialog.glade:206 +#: glade/preferences_dialog.glade:241 msgid "Compact Allocation" msgstr "" -#: glade/preferences_dialog.glade:239 +#: glade/preferences_dialog.glade:274 msgid "Queue torrents to bottom when they begin seeding" msgstr "" -#: glade/preferences_dialog.glade:252 +#: glade/preferences_dialog.glade:287 msgid "Stop seeding torrents when their share ratio reaches:" msgstr "" -#: glade/preferences_dialog.glade:288 +#: glade/preferences_dialog.glade:323 msgid "Seeding" msgstr "" -#: glade/preferences_dialog.glade:324 glade/preferences_dialog.glade:453 +#: glade/preferences_dialog.glade:359 glade/preferences_dialog.glade:488 msgid "The maximum upload speed for all torrents. Set -1 for unlimited." msgstr "" -#: glade/preferences_dialog.glade:342 glade/preferences_dialog.glade:433 +#: glade/preferences_dialog.glade:377 glade/preferences_dialog.glade:468 msgid "The maximum download speed for all torrents. Set -1 for unlimited." msgstr "" -#: glade/preferences_dialog.glade:359 glade/preferences_dialog.glade:413 +#: glade/preferences_dialog.glade:394 glade/preferences_dialog.glade:448 msgid "The maximum number of upload slots. Set -1 for unlimited." msgstr "" -#: glade/preferences_dialog.glade:376 glade/preferences_dialog.glade:395 +#: glade/preferences_dialog.glade:411 glade/preferences_dialog.glade:430 msgid "The maximum number of connections allowed. Set -1 for unlimited." msgstr "" -#: glade/preferences_dialog.glade:397 +#: glade/preferences_dialog.glade:432 msgid "Maximum Connections:" msgstr "" -#: glade/preferences_dialog.glade:415 +#: glade/preferences_dialog.glade:450 msgid "Upload Slots:" msgstr "" -#: glade/preferences_dialog.glade:435 +#: glade/preferences_dialog.glade:470 msgid "Maximum Download Speed (KiB/s):" msgstr "" -#: glade/preferences_dialog.glade:455 +#: glade/preferences_dialog.glade:490 msgid "Maximum Upload Speed (KiB/s):" msgstr "" -#: glade/preferences_dialog.glade:472 +#: glade/preferences_dialog.glade:507 msgid "Bandwidth Usage" msgstr "" -#: glade/preferences_dialog.glade:499 +#: glade/preferences_dialog.glade:534 msgid "Downloads" msgstr "" -#: glade/preferences_dialog.glade:544 +#: glade/preferences_dialog.glade:579 msgid "" "Please Note - Changes to these settings will only be applied the next " "time Deluge is restarted." msgstr "" -#: glade/preferences_dialog.glade:587 +#: glade/preferences_dialog.glade:622 msgid "From:" msgstr "" -#: glade/preferences_dialog.glade:610 +#: glade/preferences_dialog.glade:645 msgid "To:" msgstr "" -#: glade/preferences_dialog.glade:635 +#: glade/preferences_dialog.glade:670 msgid "Active Port:" msgstr "" -#: glade/preferences_dialog.glade:648 +#: glade/preferences_dialog.glade:683 msgid "0000" msgstr "" -#: glade/preferences_dialog.glade:663 +#: glade/preferences_dialog.glade:698 msgid "Test Active Port" msgstr "" -#: glade/preferences_dialog.glade:685 +#: glade/preferences_dialog.glade:720 msgid "TCP Port" msgstr "" -#: glade/preferences_dialog.glade:717 +#: glade/preferences_dialog.glade:752 msgid "Distributed hash table may improve the amount of active connections." msgstr "" -#: glade/preferences_dialog.glade:718 +#: glade/preferences_dialog.glade:753 msgid "Enable Mainline DHT" msgstr "" -#: glade/preferences_dialog.glade:734 +#: glade/preferences_dialog.glade:769 msgid "DHT" msgstr "" -#: glade/preferences_dialog.glade:769 +#: glade/preferences_dialog.glade:804 msgid "Universal Plug and Play" msgstr "" -#: glade/preferences_dialog.glade:770 +#: glade/preferences_dialog.glade:805 msgid "UPnP" msgstr "" -#: glade/preferences_dialog.glade:784 +#: glade/preferences_dialog.glade:819 msgid "NAT Port Mapping Protocol" msgstr "" -#: glade/preferences_dialog.glade:785 +#: glade/preferences_dialog.glade:820 msgid "NAT-PMP" msgstr "" -#: glade/preferences_dialog.glade:800 +#: glade/preferences_dialog.glade:835 msgid "µTorrent Peer-Exchange" msgstr "" -#: glade/preferences_dialog.glade:801 +#: glade/preferences_dialog.glade:836 msgid "µTorrent-PeX" msgstr "" -#: glade/preferences_dialog.glade:819 +#: glade/preferences_dialog.glade:854 msgid "Network Extras" msgstr "" -#: glade/preferences_dialog.glade:860 +#: glade/preferences_dialog.glade:895 msgid "Inbound:" msgstr "" -#: glade/preferences_dialog.glade:869 glade/preferences_dialog.glade:891 +#: glade/preferences_dialog.glade:904 glade/preferences_dialog.glade:926 msgid "" "Disabled\n" "Enabled\n" "Forced" msgstr "" -#: glade/preferences_dialog.glade:882 +#: glade/preferences_dialog.glade:917 msgid "Outbound:" msgstr "" -#: glade/preferences_dialog.glade:909 +#: glade/preferences_dialog.glade:944 msgid "Prefer to encrypt the entire stream" msgstr "" -#: glade/preferences_dialog.glade:922 +#: glade/preferences_dialog.glade:957 msgid "Level:" msgstr "" -#: glade/preferences_dialog.glade:931 +#: glade/preferences_dialog.glade:966 msgid "" "Handshake\n" "Either\n" "Full Stream" msgstr "" -#: glade/preferences_dialog.glade:952 +#: glade/preferences_dialog.glade:987 msgid "Encryption" msgstr "" -#: glade/preferences_dialog.glade:985 +#: glade/preferences_dialog.glade:1020 msgid "Affects regular bittorrent peers" msgstr "" -#: glade/preferences_dialog.glade:986 +#: glade/preferences_dialog.glade:1021 msgid "Peer Proxy" msgstr "" -#: glade/preferences_dialog.glade:996 +#: glade/preferences_dialog.glade:1031 msgid "" "Only affects HTTP tracker connections (UDP tracker connections are affected " "if the given proxy supports UDP, e.g. SOCKS5)." msgstr "" -#: glade/preferences_dialog.glade:997 +#: glade/preferences_dialog.glade:1032 msgid "Tracker Proxy" msgstr "" -#: glade/preferences_dialog.glade:1010 +#: glade/preferences_dialog.glade:1045 msgid "" "Affects the DHT messages. Since they are sent over UDP, it only has any " "effect if the proxy supports UDP." msgstr "" -#: glade/preferences_dialog.glade:1011 +#: glade/preferences_dialog.glade:1046 msgid "DHT Proxy" msgstr "" -#: glade/preferences_dialog.glade:1037 +#: glade/preferences_dialog.glade:1072 msgid "Proxy type" msgstr "" -#: glade/preferences_dialog.glade:1044 +#: glade/preferences_dialog.glade:1079 msgid "Username" msgstr "" -#: glade/preferences_dialog.glade:1055 +#: glade/preferences_dialog.glade:1090 msgid "Password" msgstr "" -#: glade/preferences_dialog.glade:1066 +#: glade/preferences_dialog.glade:1101 msgid "" "None\n" "Socksv4\n" @@ -513,51 +546,51 @@ msgid "" "HTTP W/ Auth" msgstr "" -#: glade/preferences_dialog.glade:1109 +#: glade/preferences_dialog.glade:1144 msgid "Server" msgstr "" -#: glade/preferences_dialog.glade:1120 +#: glade/preferences_dialog.glade:1155 msgid "Port" msgstr "" -#: glade/preferences_dialog.glade:1164 +#: glade/preferences_dialog.glade:1199 msgid "Proxy" msgstr "" -#: glade/preferences_dialog.glade:1191 +#: glade/preferences_dialog.glade:1226 msgid "Network" msgstr "" -#: glade/preferences_dialog.glade:1232 +#: glade/preferences_dialog.glade:1267 msgid "Enable system tray icon" msgstr "" -#: glade/preferences_dialog.glade:1246 +#: glade/preferences_dialog.glade:1282 msgid "Minimize to tray on close" msgstr "" -#: glade/preferences_dialog.glade:1269 +#: glade/preferences_dialog.glade:1305 msgid "Password protect system tray" msgstr "" -#: glade/preferences_dialog.glade:1286 +#: glade/preferences_dialog.glade:1322 msgid "Password:" msgstr "" -#: glade/preferences_dialog.glade:1327 +#: glade/preferences_dialog.glade:1363 msgid "System Tray" msgstr "" -#: glade/preferences_dialog.glade:1358 +#: glade/preferences_dialog.glade:1394 msgid "GUI update interval (seconds)" msgstr "" -#: glade/preferences_dialog.glade:1386 +#: glade/preferences_dialog.glade:1422 msgid "Performance" msgstr "" -#: glade/preferences_dialog.glade:1414 +#: glade/preferences_dialog.glade:1450 msgid "Other" msgstr "" @@ -617,168 +650,160 @@ msgstr "" msgid "_Quit" msgstr "" -#: src/common.py:54 src/interface.py:422 +#: src/common.py:58 src/interface.py:436 msgid "Infinity" msgstr "" -#: src/common.py:67 +#: src/common.py:71 #, python-format msgid "%.1f KiB" msgstr "" -#: src/common.py:70 +#: src/common.py:74 #, python-format msgid "%.1f MiB" msgstr "" -#: src/common.py:72 +#: src/common.py:76 #, python-format msgid "%.1f GiB" msgstr "" -#: src/common.py:120 +#: src/common.py:124 msgid "Error: no webbrowser found" msgstr "" -#: src/core.py:119 +#: src/core.py:129 #, python-format msgid "%d %d bytes needed" msgstr "" -#: src/core.py:335 +#: src/core.py:346 msgid "File was not found" msgstr "" -#: src/interface.py:195 src/interface.py:198 src/interface.py:249 -#: src/interface.py:271 +#: src/interface.py:206 src/interface.py:212 src/interface.py:266 +#: src/interface.py:288 msgid "KiB/s" msgstr "" -#: src/interface.py:242 src/interface.py:253 src/interface.py:275 +#: src/interface.py:259 src/interface.py:270 src/interface.py:292 msgid "Other..." msgstr "" -#: src/interface.py:250 src/interface.py:272 src/interface.py:869 -#: src/interface.py:875 src/interface.py:879 +#: src/interface.py:267 src/interface.py:289 src/interface.py:927 +#: src/interface.py:933 src/interface.py:937 msgid "Unlimited" msgstr "" -#: src/interface.py:298 +#: src/interface.py:315 msgid "Deluge is locked" msgstr "" -#: src/interface.py:300 +#: src/interface.py:317 msgid "" "Deluge is password protected.\n" "To show the Deluge window, please enter your password" msgstr "" -#: src/interface.py:430 +#: src/interface.py:444 msgid "Unknown" msgstr "" -#: src/interface.py:444 +#: src/interface.py:458 msgid "Name" msgstr "" -#: src/interface.py:451 +#: src/interface.py:465 msgid "ETA" msgstr "" -#: src/interface.py:452 +#: src/interface.py:466 msgid "Ratio" msgstr "" -#: src/interface.py:527 src/interface.py:566 src/interface.py:968 +#: src/interface.py:515 src/interface.py:554 src/interface.py:916 msgid "Resume" msgstr "" -#: src/interface.py:530 src/interface.py:569 src/interface.py:971 +#: src/interface.py:518 src/interface.py:557 src/interface.py:919 msgid "Pause" msgstr "" -#: src/interface.py:556 +#: src/interface.py:544 msgid "Pause/Resume" msgstr "" -#: src/interface.py:604 +#: src/interface.py:593 msgid "IP Address" msgstr "" -#: src/interface.py:605 +#: src/interface.py:594 msgid "Client" msgstr "" -#: src/interface.py:606 +#: src/interface.py:595 msgid "Percent Complete" msgstr "" -#: src/interface.py:607 -msgid "Down Speed" +#: src/interface.py:623 +msgid "Download" msgstr "" -#: src/interface.py:608 -msgid "Up Speed" -msgstr "" - -#: src/interface.py:633 +#: src/interface.py:624 msgid "Filename" msgstr "" -#: src/interface.py:636 +#: src/interface.py:626 msgid "Progress" msgstr "" -#: src/interface.py:752 +#: src/interface.py:737 #, python-format msgid "Paused %s" msgstr "" -#: src/interface.py:855 +#: src/interface.py:833 msgid "" -"For some reason, the previous state could not be loaded, so a blank state " -"has been loaded for you." +"You cannot move torrent to a different partition. Please fix your " +"preferences" msgstr "" -#: src/interface.py:857 -msgid "Would you like to attempt to reload the previous session's downloads?" -msgstr "" - -#: src/interface.py:884 src/interface.py:896 +#: src/interface.py:943 src/interface.py:956 msgid "Connections" msgstr "" -#: src/interface.py:895 +#: src/interface.py:956 msgid "Deluge Bittorrent Client" msgstr "" -#: src/interface.py:1131 +#: src/interface.py:1121 msgid "" "An error occured while trying to add the torrent. It's possible your ." "torrent file is corrupted." msgstr "" -#: src/interface.py:1133 +#: src/interface.py:1123 msgid "The torrent you've added seems to already be in Deluge." msgstr "" -#: src/interface.py:1137 +#: src/interface.py:1127 msgid "There is not enough free disk space to complete your download." msgstr "" -#: src/interface.py:1138 +#: src/interface.py:1128 msgid "Space Needed:" msgstr "" -#: src/interface.py:1139 +#: src/interface.py:1129 msgid "Available Space:" msgstr "" -#: src/interface.py:1149 +#: src/interface.py:1141 msgid "Add torrent from URL" msgstr "" -#: src/interface.py:1153 +#: src/interface.py:1145 msgid "Enter the URL of the .torrent to download" msgstr "" @@ -786,30 +811,30 @@ msgstr "" msgid "Warning - all downloaded files for this torrent will be deleted!" msgstr "" -#: src/dialogs.py:160 +#: src/dialogs.py:183 msgid "Plugin" msgstr "" -#: src/dialogs.py:162 +#: src/dialogs.py:185 msgid "Enabled" msgstr "" -#: src/dialogs.py:229 +#: src/dialogs.py:252 msgid "translator-credits" msgstr "" -#: src/dialogs.py:269 +#: src/dialogs.py:292 msgid "Choose a .torrent file" msgstr "" -#: src/dialogs.py:274 +#: src/dialogs.py:297 msgid "Torrent files" msgstr "" -#: src/dialogs.py:278 +#: src/dialogs.py:301 msgid "All files" msgstr "" -#: src/dialogs.py:296 +#: src/dialogs.py:322 msgid "Choose a download directory" msgstr "" diff --git a/scripts/deluge b/scripts/deluge index 5190aac7c..4b44a40a7 100755 --- a/scripts/deluge +++ b/scripts/deluge @@ -20,9 +20,9 @@ # # You should have received a copy of the GNU General Public License # along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. # # In addition, as a special exception, the copyright holders give # permission to link the code of portions of this program with the OpenSSL @@ -40,67 +40,67 @@ import os, os.path import gettext, locale import deluge, deluge.common, deluge.interface try: - import dbus - dbus_version = getattr(dbus, 'version', (0,0,0)) - if dbus_version >= (0,41,0) and dbus_version < (0,80,0): - import dbus.glib - elif dbus_version >= (0,80,0): - from dbus.mainloop.glib import DBusGMainLoop - DBusGMainLoop(set_as_default=True) - else: - pass + import dbus + dbus_version = getattr(dbus, 'version', (0,0,0)) + if dbus_version >= (0,41,0) and dbus_version < (0,80,0): + import dbus.glib + elif dbus_version >= (0,80,0): + from dbus.mainloop.glib import DBusGMainLoop + DBusGMainLoop(set_as_default=True) + else: + pass except: dbus_imported = False else: dbus_imported = True parser = OptionParser(usage="%prog [options] [actions]", version=deluge.common.PROGRAM_VERSION) parser.add_option("--tray", dest="tray", help="start Deluge hidden in system tray", - metavar="TRAY", action="store_true") + metavar="TRAY", action="store_true") parser.add_option("--url", dest="url", help="Load a torrent from a URL", - metavar="URL", action="store") + metavar="URL", action="store") (options, args) = parser.parse_args() def start_deluge(): - print "Starting new Deluge session..." - interface = deluge.interface.DelugeGTK() - add_args(interface) - interface.start(options.tray) + print "Starting new Deluge session..." + interface = deluge.interface.DelugeGTK() + add_args(interface) + interface.start(options.tray) def add_args(interface): - if options.url: - interface.external_add_url(options.url) - else: - for arg in args: - apath = os.path.abspath(arg) - if apath.endswith(".torrent"): - interface.external_add_torrent(apath) - else: - print "Error,", arg, " does not seem to be a .torrent file" + if options.url: + interface.external_add_url(options.url) + else: + for arg in args: + apath = os.path.abspath(arg) + if apath.endswith(".torrent"): + interface.external_add_torrent(apath) + else: + print "Error,", arg, " does not seem to be a .torrent file" if dbus_imported: - bus = dbus.SessionBus() + bus = dbus.SessionBus() - dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames() + dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames() - interface = None + interface = None - if not "org.deluge_torrent.Deluge" in dbus_objects: - print "no existing Deluge session" - start_deluge() - else: - ## This connects to the deluge interface - print "create proxy object" - proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject') - print "create iface" - deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge') - print "send to iface" + if not "org.deluge_torrent.Deluge" in dbus_objects: + print "no existing Deluge session" + start_deluge() + else: + ## This connects to the deluge interface + print "create proxy object" + proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject') + print "create iface" + deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge') + print "send to iface" - add_args(deluge_iface) + add_args(deluge_iface) else: - print "no existing Deluge session" - start_deluge() + print "no existing Deluge session" + start_deluge() diff --git a/setup.py b/setup.py index 7724aec85..52ffa7b04 100644 --- a/setup.py +++ b/setup.py @@ -26,14 +26,14 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -NAME = "deluge" -FULLNAME = "Deluge BitTorrent Client" -VERSION = "0.5.2.7" -AUTHOR = "Zach Tibbitts, Alon Zakai, Marcos Pinto, Andrew Resch" -EMAIL = "zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, alonzakai@gmail.com" +NAME = "deluge" +FULLNAME = "Deluge BitTorrent Client" +VERSION = "0.5.2.90" +AUTHOR = "Zach Tibbitts, Alon Zakai, Marcos Pinto, Andrew Resch" +EMAIL = "zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, alonzakai@gmail.com" DESCRIPTION = "A bittorrent client written in PyGTK" -URL = "http://deluge-torrent.org" -LICENSE = "GPLv2" +URL = "http://deluge-torrent.org" +LICENSE = "GPLv2" import os, platform print "Attempting to detect your system information" @@ -96,10 +96,12 @@ python_version = platform.python_version()[0:3] # it has been removed to prevent confusion. if not OS == "win": - EXTRA_COMPILE_ARGS = ["-Wno-missing-braces", "-DHAVE_INCLUDE_LIBTORRENT_ASIO____ASIO_HPP=1", + EXTRA_COMPILE_ARGS = ["-Wno-missing-braces", + "-DHAVE_INCLUDE_LIBTORRENT_ASIO____ASIO_HPP=1", "-DHAVE_INCLUDE_LIBTORRENT_ASIO_SSL_STREAM_HPP=1", "-DHAVE_INCLUDE_LIBTORRENT_ASIO_IP_TCP_HPP=1", - "-DHAVE_PTHREAD=1", "-DTORRENT_USE_OPENSSL=1", "-DHAVE_SSL=1", "-DNDEBUG", "-O2"] + "-DHAVE_PTHREAD=1", "-DTORRENT_USE_OPENSSL=1", "-DHAVE_SSL=1", + "-DNDEBUG", "-O2"] if ARCH == "x64": EXTRA_COMPILE_ARGS.append("-DAMD64") @@ -297,4 +299,3 @@ setup(name=NAME, fullname=FULLNAME, version=VERSION, ext_modules=[deluge_core], cmdclass=cmdclass ) - diff --git a/src/common.py b/src/common.py index ab774876a..bf2a6f06a 100644 --- a/src/common.py +++ b/src/common.py @@ -38,7 +38,7 @@ import xdg.BaseDirectory import gettext PROGRAM_NAME = "Deluge" -PROGRAM_VERSION = "0.5.2.7" +PROGRAM_VERSION = "0.5.2.90" CLIENT_CODE = "DE" CLIENT_VERSION = "".join(PROGRAM_VERSION.split('.'))+"0"*(4 - len(PROGRAM_VERSION.split('.'))) diff --git a/src/core.py b/src/core.py index 182491461..67bc55ff1 100644 --- a/src/core.py +++ b/src/core.py @@ -192,7 +192,7 @@ class Manager: InvalidTorrentError) # Start up the core - assert(len(version) == 4) + assert(len(version) == 5) deluge_core.init(client_ID, int(version[0]), int(version[1]),