Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Collazo <scollazo@activitycentral.com>2013-02-13 14:40:30 (GMT)
committer Santiago Collazo <scollazo@activitycentral.com>2013-02-13 14:40:30 (GMT)
commit8109efdf51cb0143eddfe5d5bd1bd3bbf8720001 (patch)
tree6c368c5b7f8e766c410227af10b288bbd8d7ecc8
parent58246d53c02be812613e1f42c9915137eefbc8e0 (diff)
parent170d3e264e645b612788b9b2e48d1f416d692f57 (diff)
Merge remote-tracking branch 'ajay/0.97.7-as-base' into devel
-rw-r--r--po/hy.po52
-rw-r--r--src/sugar3/graphics/Makefile.am1
-rw-r--r--src/sugar3/graphics/progressicon.py101
-rw-r--r--tests/graphics/progressicon.py66
4 files changed, 194 insertions, 26 deletions
diff --git a/po/hy.po b/po/hy.po
index 39f3031..02fea78 100644
--- a/po/hy.po
+++ b/po/hy.po
@@ -6,9 +6,9 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-06-02 00:32-0400\n"
-"PO-Revision-Date: 2012-06-18 06:04+0200\n"
-"Last-Translator: Chris <cjl@laptop.org>\n"
+"POT-Creation-Date: 2013-01-20 21:07-0500\n"
+"PO-Revision-Date: 2013-02-01 10:36+0200\n"
+"Last-Translator: Jasmine <udea_jasmine@yahoo.com>\n"
"Language-Team: Sugar Labs\n"
"Language: hy\n"
"MIME-Version: 1.0\n"
@@ -17,56 +17,56 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Pootle 2.0.5\n"
-#: ../src/sugar3/activity/activity.py:378
+#: ../src/sugar3/activity/activity.py:376
#, python-format
msgid "%s Activity"
msgstr "%s Գործունեություն"
-#: ../src/sugar3/activity/activity.py:874
+#: ../src/sugar3/activity/activity.py:873
msgid "Keep error"
msgstr "Պահման ձախողում"
-#: ../src/sugar3/activity/activity.py:875
+#: ../src/sugar3/activity/activity.py:874
msgid "Keep error: all changes will be lost"
msgstr "Պահման ձախողում. բոլոր փոփոխությունները կկորչեն"
-#: ../src/sugar3/activity/activity.py:878
+#: ../src/sugar3/activity/activity.py:877
msgid "Don't stop"
msgstr "Կանգ չառնել"
-#: ../src/sugar3/activity/activity.py:881
+#: ../src/sugar3/activity/activity.py:880
msgid "Stop anyway"
msgstr "Կանգ առնել ամեն դեպքում"
-#: ../src/sugar3/activity/widgets.py:86
+#: ../src/sugar3/activity/widgets.py:89
msgid "Stop"
msgstr "Կանգ"
-#: ../src/sugar3/activity/widgets.py:98
+#: ../src/sugar3/activity/widgets.py:101
msgid "Undo"
msgstr "Ետարկել"
-#: ../src/sugar3/activity/widgets.py:106
+#: ../src/sugar3/activity/widgets.py:109
msgid "Redo"
-msgstr "Կրկնել"
+msgstr "Վերականգնել"
-#: ../src/sugar3/activity/widgets.py:113
+#: ../src/sugar3/activity/widgets.py:116
msgid "Copy"
msgstr "Պատճենել"
-#: ../src/sugar3/activity/widgets.py:121
+#: ../src/sugar3/activity/widgets.py:124
msgid "Paste"
-msgstr "փակցնել"
+msgstr "Փակցնել"
-#: ../src/sugar3/activity/widgets.py:132
+#: ../src/sugar3/activity/widgets.py:135
msgid "Private"
msgstr "Անձնական"
-#: ../src/sugar3/activity/widgets.py:139
+#: ../src/sugar3/activity/widgets.py:142
msgid "My Neighborhood"
msgstr "Իմ հարևանությունը"
-#: ../src/sugar3/activity/widgets.py:226
+#: ../src/sugar3/activity/widgets.py:235
msgid "Description"
msgstr "Նկարագրություն"
@@ -87,15 +87,15 @@ msgstr "Շարունակել"
msgid "Choose a color"
msgstr "Ընտրել գույնը"
-#: ../src/sugar3/graphics/colorbutton.py:274
+#: ../src/sugar3/graphics/colorbutton.py:271
msgid "Red"
msgstr "Կարմիր"
-#: ../src/sugar3/graphics/colorbutton.py:276
+#: ../src/sugar3/graphics/colorbutton.py:273
msgid "Green"
msgstr "Կանաչ"
-#: ../src/sugar3/graphics/colorbutton.py:278
+#: ../src/sugar3/graphics/colorbutton.py:275
msgid "Blue"
msgstr "Կապույտ"
@@ -192,22 +192,22 @@ msgstr "%d MB"
msgid "%d GB"
msgstr "%d GB"
-#: ../src/sugar3/mime.py:43
+#: ../src/sugar3/mime.py:54
msgid "Text"
msgstr "Տեքստ"
-#: ../src/sugar3/mime.py:52
+#: ../src/sugar3/mime.py:63
msgid "Image"
msgstr "Պատկեր"
-#: ../src/sugar3/mime.py:58
+#: ../src/sugar3/mime.py:69
msgid "Audio"
msgstr "Աուդիո"
-#: ../src/sugar3/mime.py:66
+#: ../src/sugar3/mime.py:77
msgid "Video"
msgstr "Վիդեո"
-#: ../src/sugar3/mime.py:72
+#: ../src/sugar3/mime.py:89
msgid "Link"
msgstr "Կապ /հղում"
diff --git a/src/sugar3/graphics/Makefile.am b/src/sugar3/graphics/Makefile.am
index a4f9629..344cc82 100644
--- a/src/sugar3/graphics/Makefile.am
+++ b/src/sugar3/graphics/Makefile.am
@@ -6,6 +6,7 @@ sugar_PYTHON = \
combobox.py \
iconentry.py \
icon.py \
+ progressicon.py \
__init__.py \
menuitem.py \
notebook.py \
diff --git a/src/sugar3/graphics/progressicon.py b/src/sugar3/graphics/progressicon.py
new file mode 100644
index 0000000..c0ca8a6
--- /dev/null
+++ b/src/sugar3/graphics/progressicon.py
@@ -0,0 +1,101 @@
+# Copyright (C) 2013, One Laptop Per Child
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+from gi.repository import Gtk
+from sugar3.graphics.icon import get_surface
+from sugar3.graphics import style
+
+
+class ProgressIcon(Gtk.DrawingArea):
+ """Display the progress filling the icon.
+
+ This class is compatible with the sugar3.graphics.icon.Icon class.
+
+ Call update(progress) with the new progress to update the icon.
+
+ The direction defaults to 'vertical', in which case the icon is
+ filled from bottom to top. If direction is set to 'horizontal',
+ it will be filled from right to left or from left to right,
+ depending on the system's language RTL setting.
+
+ """
+ def __init__(self, icon_name, pixel_size, stroke_color, fill_color,
+ direction=None):
+ Gtk.DrawingArea.__init__(self)
+
+ self._icon_name = icon_name
+ if direction == None:
+ direction = 'vertical'
+ self._direction = direction
+ self._progress = 0
+
+ self._stroke = get_surface(
+ icon_name=icon_name, width=pixel_size, height=pixel_size,
+ stroke_color=stroke_color,
+ fill_color=style.COLOR_TRANSPARENT.get_svg())
+
+ self._fill = get_surface(
+ icon_name=icon_name, width=pixel_size, height=pixel_size,
+ stroke_color=style.COLOR_TRANSPARENT.get_svg(),
+ fill_color=fill_color)
+
+ self.connect("draw", self.__draw_cb)
+
+ def __draw_cb(self, widget, cr):
+ allocation = widget.get_allocation()
+
+ # Center the graphic in the allocated space.
+ margin_x = (allocation.width - self._stroke.get_width()) / 2
+ margin_y = (allocation.height - self._stroke.get_height()) / 2
+ cr.translate(margin_x, margin_y)
+
+ # Paint the fill, clipping it by the progress.
+ x_, y_ = 0, 0
+ width, height = self._stroke.get_width(), self._stroke.get_height()
+ if self._direction == 'vertical': # vertical direction, bottom to top
+ y_ = self._stroke.get_height()
+ height *= self._progress * -1
+ else:
+ rtl_direction = \
+ Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL
+ if rtl_direction: # horizontal direction, right to left
+ x_ = self._stroke.get_width()
+ width *= self._progress * -1
+ else: # horizontal direction, left to right
+ width *= self._progress
+
+ cr.rectangle(x_, y_, width, height)
+ cr.clip()
+ cr.set_source_surface(self._fill, 0, 0)
+ cr.paint()
+
+ # Paint the stroke over the fill.
+ cr.reset_clip()
+ cr.set_source_surface(self._stroke, 0, 0)
+ cr.paint()
+
+ def do_get_preferred_width(self):
+ width = self._stroke.get_width()
+ return (width, width)
+
+ def do_get_preferred_height(self):
+ height = self._stroke.get_height()
+ return (height, height)
+
+ def update(self, progress):
+ self._progress = progress
+ self.queue_draw()
diff --git a/tests/graphics/progressicon.py b/tests/graphics/progressicon.py
new file mode 100644
index 0000000..3dbd4b1
--- /dev/null
+++ b/tests/graphics/progressicon.py
@@ -0,0 +1,66 @@
+# Copyright (C) 2013, One Laptop Per Child
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Test the sugar3.graphics.progressicon.ProgressIcon widget.
+"""
+
+
+from gi.repository import GObject
+
+from sugar3.graphics.progressicon import ProgressIcon
+from sugar3.graphics.icon import Icon, get_surface
+from sugar3.graphics import style
+
+import common
+
+test = common.Test()
+test.show()
+
+icon = ProgressIcon(
+ pixel_size=style.LARGE_ICON_SIZE,
+ icon_name='computer-xo',
+ stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
+ fill_color=style.COLOR_WHITE.get_svg())
+test.pack_start(icon, True, True, 0)
+icon.show()
+
+icon2 = ProgressIcon(
+ pixel_size=style.LARGE_ICON_SIZE,
+ icon_name='computer-xo',
+ stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
+ fill_color=style.COLOR_WHITE.get_svg(),
+ direction='horizontal')
+test.pack_start(icon2, True, True, 0)
+icon2.show()
+
+progress = 0
+
+
+def timeout_cb():
+ global progress
+ progress += 0.05
+ icon.update(progress)
+ icon2.update(progress)
+ if progress >= 1:
+ return False
+ return True
+
+GObject.timeout_add(50, timeout_cb)
+
+if __name__ == '__main__':
+ common.main(test)