Пример #1
0
    def setupModels(self):
        self._all_timeline = TweetCommonModel(
            self.client.api("statuses/home_timeline"), self)
        self.all_timeline = TweetFilterModel(self._all_timeline)
        self.all_timeline.setModel(self._all_timeline)
        self._prepareTimeline(self.all_timeline)

        # extra rules
        self.all_timeline.setMaxRetweets(self.maxRetweets)
        self.all_timeline.setMaxTweetsPerUser(self.maxTweetsPerUser)

        self.homeView.setModel(self.all_timeline)

        self._mentions = TweetCommonModel(self.client.api("statuses/mentions"),
                                          self)
        self.mentions = TweetFilterModel(self._mentions)
        self.mentions.setModel(self._mentions)
        self._prepareTimeline(self.mentions)
        self.mentionsView.setModel(self.mentions)

        self._comment_to_me = TweetCommentModel(
            self.client.api("comments/to_me"), self)
        self.comment_to_me = TweetFilterModel(self._comment_to_me)
        self.comment_to_me.setModel(self._comment_to_me)
        self._prepareTimeline(self.comment_to_me)
        self.commentsView.setModel(self.comment_to_me)

        self._comment_mentions = TweetCommentModel(
            self.client.api("comments/mentions"), self)
        self.comment_mentions = TweetFilterModel(self._comment_mentions)
        self.comment_mentions.setModel(self._comment_mentions)
        self._prepareTimeline(self.comment_mentions)
        self.commentsMentionsView.setModel(self.comment_mentions)
Пример #2
0
 def setupModels(self):
     self.all_timeline = TweetCommonModel(
         TweetItem(), self.client.statuses.home_timeline, self)
     self.all_timeline.load()
     self.homeView.rootContext().setContextProperty("mymodel",
                                                    self.all_timeline)
     self.mentions = TweetCommonModel(TweetItem(),
                                      self.client.statuses.mentions, self)
     self.mentions.load()
     self.mentionsView.rootContext().setContextProperty(
         "mymodel", self.mentions)
     self.comment_to_me = TweetCommentModel(TweetItem(),
                                            self.client.comments.to_me,
                                            self)
     self.comment_to_me.load()
     self.commentsView.rootContext().setContextProperty(
         "mymodel", self.comment_to_me)
     self.my_timeline = TweetCommonModel(TweetItem(),
                                         self.client.statuses.user_timeline,
                                         self)
     self.my_timeline.load()
     self.myView.rootContext().setContextProperty("mymodel",
                                                  self.my_timeline)