From 28a331e1ac195e009833e57cde668173eb2bbdee Mon Sep 17 00:00:00 2001 From: Agustin Zubiaga Date: Thu, 10 May 2012 02:40:01 +0000 Subject: Code comments --- diff --git a/illustrate.py b/illustrate.py index 4d24b91..ceee39e 100644 --- a/illustrate.py +++ b/illustrate.py @@ -66,15 +66,22 @@ class IllustrateActivity(activity.Activity): def __init__(self, handle): activity.Activity.__init__(self, handle, True) + # Toolbar(s) toolbarbox = ToolbarBox() + # The Activity Button: activity_button = ActivityToolbarButton(self) + open_from_journal_button = ToolButton("open-from-journal") open_from_journal_button.connect("clicked", self.load_objectchooser) open_from_journal_button.props.tooltip = \ _("Load text from Sugar Journal") open_from_journal_button.show() + + # Insert a button in the activity button toolbar activity_button.page.insert(open_from_journal_button, -1) + + # Insert the Activity Toolbar Button in the toolbarbox toolbarbox.toolbar.insert(activity_button, 0) separator = gtk.SeparatorToolItem() @@ -92,15 +99,19 @@ class IllustrateActivity(activity.Activity): alert_btn.connect("clicked", self._show_alert_btn_pallete) toolbarbox.toolbar.insert(alert_btn, -1) + # Preferences toolbar options_button = ToolbarButton(icon_name='preferences-system') options_toolbar = gtk.Toolbar() + # Add a gtk.Label in a toolbar using gtk.ToolItem toolitem = gtk.ToolItem() toolitem.add(gtk.Label(_("Color Button example: "))) options_toolbar.insert(toolitem, -1) + # Get the profile color profile_color = profile.get_color() + # Color Button self.fill_color_btn = ColorToolButton() self.fill_color_btn.set_color(gtk.gdk.Color( profile_color.get_fill_color())) @@ -133,6 +144,7 @@ class IllustrateActivity(activity.Activity): self.set_toolbar_box(toolbarbox) + # For a white background: canvas = gtk.EventBox() canvas.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white")) @@ -204,16 +216,21 @@ class IllustrateActivity(activity.Activity): alert.show() def _set_fill_color(self, widget, pspec): + # Set fill color self._icon.props.fill_color = rgb2html(widget.get_color()) def _set_stroke_color(self, widget, pspec): + # Set stroke color self._icon.props.stroke_color = rgb2html(widget.get_color()) def _create_canvas(self, canvas): + # Get canvas allocation x, y, w, h = canvas.get_allocation() + # Resize for all the screen sizes pixel_size = w - h - 50 + # A sugar icon for set stroke and fill color self._icon = Icon(pixel_size=pixel_size) self._icon.props.icon_name = 'sugar-integration' self._icon.props.pixel_size = pixel_size @@ -228,7 +245,7 @@ class IllustrateActivity(activity.Activity): helpbutton.add_section(_("A section")) helpbutton.add_paragraph(_("A paragraph with an icon"), "help-icon") helpbutton.add_paragraph( - _("You can add as many paragraphs you'd like.")) + _("You can add as many paragraphs you'd like.")) helpbutton.add_section( _("Why should your activity be well integrated?")) helpbutton.add_paragraph(_("There are many Sugar activities;\ -- cgit v0.9.1