summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-07-26 12:40:08 +0200
committermathieui <mathieui@mathieui.net>2012-07-26 12:40:08 +0200
commitd8623d1c509e8f90234d239e61bb0e8bd93851e6 (patch)
tree5ff12918b3bc26808f94d3ae37f0928a8d0297e1 /src/core.py
parentc4fcf3c71af98f74497cb770c468bd860d010804 (diff)
downloadpoezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.tar.gz
poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.tar.bz2
poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.tar.xz
poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.zip
Change how scrolling is done
- All functions involved return a boolean, and the core function use that value to determine if a refresh is needed or not. (avoids useless refreshs) - Scrolling with PGUP/DOWN on the roster now only does _one_ action, an not a range corresponding to the screen size (should be way faster)
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py57
1 files changed, 45 insertions, 12 deletions
diff --git a/src/core.py b/src/core.py
index 7af9e628..9de580b8 100644
--- a/src/core.py
+++ b/src/core.py
@@ -934,34 +934,67 @@ class Core(object):
self.doupdate()
def refresh_tab_win(self):
+ """
+ Refresh the window containing the tab list
+ """
self.current_tab().refresh_tab_win()
if self.current_tab().input:
self.current_tab().input.refresh()
self.doupdate()
def scroll_page_down(self, args=None):
- self.current_tab().on_scroll_down()
- self.refresh_window()
+ """
+ Scroll a page down, if possible.
+ Returns True on success, None on failure.
+ """
+ if self.current_tab().on_scroll_down():
+ self.refresh_window()
+ return True
def scroll_page_up(self, args=None):
- self.current_tab().on_scroll_up()
- self.refresh_window()
+ """
+ Scroll a page up, if possible.
+ Returns True on success, None on failure.
+ """
+ if self.current_tab().on_scroll_up():
+ self.refresh_window()
+ return True
def scroll_line_up(self, args=None):
- self.current_tab().on_line_up()
- self.refresh_window()
+ """
+ Scroll a line up, if possible.
+ Returns True on success, None on failure.
+ """
+ if self.current_tab().on_line_up():
+ self.refresh_window()
+ return True
def scroll_line_down(self, args=None):
- self.current_tab().on_line_down()
- self.refresh_window()
+ """
+ Scroll a line down, if possible.
+ Returns True on success, None on failure.
+ """
+ if self.current_tab().on_line_down():
+ self.refresh_window()
+ return True
def scroll_half_up(self, args=None):
- self.current_tab().on_half_scroll_up()
- self.refresh_window()
+ """
+ Scroll half a screen down, if possible.
+ Returns True on success, None on failure.
+ """
+ if self.current_tab().on_half_scroll_up():
+ self.refresh_window()
+ return True
def scroll_half_down(self, args=None):
- self.current_tab().on_half_scroll_down()
- self.refresh_window()
+ """
+ Scroll half a screen down, if possible.
+ Returns True on success, None on failure.
+ """
+ if self.current_tab().on_half_scroll_down():
+ self.refresh_window()
+ return True
def grow_information_win(self, nb=1):
if self.information_win_size >= self.current_tab().height -5 or \