mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 23:48:40 +00:00
Add Options tab.
This commit is contained in:
parent
6858e875a1
commit
8eca7bfdeb
4 changed files with 904 additions and 426 deletions
7
TODO
7
TODO
|
@ -1,7 +1,5 @@
|
||||||
For 0.6 release:
|
For 0.6 release:
|
||||||
* Implement open folder
|
* Implement open folder
|
||||||
* Add per-torrent settings to the details pane.. max_download_speed, etc.. So
|
|
||||||
the user know what limits are set on the torrent.
|
|
||||||
* Add a 'move storage' on completion option
|
* Add a 'move storage' on completion option
|
||||||
* Address issue where torrents will redownload if the storage is moved outside
|
* Address issue where torrents will redownload if the storage is moved outside
|
||||||
of deluge.
|
of deluge.
|
||||||
|
@ -11,14 +9,15 @@ For 0.6 release:
|
||||||
* Translations
|
* Translations
|
||||||
* Show proper priority levels in Files tab, plus add menu to alter priorities
|
* Show proper priority levels in Files tab, plus add menu to alter priorities
|
||||||
* Implement add by hash
|
* Implement add by hash
|
||||||
|
* Implement 'Classic' mode
|
||||||
|
* Add tabs to view menu
|
||||||
|
* Add command line option to change config dir.. --config
|
||||||
|
|
||||||
After 0.6 release:
|
After 0.6 release:
|
||||||
* Figure out easy way for user-made plugins to add i18n support.
|
* Figure out easy way for user-made plugins to add i18n support.
|
||||||
* Restart daemon function
|
* Restart daemon function
|
||||||
* Docstrings!
|
* Docstrings!
|
||||||
* Implement 'Classic' mode
|
|
||||||
* Add wizard
|
* Add wizard
|
||||||
* Add command line option to change config dir.. --config
|
|
||||||
* Add method for plugins to add labels
|
* Add method for plugins to add labels
|
||||||
* Add context menus for labels.. ie. setting options for all torrents in label
|
* Add context menus for labels.. ie. setting options for all torrents in label
|
||||||
* Implement caching in core
|
* Implement caching in core
|
||||||
|
|
File diff suppressed because it is too large
Load diff
95
deluge/ui/gtkui/options_tab.py
Normal file
95
deluge/ui/gtkui/options_tab.py
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
#
|
||||||
|
# options_tab.py
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||||
|
#
|
||||||
|
# Deluge is free software.
|
||||||
|
#
|
||||||
|
# You may 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 of the License, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# deluge 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 deluge. If not, write to:
|
||||||
|
# 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
|
||||||
|
# library.
|
||||||
|
# You must obey the GNU General Public License in all respects for all of
|
||||||
|
# the code used other than OpenSSL. If you modify file(s) with this
|
||||||
|
# exception, you may extend this exception to your version of the file(s),
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import deluge.component as component
|
||||||
|
from deluge.ui.client import aclient as client
|
||||||
|
|
||||||
|
class OptionsTab:
|
||||||
|
def __init__(self):
|
||||||
|
glade = component.get("MainWindow").get_glade()
|
||||||
|
self.spin_max_download = glade.get_widget("spin_max_download")
|
||||||
|
self.spin_max_upload = glade.get_widget("spin_max_upload")
|
||||||
|
self.spin_max_connections = glade.get_widget("spin_max_connections")
|
||||||
|
self.spin_max_upload_slots = glade.get_widget("spin_max_upload_slots")
|
||||||
|
self.chk_private = glade.get_widget("chk_private")
|
||||||
|
self.chk_prioritize_first_last = glade.get_widget("chk_prioritize_first_last")
|
||||||
|
|
||||||
|
self.prev_torrent_id = None
|
||||||
|
self.prev_status = None
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
# Get the first selected torrent
|
||||||
|
torrent_id = component.get("TorrentView").get_selected_torrents()
|
||||||
|
|
||||||
|
# Only use the first torrent in the list or return if None selected
|
||||||
|
if len(torrent_id) != 0:
|
||||||
|
torrent_id = torrent_id[0]
|
||||||
|
else:
|
||||||
|
# No torrent is selected in the torrentview
|
||||||
|
return
|
||||||
|
|
||||||
|
if torrent_id != self.prev_torrent_id:
|
||||||
|
self.prev_status = None
|
||||||
|
|
||||||
|
client.get_torrent_status(self._on_get_torrent_status, torrent_id,
|
||||||
|
["max_download_speed",
|
||||||
|
"max_upload_speed",
|
||||||
|
"max_connections",
|
||||||
|
"max_upload_slots",
|
||||||
|
"private",
|
||||||
|
"prioritize_first_last"])
|
||||||
|
self.prev_torrent_id = torrent_id
|
||||||
|
|
||||||
|
def _on_get_torrent_status(self, status):
|
||||||
|
# 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.
|
||||||
|
if self.prev_status == None:
|
||||||
|
self.prev_status = {}.fromkeys(status.keys(), None)
|
||||||
|
|
||||||
|
if status != self.prev_status and status.keys() == self.prev_status.keys():
|
||||||
|
if status["max_download_speed"] != self.prev_status["max_download_speed"]:
|
||||||
|
self.spin_max_download.set_value(status["max_download_speed"])
|
||||||
|
if status["max_upload_speed"] != self.prev_status["max_upload_speed"]:
|
||||||
|
self.spin_max_upload.set_value(status["max_upload_speed"])
|
||||||
|
if status["max_connections"] != self.prev_status["max_connections"]:
|
||||||
|
self.spin_max_connections.set_value(status["max_connections"])
|
||||||
|
if status["max_upload_slots"] != self.prev_status["max_upload_slots"]:
|
||||||
|
self.spin_max_upload_slots.set_value(status["max_upload_slots"])
|
||||||
|
if status["private"] != self.prev_status["private"]:
|
||||||
|
self.chk_private.set_active(status["private"])
|
||||||
|
if status["prioritize_first_last"] != self.prev_status["prioritize_first_last"]:
|
||||||
|
self.chk_prioritize_first_last.set_active(status["prioritize_first_last"])
|
||||||
|
self.prev_status = status
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
pass
|
|
@ -41,6 +41,7 @@ from statistics_tab import StatisticsTab
|
||||||
from details_tab import DetailsTab
|
from details_tab import DetailsTab
|
||||||
from files_tab import FilesTab
|
from files_tab import FilesTab
|
||||||
from peers_tab import PeersTab
|
from peers_tab import PeersTab
|
||||||
|
from options_tab import OptionsTab
|
||||||
|
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
|
||||||
|
@ -59,12 +60,14 @@ class TorrentDetails(component.Component):
|
||||||
details_tab = DetailsTab()
|
details_tab = DetailsTab()
|
||||||
files_tab = FilesTab()
|
files_tab = FilesTab()
|
||||||
peers_tab = PeersTab()
|
peers_tab = PeersTab()
|
||||||
|
options_tab = OptionsTab()
|
||||||
|
|
||||||
self.tabs = []
|
self.tabs = []
|
||||||
self.tabs.insert(0, statistics_tab)
|
self.tabs.insert(0, statistics_tab)
|
||||||
self.tabs.insert(1, details_tab)
|
self.tabs.insert(1, details_tab)
|
||||||
self.tabs.insert(2, files_tab)
|
self.tabs.insert(2, files_tab)
|
||||||
self.tabs.insert(3, peers_tab)
|
self.tabs.insert(3, peers_tab)
|
||||||
|
self.tabs.insert(4, options_tab)
|
||||||
|
|
||||||
def visible(self, visible):
|
def visible(self, visible):
|
||||||
if visible:
|
if visible:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue