Permalink
Browse files

moved display code to a seperate module

  • Loading branch information...
Hilary Mason
Hilary Mason committed Aug 16, 2010
1 parent 1b79506 commit d3ab5e5248256702a1e92665c32a5de91335b660
Showing with 24 additions and 2 deletions.
  1. +2 −1 blacklist
  2. +22 −1 lib/display.py
  3. BIN lib/display.pyc
View
@@ -1 +1,2 @@
-.sxsw
+.sxsw
+#clfbc
View
@@ -1,3 +1,8 @@
+import sys, os
+
+sys.path.append('..')
+import settings
+
class Display(object):
HEADER = '\033[95m'
OKBLUE = '\033[94m'
@@ -10,4 +15,20 @@ class Display(object):
BOLD_ON = '\033[1m'
BOLD_OFF = '\033[22m'
- MAX_TWITTER_USERNAME_LENGTH = 15
+ MAX_TWITTER_USERNAME_LENGTH = 15
+
+ def display_tweets(self, tweets):
+
+ for t in tweets:
+ if t['_display']:
+ spacer = ' '.join(['' for i in range((self.MAX_TWITTER_USERNAME_LENGTH + 2) - len(t['user']))])
+ if settings.TWITTER_USERNAME in t['text']: # highlight replies
+ t['text'] = self.BOLD_ON + t['text'] + self.BOLD_OFF
+ tweet_text = self.OKGREEN + t['user'] + self.ENDC + spacer + t['text']
+ if t.get('_display_topics', None): # print with topics
+ print tweet_text + ' ' + self.OKBLUE + ' '.join(t['_display_topics']) + self.ENDC
+ if t.get('_datetime', None): # print with date/time
+ print tweet_text + ' ' + self.OKBLUE + t['_datetime'] + self.ENDC
+ else: # print without topics
+ print tweet_text
+
View
Binary file not shown.

0 comments on commit d3ab5e5

Please sign in to comment.