Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2011-11-25 14:44:37 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2011-11-25 14:44:37 (GMT)
commitfa00e1b23978ddf78cbf6aeb149f559fbe137a1c (patch)
tree003c64f439b41624367dbd72cc0ac1fd131b6faf
First commit
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
-rw-r--r--.gitignore5
-rw-r--r--activity.py182
-rw-r--r--activity/activity-helloworld.svg26
-rw-r--r--activity/activity.info7
-rw-r--r--setup.py21
5 files changed, 241 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..eccabd9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.pyc
+*.xo
+*~
+*.o
+locale
diff --git a/activity.py b/activity.py
new file mode 100644
index 0000000..878c59a
--- /dev/null
+++ b/activity.py
@@ -0,0 +1,182 @@
+# Copyright 2009 Simon Schampijer
+#
+# 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 USA
+
+
+import gtk
+import gobject
+import logging
+
+from gettext import gettext as _
+
+from sugar.activity import activity
+from sugar.graphics.toolbarbox import ToolbarBox
+from sugar.activity.widgets import ActivityToolbarButton
+from sugar.activity.widgets import ActivityToolbox
+from sugar.activity.widgets import TitleEntry
+from sugar.activity.widgets import StopButton
+from sugar.activity.widgets import ShareButton
+from sugar.graphics import iconentry
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.toolcombobox import ToolComboBox
+from sugar.graphics.combobox import ComboBox
+from sugar.graphics.menuitem import MenuItem
+
+
+class TestThemeActivity(activity.Activity):
+ """HelloWorldActivity class as specified in activity.info"""
+
+ def __init__(self, handle):
+ """Set up the HelloWorld activity."""
+ activity.Activity.__init__(self, handle)
+
+ # toolbar with the new toolbar redesign
+ toolbar_box = ToolbarBox()
+
+ toolbar = toolbar_box.toolbar
+
+ activity_button = ActivityToolbarButton(self)
+ toolbar.insert(activity_button, 0)
+
+ toolbar.insert(gtk.SeparatorToolItem(), -1)
+
+ tool_item = gtk.ToolItem()
+ icon_entry = iconentry.IconEntry()
+ icon_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
+ 'system-search')
+ icon_entry.add_clear_button()
+ width = int(gtk.gdk.screen_width() / 5)
+ icon_entry.set_size_request(width, -1)
+ tool_item.add(icon_entry)
+ toolbar.insert(tool_item, -1)
+
+ combo = ComboBox()
+ combotool = ToolComboBox(combo)
+ combo.append_item('0', _('First option'))
+ combo.append_item('1', _('Second option'))
+ toolbar.insert(combotool, -1)
+
+ tool_bt = ToolButton('next')
+ tool_bt.set_tooltip(_('ToolButton'))
+ toolbar.insert(tool_bt, -1)
+
+ palette = tool_bt.get_palette()
+ mn1 = MenuItem(text_label=_("First MenuItem"))
+ palette.menu.append(mn1)
+ # NOTE: toolbar.show_all() don't show menu items
+ mn1.show()
+ mn2 = MenuItem(text_label=_("Second MenuItem"))
+ palette.menu.append(mn2)
+ mn2.show()
+
+ toggle_bt = ToggleToolButton('stop')
+ toggle_bt.set_tooltip(_('ToggleToolButton'))
+ toolbar.insert(toggle_bt, -1)
+
+ separator = gtk.SeparatorToolItem()
+ separator.props.draw = False
+ separator.set_expand(True)
+ toolbar_box.toolbar.insert(separator, -1)
+
+ toolbar_box.toolbar.insert(StopButton(self), -1)
+
+ self.set_toolbar_box(toolbar_box)
+ toolbar_box.show_all()
+
+ notebook = gtk.Notebook()
+ hbox = gtk.HBox()
+ notebook.append_page(hbox)
+
+ vbox1 = gtk.VBox()
+
+ hbox.add(vbox1)
+
+ label = gtk.Label(_("Label"))
+ vbox1.pack_start(label, False, False, 5)
+
+ adj = gtk.Adjustment(0, 0, 10, 1, 32, 0)
+ spin = gtk.SpinButton(adj, 0, 0)
+
+ vbox1.pack_start(spin, False, False, 5)
+
+ hb_group = gtk.HBox()
+ item1 = gtk.RadioButton(None, _('RadioBt 1'))
+ item2 = gtk.RadioButton(item1, _('RadioBt 2'))
+ item3 = gtk.RadioButton(item1, _('RadioBt 3'))
+
+ hb_group.pack_start(item1, False, False, 5)
+ hb_group.pack_start(item2, False, False, 5)
+ hb_group.pack_start(item3, False, False, 5)
+
+ vbox1.pack_start(hb_group, False, False, 5)
+
+ checkbutton = gtk.CheckButton(_('CheckButton'))
+ vbox1.pack_start(checkbutton, False, False, 5)
+
+ entry = gtk.Entry()
+ vbox1.pack_start(entry, False, False, 5)
+
+ treev = gtk.TreeView()
+ treev.headers_clickble = True
+ treev.hover_expand = True
+ treev.rules_hint = True
+ treev.set_enable_search(False)
+ treem = gtk.ListStore(gobject.TYPE_STRING)
+ treem.append(['first row'])
+ treem.append(['second row'])
+ treev.set_model(treem)
+ renderer = gtk.CellRendererText()
+ renderer.set_property('wrap-mode', gtk.WRAP_WORD)
+ treecol = gtk.TreeViewColumn(_('Catalogs'), renderer, text=0)
+ treecol.set_property('clickable', True)
+ treev.append_column(treecol)
+ vbox1.pack_start(treev, True, padding=5)
+
+ separa = gtk.VSeparator()
+ hbox.add(separa)
+
+ vscale = gtk.VScale(adj)
+ hbox.add(vscale)
+
+ vbox2 = gtk.VBox()
+ hbox.add(vbox2)
+
+ hscale = gtk.HScale(adj)
+ vbox2.pack_start(hscale, False, False, 5)
+
+ combo2 = ComboBox()
+ combo2.append_item('0', _('First option'))
+ combo2.append_item('1', _('Second option'))
+ vbox2.pack_start(combo2, False, False, 5)
+
+ button = gtk.Button('Button')
+ vbox2.pack_start(button, False, False, 5)
+
+ tbutton = gtk.ToggleButton('ToggleButton')
+ vbox2.pack_start(tbutton, False, False, 5)
+
+ separa_h = gtk.HSeparator()
+ vbox2.pack_start(separa_h, False, False, 5)
+
+ scrollwin = gtk.ScrolledWindow()
+ scrollwin.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS)
+ self.image = gtk.Image()
+ scrollwin.add_with_viewport(self.image)
+ vbox2.pack_start(scrollwin, True, padding=5)
+
+ notebook.show_all()
+ self.set_canvas(notebook)
+ label.show()
diff --git a/activity/activity-helloworld.svg b/activity/activity-helloworld.svg
new file mode 100644
index 0000000..8da7c63
--- /dev/null
+++ b/activity/activity-helloworld.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]>
+<svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+ <g display="block" id="activity-helloworld">
+ <path d="M9.263,48.396c0.682,1.152,6.027,0.059,8.246-1.463 c2.102-1.432,3.207-2.596,4.336-2.596c1.133,0,12.54,0.92,20.935-5.715c7.225-5.707,9.773-13.788,4.52-21.437 c-5.252-7.644-13.832-9.08-20.878-8.56C16.806,9.342,4.224,16.91,4.677,28.313c0.264,6.711,3.357,9.143,4.922,10.703 c1.562,1.566,4.545,1.566,2.992,5.588C11.981,46.183,8.753,47.522,9.263,48.396z" display="inline" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5"/>
+ </g>
+ <circle cx="27.375" cy="27.5" r="19.903"
+ transform="matrix(0.6,0,0,0.6,10.95,11)"
+ id="circle4" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" display="inline" />
+ <g transform="matrix(0.6,0,0,0.6,10.95,11)" id="g6" style="display:inline">
+ <path d="m 27.376,7.598 c 0,0 -11.205,8.394 -11.205,19.976 0,11.583 11.205,19.829 11.205,19.829"
+ id="path8" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
+ <path d="m 27.376,7.598 c 0,0 11.066,9.141 11.066,19.976 0,10.839 -11.066,19.829 -11.066,19.829"
+ id="path10" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
+ <line x1="27.375999" x2="27.375999" y1="7.598" y2="47.402"
+ id="line12" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
+ <line x1="27.375999" x2="27.375999" y1="7.598" y2="47.402"
+ id="line14" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
+ <line x1="27.375999" x2="27.375999" y1="7.598" y2="47.402"
+ id="line16" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
+ <line x1="7.4720001" x2="47.278" y1="27.5" y2="27.5"
+ id="line18" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
+ </g>
+</svg>
diff --git a/activity/activity.info b/activity/activity.info
new file mode 100644
index 0000000..f8b766e
--- /dev/null
+++ b/activity/activity.info
@@ -0,0 +1,7 @@
+[Activity]
+name = TestTheme
+activity_version = 3
+bundle_id = org.sugarlabs.TestTheme
+exec = sugar-activity activity.TestThemeActivity
+icon = activity-helloworld
+license = GPLv2+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..c24196e
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2009, Simon Schampijer
+#
+# 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 USA
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start()