From 112df2abe220a9327c049006d5609cc392c36a36 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Tue, 22 Dec 2020 14:55:05 -0800 Subject: [PATCH] render longpost --- README.md | 4 ++-- src/widgets.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b60dd09..80fed8d 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ A nut obsessed saber-toothed client for pnut.io - [x] Menu (about, refresh, logout) - [x] Keyboard shortcuts - [x] Avatars -- [x] Post actions (reply, bookmark, repost, quote, copy, delete) -- [ ] Loading indicator +- [x] Post actions (reply, bookmark, repost, quote, copy) - [ ] Load newer posts - [ ] Load older posts +- [ ] Loading indicator - [ ] Render post media - [ ] Settings page - [ ] App icon and package metadata diff --git a/src/widgets.py b/src/widgets.py index c3c2511..4341bb3 100644 --- a/src/widgets.py +++ b/src/widgets.py @@ -245,11 +245,11 @@ class Timeline(Gtk.Box): if self.stream == 'unified': posts, meta = pnutpy.api.users_post_streams_unified(include_raw=1) elif self.stream == 'mentions': - posts, meta = pnutpy.api.users_mentioned_posts('me') + posts, meta = pnutpy.api.users_mentioned_posts('me', include_raw=1) elif self.stream == 'bookmarks': - posts, meta = pnutpy.api.users_bookmarked_posts('me') + posts, meta = pnutpy.api.users_bookmarked_posts('me', include_raw=1) else: - posts, meta = pnutpy.api.posts_streams_global() + posts, meta = pnutpy.api.posts_streams_global(include_raw=1) for item in posts: if 'is_deleted' in item: @@ -358,7 +358,18 @@ class PostItem(Gtk.ListBoxRow): if 'raw' in post: for raw in post.raw: - logging.debug(raw.type) + # TODO: hide this under toggle? + if raw.type == "nl.chimpnut.blog.post": + longpost = raw.value + if 'title' in longpost: + lp_title = Gtk.Label(wrap=True) + lp_title.set_markup(f"{longpost.title}") + self.c_box.pack_start(lp_title, False, False, 10) + lp_body = Gtk.Label(wrap=True) + lp_body.set_text(longpost.body) + self.c_box.pack_start(lp_body, False, False, 10) + + # TODO: open full photo in seperate window if raw.type == "io.pnut.core.oembed": oembed = raw.value if oembed.type == "photo":