Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2013-11-22 16:33:10 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2013-11-22 16:33:10 (GMT)
commit8f717ffab5cd7edb8023334f15c964f97ea143aa (patch)
treee133f203a30f92b9fed4ec56d6ad8fd680a6aaf8 /activity.py
parentdfc075728afa89892c0b50d58e3012ae856602a4 (diff)
HelloWorld in 14 lines! :)HEADmaster
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py54
1 files changed, 8 insertions, 46 deletions
diff --git a/activity.py b/activity.py
index 2252983..b0a66ae 100644
--- a/activity.py
+++ b/activity.py
@@ -14,63 +14,25 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-"""HelloWorld Activity: A case study for developing an activity."""
+"""HelloWorld Activity: A case study for developing an activity"""
from gi.repository import Gtk
-import logging
from gettext import gettext as _
+from simpleactivity import SimpleActivity
-from sugar3.activity import activity
-from sugar3.graphics.toolbarbox import ToolbarBox
-from sugar3.activity.widgets import ActivityButton
-from sugar3.activity.widgets import TitleEntry
-from sugar3.activity.widgets import StopButton
-from sugar3.activity.widgets import ShareButton
-from sugar3.activity.widgets import DescriptionItem
-class HelloWorldActivity(activity.Activity):
+class HelloWorldActivity(SimpleActivity):
"""HelloWorldActivity class as specified in activity.info"""
def __init__(self, handle):
"""Set up the HelloWorld activity."""
- activity.Activity.__init__(self, handle)
+ SimpleActivity.__init__(self, handle,
+ activitytoolbarbutton=False)
+ # The last param puts our activity buttons directly in the main toolbar
- # we do not have collaboration features
- # make the share option insensitive
- self.max_participants = 1
-
- # toolbar with the new toolbar redesign
- toolbar_box = ToolbarBox()
-
- activity_button = ActivityButton(self)
- toolbar_box.toolbar.insert(activity_button, 0)
- activity_button.show()
-
- title_entry = TitleEntry(self)
- toolbar_box.toolbar.insert(title_entry, -1)
- title_entry.show()
-
- description_item = DescriptionItem(self)
- toolbar_box.toolbar.insert(description_item, -1)
- description_item.show()
-
- share_button = ShareButton(self)
- toolbar_box.toolbar.insert(share_button, -1)
- share_button.show()
-
- separator = Gtk.SeparatorToolItem()
- separator.props.draw = False
- separator.set_expand(True)
- toolbar_box.toolbar.insert(separator, -1)
- separator.show()
-
- stop_button = StopButton(self)
- toolbar_box.toolbar.insert(stop_button, -1)
- stop_button.show()
-
- self.set_toolbar_box(toolbar_box)
- toolbar_box.show()
+ # Let's add the StopButton
+ self.add_stopbutton()
# label with the text, make the string translatable
label = Gtk.Label(_("Hello World!"))