mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 16:08:40 +00:00
Make buttons on the options tab actually work.
This commit is contained in:
parent
37fcf4ec4d
commit
4423ce667f
2 changed files with 31 additions and 3 deletions
|
@ -1619,6 +1619,7 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="response_id">0</property>
|
<property name="response_id">0</property>
|
||||||
|
<signal name="clicked" handler="on_button_edit_trackers_clicked"/>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox8">
|
<widget class="GtkHBox" id="hbox8">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -1691,6 +1692,7 @@
|
||||||
<property name="label" translatable="yes">gtk-apply</property>
|
<property name="label" translatable="yes">gtk-apply</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="response_id">0</property>
|
<property name="response_id">0</property>
|
||||||
|
<signal name="clicked" handler="on_button_apply_clicked"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -47,6 +47,11 @@ class OptionsTab:
|
||||||
self.prev_torrent_id = None
|
self.prev_torrent_id = None
|
||||||
self.prev_status = None
|
self.prev_status = None
|
||||||
|
|
||||||
|
glade.signal_autoconnect({
|
||||||
|
"on_button_apply_clicked": self._on_button_apply_clicked,
|
||||||
|
"on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked
|
||||||
|
})
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
# Get the first selected torrent
|
# Get the first selected torrent
|
||||||
torrent_id = component.get("TorrentView").get_selected_torrents()
|
torrent_id = component.get("TorrentView").get_selected_torrents()
|
||||||
|
@ -69,7 +74,10 @@ class OptionsTab:
|
||||||
"private",
|
"private",
|
||||||
"prioritize_first_last"])
|
"prioritize_first_last"])
|
||||||
self.prev_torrent_id = torrent_id
|
self.prev_torrent_id = torrent_id
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def _on_get_torrent_status(self, status):
|
def _on_get_torrent_status(self, status):
|
||||||
# We only want to update values that have been applied in the core. This
|
# We only want to update values that have been applied in the core. This
|
||||||
# is so we don't overwrite the user changes that haven't been applied yet.
|
# is so we don't overwrite the user changes that haven't been applied yet.
|
||||||
|
@ -91,5 +99,23 @@ class OptionsTab:
|
||||||
self.chk_prioritize_first_last.set_active(status["prioritize_first_last"])
|
self.chk_prioritize_first_last.set_active(status["prioritize_first_last"])
|
||||||
self.prev_status = status
|
self.prev_status = status
|
||||||
|
|
||||||
def clear(self):
|
def _on_button_apply_clicked(self, button):
|
||||||
pass
|
if self.spin_max_download.get_value() != self.prev_status["max_download_speed"]:
|
||||||
|
client.set_torrent_max_download_speed(self.prev_torrent_id, self.spin_max_download.get_value())
|
||||||
|
if self.spin_max_upload.get_value() != self.prev_status["max_upload_speed"]:
|
||||||
|
client.set_torrent_max_upload_speed(self.prev_torrent_id, self.spin_max_upload.get_value())
|
||||||
|
if self.spin_max_connections.get_value_as_int() != self.prev_status["max_connections"]:
|
||||||
|
client.set_torrent_max_connections(self.prev_torrent_id, self.spin_max_connections.get_value_as_int())
|
||||||
|
if self.spin_max_upload_slots.get_value_as_int() != self.prev_status["max_upload_slots"]:
|
||||||
|
client.set_torrent_max_upload_slots(self.prev_torrent_id, self.spin_max_upload_slots.get_value_as_int())
|
||||||
|
if self.chk_private.get_active() != self.prev_status["private"]:
|
||||||
|
client.set_torrent_private_flag(self.prev_torrent_id, self.chk_private.get_active())
|
||||||
|
if self.chk_prioritize_first_last.get_active() != self.prev_status["prioritize_first_last"]:
|
||||||
|
client.set_torrent_prioritize_first_last(self.prev_torrent_id, self.chk_prioritize_first_last.get_active())
|
||||||
|
|
||||||
|
def _on_button_edit_trackers_clicked(self, button):
|
||||||
|
from edittrackersdialog import EditTrackersDialog
|
||||||
|
dialog = EditTrackersDialog(
|
||||||
|
self.prev_torrent_id,
|
||||||
|
component.get("MainWindow").window)
|
||||||
|
dialog.run()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue