Пример #1
0
 def new_timeline(self, label, method, userstream = False, *args, **kwargs):
     # Create Timeline Object
     tl = Timeline()
     
     if method == "filter":
         if self.get_filter_tab():
             # filter method only one connection
             self.message_dialog(
                 "May create only one standing connection to the Streaming API.\n"
                 "Please close existing Streaming API tab if you want.")
             tl.destroy()
             return
         
         # set Streaming API stream
         tl.set_stream("filter", kwargs)
     else:
         interval = self.get_default_interval(method)        
         tl.set_timeline(method, interval, self.scounts, args, kwargs)
         # Put error to statubar
         tl.timeline.on_twitterapi_error = self.on_twitterapi_error
     
     # for Event
     tl.view.new_timeline = self.new_timeline
     
     # Add Notebook (Tab view)
     uid = self.new_tab(tl, label, tl, kwargs.get("deny_close", False))
     if method == "filter": self.set_filter_tab(uid)
     
     # Set color
     tl.view.set_color(self.status_color)
     
     if method == "mentions":
         # memory mentions tab_id
         self.timeline_mention = uid
         tl.on_status_added = self.on_mentions_added
     else:
         tl.on_status_added = self.on_status_added
     
     # Put tweet information to statusbar
     tl.view.on_status_selection_changed = self.on_status_selection_changed
     # Reply on double click
     tl.view.on_status_activated = self.on_status_activated
    
     # Set UserStream parameter
     if userstream:
         tl.set_stream("user")
     
     tl.start_stream()
     tl.start_timeline()