PGUP/PGDOWN on muc list (partially fixes #2165)

This commit is contained in:
mathieui 2011-09-12 01:24:43 +02:00
parent a20b42d2b4
commit d24b3c4295
2 changed files with 28 additions and 0 deletions

View file

@ -1736,6 +1736,12 @@ class MucListTab(Tab):
def get_color_state(self):
return self._color_state
def on_scroll_up(self):
self.listview.scroll_up()
def on_scroll_down(self):
self.listview.scroll_down()
class SimpleTextTab(Tab):
"""
A very simple tab, with just a text displaying some

View file

@ -1617,6 +1617,28 @@ class ListWin(Win):
self._starting_pos -= self.height // 2
return True
def scroll_down(self):
if not self.lines:
return
self._selected_row += self.height
if self._selected_row > len(self.lines) - 1:
self._selected_row = len(self.lines) -1
while self._selected_row >= self._starting_pos + self.height:
self._starting_pos += self.height // 2
if self._starting_pos < 0:
self._starting_pos = 0
return True
def scroll_up(self):
if not self.lines:
return
self._selected_row -= self.height + 1
if self._selected_row < 0:
self._selected_row = 0
while self._selected_row < self._starting_pos:
self._starting_pos -= self.height // 2
return True
class ColumnHeaderWin(Win):
"""
A class displaying the column's names