Add coloured tag for sticky comments.

This commit is contained in:
5225225
2016-01-07 23:22:23 +00:00
parent e5df17ce73
commit e7c910e8fc
3 changed files with 12 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ class Content(object):
sub_name = getattr(sub_author, 'name', '[deleted]')
flair = getattr(comment, 'author_flair_text', '')
permalink = getattr(comment, 'permalink', None)
stickied = getattr(comment, 'stickied', False)
data['type'] = 'Comment'
data['body'] = comment.body
@@ -112,6 +113,7 @@ class Content(object):
data['likes'] = comment.likes
data['gold'] = comment.gilded > 0
data['permalink'] = permalink
data['stickied'] = stickied
return data

View File

@@ -163,6 +163,10 @@ class SubmissionPage(Page):
text, attr = self.term.guilded
self.term.add_line(win, text, attr=attr)
if data['stickied']:
text, attr = self.term.stickied
self.term.add_line(win, text, attr=attr)
for row, text in enumerate(data['split_body'], start=offset+1):
if row in valid_rows:
self.term.add_line(win, text, row, 1)

View File

@@ -67,6 +67,12 @@ class Terminal(object):
attr = curses.A_BOLD | Color.YELLOW
return symbol, attr
@property
def stickied(self):
text = '[stickied]'
attr = Color.GREEN
return text, attr
@property
def vline(self):
return getattr(curses, 'ACS_VLINE', ord('|'))