From fa00e1b23978ddf78cbf6aeb149f559fbe137a1c Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Fri, 25 Nov 2011 14:44:37 +0000 Subject: First commit Signed-off-by: Manuel QuiƱones --- 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 @@ + + +]> + + + + + + + + + + + + + + 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() -- cgit v0.9.1