Sequential downloads: Implemented in GTK UI preferences dialog.
This commit is contained in:
parent
c8735b5cab
commit
ce3ce2c035
|
@ -635,152 +635,6 @@
|
|||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkMenu" id="menu_file_tab">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_open_file">
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="on_menuitem_open_file_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="menuitem3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_expand_all">
|
||||
<property name="label" translatable="yes">_Expand All</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_expand_all_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-zoom-fit</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="menuitem_priority_sep">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_donotdownload">
|
||||
<property name="label" translatable="yes">_Do Not Download</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_donotdownload_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_normal">
|
||||
<property name="label" translatable="yes">_Normal Priority</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_normal_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-yes</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_high">
|
||||
<property name="label" translatable="yes">_High Priority</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_high_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_highest">
|
||||
<property name="label" translatable="yes">Hi_ghest Priority</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_highest_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-goto-top</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkMenu" id="menu_peer_tab">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem4">
|
||||
<property name="label" translatable="yes">_Add Peer</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip" translatable="yes">Add a peer by its IP</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_add_peer_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkDialog" id="move_storage_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
|
@ -2499,7 +2353,7 @@
|
|||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">-1 -1 999999 1 10 0</property>
|
||||
<property name="adjustment">0 -1 999999 1 10 0</property>
|
||||
<signal name="value_changed" handler="on_spin_value_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
|
@ -2521,7 +2375,7 @@
|
|||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">-1 -1 99999 1 10 0</property>
|
||||
<property name="adjustment">0 -1 99999 1 10 0</property>
|
||||
<property name="digits">1</property>
|
||||
<signal name="value_changed" handler="on_spin_value_changed"/>
|
||||
</widget>
|
||||
|
@ -2544,7 +2398,7 @@
|
|||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">-1 -1 999999 1 10 0</property>
|
||||
<property name="adjustment">0 -1 999999 1 10 0</property>
|
||||
<property name="digits">1</property>
|
||||
<signal name="value_changed" handler="on_spin_value_changed"/>
|
||||
</widget>
|
||||
|
@ -2647,7 +2501,7 @@
|
|||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">-1 -1 999999 1 10 0</property>
|
||||
<property name="adjustment">0 -1 999999 1 10 0</property>
|
||||
<signal name="value_changed" handler="on_spin_value_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
|
@ -2932,6 +2786,29 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_sequential_download">
|
||||
<property name="label" translatable="yes">Sequential Download</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">When enabled, the piece picker will pick pieces in
|
||||
sequence instead of rarest first.
|
||||
|
||||
Enabling sequential download will affect the piece
|
||||
distribution negatively in the swarm. It should be
|
||||
used sparingly.</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_chk_sequential_download_toggled"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_shared">
|
||||
<property name="label" translatable="yes">Shared</property>
|
||||
|
@ -2946,7 +2823,7 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -2994,7 +2871,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -45,7 +45,6 @@ import pkg_resources
|
|||
import deluge.component as component
|
||||
from deluge.ui.client import client
|
||||
import deluge.common
|
||||
import deluge.error
|
||||
import common
|
||||
import dialogs
|
||||
from deluge.configmanager import ConfigManager
|
||||
|
@ -152,7 +151,8 @@ class Preferences(component.Component):
|
|||
"on_button_associate_magnet_clicked": self._on_button_associate_magnet_clicked,
|
||||
"on_accounts_add_clicked": self._on_accounts_add_clicked,
|
||||
"on_accounts_delete_clicked": self._on_accounts_delete_clicked,
|
||||
"on_accounts_edit_clicked": self._on_accounts_edit_clicked
|
||||
"on_accounts_edit_clicked": self._on_accounts_edit_clicked,
|
||||
"on_alocation_toggled": self._on_alocation_toggled
|
||||
})
|
||||
|
||||
# These get updated by requests done to the core
|
||||
|
@ -282,6 +282,9 @@ class Preferences(component.Component):
|
|||
"chk_prioritize_first_last_pieces": \
|
||||
("active",
|
||||
self.core_config["prioritize_first_last_pieces"]),
|
||||
"chk_sequential_download": \
|
||||
("active",
|
||||
self.core_config["sequential_download"]),
|
||||
"chk_add_paused": ("active", self.core_config["add_paused"]),
|
||||
"spin_port_min": ("value", self.core_config["listen_ports"][0]),
|
||||
"spin_port_max": ("value", self.core_config["listen_ports"][1]),
|
||||
|
@ -349,28 +352,44 @@ class Preferences(component.Component):
|
|||
}
|
||||
# Add proxy stuff
|
||||
for t in ("peer", "web_seed", "tracker", "dht"):
|
||||
core_widgets["spin_proxy_port_%s" % t] = ("value", self.core_config["proxies"][t]["port"])
|
||||
core_widgets["combo_proxy_type_%s" % t] = ("active", self.core_config["proxies"][t]["type"])
|
||||
core_widgets["txt_proxy_server_%s" % t] = ("text", self.core_config["proxies"][t]["hostname"])
|
||||
core_widgets["txt_proxy_username_%s" % t] = ("text", self.core_config["proxies"][t]["username"])
|
||||
core_widgets["txt_proxy_password_%s" % t] = ("text", self.core_config["proxies"][t]["password"])
|
||||
core_widgets["spin_proxy_port_%s" % t] = (
|
||||
"value", self.core_config["proxies"][t]["port"]
|
||||
)
|
||||
core_widgets["combo_proxy_type_%s" % t] = (
|
||||
"active", self.core_config["proxies"][t]["type"]
|
||||
)
|
||||
core_widgets["txt_proxy_server_%s" % t] = (
|
||||
"text", self.core_config["proxies"][t]["hostname"]
|
||||
)
|
||||
core_widgets["txt_proxy_username_%s" % t] = (
|
||||
"text", self.core_config["proxies"][t]["username"]
|
||||
)
|
||||
core_widgets["txt_proxy_password_%s" % t] = (
|
||||
"text", self.core_config["proxies"][t]["password"]
|
||||
)
|
||||
|
||||
# Change a few widgets if we're connected to a remote host
|
||||
if not client.is_localhost():
|
||||
self.glade.get_widget("entry_download_path").show()
|
||||
self.glade.get_widget("download_path_button").hide()
|
||||
core_widgets.pop("download_path_button")
|
||||
core_widgets["entry_download_path"] = ("text", self.core_config["download_location"])
|
||||
core_widgets["entry_download_path"] = (
|
||||
"text", self.core_config["download_location"]
|
||||
)
|
||||
|
||||
self.glade.get_widget("entry_move_completed_path").show()
|
||||
self.glade.get_widget("move_completed_path_button").hide()
|
||||
core_widgets.pop("move_completed_path_button")
|
||||
core_widgets["entry_move_completed_path"] = ("text", self.core_config["move_completed_path"])
|
||||
core_widgets["entry_move_completed_path"] = (
|
||||
"text", self.core_config["move_completed_path"]
|
||||
)
|
||||
|
||||
self.glade.get_widget("entry_torrents_path").show()
|
||||
self.glade.get_widget("torrent_files_button").hide()
|
||||
core_widgets.pop("torrent_files_button")
|
||||
core_widgets["entry_torrents_path"] = ("text", self.core_config["torrentfiles_location"])
|
||||
core_widgets["entry_torrents_path"] = (
|
||||
"text", self.core_config["torrentfiles_location"]
|
||||
)
|
||||
else:
|
||||
self.glade.get_widget("entry_download_path").hide()
|
||||
self.glade.get_widget("download_path_button").show()
|
||||
|
@ -419,6 +438,7 @@ class Preferences(component.Component):
|
|||
"radio_compact_allocation",
|
||||
"radio_full_allocation",
|
||||
"chk_prioritize_first_last_pieces",
|
||||
"chk_sequential_download",
|
||||
"chk_add_paused",
|
||||
"spin_port_min",
|
||||
"spin_port_max",
|
||||
|
@ -539,7 +559,8 @@ class Preferences(component.Component):
|
|||
"""
|
||||
Sets all altered config values in the core.
|
||||
|
||||
:param hide: bool, if True, will not re-show the dialog and will hide it instead
|
||||
:param hide: bool, if True, will not re-show the dialog and will hide
|
||||
it instead
|
||||
"""
|
||||
try:
|
||||
from hashlib import sha1 as sha_hash
|
||||
|
@ -583,6 +604,11 @@ class Preferences(component.Component):
|
|||
new_core_config["prioritize_first_last_pieces"] = \
|
||||
self.glade.get_widget(
|
||||
"chk_prioritize_first_last_pieces").get_active()
|
||||
new_core_config["sequential_download"] = \
|
||||
self.glade.get_widget("chk_sequential_download").get_active()
|
||||
new_core_config["sequential_download"] = \
|
||||
self.glade.get_widget("radio_compact_allocation").get_active() and \
|
||||
False or self.glade.get_widget("chk_sequential_download").get_active()
|
||||
new_core_config["add_paused"] = \
|
||||
self.glade.get_widget("chk_add_paused").get_active()
|
||||
|
||||
|
@ -1179,3 +1205,8 @@ class Preferences(component.Component):
|
|||
username
|
||||
).addCallback(remove_ok).addErrback(remove_fail)
|
||||
dialog.run().addCallback(dialog_finished)
|
||||
|
||||
def _on_alocation_toggled(self, widget):
|
||||
full_allocation_active = self.glade.get_widget("radio_full_allocation").get_active()
|
||||
self.glade.get_widget("chk_prioritize_first_last_pieces").set_sensitive(full_allocation_active)
|
||||
self.glade.get_widget("chk_sequential_download").set_sensitive(full_allocation_active)
|
||||
|
|
Loading…
Reference in New Issue