diff options
author | bendikro <bro.devel+deluge@gmail.com> | 2016-04-30 03:04:40 +0200 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2016-10-30 12:45:04 +0000 |
commit | 20bae1bf9075f8fbcabb3bbaaeaaa1d8cda1c400 (patch) | |
tree | 464aca0ccaac57b835a5dd017f79868e3e1a38b8 /deluge/ui/common.py | |
parent | 2f8b4732b45cb3e5c13d84530b1a3fa865985291 (diff) | |
download | deluge-20bae1bf9075f8fbcabb3bbaaeaaa1d8cda1c400.tar.gz deluge-20bae1bf9075f8fbcabb3bbaaeaaa1d8cda1c400.tar.bz2 deluge-20bae1bf9075f8fbcabb3bbaaeaaa1d8cda1c400.zip |
[Console] Rewrite of the console code
This commit is a rewrite of larger parts of the console code. The
motivation behind the rewrite is to cleanup the code and reduce code
duplication to make it easier to understand and modify, and allow any
form of code reuse. Most changes are to the interactive console, but
also to how the different modes (BaseMode subclasses) are used and set
up.
* Address [#2097] - Improve match_torrent search match:
Instead of matching e.g. torrent name with name.startswith(pattern)
now check for asterix at beginning and end of pattern and search
with startswith, endswith or __contains__ according to the pattern.
Various smaller fixes:
* Add errback handler to connection failed
* Fix cmd line console mixing str and unicode input
* Fix handling delete backwards with ALT+Backspace
* Fix handling resizing of message popups
* Fix docs generation warnings
* Lets not stop the reactor on exception in basemode..
* Markup for translation arg help strings
* Main functionality improvements:
- Add support for indentation in formatting code in popup messages (like help)
- Add filter sidebar
- Add ComboBox and UI language selection
- Add columnsview to allow rearranging the torrentlist columns
and changing column widths.
- Removed Columns pane in preferences as columnsview.py is sufficient
- Remove torrent info panel (short cut 'i') as the torrent detail view
is sufficient
* Cleanups and code restructuring
- Made BaseModes subclass of Component
- Rewrite of most of basic window/panel to allow easier code reuse
- Implemented better handling of multple popups by stacking popups. This
makes it easier to return to previous popup when opening multiple popups.
* Refactured console code:
- modes/ for the different modes
- Renamed Legacy mode to CmdLine
- Renamed alltorrent.py to torrentlist.py and split the code into
- torrentlist/columnsview.py
- torrentlist/torrentsview.py
- torrentlist/search_mode.py (minor mode)
- torrentlist/queue_mode.py (minor mode)
- cmdline/ for cmd line commands
- utils/ for utility files
- widgets/ for reusable GUI widgets
- fields.py: Base widgets like TextInput, SelectInput, ComboInput
- popup.py: Popup windows
- inputpane.py: The BaseInputPane used to manage multiple base widgets in a panel
- window.py: The BaseWindow used by all panels needing a curses screen
- sidebar.py: The Sidebar panel
- statusbars.py: The statusbars
- Moved option parsing code from main.py to parser.py
Diffstat (limited to 'deluge/ui/common.py')
-rw-r--r-- | deluge/ui/common.py | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/deluge/ui/common.py b/deluge/ui/common.py index 461fa2dc2..81bdd37bb 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -44,6 +44,52 @@ STATE_TRANSLATION = { "Error": _("Error"), } +TORRENT_DATA_FIELD = { + "queue": {"name": "#", "status": ["queue"]}, + "name": {"name": _("Name"), "status": ["state", "name"]}, + "progress_state": {"name": _("Progress"), "status": ["progress", "state"]}, + "state": {"name": _("State"), "status": ["state"]}, + "progress": {"name": _("Progress"), "status": ["progress"]}, + "size": {"name": _("Size"), "status": ["total_wanted"]}, + "downloaded": {"name": _("Downloaded"), "status": ["all_time_download"]}, + "uploaded": {"name": _("Uploaded"), "status": ["total_uploaded"]}, + "remaining": {"name": _("Remaining"), "status": ["total_remaining"]}, + "ratio": {"name": _("Ratio"), "status": ["ratio"]}, + "download_speed": {"name": _("Down Speed"), "status": ["download_payload_rate"]}, + "upload_speed": {"name": _("Up Speed"), "status": ["upload_payload_rate"]}, + "max_download_speed": {"name": _("Down Limit"), "status": ["max_download_speed"]}, + "max_upload_speed": {"name": _("Up Limit"), "status": ["max_upload_speed"]}, + "max_connections": {"name": _("Max Connections"), "status": ["max_connections"]}, + "max_upload_slots": {"name": _("Max Upload Slots"), "status": ["max_upload_slots"]}, + "peers": {"name": _("Peers"), "status": ["num_peers", "total_peers"]}, + "seeds": {"name": _("Seeds"), "status": ["num_seeds", "total_seeds"]}, + "avail": {"name": _("Avail"), "status": ["distributed_copies"]}, + "seeds_peers_ratio": {"name": _("Seeds:Peers"), "status": ["seeds_peers_ratio"]}, + "time_added": {"name": _("Added"), "status": ["time_added"]}, + "tracker": {"name": _("Tracker"), "status": ["tracker_host"]}, + "download_location": {"name": _("Download Folder"), "status": ["download_location"]}, + "seeding_time": {"name": _("Seeding Time"), "status": ["seeding_time"]}, + "active_time": {"name": _("Active Time"), "status": ["active_time"]}, + "finished_time": {"name": _("Finished Time"), "status": ["finished_time"]}, + "last_seen_complete": {"name": _("Complete Seen"), "status": ["last_seen_complete"]}, + "completed_time": {"name": _("Completed"), "status": ["completed_time"]}, + "eta": {"name": _("ETA"), "status": ["eta"]}, + "shared": {"name": _("Shared"), "status": ["shared"]}, + "prioritize_first_last": {"name": _("Prioritize First/Last"), "status": ["prioritize_first_last"]}, + "sequential_download": {"name": _("Sequential Download"), "status": ["sequential_download"]}, + "is_auto_managed": {"name": _("Auto Managed"), "status": ["is_auto_managed"]}, + "auto_managed": {"name": _("Auto Managed"), "status": ["auto_managed"]}, + "stop_at_ratio": {"name": _("Stop At Ratio"), "status": ["stop_at_ratio"]}, + "stop_ratio": {"name": _("Stop Ratio"), "status": ["stop_ratio"]}, + "remove_at_ratio": {"name": _("Remove At Ratio"), "status": ["remove_at_ratio"]}, + "move_completed": {"name": _("Move On Completed"), "status": ["move_completed"]}, + "move_completed_path": {"name": _("Move Completed Path"), "status": ["move_completed_path"]}, + "move_on_completed": {"name": _("Move On Completed"), "status": ["move_on_completed"]}, + "move_on_completed_path": {"name": _("Move On Completed Path"), "status": ["move_on_completed_path"]}, + "owner": {"name": _("Owner"), "status": ["owner"]} +} + + TRACKER_STATUS_TRANSLATION = { "Error": _("Error"), "Warning": _("Warning"), @@ -73,9 +119,13 @@ class TorrentInfo(object): log.debug("Attempting to open %s.", filename) with open(filename, "rb") as _file: self.__m_filedata = _file.read() + except IOError as ex: + log.warning("Unable to open %s: %s", filename, ex) + raise ex + try: self.__m_metadata = bencode.bdecode(self.__m_filedata) except bencode.BTFailure as ex: - log.warning("Unable to open %s: %s", filename, ex) + log.warning("Failed to decode %s: %s", filename, ex) raise ex self.__m_info_hash = sha(bencode.bencode(self.__m_metadata["info"])).hexdigest() |