add "font_size" conf param
This commit is contained in:
parent
13c1443b02
commit
546de0c965
16
Window.py
16
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(
|
||||
('<span font_weight="bold" font_size="%d">%d</span>'
|
||||
% (1024 * self.conf['font_size'], self.count)))
|
||||
|
||||
def destroy_event(self):
|
||||
self.disconnect()
|
||||
self.update_conf()
|
||||
|
Loading…
x
Reference in New Issue
Block a user