Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2013-03-30 12:06:19 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2013-03-30 12:06:19 (GMT)
commit0a0bddd5ef26b7819ab0b4f4b8f80bcd9724904d (patch)
treef9d1d4403191e35890f893a316078af5fb962129
parente763b4dccec41c21e5c37e167fc082e38eaf6d3b (diff)
add download system
-rw-r--r--canvas.py26
-rw-r--r--utils.py7
2 files changed, 17 insertions, 16 deletions
diff --git a/canvas.py b/canvas.py
index dfaf200..70d3919 100644
--- a/canvas.py
+++ b/canvas.py
@@ -47,13 +47,14 @@ color = XoColor(client.get_string('/desktop/sugar/user/color'))
def _gen_activity(_id, parent):
_id = _id
_activity_props = parent._list[_id]
- text1 = "<b>Description: </b>%s" % _activity_props[3]
- text2 = "<b>Version: </b>%s" % _activity_props[4]
- text3 = "<b>Works with: </b>%s" % (_activity_props[5] + ' - ' +\
+ bold = '<b>%s </b>'
+ text1 = bold % _("Description:") + _activity_props[3]
+ text2 = bold % _("Version:") + _activity_props[4]
+ text3 = bold % _("Works with:") + (_activity_props[5] + ' - ' +\
_activity_props[6])
- text4 = "<b>Updated: </b>%s" % _activity_props[7]
- text5 = "<b>Downloads: </b>%s" % _activity_props[8]
- text6 = "<b>Homepage: </b>%s" % _activity_props[9]
+ text4 = bold % _("Updated:") + _activity_props[7]
+ text5 = bold % _("Downloads:") + _activity_props[8]
+ text6 = bold % _("Homepage:") + _activity_props[9]
text = text1 + "\n" + text2 + "\n" + text3 + "\n" + text4 + "\n" +\
text5 + "\n" + text6
@@ -87,13 +88,11 @@ class Canvas(gtk.Notebook):
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport(eventbox)
-
self.append_page(scroll)
# Download List
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
-
scroll.add_with_viewport(self.gtk_list.download_list)
self.append_page(scroll)
@@ -170,17 +169,17 @@ class List(gtk.TreeView):
self.current -= 1
def _download(self, widget, row, col):
- # FIXME: Traduction to english please.
model = widget.get_model()
name = str(model[row][1]).replace("<b>", "").replace("</b>", "")
- _logger.debug("Started download of activity:" + name)
+ _logger.debug(_("Started download of activity: %s") % name)
self._alert = NotifyAlert()
- self._alert.props.msg = _("La actividad %s comenzo a descargarse") %\
- name
- self._alert.props.title = _("Descarga comenzada")
+ self._alert.props.msg = _("The activity %s begins to download") % name
+ self._alert.props.title = _("Download begins")
self._activity.add_alert(self._alert)
self._alert.connect('response', lambda x,
i: self._activity.remove_alert(x))
+ # add to download
+ self.download_list.add_download(name)
return True
def stop_search(self, *args):
@@ -265,3 +264,4 @@ class DownloadList(gtk.TreeView):
if progress == 200:
self._model[_id][1] = _("Installed!")
+
diff --git a/utils.py b/utils.py
index bfa60a0..60a5647 100644
--- a/utils.py
+++ b/utils.py
@@ -139,12 +139,12 @@ def download_activity(_id, progress_function):
xo = name + '-' + version + '.xo'
file_path = os.path.join(activity.get_activity_root(), "data", xo)
- _logger.info("Downloading activity (%s)")
+ _logger.info(_("Downloading activity (%s)") % name)
urllib.urlretrieve(web,
file_path,
reporthook=progress_changed)
- _logger.info("Installing activity (%s)")
+ _logger.info(_("Installing activity (%s)") % name)
install_activity(file_path, progress_function)
@@ -163,4 +163,5 @@ def install_activity(xofile, progress_function):
# Show "Installed..." message
progress_function(200)
- _logger.info("Activity installed! (%s)")
+ _logger.info(_("Activity installed!"))
+