From 2cc1edcf70d67716ce8fae94e2807dff3bbd5a89 Mon Sep 17 00:00:00 2001 From: Pootle User Date: Fri, 21 Dec 2007 06:17:52 +0000 Subject: Merge branch 'update-1' of git+ssh://dev.laptop.org/git/web-activity into update-1 --- diff --git a/NEWS b/NEWS index aa3649f..0bb57fc 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +81 + +* Use the new show_object_in_journal API of the base activity class + to show a downladed object or the view source one in the journal + #4909 (cscott) + 80 * Update the progress of downloads less often #5449 (tomeu) diff --git a/activity/activity.info b/activity/activity.info index 7c89f26..ea7587b 100755 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = Browse -activity_version = 80 +activity_version = 81 service_name = org.laptop.WebActivity icon = activity-web exec = sugar-activity webactivity.WebActivity -s diff --git a/browser.py b/browser.py index 4b023bd..ab972e7 100644 --- a/browser.py +++ b/browser.py @@ -141,6 +141,7 @@ class Browser(WebView): def _internal_save_cb(self): logging.debug("Saved source object to datastore.") + activity.show_object_in_journal(self._jobject.object_id) self._cleanup_jobject() def _internal_save_error_cb(self, err): diff --git a/downloadmanager.py b/downloadmanager.py index 7b1af9c..5d4a80d 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -16,7 +16,6 @@ import os import logging -import tempfile from gettext import gettext as _ import time import gtk @@ -30,9 +29,9 @@ import dbus from sugar.datastore import datastore from sugar import profile from sugar import mime -from sugar.graphics.alert import NotifyAlert, TimeoutAlert -from sugar.graphics import style +from sugar.graphics.alert import Alert, TimeoutAlert from sugar.graphics.icon import Icon +from sugar.activity import activity # #3903 - this constant can be removed and assumed to be 1 when dbus-python # 0.82.3 is the only version used @@ -52,6 +51,7 @@ _MIN_TIME_UPDATE = 5 # In seconds _MIN_PERCENT_UPDATE = 10 _browser = None +_activity = None _temp_path = '/tmp' def init(browser, activity, temp_path): global _browser @@ -150,17 +150,21 @@ class Download: if NS_FAILED(status): # download cancelled return - self._stop_alert = NotifyAlert(9) - self._stop_alert.props.title = _('Download completed') - path, file_name = os.path.split(self._target_file.path) - self._stop_alert.props.msg = _('%s'%(file_name)) - _activity.add_alert(self._stop_alert) + self._stop_alert = Alert() + self._stop_alert.props.title = _('Download completed') + path, file_name = os.path.split(self._target_file.path) + self._stop_alert.props.msg = _('%s'%(file_name)) + open_icon = Icon(icon_name='zoom-activity') + self._stop_alert.add_button(gtk.RESPONSE_APPLY, _('Open'), open_icon) + open_icon.show() + ok_icon = Icon(icon_name='dialog-ok') + self._stop_alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon) + ok_icon.show() + _activity.add_alert(self._stop_alert) self._stop_alert.connect('response', self.__stop_response_cb) self._stop_alert.show() - path, file_name = os.path.split(self._target_file.path) - - self._dl_jobject.metadata['title'] = _('File %s downloaded from\n%s.') % \ + self._dl_jobject.metadata['title'] = _('File %s from %s.') % \ (file_name, self._source.spec) self._dl_jobject.metadata['progress'] = '100' self._dl_jobject.file_path = self._target_file.path @@ -193,6 +197,10 @@ class Download: _activity.remove_alert(alert) def __stop_response_cb(self, alert, response_id): + global _active_downloads + if response_id is gtk.RESPONSE_APPLY: + logging.debug('Start application with downloaded object') + activity.show_object_in_journal(self._object_id) _activity.remove_alert(alert) def _cleanup_datastore_write(self): -- cgit v0.9.1