Added some messages to panes that display while data is still loading, or when there are errors or no data
This commit is contained in:
parent
f37246f30b
commit
d2cf7c2ff5
|
@ -35,7 +35,7 @@ class TweetPane(gtk.ScrolledWindow):
|
||||||
|
|
||||||
self.tab_label = CloseTabLabel(self.list_name)
|
self.tab_label = CloseTabLabel(self.list_name)
|
||||||
|
|
||||||
self.error_message = gtk.Label('Failed to load tweet(s)')
|
self.message = gtk.Label('Loading...')
|
||||||
|
|
||||||
# These handle determining which tweets are unread
|
# These handle determining which tweets are unread
|
||||||
self.last_tweet_read = None
|
self.last_tweet_read = None
|
||||||
|
@ -54,7 +54,7 @@ class TweetPane(gtk.ScrolledWindow):
|
||||||
viewport = gtk.Viewport()
|
viewport = gtk.Viewport()
|
||||||
|
|
||||||
# Build us some labels...
|
# Build us some labels...
|
||||||
tweet_box.pack_start(self.error_message)
|
tweet_box.pack_start(self.message)
|
||||||
|
|
||||||
for i in range(0, self.num_entries):
|
for i in range(0, self.num_entries):
|
||||||
self.tweets.append(TweetBox())
|
self.tweets.append(TweetBox())
|
||||||
|
@ -77,16 +77,19 @@ class TweetPane(gtk.ScrolledWindow):
|
||||||
self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
self.error_message.hide()
|
|
||||||
for tweet in self.tweets:
|
for tweet in self.tweets:
|
||||||
tweet.hide()
|
tweet.hide()
|
||||||
|
|
||||||
|
|
||||||
def update_window(self, statuses):
|
def update_window(self, statuses):
|
||||||
if statuses is None:
|
if statuses is None:
|
||||||
self.error_message.show()
|
self.message.set_label('An error occurred while fetching data')
|
||||||
|
self.message.show()
|
||||||
for i in range(0, self.num_entries):
|
for i in range(0, self.num_entries):
|
||||||
self.tweets[i].hide()
|
self.tweets[i].hide()
|
||||||
|
return
|
||||||
|
|
||||||
|
self.message.hide()
|
||||||
|
|
||||||
if self.updated_once is False:
|
if self.updated_once is False:
|
||||||
self.updated_once = True
|
self.updated_once = True
|
||||||
|
@ -113,6 +116,9 @@ class TweetPane(gtk.ScrolledWindow):
|
||||||
self.tweets[i].clear_status()
|
self.tweets[i].clear_status()
|
||||||
self.tweets[i].hide()
|
self.tweets[i].hide()
|
||||||
|
|
||||||
|
if len(statuses) == 0:
|
||||||
|
self.message.set_label('There is no data to display')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.latest_tweet = statuses[0].id
|
self.latest_tweet = statuses[0].id
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
|
Reference in New Issue
Block a user