support prefs that don't fit on the screen

remove superfluous log message
This commit is contained in:
Nick Lanham 2011-03-08 12:21:45 +01:00
parent e0bb8869aa
commit 08843ccad5
3 changed files with 18 additions and 2 deletions

View File

@ -262,7 +262,6 @@ class AllTorrents(BaseMode, component.Component):
# component start/update # component start/update
def start(self): def start(self):
log.error("STARTING")
component.get("SessionProxy").get_torrents_status(self.__status_dict, self.__status_fields).addCallback(self.set_state,False) component.get("SessionProxy").get_torrents_status(self.__status_dict, self.__status_fields).addCallback(self.set_state,False)
def update(self): def update(self):

View File

@ -93,6 +93,9 @@ class BasePane:
self.inputs = [] self.inputs = []
self.active_input = -1 self.active_input = -1
# have we scrolled down in the list
self.input_offset = 0
def move(self,r,c): def move(self,r,c):
self._cursor_row = r self._cursor_row = r
self._cursor_col = c self._cursor_col = c
@ -134,12 +137,25 @@ class BasePane:
if not isinstance(ipt,NoInput): if not isinstance(ipt,NoInput):
self.active_input = i self.active_input = i
break break
drew_act = not active
crow = 1 crow = 1
for i,ipt in enumerate(self.inputs): for i,ipt in enumerate(self.inputs):
if ipt.depend_skip(): if ipt.depend_skip() or i<self.input_offset:
if active and i==self.active_input:
self.input_offset-=1
mode.refresh()
return 0
continue continue
act = active and i==self.active_input act = active and i==self.active_input
if act: drew_act = True
crow += ipt.render(screen,crow,width, act, self.offset) crow += ipt.render(screen,crow,width, act, self.offset)
if crow >= (mode.prefs_height):
break
if not drew_act:
self.input_offset+=1
mode.refresh()
return 0
if active and self._cursor_row >= 0: if active and self._cursor_row >= 0:
curses.curs_set(2) curses.curs_set(2)

View File

@ -129,6 +129,7 @@ class Preferences(BaseMode):
# create the panes # create the panes
self.prefs_width = self.cols-self.div_off-1 self.prefs_width = self.cols-self.div_off-1
self.prefs_height = self.rows-4
self.panes = [ self.panes = [
DownloadsPane(self.div_off+2, self, self.prefs_width), DownloadsPane(self.div_off+2, self, self.prefs_width),
NetworkPane(self.div_off+2, self, self.prefs_width), NetworkPane(self.div_off+2, self, self.prefs_width),