From d1c87cfdc444d15692421b207ae87384aeac1815 Mon Sep 17 00:00:00 2001 From: Agustin Zubiaga Date: Thu, 10 May 2012 02:23:40 +0000 Subject: Toolbar redesign, Illustrate pallete --- diff --git a/icons/alert-icon.svg b/icons/alert-icon.svg new file mode 100644 index 0000000..75fac6a --- /dev/null +++ b/icons/alert-icon.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/icons/dialog-icon.svg b/icons/dialog-icon.svg index 2c273b3..1a45505 100644 --- a/icons/dialog-icon.svg +++ b/icons/dialog-icon.svg @@ -40,9 +40,9 @@ inkscape:window-height="744" id="namedview10" showgrid="false" - inkscape:zoom="4.2909091" - inkscape:cx="-11.807142" - inkscape:cy="25.602905" + inkscape:zoom="4.0014917" + inkscape:cx="30.944886" + inkscape:cy="25.607541" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" diff --git a/icons/notify-alert-icon.svg b/icons/notify-alert-icon.svg new file mode 100644 index 0000000..4f5d52b --- /dev/null +++ b/icons/notify-alert-icon.svg @@ -0,0 +1,105 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/illustrate.py b/illustrate.py index 5dc6a7d..c8fe839 100644 --- a/illustrate.py +++ b/illustrate.py @@ -35,7 +35,7 @@ from sugar.graphics.colorbutton import ColorToolButton from sugar.graphics.toolbarbox import ToolbarBox from sugar.graphics.toolbutton import ToolButton from sugar.graphics.objectchooser import ObjectChooser -from sugar.graphics.alert import NotifyAlert +from sugar.graphics.alert import Alert, NotifyAlert from helpbutton import HelpButton from dialogs import ExampleDialog @@ -78,15 +78,20 @@ class IllustrateActivity(activity.Activity): toolbarbox.toolbar.insert(activity_button, 0) separator = gtk.SeparatorToolItem() - separator.set_expand(True) - separator.set_draw(False) + separator.set_expand(False) + separator.set_draw(True) toolbarbox.toolbar.insert(separator, -1) dialog_btn = ToolButton("dialog-icon") - dialog_btn.set_tooltip(_("Show an example of a dialog")) + dialog_btn.set_tooltip(_("Dialog example")) dialog_btn.connect("clicked", self._show_example_dialog) toolbarbox.toolbar.insert(dialog_btn, -1) + alert_btn = ToolButton("alert-icon") + alert_btn.set_tooltip(_("Alert example")) + alert_btn.connect("clicked", self._show_example_alert) + toolbarbox.toolbar.insert(alert_btn, -1) + options_button = ToolbarButton(icon_name='preferences-system') options_toolbar = gtk.Toolbar() @@ -136,6 +141,24 @@ class IllustrateActivity(activity.Activity): self.show_all() self._create_canvas(canvas) + self._create_alert_btn_palette(alert_btn) + + def _create_alert_btn_palette(self, button): + palette = button.get_palette() + hbox = gtk.HBox() + + simple = ToolButton("alert-icon") + simple.connect("clicked", self._show_example_alert, False) + + notify = ToolButton("notify-alert-icon") + notify.connect("clicked", self._show_example_alert, True) + + hbox.pack_start(simple, False, True, 0) + hbox.pack_start(notify, False, True, 0) + + hbox.show_all() + + palette.set_content(hbox) def load_objectchooser(self, widget): chooser = ObjectChooser(parent=self, @@ -157,6 +180,26 @@ class IllustrateActivity(activity.Activity): def _show_example_dialog(self, widget): ExampleDialog() + def _show_example_alert(self, widget, notify=False): + if notify: + alert = NotifyAlert(10) + alert.props.title = _('Notify Alert') + + elif not notify: + alert = Alert() + ok_icon = Icon(icon_name='dialog-ok') + alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon) + ok_icon.show() + alert.props.title = _('Simple Alert') + + alert.props.msg = _('Message') + + alert.connect('response', lambda a, r: self.remove_alert(a)) + + self.add_alert(alert) + + alert.show() + def _set_fill_color(self, widget, pspec): self._icon.props.fill_color = rgb2html(widget.get_color()) -- cgit v0.9.1