New tweets get a different background color... need a better way to determine when they are no longer new, though

This commit is contained in:
Anna 2010-04-11 21:07:37 -04:00
parent c0b1f5b85d
commit 1167e3e910

View File

@ -91,10 +91,12 @@ class MyTwitter():
num_new_tweets = 0 num_new_tweets = 0
for i in range(0, self.num_entries): for i in range(0, self.num_entries):
read = True
if i < len(statuses): if i < len(statuses):
if statuses[i].id > self.latest_tweet: if statuses[i].id > self.latest_tweet:
num_new_tweets += 1 num_new_tweets += 1
self.tweets[i].set_status(statuses[i]) read = False
self.tweets[i].set_status(statuses[i], read)
else: else:
self.tweets[i].clear_status() self.tweets[i].clear_status()
@ -195,7 +197,9 @@ class TweetBox(gtk.VBox):
self.text = gtk.Label() self.text = gtk.Label()
text_align = gtk.Alignment() text_align = gtk.Alignment()
text_align.add(self.text) text_align.add(self.text)
self.pack_start(text_align) self.text_eb = gtk.EventBox()
self.text_eb.add(text_align)
self.pack_start(self.text_eb)
# Set the text's properties # Set the text's properties
text_align.set_padding(2, 10, 3, 0) text_align.set_padding(2, 10, 3, 0)
@ -216,7 +220,9 @@ class TweetBox(gtk.VBox):
retweet_button.connect("clicked", self.on_retweet_clicked) retweet_button.connect("clicked", self.on_retweet_clicked)
def set_status(self, status): def set_status(self, status, read=True):
self.set_read(read)
timezone = dateutil.tz.gettz() timezone = dateutil.tz.gettz()
time_format = "%Y.%m.%d %H:%M:%S %Z" time_format = "%Y.%m.%d %H:%M:%S %Z"
@ -248,6 +254,16 @@ class TweetBox(gtk.VBox):
self.text.set_markup('') self.text.set_markup('')
self.screen_name = None self.screen_name = None
self.id = None self.id = None
self.set_read(True)
def set_read(self, read=True):
if read:
self.text_eb.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse("#ffffff"))
else:
self.text_eb.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse("#ddffdd"))
def on_reply_clicked(self, widget): def on_reply_clicked(self, widget):