Made some bug fixes related to unassigned variables

This commit is contained in:
Anna 2010-05-23 11:50:14 -04:00
parent c2fd23b335
commit 964358c1f2
3 changed files with 21 additions and 12 deletions

5
TODO
View File

@ -15,9 +15,8 @@ features:
bugs:
* Direct Messages have no names, only screen names (may not be fixable without
considerable tweaks to python-twitter)
* Searches and Direct Messages have no names, only screen names (may not be fixable without considerable tweaks to python-twitter?)
* Search results have html-escaped character strings
* "ValueError: list.remove(x): x not in list" when trying to close a tab (error recurred after adding conversation support). Tabs can be reordered, then closed, as a workaround.
* Links must be right-clicked on to activate - can't left-click on the link directly. This seems to be a pygtk issue
* If an @ appears anywhere in a status update, links after it try to resolve to user: links... need to work on my regexes
* "/home/user/code/hrafn/apithreads.py", line 241: UnboundLocalError: local variable 'user' referenced before assignment

View File

@ -235,11 +235,11 @@ class GetUserInfo(ApiThread):
try:
with self.api.lock:
user = self.api.GetUser(screen_name)
avcache.add_to_cache(user)
except (HTTPError, URLError):
verified = False
user = None
avcache.add_to_cache(user)
gtk.gdk.threads_enter()
try:
self.pane.user_box.update_info(user)
@ -417,7 +417,7 @@ def results_to_statuses(results, api):
status.id = result.id
status.user = User()
status.user.screen_name = result.from_user
status.user.name = ""
status.user.name = ''
status.user.profile.image_url = result.profile_image_url
status.in_reply_to_screen_name = result.to_user
# The Twitter Search API has different timestamps than the
@ -461,6 +461,8 @@ def dms_to_statuses(direct_messages):
status.created_at = dm.created_at
status.text = dm.text
status.source = None
status.in_reply_to_status_id = None
status.in_reply_to_screen_name = None
statuses.append(status)
return statuses

View File

@ -285,9 +285,9 @@ class TweetBox(gtk.HBox):
app_button_eb = gtk.EventBox()
app_button_eb.add(self.app_button)
via_label = gtk.Label(' via ')
self.via_label = gtk.Label(' via ')
via_label_eb = gtk.EventBox()
via_label_eb.add(via_label)
via_label_eb.add(self.via_label)
self.header = gtk.Button()
label_box = gtk.HBox()
@ -307,7 +307,7 @@ class TweetBox(gtk.HBox):
time_label_eb.modify_text(gtk.STATE_NORMAL,gtk.gdk.color_parse("#ffffff"))
time_label_eb.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse("#8888ff"))
via_label.set_alignment(0.0, 0.5)
self.via_label.set_alignment(0.0, 0.5)
via_label_eb.modify_text(gtk.STATE_NORMAL,gtk.gdk.color_parse("#ffffff"))
via_label_eb.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse("#8888ff"))
@ -402,9 +402,17 @@ class TweetBox(gtk.HBox):
timestring = timestamp.astimezone(timezone).strftime(time_format)
# Set the header
self.app_url = re.sub(r'.*<a href=\"(.*?)\".*', r'\1', status.source)
app_name = re.sub(r'.*<a.*?>(.*)</a>.*', r'\1', status.source)
self.app_button.set_label(app_name)
if status.source is not None:
self.app_url = re.sub(r'.*<a href=\"(.*?)\".*', r'\1', status.source)
app_name = re.sub(r'.*<a.*?>(.*)</a>.*', r'\1', status.source)
self.app_button.set_label(app_name)
self.app_button.show()
self.via_label.show()
else:
self.app_button.hide()
self.via_label.hide()
self.app_url = ''
if re.match('/', self.app_url):
self.app_url = 'http://twitter.com' + self.app_url