Disabled toggling the submission. Improved scrolling stability.

This commit is contained in:
Michael Lazar
2015-02-09 23:29:21 -08:00
parent d048fddeab
commit a980e6b4c3
2 changed files with 20 additions and 11 deletions

View File

@@ -241,7 +241,11 @@ class SubmissionContent(BaseContent):
"""
data = self.get(index)
if data['type'] == 'Comment':
if data['type'] == 'Submission':
# Can't hide the submission!
pass
elif data['type'] == 'Comment':
cache = [data]
count = 1
for d in self.iterate(index+1, 1, n_cols):
@@ -260,11 +264,9 @@ class SubmissionContent(BaseContent):
self._comment_data[index:index+len(cache)] = [comment]
elif data['type'] == 'HiddenComment':
self._comment_data[index:index+1] = data['cache']
elif data['type'] == 'MoreComments':
with self._loader():
comments = data['object'].comments()
comments = self.flatten_comments(comments, root_level=data['level'])

View File

@@ -53,21 +53,28 @@ class Navigator(object):
else:
self.cursor_index += 1
if self.cursor_index >= n_windows - 1:
# We have reached the end of the page - flip the orientation
# We have reached the end of the page
if self._is_valid(self.absolute_index):
# Flip the orientation
self.page_index += (self.step * self.cursor_index)
self.cursor_index = 0
self.inverted = not self.inverted
redraw = True
else:
# Unless we are at the absolute end of the submission
self.cursor_index -= 1 # Revert
valid = False
else:
if self.cursor_index > 0:
self.cursor_index -= 1
else:
if self._is_valid(self.page_index - self.step):
# We have reached the beginning of the page - move the index
self.page_index -= self.step
if self._is_valid(self.absolute_index):
# We have reached the beginning of the page - move the index
redraw = True
else:
valid = False
self.page_index += self.step
valid = False # Revert
return valid, redraw