Module: deluge
Branch: master
Commit: 60d96c6f2096da64ec895a30d8ed8d05c0800f2c

Author: Nick Lanham <[email protected]>
Date:   Wed Feb 23 16:07:47 2011 +0100

add add_spaces to InputPopup

---

 deluge/ui/console/modes/input_popup.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/deluge/ui/console/modes/input_popup.py 
b/deluge/ui/console/modes/input_popup.py
index 6a0f3f5..44f9de0 100644
--- a/deluge/ui/console/modes/input_popup.py
+++ b/deluge/ui/console/modes/input_popup.py
@@ -562,6 +562,7 @@ class InputPopup(Popup):
     def 
__init__(self,parent_mode,title,width_req=-1,height_req=-1,close_cb=None):
         Popup.__init__(self,parent_mode,title,width_req,height_req,close_cb)
         self.inputs = []
+        self.spaces = []
         self.current_input = 0
 
     def move(self,r,c):
@@ -580,6 +581,9 @@ class InputPopup(Popup):
         self.inputs.append(TextInput(self.parent, self.move, self.width, 
message,
                                      name, value, complete))
 
+    def add_spaces(self, num):
+        self.spaces.append((len(self.inputs)-1,num))
+
     def add_select_input(self, message, name, opts, vals, default_index=0):
         self.inputs.append(SelectInput(self.parent, message, name, opts, vals, 
default_index))
 
@@ -591,8 +595,12 @@ class InputPopup(Popup):
         self._cursor_col = -1
         curses.curs_set(0)
         crow = 1
+        spos = 0
         for i,ipt in enumerate(self.inputs):
             crow += 
ipt.render(self.screen,crow,self.width,i==self.current_input)
+            if self.spaces and (spos < len(self.spaces)) and (i == 
self.spaces[spos][0]):
+                crow += self.spaces[spos][1]
+                spos += 1
 
         # need to do this last as adding things moves the cursor
         if self._cursor_row >= 0:

-- 
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