Remove support for multiple API calls in buffers. Closes #214

This commit is contained in:
Manuel Cortez 2018-05-25 11:35:24 -05:00
parent 8af1e650b7
commit 537d011b40
3 changed files with 16 additions and 10 deletions

View File

@ -130,7 +130,8 @@ class accountSettingsController(globalSettingsController):
widgetUtils.connect_event(self.dialog.general.au, widgetUtils.BUTTON_PRESSED, self.manage_autocomplete) widgetUtils.connect_event(self.dialog.general.au, widgetUtils.BUTTON_PRESSED, self.manage_autocomplete)
self.dialog.set_value("general", "relative_time", self.config["general"]["relative_times"]) self.dialog.set_value("general", "relative_time", self.config["general"]["relative_times"])
self.dialog.set_value("general", "show_screen_names", self.config["general"]["show_screen_names"]) self.dialog.set_value("general", "show_screen_names", self.config["general"]["show_screen_names"])
self.dialog.set_value("general", "apiCalls", self.config["general"]["max_api_calls"]) if application.streaming_lives():
self.dialog.set_value("general", "apiCalls", self.config["general"]["max_api_calls"])
self.dialog.set_value("general", "itemsPerApiCall", self.config["general"]["max_tweets_per_call"]) self.dialog.set_value("general", "itemsPerApiCall", self.config["general"]["max_tweets_per_call"])
self.dialog.set_value("general", "reverse_timelines", self.config["general"]["reverse_timelines"]) self.dialog.set_value("general", "reverse_timelines", self.config["general"]["reverse_timelines"])
rt = self.config["general"]["retweet_mode"] rt = self.config["general"]["retweet_mode"]
@ -182,7 +183,8 @@ class accountSettingsController(globalSettingsController):
self.needs_restart = True self.needs_restart = True
self.config["general"]["relative_times"] = self.dialog.get_value("general", "relative_time") self.config["general"]["relative_times"] = self.dialog.get_value("general", "relative_time")
self.config["general"]["show_screen_names"] = self.dialog.get_value("general", "show_screen_names") self.config["general"]["show_screen_names"] = self.dialog.get_value("general", "show_screen_names")
self.config["general"]["max_api_calls"] = self.dialog.get_value("general", "apiCalls") if application.streaming_lives():
self.config["general"]["max_api_calls"] = self.dialog.get_value("general", "apiCalls")
self.config["general"]["max_tweets_per_call"] = self.dialog.get_value("general", "itemsPerApiCall") self.config["general"]["max_tweets_per_call"] = self.dialog.get_value("general", "itemsPerApiCall")
if self.config["general"]["persist_size"] != self.dialog.get_value("general", "persist_size"): if self.config["general"]["persist_size"] != self.dialog.get_value("general", "persist_size"):
if self.dialog.get_value("general", "persist_size") == '': if self.dialog.get_value("general", "persist_size") == '':

View File

@ -251,7 +251,10 @@ class Session(object):
update_function str: The function to call. This function must be child of self.twitter.twitter update_function str: The function to call. This function must be child of self.twitter.twitter
returns a list with all items retrieved.""" returns a list with all items retrieved."""
max = int(self.settings["general"]["max_api_calls"])-1 if application.streaming_lives():
max = int(self.settings["general"]["max_api_calls"])-1
else:
max = 0
results = [] results = []
data = getattr(self.twitter.twitter, update_function)(count=self.settings["general"]["max_tweets_per_call"], *args, **kwargs) data = getattr(self.twitter.twitter, update_function)(count=self.settings["general"]["max_tweets_per_call"], *args, **kwargs)
results.extend(data) results.extend(data)

View File

@ -93,13 +93,14 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(self.au, 0, wx.ALL, 5) sizer.Add(self.au, 0, wx.ALL, 5)
self.relative_time = wx.CheckBox(self, wx.NewId(), _(U"Relative timestamps")) self.relative_time = wx.CheckBox(self, wx.NewId(), _(U"Relative timestamps"))
sizer.Add(self.relative_time, 0, wx.ALL, 5) sizer.Add(self.relative_time, 0, wx.ALL, 5)
apiCallsBox = wx.BoxSizer(wx.HORIZONTAL) if application.streaming_lives():
apiCallsBox.Add(wx.StaticText(self, -1, _(u"API calls (One API call = 200 tweets, two API calls = 400 tweets, etc):")), 0, wx.ALL, 5) apiCallsBox = wx.BoxSizer(wx.HORIZONTAL)
self.apiCalls = wx.SpinCtrl(self, wx.NewId()) apiCallsBox.Add(wx.StaticText(self, -1, _(u"API calls (One API call = 200 tweets, two API calls = 400 tweets, etc):")), 0, wx.ALL, 5)
self.apiCalls.SetRange(1, 10) self.apiCalls = wx.SpinCtrl(self, wx.NewId())
self.apiCalls.SetSize(self.apiCalls.GetBestSize()) self.apiCalls.SetRange(1, 10)
apiCallsBox.Add(self.apiCalls, 0, wx.ALL, 5) self.apiCalls.SetSize(self.apiCalls.GetBestSize())
sizer.Add(apiCallsBox, 0, wx.ALL, 5) apiCallsBox.Add(self.apiCalls, 0, wx.ALL, 5)
sizer.Add(apiCallsBox, 0, wx.ALL, 5)
tweetsPerCallBox = wx.BoxSizer(wx.HORIZONTAL) tweetsPerCallBox = wx.BoxSizer(wx.HORIZONTAL)
tweetsPerCallBox.Add(wx.StaticText(self, -1, _(u"Items on each API call")), 0, wx.ALL, 5) tweetsPerCallBox.Add(wx.StaticText(self, -1, _(u"Items on each API call")), 0, wx.ALL, 5)
self.itemsPerApiCall = wx.SpinCtrl(self, wx.NewId()) self.itemsPerApiCall = wx.SpinCtrl(self, wx.NewId())