Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

Conflicts:

	sugar/graphics/palette.py
This commit is contained in:
Marco Pesenti Gritti 2007-06-26 14:55:58 +02:00
commit 3b9e2c1e7e
4 changed files with 41 additions and 100 deletions

View File

@ -1,87 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-06-21 15:25+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../shell/intro/intro.py:77
msgid "Pick a buddy picture"
msgstr ""
#: ../shell/intro/intro.py:100
msgid "My Picture:"
msgstr ""
#: ../shell/intro/intro.py:180
msgid "My Name:"
msgstr ""
#: ../shell/intro/intro.py:204
msgid "My Color:"
msgstr ""
#: ../shell/view/BuddyMenu.py:83
msgid "Remove friend"
msgstr ""
#: ../shell/view/BuddyMenu.py:87
msgid "Make friend"
msgstr ""
#: ../shell/view/BuddyMenu.py:97
msgid "Invite"
msgstr ""
#: ../shell/view/clipboardmenu.py:103
msgid "Remove"
msgstr ""
#: ../shell/view/clipboardmenu.py:110
msgid "Open"
msgstr ""
#: ../shell/view/clipboardmenu.py:117
msgid "Stop download"
msgstr ""
#: ../shell/view/clipboardmenu.py:124
msgid "Add to journal"
msgstr ""
#: ../services/clipboard/objecttypeservice.py:32
msgid "Text"
msgstr ""
#: ../services/clipboard/objecttypeservice.py:35
msgid "Image"
msgstr ""
#: ../shell/view/Shell.py:227
msgid "Screenshot"
msgstr ""
#: ../shell/view/clipboardicon.py:211
#, python-format
msgid "Clipboard object: %s."
msgstr ""
#: ../shell/view/home/MeshBox.py:122
msgid "Mesh Network"
msgstr ""
#: ../sugar/activity/activity.py:224
#, python-format
msgid "%s Activity"
msgstr ""

View File

@ -49,7 +49,7 @@ class Palette(gobject.GObject):
self._alignment = ALIGNMENT_AUTOMATIC self._alignment = ALIGNMENT_AUTOMATIC
self._popup_anim = animator.Animator(0.6, 10) self._popup_anim = animator.Animator(0.3, 10)
self._popup_anim.add(_PopupAnimation(self)) self._popup_anim.add(_PopupAnimation(self))
self._popup_anim.start() self._popup_anim.start()
@ -300,7 +300,9 @@ class CanvasInvoker(Invoker):
def get_rect(self): def get_rect(self):
context = self._item.get_context() context = self._item.get_context()
x, y = context.translate_to_screen(self._item) if context:
x, y = context.translate_to_screen(self._item)
width, height = self._item.get_allocation() width, height = self._item.get_allocation()
return gtk.gdk.Rectangle(x, y, width, height) return gtk.gdk.Rectangle(x, y, width, height)

View File

@ -25,6 +25,13 @@ _N_TABS = 8
class Toolbox(gtk.VBox): class Toolbox(gtk.VBox):
__gtype_name__ = 'SugarToolbox' __gtype_name__ = 'SugarToolbox'
__gsignals__ = {
'current-toolbar-changed': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([int]))
}
def __init__(self): def __init__(self):
gtk.VBox.__init__(self) gtk.VBox.__init__(self)
@ -34,7 +41,12 @@ class Toolbox(gtk.VBox):
self._notebook.set_show_tabs(False) self._notebook.set_show_tabs(False)
self.pack_start(self._notebook) self.pack_start(self._notebook)
self._notebook.show() self._notebook.show()
self._notebook.connect('notify::page', self._notify_page_cb)
def _notify_page_cb(self, notebook, pspec):
self.emit('current-toolbar-changed', notebook.props.page)
def _toolbar_box_expose_cb(self, widget, event): def _toolbar_box_expose_cb(self, widget, event):
widget.style.paint_flat_box(widget.window, widget.style.paint_flat_box(widget.window,
gtk.STATE_NORMAL, gtk.SHADOW_NONE, gtk.STATE_NORMAL, gtk.SHADOW_NONE,

View File

@ -20,7 +20,8 @@ import gtk
from sugar.graphics.window import Window from sugar.graphics.window import Window
from sugar.graphics.toolbutton import ToolButton from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toolbox import ActivityToolbar from sugar.graphics.toolbox import Toolbox
from sugar.graphics.palette import Palette
class EditToolbar(gtk.Toolbar): class EditToolbar(gtk.Toolbar):
def __init__(self): def __init__(self):
@ -33,6 +34,17 @@ class TextToolbar(gtk.Toolbar):
button = ToolButton('text-format-bold') button = ToolButton('text-format-bold')
self.insert(button, -1) self.insert(button, -1)
button.show() button.show()
palette = Palette()
button.set_palette(palette)
palette.set_primary_state('This is a palette')
menu_item = gtk.MenuItem('First menu item')
palette.append_menu_item(menu_item)
menu_item = gtk.MenuItem('Second menu item')
palette.append_menu_item(menu_item)
menu_item = gtk.MenuItem('Third menu item')
palette.append_menu_item(menu_item)
class ImageToolbar(gtk.Toolbar): class ImageToolbar(gtk.Toolbar):
def __init__(self): def __init__(self):
@ -53,34 +65,36 @@ class ViewToolbar(gtk.Toolbar):
window = Window() window = Window()
window.connect("destroy", lambda w: gtk.main_quit()) window.connect("destroy", lambda w: gtk.main_quit())
activity_toolbar = ActivityToolbar() toolbox = Toolbox()
window.toolbox.add_toolbar('Activity', activity_toolbar) window.set_toolbox(toolbox)
activity_toolbar.show() toolbox.show()
edit_toolbar = EditToolbar() edit_toolbar = EditToolbar()
window.toolbox.add_toolbar('Edit', edit_toolbar) toolbox.add_toolbar('Edit', edit_toolbar)
edit_toolbar.show() edit_toolbar.show()
text_toolbar = TextToolbar() text_toolbar = TextToolbar()
window.toolbox.add_toolbar('Text', text_toolbar) toolbox.add_toolbar('Text', text_toolbar)
text_toolbar.show() text_toolbar.show()
image_toolbar = ImageToolbar() image_toolbar = ImageToolbar()
window.toolbox.add_toolbar('Image', image_toolbar) toolbox.add_toolbar('Image', image_toolbar)
image_toolbar.show() image_toolbar.show()
table_toolbar = TableToolbar() table_toolbar = TableToolbar()
window.toolbox.add_toolbar('Table', table_toolbar) toolbox.add_toolbar('Table', table_toolbar)
table_toolbar.show() table_toolbar.show()
format_toolbar = FormatToolbar() format_toolbar = FormatToolbar()
window.toolbox.add_toolbar('Format', format_toolbar) toolbox.add_toolbar('Format', format_toolbar)
format_toolbar.show() format_toolbar.show()
view_toolbar = ViewToolbar() view_toolbar = ViewToolbar()
window.toolbox.add_toolbar('View', view_toolbar) toolbox.add_toolbar('View', view_toolbar)
view_toolbar.show() view_toolbar.show()
toolbox.set_current_toolbar(1)
scrolled_window = gtk.ScrolledWindow() scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
window.set_canvas(scrolled_window) window.set_canvas(scrolled_window)