Add move completed option to add torrent dialog.

This commit is contained in:
Chase Sterling 2012-11-02 02:06:33 -04:00
parent 03abe32054
commit fd8dc457fa
3 changed files with 106 additions and 6 deletions

View File

@ -6,6 +6,7 @@
==== Core ==== ==== Core ====
* Fix not properly detecting when torrent is at end of queue * Fix not properly detecting when torrent is at end of queue
* #2049: Preserve order when moving multiple torrents in the queue * #2049: Preserve order when moving multiple torrents in the queue
* Add move completed option to add torrent dialog
==== GtkUI ==== ==== GtkUI ====
* Modified fix for #1957, keyerror with non-acsii columns * Modified fix for #1957, keyerror with non-acsii columns

View File

@ -142,7 +142,9 @@ class AddTorrentDialog(component.Component):
"max_download_speed_per_torrent", "max_download_speed_per_torrent",
"prioritize_first_last_pieces", "prioritize_first_last_pieces",
"download_location", "download_location",
"add_paused" "add_paused",
"move_completed",
"move_completed_path"
] ]
self.core_config = {} self.core_config = {}
@ -158,9 +160,13 @@ class AddTorrentDialog(component.Component):
if client.is_localhost(): if client.is_localhost():
self.glade.get_widget("button_location").show() self.glade.get_widget("button_location").show()
self.glade.get_widget("entry_download_path").hide() self.glade.get_widget("entry_download_path").hide()
self.glade.get_widget("button_move_completed_location").show()
self.glade.get_widget("entry_move_completed_path").hide()
else: else:
self.glade.get_widget("button_location").hide() self.glade.get_widget("button_location").hide()
self.glade.get_widget("entry_download_path").show() self.glade.get_widget("entry_download_path").show()
self.glade.get_widget("button_move_completed_location").hide()
self.glade.get_widget("entry_move_completed_path").show()
self.dialog.set_transient_for(component.get("MainWindow").window) self.dialog.set_transient_for(component.get("MainWindow").window)
self.dialog.present() self.dialog.present()
@ -366,9 +372,13 @@ class AddTorrentDialog(component.Component):
if client.is_localhost(): if client.is_localhost():
self.glade.get_widget("button_location").set_current_folder( self.glade.get_widget("button_location").set_current_folder(
options["download_location"]) options["download_location"])
self.glade.get_widget("button_move_completed_location").set_current_folder(
options["move_completed_path"])
else: else:
self.glade.get_widget("entry_download_path").set_text( self.glade.get_widget("entry_download_path").set_text(
options["download_location"]) options["download_location"])
self.glade.get_widget("entry_move_completed_path").set_text(
options["move_completed_path"])
self.glade.get_widget("radio_full").set_active( self.glade.get_widget("radio_full").set_active(
not options["compact_allocation"]) not options["compact_allocation"])
@ -386,6 +396,8 @@ class AddTorrentDialog(component.Component):
options["add_paused"]) options["add_paused"])
self.glade.get_widget("chk_prioritize").set_active( self.glade.get_widget("chk_prioritize").set_active(
options["prioritize_first_last_pieces"]) options["prioritize_first_last_pieces"])
self.glade.get_widget("chk_move_completed").set_active(
options["move_completed"])
def save_torrent_options(self, row=None): def save_torrent_options(self, row=None):
# Keeps the torrent options dictionary up-to-date with what the user has # Keeps the torrent options dictionary up-to-date with what the user has
@ -406,9 +418,13 @@ class AddTorrentDialog(component.Component):
if client.is_localhost(): if client.is_localhost():
options["download_location"] = \ options["download_location"] = \
self.glade.get_widget("button_location").get_filename() self.glade.get_widget("button_location").get_filename()
options["move_completed_path"] = \
self.glade.get_widget("button_move_completed_location").get_filename()
else: else:
options["download_location"] = \ options["download_location"] = \
self.glade.get_widget("entry_download_path").get_text() self.glade.get_widget("entry_download_path").get_text()
options["move_completed_path"] = \
self.glade.get_widget("entry_move_completed_path").get_text()
options["compact_allocation"] = \ options["compact_allocation"] = \
self.glade.get_widget("radio_compact").get_active() self.glade.get_widget("radio_compact").get_active()
@ -431,6 +447,8 @@ class AddTorrentDialog(component.Component):
self.glade.get_widget("chk_paused").get_active() self.glade.get_widget("chk_paused").get_active()
options["prioritize_first_last_pieces"] = \ options["prioritize_first_last_pieces"] = \
self.glade.get_widget("chk_prioritize").get_active() self.glade.get_widget("chk_prioritize").get_active()
options["move_completed"] = \
self.glade.get_widget("chk_move_completed").get_active()
self.options[torrent_id] = options self.options[torrent_id] = options
@ -456,9 +474,15 @@ class AddTorrentDialog(component.Component):
if client.is_localhost(): if client.is_localhost():
self.glade.get_widget("button_location").set_current_folder( self.glade.get_widget("button_location").set_current_folder(
self.core_config["download_location"]) self.core_config["download_location"])
self.glade.get_widget("button_move_completed_location").set_current_folder(
self.core_config["move_completed_path"]
)
else: else:
self.glade.get_widget("entry_download_path").set_text( self.glade.get_widget("entry_download_path").set_text(
self.core_config["download_location"]) self.core_config["download_location"])
self.glade.get_widget("entry_move_completed_path").set_text(
self.core_config["move_completed_path"]
)
self.glade.get_widget("radio_compact").set_active( self.glade.get_widget("radio_compact").set_active(
self.core_config["compact_allocation"]) self.core_config["compact_allocation"])
@ -476,6 +500,8 @@ class AddTorrentDialog(component.Component):
self.core_config["add_paused"]) self.core_config["add_paused"])
self.glade.get_widget("chk_prioritize").set_active( self.glade.get_widget("chk_prioritize").set_active(
self.core_config["prioritize_first_last_pieces"]) self.core_config["prioritize_first_last_pieces"])
self.glade.get_widget("chk_move_completed").set_active(
self.core_config["move_completed"])
def get_file_priorities(self, torrent_id): def get_file_priorities(self, torrent_id):
# A list of priorities # A list of priorities

View File

@ -375,8 +375,8 @@
<child> <child>
<widget class="GtkEntry" id="entry_download_path"> <widget class="GtkEntry" id="entry_download_path">
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="truncate_multiline">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="truncate_multiline">True</property>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -404,6 +404,79 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkFrame" id="frame1">
<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_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment8">
<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="top_padding">5</property>
<property name="left_padding">5</property>
<property name="right_padding">5</property>
<child>
<widget class="GtkHBox" id="hbox1">
<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>
<child>
<widget class="GtkCheckButton" id="chk_move_completed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="button_move_completed_location">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="show_hidden">True</property>
<property name="action">select-folder</property>
<property name="title" translatable="yes">Select A Folder</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry_move_completed_path">
<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="invisible_char">&#x25CF;</property>
<property name="truncate_multiline">True</property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<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">&lt;b&gt;Move Completed Location&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<widget class="GtkHBox" id="hbox6"> <widget class="GtkHBox" id="hbox6">
<property name="visible">True</property> <property name="visible">True</property>
@ -715,7 +788,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -833,7 +906,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</widget> </widget>
@ -1022,9 +1095,9 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
<property name="is_focus">True</property> <property name="is_focus">True</property>
<property name="truncate_multiline">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="activates_default">True</property> <property name="activates_default">True</property>
<property name="truncate_multiline">True</property>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -1181,9 +1254,9 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
<property name="is_focus">True</property> <property name="is_focus">True</property>
<property name="truncate_multiline">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="activates_default">True</property> <property name="activates_default">True</property>
<property name="truncate_multiline">True</property>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>