Module: deluge
Branch: master
Commit: f6f3a8e0841a114b826506425cbe6f224113a2c6

Author: Nick <[email protected]>
Date:   Wed Feb  2 13:09:41 2011 +0100

allow marking in file view (no actions just yet)

---

 deluge/ui/console/modes/torrentdetail.py |   33 +++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/deluge/ui/console/modes/torrentdetail.py 
b/deluge/ui/console/modes/torrentdetail.py
index d6d93ac..0620467 100644
--- a/deluge/ui/console/modes/torrentdetail.py
+++ b/deluge/ui/console/modes/torrentdetail.py
@@ -220,12 +220,24 @@ class TorrentDetail(BaseMode, component.Component):
             self.file_limit = idx
 
             if idx >= self.file_off:
-                # set fg/bg colors based on if we are selected or not
+                # set fg/bg colors based on if we are selected/marked or not
+
+                # default values
+                fg = "white"
+                bg = "black"
+
+                if fl[1] in self.marked:
+                    bg = "blue"
+
                 if idx == self.current_file_idx:
                     self.current_file = fl
-                    fc = "{!black,white!}"
-                else:
-                    fc = "{!white,black!}"
+                    bg = "white"
+                    if fl[1] in self.marked:
+                        fg = "blue"
+                    else:
+                        fg = "black"
+
+                color_string = "{!%s,%s!}"%(fg,bg)
 
                 #actually draw the dir/file string
                 if fl[3] and fl[4]: # this is an expanded directory
@@ -239,7 +251,7 @@ class TorrentDetail(BaseMode, component.Component):
                                              
deluge.common.fsize(fl[2]),fl[5],fl[6]],
                                             self.column_widths)
                 
-                self.add_string(off,"%s%s"%(fc,r),trim=False)
+                self.add_string(off,"%s%s"%(color_string,r),trim=False)
                 off += 1
 
             if fl[3] and fl[4]:
@@ -322,6 +334,12 @@ class TorrentDetail(BaseMode, component.Component):
         component.get("ConsoleUI").set_mode(self.alltorrentmode)
         self.alltorrentmode.resume()
 
+    def _mark_unmark(self,idx):
+        if idx in self.marked:
+            del self.marked[idx]
+        else:
+            self.marked[idx] = True
+
     def _doRead(self):
         c = self.stdscr.getch()
 
@@ -359,5 +377,10 @@ class TorrentDetail(BaseMode, component.Component):
         # space
         elif c == 32:
             self.expcol_cur_file()
+        else:
+            if c > 31 and c < 256:
+                if chr(c) == 'm':
+                    if self.current_file:
+                        self._mark_unmark(self.current_file[1])
 
         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