From 546de0c965119a10081bf3a8e29d18dbf6cf7856 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 7 Jul 2011 14:22:20 -0400 Subject: [PATCH] add "font_size" conf param --- Window.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Window.py b/Window.py index 1f58eb1..f6f2aa5 100755 --- a/Window.py +++ b/Window.py @@ -6,6 +6,7 @@ import imaplib class Window(object): def __init__(self, title, conf): self.conf = conf + self.count = 0 self.connection = None if not 'width' in self.conf: @@ -18,6 +19,8 @@ class Window(object): self.conf['updaterate'] = 5000 if not 'bgcolor' in self.conf: self.conf['bgcolor'] = (1.0, 0.5, 0.0) + if not 'font_size' in self.conf: + self.conf['font_size'] = 18 sticky = True if 'sticky' in self.conf: sticky = self.conf['sticky'] @@ -76,13 +79,20 @@ class Window(object): try: self.connection.select(self.conf['mailbox']) msgs = self.connection.search(None, 'UnSeen')[1][0].split() - count = len(msgs) - self.label.set_text(str(count)) + self.count = len(msgs) except: self.connection = None - self.label.set_text('-') + self.update_count() return self.connection is not None + def update_count(self): + if self.connection is None: + self.label.set_text('-') + else: + self.label.set_markup( + ('%d' + % (1024 * self.conf['font_size'], self.count))) + def destroy_event(self): self.disconnect() self.update_conf()