Module: deluge
Branch: multiuser-oldprefs
Commit: 897c2f981f783a5fe7a1045cfd77c7d12f15d8b0

Author: Nick Lanham <[email protected]>
Date:   Tue Apr 26 12:39:57 2011 +0200

Add help to torrent details mode.

fixes bug: 1687

---

 deluge/ui/console/modes/alltorrents.py   |    4 +-
 deluge/ui/console/modes/torrentdetail.py |   41 ++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/deluge/ui/console/modes/alltorrents.py 
b/deluge/ui/console/modes/alltorrents.py
index 083bbf6..68e8a59 100644
--- a/deluge/ui/console/modes/alltorrents.py
+++ b/deluge/ui/console/modes/alltorrents.py
@@ -81,7 +81,7 @@ this one) using the up/down arrows.
 All popup windows can be closed/canceled by hitting the Esc key \
 (you might need to wait a second for an Esc to register)
 
-The actions you can perform and the keys to perform them are as follows: \
+The actions you can perform and the keys to perform them are as follows:
 
 {!info!}'h'{!normal!} - Show this help
 
@@ -113,7 +113,7 @@ about the currently selected torrent, as well as a view of 
the \
 files in the torrent and the ability to set file priorities.
 
 {!info!}Enter{!normal!} - Show torrent actions popup.  Here you can do things 
like \
-pause/resume, remove, recheck and so one.  These actions \
+pause/resume, remove, recheck and so on.  These actions \
 apply to all currently marked torrents.  The currently \
 selected torrent is automatically marked when you press enter. 
 
diff --git a/deluge/ui/console/modes/torrentdetail.py 
b/deluge/ui/console/modes/torrentdetail.py
index 4c5d41e..39f7737 100644
--- a/deluge/ui/console/modes/torrentdetail.py
+++ b/deluge/ui/console/modes/torrentdetail.py
@@ -59,6 +59,35 @@ except ImportError:
 import logging
 log = logging.getLogger(__name__)
 
+# Big help string that gets displayed when the user hits 'h'
+HELP_STR = """\
+This screen shows detailed information about a torrent, and also the \
+information about the individual files in the torrent.
+
+You can navigate the file list with the Up/Down arrows and use space to \
+collapse/expand the file tree.
+
+All popup windows can be closed/canceled by hitting the Esc key \
+(you might need to wait a second for an Esc to register)
+
+The actions you can perform and the keys to perform them are as follows:
+
+{!info!}'h'{!normal!} - Show this help
+
+{!info!}'a'{!normal!} - Show torrent actions popup.  Here you can do things 
like \
+pause/resume, remove, recheck and so on.
+
+{!info!}'m'{!normal!} - Mark a file
+{!info!}'c'{!normal!} - Un-mark all files
+
+{!info!}Space{!normal!} - Expand/Collapse currently selected folder
+
+{!info!}Enter{!normal!} - Show priority popup in which you can set the \
+download priority of selected files.
+
+{!info!}Left Arrow{!normal!} - Go back to torrent overview.
+"""
+
 class TorrentDetail(BaseMode, component.Component):
     def __init__(self, alltorrentmode, torrentid, stdscr, encoding=None):
         self.alltorrentmode = alltorrentmode
@@ -106,6 +135,8 @@ class TorrentDetail(BaseMode, component.Component):
         BaseMode.__init__(self, stdscr, encoding)
         component.Component.__init__(self, "TorrentDetail", 1, 
depend=["SessionProxy"])
 
+        self.__split_help()
+
         self.column_names = ["Filename", "Size", "Progress", "Priority"]
         self._update_columns()
 
@@ -137,6 +168,9 @@ class TorrentDetail(BaseMode, component.Component):
         self.torrent_state = state
         self.refresh()
 
+    def __split_help(self):
+        self.__help_lines = format_utils.wrap_string(HELP_STR,(self.cols/2)-2)
+
     # split file list into directory tree. this function assumes all files in a
     # particular directory are returned together.  it won't work otherwise.
     # returned list is a list of lists of the form:
@@ -288,6 +322,7 @@ class TorrentDetail(BaseMode, component.Component):
     def on_resize(self, *args):
         BaseMode.on_resize_norefresh(self, *args)
         self._update_columns()
+        self.__split_help()
         if self.popup:
             self.popup.handle_resize()
         self.refresh()
@@ -470,10 +505,12 @@ class TorrentDetail(BaseMode, component.Component):
                 if chr(c) == 'm':
                     if self.current_file:
                         self._mark_unmark(self.current_file[1])
-                if chr(c) == 'c':
+                elif chr(c) == 'c':
                     self.marked = {}
-                if chr(c) == 'a':
+                elif chr(c) == 'a':
                     torrent_actions_popup(self,[self.torrentid],details=False)
                     return
+                elif chr(c) == 'h':
+                    self.popup = 
Popup(self,"Help",init_lines=self.__help_lines)
 
         self.refresh()

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to