diff options
author | James Simmons <jim@simmons.olpc> | 2010-03-14 23:58:53 (GMT) |
---|---|---|
committer | James Simmons <jim@simmons.olpc> | 2010-03-14 23:58:53 (GMT) |
commit | 2d686d52766e5e163f1765238e28e2d1ff5a6570 (patch) | |
tree | ffc28c8402e527c963b4e38cc826183c7b89a417 | |
parent | 9600641539fcbddfae887a91b6e0ef997703a001 (diff) |
Correct new toolbar, do not create Journal entry
-rwxr-xr-x | GetIABooksActivity.py | 22 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | activity/activity.info | 2 | ||||
-rw-r--r-- | mybutton.py | 52 |
4 files changed, 8 insertions, 69 deletions
diff --git a/GetIABooksActivity.py b/GetIABooksActivity.py index 140b738..6bf228e 100755 --- a/GetIABooksActivity.py +++ b/GetIABooksActivity.py @@ -17,25 +17,19 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import os import logging -import tempfile import time -import pygtk import gtk -import string import csv import urllib _NEW_TOOLBAR_SUPPORT = True try: from sugar.graphics.toolbarbox import ToolbarBox - from sugar.graphics.toolbarbox import ToolbarButton from sugar.activity.widgets import StopButton - from mybutton import MyActivityToolbarButton except: _NEW_TOOLBAR_SUPPORT = False from sugar.graphics.toolbutton import ToolButton -from sugar.graphics.menuitem import MenuItem from sugar.graphics.toolcombobox import ToolComboBox from sugar.graphics.combobox import ComboBox from sugar import profile @@ -44,8 +38,6 @@ from sugar import network from sugar.datastore import datastore from sugar.graphics.alert import NotifyAlert from gettext import gettext as _ -import pango -import dbus import gobject _TOOLBAR_BOOKS = 1 @@ -146,9 +138,9 @@ class ReadURLDownloader(network.GlibURLDownloader): READ_STREAM_SERVICE = 'read-activity-http' class GetIABooksActivity(activity.Activity): - def __init__(self, handle): + def __init__(self, handle, create_jobject=True): "The entry point to the Activity" - activity.Activity.__init__(self, handle) + activity.Activity.__init__(self, handle, False) if _NEW_TOOLBAR_SUPPORT: self.create_new_toolbar() @@ -228,6 +220,10 @@ class GetIABooksActivity(activity.Activity): self.list_scroller.show() self.progressbar.hide() + def close(self, skip_save=False): + "Override the close method so we don't try to create a Journal entry." + activity.Activity.close(self, True) + def create_old_toolbar(self): toolbox = activity.ActivityToolbox(self) activity_toolbar = toolbox.get_activity_toolbar() @@ -247,10 +243,6 @@ class GetIABooksActivity(activity.Activity): def create_new_toolbar(self): toolbar_box = ToolbarBox() - activity_button = MyActivityToolbarButton(self) - toolbar_box.toolbar.insert(activity_button, 0) - activity_button.show() - book_search_item = gtk.ToolItem() self.search_entry = gtk.Entry() @@ -435,7 +427,7 @@ class GetIABooksActivity(activity.Activity): reader.next() # skip the first header row. for row in reader: if len(row) < 9: - _alert("Server Error", self.search_url) + self._alert("Server Error", self.search_url) return iter = self.ls.append() self.ls.set(iter, 0, row[0], 1, row[1], 2, row[2], 3, row[3], 4, row[4], 5, row[5], \ @@ -4,7 +4,6 @@ setup.py activity/get-ia-books.svg activity/activity.info po/GetIABooks.pot -mybutton.py locale/bg/activity.linfo locale/bg/LC_MESSAGES/org.laptop.sugar.GetIABooksActivity.mo locale/gu/activity.linfo diff --git a/activity/activity.info b/activity/activity.info index d117b15..8301d4c 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -4,5 +4,5 @@ service_name = org.laptop.sugar.GetIABooksActivity icon = get-ia-books exec = sugar-activity GetIABooksActivity.GetIABooksActivity show_launcher = yes -activity_version = 4 +activity_version = 5 license = GPLv2+ diff --git a/mybutton.py b/mybutton.py deleted file mode 100644 index 38a7acb..0000000 --- a/mybutton.py +++ /dev/null @@ -1,52 +0,0 @@ -# mybutton.py A version of ActivityToolbarButton that hides the "Keep" -# button. - -# Copyright (C) 2010 James D. Simmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US -import gtk -import gconf - -from sugar.graphics.toolbarbox import ToolbarButton -from sugar.activity.widgets import ActivityToolbar -from sugar.graphics.xocolor import XoColor -from sugar.graphics.icon import Icon -from sugar.bundle.activitybundle import ActivityBundle - -def _create_activity_icon(metadata): - if metadata.get('icon-color', ''): - color = XoColor(metadata['icon-color']) - else: - client = gconf.client_get_default() - color = XoColor(client.get_string('/desktop/sugar/user/color')) - - from sugar.activity.activity import get_bundle_path - bundle = ActivityBundle(get_bundle_path()) - icon = Icon(file=bundle.get_icon(), xo_color=color) - - return icon - -class MyActivityToolbarButton(ToolbarButton): - - def __init__(self, activity, **kwargs): - toolbar = ActivityToolbar(activity, orientation_left=True) - toolbar.stop.hide() - toolbar.keep.hide() - - ToolbarButton.__init__(self, page=toolbar, **kwargs) - - icon = _create_activity_icon(activity.metadata) - self.set_icon_widget(icon) - icon.show() |