Ejemplo n.º 1
0
 def read_theme(self, name, theme_file):
     with open(theme_file, 'rb') as f:
         lines = [e.strip() for e in f if not e.strip().startswith('#')]
         try:
             theme_data = UNSET_STRING.join(lines).replace('\'', '"')
             self.color_themes[name] = json.loads(theme_data)
             
             if not 'title_en' in self.color_themes[name]:
                 del self.color_themes[name]
         
         except (TypeError, ValueError):
             log_error('Invalid theme description for "%s"' % name)
Ejemplo n.º 2
0
 def multi_border(self, mode):
     base_color = self.get_style().bg[gtk.STATE_NORMAL]
     if not mode:
         self.multi_container.modify_bg(gtk.STATE_NORMAL, base_color)
         return False
     
     # Crazy color blending!
     col1 = base_color.to_string()[1:]
     col2 = self.tweet.get_style().dark[gtk.STATE_NORMAL].to_string()[1:]
     col1 = (col1[0:4], col1[4:8], col1[8:12])
     col2 = (col2[0:4], col2[4:8], col2[8:12])
     col3 = [0, 0, 0]
     
     # Aplhablend the two colors since there is no way to get the lighter
     # border color of the scrollbar
     for i in xrange(3):
         col3[i] = int(int((1 - 0.5) * int(col2[i], 16) \
                                       + 0.5 * int(col1[i], 16)))
     
     col = '#' + UNSET_STRING.join([hex(i)[2:] for i in col3])
     self.multi_container.modify_bg(gtk.STATE_NORMAL,
                                    gtk.gdk.color_parse(col))
Ejemplo n.º 3
0
def filter_chars(text, chars):
    return UNSET_STRING.join([i for i in text if i in chars])
Ejemplo n.º 4
0
def escape(text):
    return UNSET_STRING.join(ENTITIES.get(c, c) for c in text)