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):
|
class Window(object):
|
||||||
def __init__(self, title, conf):
|
def __init__(self, title, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
|
self.count = 0
|
||||||
self.connection = None
|
self.connection = None
|
||||||
|
|
||||||
if not 'width' in self.conf:
|
if not 'width' in self.conf:
|
||||||
@ -18,6 +19,8 @@ class Window(object):
|
|||||||
self.conf['updaterate'] = 5000
|
self.conf['updaterate'] = 5000
|
||||||
if not 'bgcolor' in self.conf:
|
if not 'bgcolor' in self.conf:
|
||||||
self.conf['bgcolor'] = (1.0, 0.5, 0.0)
|
self.conf['bgcolor'] = (1.0, 0.5, 0.0)
|
||||||
|
if not 'font_size' in self.conf:
|
||||||
|
self.conf['font_size'] = 18
|
||||||
sticky = True
|
sticky = True
|
||||||
if 'sticky' in self.conf:
|
if 'sticky' in self.conf:
|
||||||
sticky = self.conf['sticky']
|
sticky = self.conf['sticky']
|
||||||
@ -76,13 +79,20 @@ class Window(object):
|
|||||||
try:
|
try:
|
||||||
self.connection.select(self.conf['mailbox'])
|
self.connection.select(self.conf['mailbox'])
|
||||||
msgs = self.connection.search(None, 'UnSeen')[1][0].split()
|
msgs = self.connection.search(None, 'UnSeen')[1][0].split()
|
||||||
count = len(msgs)
|
self.count = len(msgs)
|
||||||
self.label.set_text(str(count))
|
|
||||||
except:
|
except:
|
||||||
self.connection = None
|
self.connection = None
|
||||||
self.label.set_text('-')
|
self.update_count()
|
||||||
return self.connection is not None
|
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):
|
def destroy_event(self):
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
self.update_conf()
|
self.update_conf()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user