Fixed #368 - Added ability to prioritize first and last pieces of files in

torrent.
This commit is contained in:
Alex Dedul 2007-07-23 23:29:37 +00:00
parent f5bed290df
commit 442cac8aef
8 changed files with 379 additions and 360 deletions

View File

@ -55,6 +55,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Ask where to save each download</property> <property name="label" translatable="yes">Ask where to save each download</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -65,30 +66,16 @@
<property name="n_rows">2</property> <property name="n_rows">2</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<child> <child>
<widget class="GtkRadioButton" id="radio_save_all_to"> <widget class="GtkFileChooserButton" id="finished_path_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Store all downloads in:</property>
<property name="label" translatable="yes">Store all downloads in:</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_ask_save</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
</child>
<child>
<widget class="GtkCheckButton" id="chk_move_completed">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Move completed downloads to (*same partition only*):</property> <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
<property name="label" translatable="yes">Move completed downloads to:</property> <property name="title" translatable="yes">Select A Folder</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
</packing> </packing>
@ -107,20 +94,36 @@
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkFileChooserButton" id="finished_path_button"> <widget class="GtkCheckButton" id="chk_move_completed">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property> <property name="tooltip" translatable="yes">Move completed downloads to (*same partition only*):</property>
<property name="title" translatable="yes">Select A Folder</property> <property name="label" translatable="yes">Move completed downloads to:</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkRadioButton" id="radio_save_all_to">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Store all downloads in:</property>
<property name="label" translatable="yes">Store all downloads in:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_ask_save</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
</child>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -203,6 +206,7 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Enable selecting files for torrents before loading</property> <property name="tooltip" translatable="yes">Enable selecting files for torrents before loading</property>
<property name="label" translatable="yes">Enable selecting files for torrents before loading</property> <property name="label" translatable="yes">Enable selecting files for torrents before loading</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -210,6 +214,21 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkCheckButton" id="chk_prioritize_first_last_pieces">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Prioritize first and last pieces of files in torrent</property>
<property name="label" translatable="yes">Prioritize first and last pieces of files in torrent</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -249,6 +268,7 @@
<property name="tooltip" translatable="yes">Compact allocation will only allocate as much storage as it needs to keep the pieces downloaded so far.</property> <property name="tooltip" translatable="yes">Compact allocation will only allocate as much storage as it needs to keep the pieces downloaded so far.</property>
<property name="label" translatable="yes">Use compact storage allocation</property> <property name="label" translatable="yes">Use compact storage allocation</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -292,6 +312,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Queue torrents to bottom when they begin seeding</property> <property name="label" translatable="yes">Queue torrents to bottom when they begin seeding</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
@ -303,6 +324,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Queue new torrents above completed ones</property> <property name="label" translatable="yes">Queue new torrents above completed ones</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -318,6 +340,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Stop seeding torrents when their share ratio reaches:</property> <property name="label" translatable="yes">Stop seeding torrents when their share ratio reaches:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
@ -353,6 +376,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Automatically clear torrents that reach the max share ratio</property> <property name="label" translatable="yes">Automatically clear torrents that reach the max share ratio</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -399,42 +423,87 @@
<property name="n_rows">4</property> <property name="n_rows">4</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<child> <child>
<widget class="GtkAlignment" id="alignment18"> <widget class="GtkSpinButton" id="spin_max_upload">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="can_focus">True</property>
<property name="right_padding">10</property> <property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<child> <property name="xalign">1</property>
<widget class="GtkLabel" id="label55"> <property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="visible">True</property> <property name="climb_rate">1</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Speed (KiB/s):</property>
</widget>
</child>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkAlignment" id="alignment14"> <widget class="GtkSpinButton" id="spin_max_download">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum number of upload slots. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_connections">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="right_padding">10</property> <property name="right_padding">10</property>
<child> <child>
<widget class="GtkLabel" id="label52"> <widget class="GtkLabel" id="label54">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property> <property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Download Speed (KiB/s):</property> <property name="label" translatable="yes">Maximum Connections:</property>
</widget> </widget>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
@ -459,85 +528,40 @@
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkAlignment" id="alignment4"> <widget class="GtkAlignment" id="alignment14">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="right_padding">10</property> <property name="right_padding">10</property>
<child> <child>
<widget class="GtkLabel" id="label54"> <widget class="GtkLabel" id="label52">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property> <property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections:</property> <property name="label" translatable="yes">Maximum Download Speed (KiB/s):</property>
</widget> </widget>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_connections">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum number of upload slots. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_download">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_upload"> <widget class="GtkAlignment" id="alignment18">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property> <property name="right_padding">10</property>
<property name="xalign">1</property> <child>
<property name="adjustment">-1 -1 9000 1 10 10</property> <widget class="GtkLabel" id="label55">
<property name="climb_rate">1</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Speed (KiB/s):</property>
</widget>
</child>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -742,6 +766,7 @@
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Test Active Port</property> <property name="label" translatable="yes">Test Active Port</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_btn_testport_clicked"/> <signal name="clicked" handler="on_btn_testport_clicked"/>
</widget> </widget>
<packing> <packing>
@ -797,6 +822,7 @@
<property name="tooltip" translatable="yes">Distributed hash table may improve the amount of active connections.</property> <property name="tooltip" translatable="yes">Distributed hash table may improve the amount of active connections.</property>
<property name="label" translatable="yes">Enable Mainline DHT</property> <property name="label" translatable="yes">Enable Mainline DHT</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -848,6 +874,7 @@
<property name="tooltip" translatable="yes">Universal Plug and Play</property> <property name="tooltip" translatable="yes">Universal Plug and Play</property>
<property name="label" translatable="yes">UPnP</property> <property name="label" translatable="yes">UPnP</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -862,6 +889,7 @@
<property name="tooltip" translatable="yes">NAT Port Mapping Protocol</property> <property name="tooltip" translatable="yes">NAT Port Mapping Protocol</property>
<property name="label" translatable="yes">NAT-PMP</property> <property name="label" translatable="yes">NAT-PMP</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -877,6 +905,7 @@
<property name="tooltip" translatable="yes">µTorrent Peer-Exchange</property> <property name="tooltip" translatable="yes">µTorrent Peer-Exchange</property>
<property name="label" translatable="yes">µTorrent-PeX</property> <property name="label" translatable="yes">µTorrent-PeX</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -984,6 +1013,7 @@ Forced</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Prefer to encrypt the entire stream</property> <property name="label" translatable="yes">Prefer to encrypt the entire stream</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -1059,6 +1089,7 @@ Full Stream</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Affects regular bittorrent peers</property> <property name="tooltip" translatable="yes">Affects regular bittorrent peers</property>
<property name="label" translatable="yes">Peer Proxy</property> <property name="label" translatable="yes">Peer Proxy</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
@ -1070,6 +1101,7 @@ Full Stream</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Only affects HTTP tracker connections (UDP tracker connections are affected if the given proxy supports UDP, e.g. SOCKS5).</property> <property name="tooltip" translatable="yes">Only affects HTTP tracker connections (UDP tracker connections are affected if the given proxy supports UDP, e.g. SOCKS5).</property>
<property name="label" translatable="yes">Tracker Proxy</property> <property name="label" translatable="yes">Tracker Proxy</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
@ -1084,6 +1116,7 @@ Full Stream</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Affects the DHT messages. Since they are sent over UDP, it only has any effect if the proxy supports UDP.</property> <property name="tooltip" translatable="yes">Affects the DHT messages. Since they are sent over UDP, it only has any effect if the proxy supports UDP.</property>
<property name="label" translatable="yes">DHT Proxy</property> <property name="label" translatable="yes">DHT Proxy</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
@ -1106,85 +1139,34 @@ Full Stream</property>
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<widget class="GtkSpinButton" id="spin_proxy_port"> <widget class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">8080 0 10000 1 10 10</property> <property name="label" translatable="yes">Proxy type</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Username</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkEntry" id="txt_proxy_hostname"> <widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Port</property> <property name="label" translatable="yes">Password</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Server</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_password">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">3</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkEntry" id="txt_proxy_username">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child> <child>
<widget class="GtkComboBox" id="combo_proxy_type"> <widget class="GtkComboBox" id="combo_proxy_type">
<property name="visible">True</property> <property name="visible">True</property>
@ -1203,33 +1185,84 @@ HTTP W/ Auth</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label6"> <widget class="GtkEntry" id="txt_proxy_username">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Password</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Username</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label1"> <widget class="GtkEntry" id="txt_proxy_password">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Proxy type</property> <property name="label" translatable="yes">Server</property>
</widget> </widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Port</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_hostname">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_proxy_port">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">8080 0 10000 1 10 10</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child> </child>
</widget> </widget>
<packing> <packing>
@ -1311,6 +1344,7 @@ HTTP W/ Auth</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Enable system tray icon</property> <property name="label" translatable="yes">Enable system tray icon</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
@ -1326,6 +1360,7 @@ HTTP W/ Auth</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="label" translatable="yes">Minimize to tray on close</property> <property name="label" translatable="yes">Minimize to tray on close</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -1349,6 +1384,7 @@ HTTP W/ Auth</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Password protect system tray</property> <property name="label" translatable="yes">Password protect system tray</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/> <signal name="toggled" handler="toggle_ui"/>
</widget> </widget>
@ -1517,6 +1553,7 @@ HTTP W/ Auth</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
</widget> </widget>
</child> </child>
<child> <child>

View File

@ -1,120 +0,0 @@
# Copyright (C) 2007 - Marcos Pinto <markybob@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
### Initialization ###
plugin_name = _("First/Last Priority")
plugin_author = "Marcos Pinto"
plugin_version = "0.1"
plugin_description = _("Set the highest priority to the first and last pieces.")
def deluge_init(deluge_path):
global path
path = deluge_path
def enable(core, interface):
global path
return FirstLast(path, core, interface)
### The Plugin ###
DEFAULT_PREFS = {
"flpriorities": [7]
}
import deluge
import gtk, gtk.glade
class FirstLast:
def __init__(self, path, core, interface):
self.path = path
self.core = core
self.interface = interface
self.set_flpriorities = {}
self.callback_ids = []
# Setup preferences
self.config_file = deluge.common.CONFIG_DIR + "/firstlast_priorty.conf"
self.config = deluge.pref.Preferences(filename=deluge.common.CONFIG_DIR + "/firstlast_priority.conf", global_defaults=False, defaults=DEFAULT_PREFS)
try:
self.config.load(self.config_file)
except IOError:
# File does not exist
pass
print self.config.get
# 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))
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.flp_menuitem = gtk.MenuItem(_("_First/Last Priority"))
self.flp_menu = self.interface.build_menu_radio_list(self.config.get("flpriorities"), self.flp_clicked, self.get_torrent_flp(), None, True, _("_Not Set"), 1, None, True)
self.flp_menuitem.set_submenu(self.flp_menu)
self.interface.torrent_menu.append(self.flp_menuitem)
self.flp_menuitem.show_all()
def torrent_menu_hide(self, widget):
try:
self.interface.torrent_menu.remove(self.flp_menuitem)
except AttributeError:
pass
def update(self):
pass
def unload(self):
self.config.save(self.config_file)
# Disconnect all callbacks
for callback_id in self.callback_ids:
self.interface.torrent_menu.disconnect(callback_id)
self.callback_ids = []
# Reset all desired flpriorities in the core
for unique_ID, flp in self.set_flpriorities.items():
if flp > 1:
self.core.set_flp(unique_ID, flp)
self.set_flpriorities = {}
def flp_clicked(self, widget):
value = widget.get_children()[0].get_text()
if value == _("Not Set"):
value = 1
if value == _("Activated"):
value = 7
value = int(value) # Make sure the value is an int
# Set the flp in the core and remember the setting
self.core.set_flp(self.unique_ID, value)
self.set_flpriorities[self.unique_ID] = value
def get_torrent_flp(self):
if self.set_flpriorities.has_key(self.unique_ID):
return self.set_flpriorities[self.unique_ID]
else:
return 1

View File

@ -168,7 +168,7 @@ class ProxyType:
PRIORITY_DONT_DOWNLOAD = 0 PRIORITY_DONT_DOWNLOAD = 0
PRIORITY_NORMAL = 1 PRIORITY_NORMAL = 1
PRIORITY_HIGH = 2 PRIORITY_HIGH = 2
PRIORITY_HIGHEST = 6 PRIORITY_HIGHEST = 5
PRIORITY_DICT = {PRIORITY_DONT_DOWNLOAD: N_("Don't download"), PRIORITY_DICT = {PRIORITY_DONT_DOWNLOAD: N_("Don't download"),
PRIORITY_NORMAL: N_("Normal"), PRIORITY_NORMAL: N_("Normal"),

View File

@ -76,7 +76,7 @@ PREF_FUNCTIONS = {
"auto_seed_ratio" : None, # no need for a function, applied constantly "auto_seed_ratio" : None, # no need for a function, applied constantly
"max_download_speed_bps" : deluge_core.set_download_rate_limit, "max_download_speed_bps" : deluge_core.set_download_rate_limit,
"max_upload_speed_bps" : deluge_core.set_upload_rate_limit, "max_upload_speed_bps" : deluge_core.set_upload_rate_limit,
"enable_dht" : None, # not a normal pref in that is is applied only on start "enable_dht" : None, # not a normal pref in that is is applied only on start
"use_upnp" : deluge_core.use_upnp, "use_upnp" : deluge_core.use_upnp,
"use_natpmp" : deluge_core.use_natpmp, "use_natpmp" : deluge_core.use_natpmp,
"use_utpex" : deluge_core.use_utpex, "use_utpex" : deluge_core.use_utpex,
@ -250,10 +250,6 @@ class Manager:
# unique_IDs # unique_IDs
self.sync(True) self.sync(True)
# Apply all the file priorities, right after adding the
# torrents
self.apply_all_file_priorities()
# Apply the queue at this time, after all is loaded and ready # Apply the queue at this time, after all is loaded and ready
self.apply_queue() self.apply_queue()
except IOError: except IOError:
@ -627,6 +623,9 @@ class Manager:
self.unique_IDs[unique_ID].priorities = priorities[:] self.unique_IDs[unique_ID].priorities = priorities[:]
deluge_core.prioritize_files(unique_ID, priorities) deluge_core.prioritize_files(unique_ID, priorities)
if self.get_pref('prioritize_first_last_pieces'):
self.prioritize_first_last_pieces(unique_ID)
def get_priorities(self, unique_ID): def get_priorities(self, unique_ID):
try: try:
@ -637,14 +636,15 @@ class Manager:
num_files = self.get_core_torrent_state(unique_ID)['num_files'] num_files = self.get_core_torrent_state(unique_ID)['num_files']
return [PRIORITY_NORMAL] * num_files return [PRIORITY_NORMAL] * num_files
# Called when a session starts, to apply existing priorities def prioritize_first_last_pieces(self, unique_ID):
def apply_all_file_priorities(self): """Try to prioritize first and last pieces of each file in torrent
for unique_ID in self.unique_IDs.keys():
try: Currently it tries to prioritize 1% in the beginning and in the end
self.prioritize_files(unique_ID, of each file in the torrent
self.get_priorities(unique_ID))
except AttributeError: """
pass deluge_core.prioritize_first_last_pieces(unique_ID,
self.unique_IDs[unique_ID].priorities)
# Advanced statistics - these may be SLOW. The client should call these only # Advanced statistics - these may be SLOW. The client should call these only
# when needed, and perhaps only once in a long while (they are mostly just # when needed, and perhaps only once in a long while (they are mostly just
@ -832,10 +832,14 @@ class Manager:
def apply_prefs(self): def apply_prefs(self):
print "Applying preferences" print "Applying preferences"
for pref in PREF_FUNCTIONS.keys(): for pref in PREF_FUNCTIONS:
if PREF_FUNCTIONS[pref] is not None: if PREF_FUNCTIONS[pref] is not None:
PREF_FUNCTIONS[pref](self.get_pref(pref)) PREF_FUNCTIONS[pref](self.get_pref(pref))
# We need to reapply priorities to files after preferences were
# changed
for unique_ID in self.unique_IDs:
self.prioritize_files(unique_ID, self.get_priorities(unique_ID))
def set_DHT(self, start=False): def set_DHT(self, start=False):
if start == True and self.dht_running != True: if start == True and self.dht_running != True:

View File

@ -1517,8 +1517,103 @@ static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)
t.handle.prioritize_files(priorities_vector); t.handle.prioritize_files(priorities_vector);
#ifndef NDEBUG
int num_pieces = t.handle.get_torrent_info().num_pieces();
std::vector<int> priorities_pieces_vector(num_pieces);
priorities_pieces_vector = t.handle.piece_priorities();
std::cout << "after files prioritization\n";
for (long i = 0; i < num_pieces; i++) {
std::cout << priorities_pieces_vector.at(i);
}
std::cout << "\n";
#endif
return Py_None; return Py_None;
} }
static PyObject *torrent_prioritize_first_last_pieces(PyObject *self,
PyObject *args)
{
#define FIRST_LAST_PRIO 6
// Prioritize first and last 1% of file size bytes in each file of torrent
// with unique_ID
python_long unique_ID;
PyObject *priorities_list_object;
// We need priorities_list_object to see whether file is marked to
// download(has priority > 0) or not.
if (!PyArg_ParseTuple(args, "iO", &unique_ID, &priorities_list_object))
return NULL;
long index = get_index_from_unique_ID(unique_ID);
if (PyErr_Occurred())
return NULL;
torrent_t &t = M_torrents->at(index);
const torrent_info &tor_info = t.handle.get_torrent_info();
int num_files = tor_info.num_files();
assert(PyList_Size(priorities_list_object) == num_files);
int num_pieces = tor_info.num_pieces();
std::vector<int> priorities_vector(num_pieces);
priorities_vector = t.handle.piece_priorities();
#ifndef NDEBUG
std::cout << "priority distribution in torrent_prioritize_first_last_pieces()\n";
std::cout << "before prioritization\n";
for (long i = 0; i < num_pieces; i++) {
std::cout << priorities_vector.at(i);
}
std::cout << "\n";
#endif
for (long i = 0; i < num_files; i++) {
file_entry const &file = tor_info.file_at(i);
if(file.size == 0) {
continue;
}
// Check if file has priority 0 - means don't download - skip it
// and move to next file
int file_prio = PyInt_AsLong(PyList_GetItem(priorities_list_object,
i));
if(file_prio == 0) {
continue;
}
int start_piece = tor_info.map_file(i, 0, 0).piece;
int end_piece = tor_info.map_file(i, file.size, 0).piece;
// Set prio_size to 1% of the file size
int prio_size = file.size / 100;
int prio_pieces = tor_info.map_file(i, prio_size, 0).piece -
start_piece + 1;
#ifndef NDEBUG
std::cout << "s=" << start_piece << ", e=" << end_piece << ", p=" << prio_pieces << "\n";
#endif
for (int piece = 0; piece < prio_pieces; piece++) {
priorities_vector.at(start_piece + piece) = FIRST_LAST_PRIO;
priorities_vector.at(end_piece - piece) = FIRST_LAST_PRIO;
}
}
t.handle.prioritize_pieces(priorities_vector);
#ifndef NDEBUG
std::cout << "after prioritization\n";
for (long i = 0; i < num_pieces; i++) {
std::cout << priorities_vector.at(i);
}
std::cout << "\n";
#endif
return Py_None;
}
static PyObject *torrent_set_priv(PyObject *self, PyObject *args) static PyObject *torrent_set_priv(PyObject *self, PyObject *args)
{ {
using namespace libtorrent; using namespace libtorrent;
@ -1545,51 +1640,52 @@ static PyObject *torrent_set_priv(PyObject *self, PyObject *args)
static PyMethodDef deluge_core_methods[] = static PyMethodDef deluge_core_methods[] =
{ {
{"pe_settings", torrent_pe_settings, METH_VARARGS, "."}, {"pe_settings", torrent_pe_settings, METH_VARARGS, "."},
{"pre_init", torrent_pre_init, METH_VARARGS, "."}, {"pre_init", torrent_pre_init, METH_VARARGS, "."},
{"init", torrent_init, METH_VARARGS, "."}, {"init", torrent_init, METH_VARARGS, "."},
{"quit", torrent_quit, METH_VARARGS, "."}, {"quit", torrent_quit, METH_VARARGS, "."},
{"save_fastresume", torrent_save_fastresume, METH_VARARGS, "."}, {"save_fastresume", torrent_save_fastresume, METH_VARARGS, "."},
{"set_max_half_open", torrent_set_max_half_open, METH_VARARGS, "."}, {"set_max_half_open", torrent_set_max_half_open, METH_VARARGS, "."},
{"set_download_rate_limit", torrent_set_download_rate_limit, METH_VARARGS, "."}, {"set_download_rate_limit", torrent_set_download_rate_limit, METH_VARARGS, "."},
{"set_upload_rate_limit", torrent_set_upload_rate_limit, METH_VARARGS, "."}, {"set_upload_rate_limit", torrent_set_upload_rate_limit, METH_VARARGS, "."},
{"set_listen_on", torrent_set_listen_on, METH_VARARGS, "."}, {"set_listen_on", torrent_set_listen_on, METH_VARARGS, "."},
{"is_listening", torrent_is_listening, METH_VARARGS, "."}, {"is_listening", torrent_is_listening, METH_VARARGS, "."},
{"listening_port", torrent_listening_port, METH_VARARGS, "."}, {"listening_port", torrent_listening_port, METH_VARARGS, "."},
{"set_max_uploads", torrent_set_max_uploads, METH_VARARGS, "."}, {"set_max_uploads", torrent_set_max_uploads, METH_VARARGS, "."},
{"set_max_connections", torrent_set_max_connections, METH_VARARGS, "."}, {"set_max_connections", torrent_set_max_connections, METH_VARARGS, "."},
{"add_torrent", torrent_add_torrent, METH_VARARGS, "."}, {"add_torrent", torrent_add_torrent, METH_VARARGS, "."},
{"move_storage", torrent_move_storage, METH_VARARGS, "."}, {"move_storage", torrent_move_storage, METH_VARARGS, "."},
{"remove_torrent", torrent_remove_torrent, METH_VARARGS, "."}, {"remove_torrent", torrent_remove_torrent, METH_VARARGS, "."},
{"get_num_torrents", torrent_get_num_torrents, METH_VARARGS, "."}, {"get_num_torrents", torrent_get_num_torrents, METH_VARARGS, "."},
{"reannounce", torrent_reannounce, METH_VARARGS, "."}, {"reannounce", torrent_reannounce, METH_VARARGS, "."},
{"pause", torrent_pause, METH_VARARGS, "."}, {"pause", torrent_pause, METH_VARARGS, "."},
{"resume", torrent_resume, METH_VARARGS, "."}, {"resume", torrent_resume, METH_VARARGS, "."},
{"get_torrent_state", torrent_get_torrent_state, METH_VARARGS, "."}, {"get_torrent_state", torrent_get_torrent_state, METH_VARARGS, "."},
{"pop_event", torrent_pop_event, METH_VARARGS, "."}, {"pop_event", torrent_pop_event, METH_VARARGS, "."},
{"get_session_info", torrent_get_session_info, METH_VARARGS, "."}, {"get_session_info", torrent_get_session_info, METH_VARARGS, "."},
{"get_peer_info", torrent_get_peer_info, METH_VARARGS, "."}, {"get_peer_info", torrent_get_peer_info, METH_VARARGS, "."},
{"get_file_info", torrent_get_file_info, METH_VARARGS, "."}, {"get_file_info", torrent_get_file_info, METH_VARARGS, "."},
{"dump_file_info", torrent_dump_file_info, METH_VARARGS, "."}, {"dump_file_info", torrent_dump_file_info, METH_VARARGS, "."},
{"constants", torrent_constants, METH_VARARGS, "."}, {"constants", torrent_constants, METH_VARARGS, "."},
{"start_DHT", torrent_start_DHT, METH_VARARGS, "."}, {"start_DHT", torrent_start_DHT, METH_VARARGS, "."},
{"stop_DHT", torrent_stop_DHT, METH_VARARGS, "."}, {"stop_DHT", torrent_stop_DHT, METH_VARARGS, "."},
{"get_DHT_info", torrent_get_DHT_info, METH_VARARGS, "."}, {"get_DHT_info", torrent_get_DHT_info, METH_VARARGS, "."},
{"create_torrent", torrent_create_torrent, METH_VARARGS, "."}, {"create_torrent", torrent_create_torrent, METH_VARARGS, "."},
{"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."}, {"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."},
{"add_range_to_IP_filter", torrent_add_range_to_IP_filter, METH_VARARGS, "."}, {"add_range_to_IP_filter", torrent_add_range_to_IP_filter, METH_VARARGS, "."},
{"use_upnp", torrent_use_upnp, METH_VARARGS, "."}, {"use_upnp", torrent_use_upnp, METH_VARARGS, "."},
{"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."}, {"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."},
{"use_utpex", torrent_use_utpex, METH_VARARGS, "."}, {"use_utpex", torrent_use_utpex, METH_VARARGS, "."},
{"set_ratio", torrent_set_ratio, METH_VARARGS, "."}, {"set_ratio", torrent_set_ratio, METH_VARARGS, "."},
{"proxy_settings", torrent_proxy_settings, METH_VARARGS, "."}, {"proxy_settings", torrent_proxy_settings, METH_VARARGS, "."},
{"get_trackers", torrent_get_trackers, METH_VARARGS, "."}, {"get_trackers", torrent_get_trackers, METH_VARARGS, "."},
{"dump_trackers", torrent_dump_trackers, METH_VARARGS, "."}, {"dump_trackers", torrent_dump_trackers, METH_VARARGS, "."},
{"replace_trackers", torrent_replace_trackers, METH_VARARGS, "."}, {"replace_trackers", torrent_replace_trackers, METH_VARARGS, "."},
{"set_flp", torrent_set_flp, METH_VARARGS, "."}, {"set_flp", torrent_set_flp, METH_VARARGS, "."},
{"prioritize_files", torrent_prioritize_files, METH_VARARGS, "."}, {"prioritize_files", torrent_prioritize_files, METH_VARARGS, "."},
{"set_priv", torrent_set_priv, METH_VARARGS, "."}, {"prioritize_first_last_pieces", torrent_prioritize_first_last_pieces, METH_VARARGS, "."},
{"test_duplicate", torrent_test_duplicate, METH_VARARGS, "."}, {"set_priv", torrent_set_priv, METH_VARARGS, "."},
{"test_duplicate", torrent_test_duplicate, METH_VARARGS, "."},
{NULL} {NULL}
}; };

View File

@ -75,6 +75,7 @@ class PreferencesDlg:
self.glade.get_widget("finished_path_button").set_filename(self.preferences.get("default_finished_path")) self.glade.get_widget("finished_path_button").set_filename(self.preferences.get("default_finished_path"))
self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path")) self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path"))
self.glade.get_widget("chk_enable_files_dialog").set_active(self.preferences.get("enable_files_dialog")) self.glade.get_widget("chk_enable_files_dialog").set_active(self.preferences.get("enable_files_dialog"))
self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(self.preferences.get("prioritize_first_last_pieces"))
self.glade.get_widget("chk_compact").set_active(self.preferences.get("use_compact_storage")) self.glade.get_widget("chk_compact").set_active(self.preferences.get("use_compact_storage"))
self.glade.get_widget("active_port_label").set_text(str(self.active_port)) self.glade.get_widget("active_port_label").set_text(str(self.active_port))
self.glade.get_widget("spin_port_min").set_value(self.preferences.get("listen_on")[0]) self.glade.get_widget("spin_port_min").set_value(self.preferences.get("listen_on")[0])
@ -148,6 +149,7 @@ class PreferencesDlg:
self.preferences.set("enable_move_completed", self.glade.get_widget("chk_move_completed").get_active()) self.preferences.set("enable_move_completed", self.glade.get_widget("chk_move_completed").get_active())
self.preferences.set("default_finished_path", self.glade.get_widget("finished_path_button").get_filename()) self.preferences.set("default_finished_path", self.glade.get_widget("finished_path_button").get_filename())
self.preferences.set("enable_files_dialog", self.glade.get_widget("chk_enable_files_dialog").get_active()) self.preferences.set("enable_files_dialog", self.glade.get_widget("chk_enable_files_dialog").get_active())
self.preferences.set("prioritize_first_last_pieces", self.glade.get_widget("chk_prioritize_first_last_pieces").get_active())
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active()) self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
self.preferences.set("auto_seed_ratio", self.glade.get_widget("ratio_spinner").get_value()) self.preferences.set("auto_seed_ratio", self.glade.get_widget("ratio_spinner").get_value())
self.preferences.set("use_compact_storage", self.glade.get_widget("chk_compact").get_active()) self.preferences.set("use_compact_storage", self.glade.get_widget("chk_compact").get_active())

View File

@ -165,7 +165,6 @@ class FilesTabManager(FilesBaseManager):
def priority_clicked(self, widget): def priority_clicked(self, widget):
state = self.manager.get_torrent_state(self.file_unique_id) state = self.manager.get_torrent_state(self.file_unique_id)
print state["compact_mode"]
if state["compact_mode"]: if state["compact_mode"]:
self.compact_allocation_warning() self.compact_allocation_warning()
else: else:

View File

@ -70,6 +70,7 @@ DEFAULT_PREFS = {
"max_upload_speed_bps" : -1, "max_upload_speed_bps" : -1,
"max_uploads" : 2, "max_uploads" : 2,
"pref_rc4" : True, "pref_rc4" : True,
"prioritize_first_last_pieces" : True,
"proxy_type" : common.ProxyType.none, "proxy_type" : common.ProxyType.none,
"peer_proxy" : False, "peer_proxy" : False,
"tracker_proxy" : False, "tracker_proxy" : False,