Temporary fix for large selfposts.

This commit is contained in:
Michael Lazar
2015-02-08 00:34:17 -08:00
parent 14e4d30c1d
commit d048fddeab
2 changed files with 4 additions and 1 deletions

View File

@@ -142,8 +142,10 @@ class SubmissionPage(BasePage):
n_rows, n_cols = win.getmaxyx() n_rows, n_cols = win.getmaxyx()
n_cols -= 3 # one for each side of the border + one for offset n_cols -= 3 # one for each side of the border + one for offset
# Don't print at all if there is not enough room to fit the whole sub # Don't print at all if there is not enough room to fit the whole sub
if data['n_rows'] > n_rows: if data['n_rows'] > n_rows:
win.addnstr(0, 0, '(Not enough space to display)', n_cols)
return return
for row, text in enumerate(data['split_title'], start=1): for row, text in enumerate(data['split_title'], start=1):
@@ -166,7 +168,7 @@ class SubmissionPage(BasePage):
win.addnstr(row, 1, text, n_cols) win.addnstr(row, 1, text, n_cols)
row = len(data['split_title']) + len(data['split_text']) + 3 row = len(data['split_title']) + len(data['split_text']) + 3
text = '{} {}'.format(data['score'], data['comments']) text = '{score} {comments}'.format(**data)
win.addnstr(row, 1, text, n_cols, curses.A_BOLD) win.addnstr(row, 1, text, n_cols, curses.A_BOLD)
win.border() win.border()

View File

@@ -41,6 +41,7 @@ class Color(object):
curses.init_pair(index, code[0], code[1]) curses.init_pair(index, code[0], code[1])
setattr(cls, attr, curses.color_pair(index)) setattr(cls, attr, curses.color_pair(index))
def text_input(window): def text_input(window):
""" """
Transform a window into a text box that will accept user input and loop Transform a window into a text box that will accept user input and loop