bigboard r7341 - in trunk/bigboard: . stocks/mail
- From: marinaz svn gnome org
- To: svn-commits-list gnome org
- Subject: bigboard r7341 - in trunk/bigboard: . stocks/mail
- Date: Tue, 20 May 2008 02:19:31 +0000 (UTC)
Author: marinaz
Date: Tue May 20 02:19:30 2008
New Revision: 7341
URL: http://svn.gnome.org/viewvc/bigboard?rev=7341&view=rev
Log:
Display inbox unread count next to the account name.
Display folder unread count next to the folder name.
Ellipsize the account and folder names to fit the counts.
Add up and down arrows to allow collapsing and expending the section of the Mail stock that corresponds to one account.
Add a right arrow on the same line as the folder name to make it more clear that a slideout will appear if you click on that line.
Make clicking on the account name open that Google Mail account in the browser.
Modified:
trunk/bigboard/big_widgets.py
trunk/bigboard/google.py
trunk/bigboard/stocks/mail/MailStock.py
Modified: trunk/bigboard/big_widgets.py
==============================================================================
--- trunk/bigboard/big_widgets.py (original)
+++ trunk/bigboard/big_widgets.py Tue May 20 02:19:30 2008
@@ -190,17 +190,18 @@
MIN_SIZE = 12
- def __init__(self, arrow_type, **kwargs):
+ def __init__(self, arrow_type, arrow_size = MIN_SIZE, **kwargs):
gobject.GObject.__init__(self, **kwargs)
self.__arrow_type = arrow_type
+ self.__arrow_size = arrow_size
self.set_clickable(True)
def do_get_content_width_request(self):
- return (self.MIN_SIZE, self.MIN_SIZE)
+ return (self.__arrow_size, self.__arrow_size)
def do_get_content_height_request(self, for_width):
- return (self.MIN_SIZE, self.MIN_SIZE)
+ return (self.__arrow_size, self.__arrow_size)
def do_paint_below_children(self, cr, dmgbox):
[w, h] = self.get_allocation()
@@ -233,6 +234,9 @@
cr.close_path()
cr.fill()
+ def get_arrow_type(self):
+ return self.__arrow_type
+
class GradientHeader(hippo.CanvasGradient):
def __init__(self, **kwargs):
hippo.CanvasGradient.__init__(self,
Modified: trunk/bigboard/google.py
==============================================================================
--- trunk/bigboard/google.py (original)
+++ trunk/bigboard/google.py Tue May 20 02:19:30 2008
@@ -341,7 +341,7 @@
class CheckGoogleTask(libbig.polling.Task):
def __init__(self, google):
- libbig.polling.Task.__init__(self, 1000 * 20, initial_interval=0) # initial_interval=1000*5
+ libbig.polling.Task.__init__(self, 1000 * 120, initial_interval=0) # initial_interval=1000*5
self.__google = google
self.__actions = {} ## hash from id to [add count, GooglePollAction object]
Modified: trunk/bigboard/stocks/mail/MailStock.py
==============================================================================
--- trunk/bigboard/stocks/mail/MailStock.py (original)
+++ trunk/bigboard/stocks/mail/MailStock.py Tue May 20 02:19:30 2008
@@ -12,9 +12,10 @@
from bigboard.slideout import ThemedSlideout
import bigboard.google as google
import bigboard.google_stock as google_stock
-from bigboard.big_widgets import CanvasHBox, CanvasVBox, Button, Header, PrelightingCanvasBox
+from bigboard.big_widgets import ActionLink, CanvasHBox, CanvasVBox, Button, Header, PrelightingCanvasBox, Arrow
import bigboard.libbig as libbig
from bigboard.libbig.struct import AutoStruct, AutoSignallingStruct
+from bigboard.libbig.logutil import log_except
#TODO: add a scrollable view for emails
#import bigboard.scroll_ribbon as scroll_ribbon
@@ -70,12 +71,17 @@
super(GoogleAccountInfo, self).__init__({ 'google_account' : None, \
'google_account_box' : hippo.CanvasBox(orientation=hippo.ORIENTATION_VERTICAL), \
'current_folder' : 'inbox', \
- 'logged_in_flag' : False })
+ 'logged_in_flag' : False, \
+ 'expand_arrow' : hippo.CanvasImage(yalign=hippo.ALIGNMENT_CENTER, padding=2), \
+ 'expand_arrow_signal_id' : None})
+ self.get_expand_arrow().set_clickable(True)
+ self.get_expand_arrow().set_property('image-name', 'bigboard-up-arrow-enabled')
+
def __str__(self):
if self.get_google_account():
- return "Google Account Username: " + str(self.get_google_account().name) + " Domain: " + str(self.get_google_account().domain) + " Current folder: " + self.get_current_folder() + " Logged in: " + str(self.get_logged_in_flag())
+ return "Google Account Username: " + str(self.get_google_account().name) + " Domain: " + str(self.get_google_account().domain) + " Current folder: " + self.get_current_folder() + " Logged in: " + str(self.get_logged_in_flag()) + " Arrow state: " + self.get_expand_arrow().get_property("image_name")
else:
- return "Google Account: None Current folder: " + self.get_current_folder() + " Logged in: " + str(self.get_logged_in_flag())
+ return "Google Account: None Current folder: " + self.get_current_folder() + " Logged in: " + str(self.get_logged_in_flag()) + " Arrow state: " + self.get_expand_arrow().get_property("image_name")
class LabelSlideout(ThemedSlideout):
__gsignals__ = {
@@ -190,6 +196,7 @@
def remove_google_data(self, gobj):
if self.__google_accounts.has_key(gobj):
self._box.remove(self.__google_accounts[gobj].get_google_account_box())
+ _logger.debug("will remove key for %s" % gobj.get_account().get_username())
del self.__google_accounts[gobj]
# sometimes we don't even get the self.__google_accounts because the polling task didn't start, so
@@ -202,6 +209,7 @@
self._box.set_child_visible(self.__failed_to_connect_message, False)
self.__google_accounts = {}
+ @log_except(_logger)
def __update_email_box (self, gobj):
_logger.debug("will update mailbox")
username = gobj.get_account().get_username()
@@ -213,11 +221,13 @@
if not self.__google_accounts.has_key(gobj):
self.__google_accounts[gobj] = GoogleAccountInfo()
self._box.append(self.__google_accounts[gobj].get_google_account_box())
-
+
google_account = self.__google_accounts[gobj].get_google_account()
google_account_box = self.__google_accounts[gobj].get_google_account_box()
current_folder = self.__google_accounts[gobj].get_current_folder()
logged_in_flag = self.__google_accounts[gobj].get_logged_in_flag()
+ expand_arrow = self.__google_accounts[gobj].get_expand_arrow()
+ expand_arrow_signal_id = self.__google_accounts[gobj].get_expand_arrow_signal_id()
try:
if password == '':
@@ -239,6 +249,7 @@
# this is how we know there was a login problem with GAFYD accounts
if not labelsDict:
raise libgmail.GmailLoginFailure, 'Failed to login to Google.'
+ labelsDict["unread"] = google_account.getUnreadMsgCount()
logged_in_flag = True
self._box.set_child_visible(self.__failed_to_connect_message, False)
@@ -253,14 +264,41 @@
_logger.debug("done getting threads")
google_account_box.remove_all()
- account = hippo.CanvasText(classes='header', text=gobj.get_account().get_username_as_google_email())
+ account = CanvasHBox(xalign=hippo.ALIGNMENT_START)
+
+ account_name = ActionLink(text=gobj.get_account().get_username_as_google_email(), size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END, font="14px")
+ account_name.connect("activated", self.__on_visit_mail_account, gobj)
+ unread_message_count = ActionLink(text=" (%s)" % labelsDict['inbox'], font="14px", xalign=hippo.ALIGNMENT_START)
+ unread_message_count.connect("activated", self.__on_visit_mail_account, gobj)
+ # connecting to this signal once per GoogleAccountInfo did not work in all cases, and connecting multiple
+ # times means that the function would be called multiple times, so we need to keep the expand_arrow_signal_id
+ # to use it for disconnecting, and then connect again each time
+ if expand_arrow_signal_id:
+ expand_arrow.disconnect(expand_arrow_signal_id)
+ expand_arrow_signal_id = None
+ expand_arrow_signal_id = expand_arrow.connect("activated", self.__on_expand_arrow_clicked, gobj)
+ account.append(expand_arrow)
+ account.append(account_name)
+ account.append(unread_message_count)
google_account_box.append(account)
+ details_box = CanvasVBox()
+
box = PrelightingCanvasBox()
box.connect("button-press-event", self.create_label_slideout, gobj)
- google_account_box.append(box)
- label = hippo.CanvasText(text=current_folder, font="14px Bold Italic")
- box.append(label)
+ details_box.append(box)
+
+ label_and_arrow = CanvasHBox()
+ label = CanvasHBox(xalign=hippo.ALIGNMENT_CENTER)
+ label_name = ActionLink(text=current_folder, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END, font="12px Italic")
+ unread_message_count_for_label = ActionLink(text=" (%s)" % labelsDict[current_folder], font="12px Italic")
+ arrow = Arrow(Arrow.RIGHT, arrow_size = 8, padding = 2)
+
+ label.append(label_name)
+ label.append(unread_message_count_for_label)
+ label_and_arrow.append(label, hippo.PACK_EXPAND)
+ label_and_arrow.append(arrow, hippo.PACK_END)
+ box.append(label_and_arrow)
i = 0
for thread in threads:
@@ -270,19 +308,22 @@
box = PrelightingCanvasBox()
box.connect("button-press-event", self.create_email_slideout, thread)
- google_account_box.append(box)
+ details_box.append(box)
email = hippo.CanvasText(markup=subject, xalign=hippo.ALIGNMENT_START)
box.append(email)
i += 1
- footer = hippo.CanvasText(classes='footer', text="%s unread" % labelsDict[current_folder], font="14px Bold Italic")
- google_account_box.append(footer)
+ google_account_box.append(details_box)
+ if expand_arrow.get_property('image-name') == 'bigboard-down-arrow-enabled':
+ google_account_box.set_child_visible(details_box, False)
+
print "updated mailbox"
except libgmail.GmailLoginFailure:
self._box.set_child_visible(self.__failed_to_connect_message, False)
google_account_box.remove_all()
- account = hippo.CanvasText(classes='header', text=gobj.get_account().get_username_as_google_email())
+ account = ActionLink(text=gobj.get_account().get_username_as_google_email(), xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END, font="14px")
+ account.connect("activated", self.__on_visit_mail_account, gobj)
google_account_box.append(account)
logged_in_flag = False
@@ -292,12 +333,13 @@
except urllib2.URLError:
if not logged_in_flag:
google_account_box.remove_all()
- account = hippo.CanvasText(classes='header', text=gobj.get_account().get_username_as_google_email())
+ account = ActionLink(text=gobj.get_account().get_username_as_google_email(), xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END, font="14px")
+ account.connect("activated", self.__on_visit_mail_account, gobj)
google_account_box.append(account)
self._box.set_child_visible(self.__failed_to_connect_message, True)
- self.__google_accounts[gobj].update({'google_account' : google_account, 'google_account_box' : google_account_box, 'current_folder' : current_folder, 'logged_in_flag' : logged_in_flag})
+ self.__google_accounts[gobj].update({'google_account' : google_account, 'google_account_box' : google_account_box, 'current_folder' : current_folder, 'logged_in_flag' : logged_in_flag, 'expand_arrow_signal_id' : expand_arrow_signal_id})
# set self.__last_login_gobj out here even if the login was unsuccessful, because that still has a way in
# which it can affect things
@@ -359,6 +401,18 @@
self.__google_accounts[gobj].update({'current_folder' : label})
self.__update_email_box(gobj)
+ def __on_expand_arrow_clicked(self, widget, gobj):
+ _logger.debug("arrow clicked image_name: %s" % self.__google_accounts[gobj].get_expand_arrow().get_property('image-name'))
+ google_account_box = self.__google_accounts[gobj].get_google_account_box()
+
+ if self.__google_accounts[gobj].get_logged_in_flag():
+ if self.__google_accounts[gobj].get_expand_arrow().get_property('image-name') == 'bigboard-down-arrow-enabled':
+ self.__google_accounts[gobj].get_expand_arrow().set_property('image-name', 'bigboard-up-arrow-enabled')
+ google_account_box.set_child_visible(google_account_box.get_children()[-1], True)
+ elif self.__google_accounts[gobj].get_expand_arrow().get_property('image-name') == 'bigboard-up-arrow-enabled':
+ self.__google_accounts[gobj].get_expand_arrow().set_property('image-name', 'bigboard-down-arrow-enabled')
+ google_account_box.set_child_visible(google_account_box.get_children()[-1], False)
+
# TODO: move generic code to google_stock.py
def __on_more_button(self):
done_with_sleep_state = 0
@@ -373,3 +427,7 @@
libbig.show_url(create_account_url(google_account.get_account().get_username_as_google_email()))
if done_with_sleep_state == 0:
done_with_sleep_state = 1
+
+ def __on_visit_mail_account(self, widget, gobj):
+ libbig.show_url(create_account_url(gobj.get_account().get_username_as_google_email()))
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]