def get_feeds(noticer, author, amount_num, old_feeds_list=None, progress_dialog=None): feeds = [] latest_act_url = noticer.latest_act_url activities = author.activities for act in activities: # 两个截止遍历的条件 if latest_act_url and latest_act_url == act.content.url: break if int(amount_num) == len(feeds): break feed = FeedsList._create_feed(author, act) feeds.append(feed) # feed_num += 1 # progress.renew_feed_num(progress_dialog, feed_num) if old_feeds_list: feeds.extend(old_feeds_list) # progress_dialog.close() noticer.set_latest_act_url(feeds[0]["url"]) Noticer.add_noticer(noticer) return feeds
def add_new_feedslist(my_app, noticer, feed_num, progress_dialog=None): Noticer.add_noticer(noticer) # my_thread = MyThread("add_feeds_list_thread", FeedsList.add_feeds_list, noticer, feed_num, progress_dialog) # my_thread.start() FeedsList.add_feeds_list(noticer, feed_num, progress_dialog) use_qml_fun(my_app.root_view, fun_parent_name="rect", fun_name="add_new_feedslist", args={"feeds_list": FeedsList.get_feeds_list(noticer.name), "notice_methods": noticer.notice_methods}) listview.load_noticers_listview(my_app.root_view)
def load_noticers_listview(root_view): noticers = Noticer.get_noticers_in_json() noticers_names = list() unread_nums = list() feedslists = FeedsList.get_feeds_lists_in_json() feedslists_processed = [] set_noticers_data(noticers_names, unread_nums, feedslists_processed, noticers, feedslists) use_qml_fun(root_view, fun_parent_name="rect", fun_name="updateNoticersList", args={"names": noticers_names, "unread_nums": unread_nums, "feedslists": feedslists_processed})
def test_get_noticer(self): noticer = Noticer.get_noticers(0)
def del_noticer(root_view): Noticer.del_noticer(root_view) name = Noticer.get_current_noticer_name(root_view) FeedsList.del_feeds_list(name) listview.load_noticers_listview(root_view)