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

This commit is contained in:
Morgan Collett 2007-08-16 16:17:23 +01:00
commit 1db4cd77d3
24 changed files with 193 additions and 141 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #2703: Update macedonian translation. (ArangelAngov)
* #2543: Offer multiple activities for opening clipboard objects.
Snapshot d93122bf5e

121
po/mk.po
View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: olpc-sugar.master\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-07-05 07:57-0700\n"
"PO-Revision-Date: 2007-07-05 19:34+0200\n"
"POT-Creation-Date: 2007-07-24 10:09-0700\n"
"PO-Revision-Date: 2007-08-08 15:40+0200\n"
"Last-Translator: Arangel Angov <arangel@linux.net.mk>\n"
"Language-Team: Macedonian <ossm-members@hedona.on.net.mk>\n"
"MIME-Version: 1.0\n"
@ -16,72 +16,129 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"
#: ../shell/intro/intro.py:77
msgid "Pick a buddy picture"
msgstr "Избери слика за пријател"
#: ../shell/intro/intro.py:61
msgid "Name:"
msgstr "Име:"
#: ../shell/intro/intro.py:100
msgid "My Picture:"
msgstr "Мојата слика:"
#: ../shell/intro/intro.py:84
msgid "Click to change color:"
msgstr "Кликни да смениш боја:"
#: ../shell/intro/intro.py:180
msgid "My Name:"
msgstr "Моето име:"
#: ../shell/intro/intro.py:134
msgid "Back"
msgstr "Назад"
#: ../shell/intro/intro.py:204
msgid "My Color:"
msgstr "Мојата боја:"
#: ../shell/intro/intro.py:142
msgid "Done"
msgstr "Завршено"
#: ../shell/view/BuddyMenu.py:83
#: ../shell/intro/intro.py:145
msgid "Next"
msgstr "Напред"
#: ../shell/view/BuddyMenu.py:82
msgid "Remove friend"
msgstr "Отстрани пријател"
#: ../shell/view/BuddyMenu.py:87
#: ../shell/view/BuddyMenu.py:85
msgid "Make friend"
msgstr "Додај пријател"
#: ../shell/view/BuddyMenu.py:97
#. FIXME check that the buddy is not in the activity already
#: ../shell/view/BuddyMenu.py:96
msgid "Invite"
msgstr "Покани"
#: ../shell/view/clipboardmenu.py:103
#: ../shell/view/clipboardmenu.py:66
msgid "Remove"
msgstr "Отстрани"
#: ../shell/view/clipboardmenu.py:110
#: ../shell/view/clipboardmenu.py:70
msgid "Open"
msgstr "Отвори"
#: ../shell/view/clipboardmenu.py:117
msgid "Stop download"
msgstr "Прекини преземање"
#: ../shell/view/clipboardmenu.py:124
#. self._stop_item = MenuItem(_('Stop download'), 'stock-close')
#. TODO: Implement stopping downloads
#. self._stop_item.connect('activate', self._stop_item_activate_cb)
#. self.append_menu_item(self._stop_item)
#: ../shell/view/clipboardmenu.py:79
msgid "Add to journal"
msgstr "Додај во дневникот"
#: ../shell/view/clipboardmenu.py:180
#, python-format
msgid "Clipboard object: %s."
msgstr "Објект од таблата со исечоци: %s"
#: ../shell/view/frame/zoombox.py:42
msgid "Neighborhood"
msgstr "Соседство"
#: ../shell/view/frame/zoombox.py:55
msgid "Group"
msgstr "Група"
#: ../shell/view/frame/zoombox.py:68
msgid "Home"
msgstr "Дома"
#: ../shell/view/frame/zoombox.py:81
msgid "Activity"
msgstr "Активност"
#: ../services/clipboard/objecttypeservice.py:32
msgid "Text"
msgstr "Текст"
#: ../services/clipboard/objecttypeservice.py:35
#: ../services/clipboard/objecttypeservice.py:36
msgid "Image"
msgstr "Слика"
#: ../shell/view/Shell.py:227
#: ../shell/view/Shell.py:203
msgid "Screenshot"
msgstr "Слика од екранот"
#: ../shell/view/clipboardicon.py:211
#, python-format
msgid "Clipboard object: %s."
msgstr "Објект од таблата со исечоци: %s"
#: ../shell/view/home/HomeBox.py:140
msgid "Shutdown"
msgstr "Исклучи"
#: ../shell/view/home/MeshBox.py:122
#: ../shell/view/home/MeshBox.py:126
msgid "Mesh Network"
msgstr "Соседство"
#: ../sugar/activity/activity.py:232
#: ../shell/view/devices/battery.py:34
msgid "My Battery life"
msgstr "Мојата батерија"
#: ../shell/view/devices/battery.py:87
msgid "Battery charging"
msgstr "Батеријата се полни"
#: ../shell/view/devices/battery.py:89
msgid "Battery discharging"
msgstr "Батерјате се празни"
#: ../shell/view/devices/battery.py:91
msgid "Battery fully charged"
msgstr "Батеријата е наполнета"
#: ../sugar/activity/activity.py:73
msgid "Private"
msgstr "Приватно"
#: ../sugar/activity/activity.py:74
msgid "My Neighborhood"
msgstr "Мое соседство"
#: ../sugar/activity/activity.py:81
msgid "Keep"
msgstr "Зачувај"
#: ../sugar/activity/activity.py:87
msgid "Stop"
msgstr "Стоп"
#: ../sugar/activity/activity.py:260
#, python-format
msgid "%s Activity"
msgstr "%s активност"

View File

@ -17,6 +17,8 @@
import dbus
import dbus.service
from gettext import gettext as _
_REGISTRY_IFACE = "org.laptop.ObjectTypeRegistry"
_REGISTRY_PATH = "/org/laptop/ObjectTypeRegistry"
@ -28,12 +30,11 @@ class ObjectTypeRegistry(dbus.service.Object):
self._types = {}
from gettext import gettext as _
self._add_primitive('Text', _('Text'), 'theme:object-text',
self._add_primitive('Text', _('Text'), 'theme:text',
[ 'text/plain', 'text/rtf', 'application/pdf',
'application/x-pdf', 'text/html',
'application/vnd.oasis.opendocument.text' ])
self._add_primitive('Image', _('Image'), 'theme:object-image',
self._add_primitive('Image', _('Image'), 'theme:image',
[ 'image/png', 'image/gif', 'image/jpeg' ])
def _add_primitive(self, type_id, name, icon, mime_types):

View File

@ -26,7 +26,7 @@ class ColorPicker(hippo.CanvasBox, hippo.CanvasItem):
self.props.orientation = hippo.ORIENTATION_HORIZONTAL
self._xo = CanvasIcon(size=style.XLARGE_ICON_SIZE,
icon_name='theme:stock-buddy')
icon_name='theme:xo')
self._set_random_colors()
self._xo.connect('activated', self._xo_activated_cb)
self.append(self._xo)

View File

@ -103,7 +103,7 @@ class HomeActivity(gobject.GObject):
if self._activity_info:
return self._activity_info.icon
else:
return 'theme:stock-missing'
return 'theme:image-missing'
def get_icon_color(self):
"""Retrieve the appropriate icon colour for this activity

View File

@ -20,7 +20,7 @@ from view.BuddyMenu import BuddyMenu
class BuddyIcon(CanvasIcon):
def __init__(self, shell, buddy):
CanvasIcon.__init__(self, icon_name='theme:stock-buddy',
CanvasIcon.__init__(self, icon_name='theme:xo',
xo_color=buddy.get_color())
self._shell = shell

View File

@ -80,10 +80,10 @@ class BuddyMenu(Palette):
friends = shell_model.get_friends()
if friends.has_buddy(self._buddy):
menu_item = MenuItem(_('Remove friend'), 'stock-remove')
menu_item = MenuItem(_('Remove friend'), 'list-remove')
menu_item.connect('activate', self._remove_friend_cb)
else:
menu_item = MenuItem(_('Make friend'), 'stock-add')
menu_item = MenuItem(_('Make friend'), 'list-add')
menu_item.connect('activate', self._make_friend_cb)
self.menu.append(menu_item)

View File

@ -88,7 +88,7 @@ class ClipboardIcon(CanvasIcon):
if icon_name:
self.props.icon_name = icon_name
else:
self.props.icon_name = 'theme:object-generic'
self.props.icon_name = 'theme:unknown-object'
self._name = name
self._percent = percent

View File

@ -63,12 +63,12 @@ class ClipboardMenu(Palette):
self.append(self._preview_text)
"""
self._remove_item = MenuItem(_('Remove'), 'stock-remove')
self._remove_item = MenuItem(_('Remove'), 'list-remove')
self._remove_item.connect('activate', self._remove_item_activate_cb)
self.menu.append(self._remove_item)
self._remove_item.show()
self._open_item = MenuItem(_('Open'), 'stock-keep')
self._open_item = MenuItem(_('Open'))
self._open_item_activate_sid = self._open_item.connect('activate',
self._open_item_activate_cb)
self.menu.append(self._open_item)

View File

@ -21,7 +21,7 @@ from sugar.graphics import canvasicon
from sugar.graphics import style
from sugar.graphics.palette import Palette
_ICON_NAME = 'device-battery'
_ICON_NAME = 'battery'
_STATUS_CHARGING = 0
_STATUS_DISCHARGING = 1

View File

@ -22,7 +22,7 @@ from model.devices import device
class DeviceView(canvasicon.CanvasIcon):
def __init__(self, model):
canvasicon.CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
icon_name='theme:device-network-mesh')
icon_name='theme:network-mesh')
self._model = model
model.connect('notify::state', self._state_changed_cb)

View File

@ -19,4 +19,4 @@ from view.devices import deviceview
class DeviceView(deviceview.DeviceView):
def __init__(self, model):
deviceview.DeviceView.__init__(self, model)
self.props.icon_name = 'theme:stock-net-wired'
self.props.icon_name = 'theme:network-wired'

View File

@ -22,7 +22,7 @@ from model.devices.network import wireless
from sugar.graphics.canvasicon import CanvasIcon
from model.devices import device
_ICON_NAME = 'device-network-wireless'
_ICON_NAME = 'network-wireless'
class DeviceView(CanvasIcon):
def __init__(self, model):

View File

@ -36,7 +36,7 @@ from view.BuddyIcon import BuddyIcon
from view.pulsingicon import PulsingIcon
from view.home.snowflakelayout import SnowflakeLayout
_ICON_NAME = 'device-network-wireless'
_ICON_NAME = 'network-wireless'
class AccessPointView(PulsingIcon):
def __init__(self, model):
@ -116,7 +116,7 @@ class AccessPointView(PulsingIcon):
]
_MESH_ICON_NAME = 'theme:device-network-mesh'
_MESH_ICON_NAME = 'theme:network-mesh'
class MeshDeviceView(PulsingIcon):
def __init__(self, nm_device):

View File

@ -20,5 +20,5 @@ from sugar import profile
class MyIcon(CanvasIcon):
def __init__(self, size):
CanvasIcon.__init__(self, size=size,
icon_name='theme:stock-buddy',
icon_name='theme:xo',
xo_color=profile.get_color())

View File

@ -28,55 +28,63 @@ DS_DBUS_SERVICE = "org.laptop.sugar.DataStore"
DS_DBUS_INTERFACE = "org.laptop.sugar.DataStore"
DS_DBUS_PATH = "/org/laptop/sugar/DataStore"
_bus = dbus.SessionBus()
_data_store = dbus.Interface(_bus.get_object(DS_DBUS_SERVICE, DS_DBUS_PATH),
DS_DBUS_INTERFACE)
_data_store = None
def _get_data_store():
global _data_store
if not _data_store:
_bus = dbus.SessionBus()
_data_store = dbus.Interface(_bus.get_object(DS_DBUS_SERVICE,
DS_DBUS_PATH),
DS_DBUS_INTERFACE)
return _data_store
def create(properties, filename):
object_id = _data_store.create(dbus.Dictionary(properties), filename)
object_id = _get_data_store().create(dbus.Dictionary(properties), filename)
logging.debug('dbus_helpers.create: ' + object_id)
return object_id
def update(uid, properties, filename, reply_handler=None, error_handler=None, timeout=-1):
logging.debug('dbus_helpers.update: %s, %s, %s' % (uid, filename, properties))
if reply_handler and error_handler:
_data_store.update(uid, dbus.Dictionary(properties), filename,
_get_data_store().update(uid, dbus.Dictionary(properties), filename,
reply_handler=reply_handler,
error_handler=error_handler,
timeout=timeout)
else:
_data_store.update(uid, dbus.Dictionary(properties), filename)
_get_data_store().update(uid, dbus.Dictionary(properties), filename)
def delete(uid):
logging.debug('dbus_helpers.delete: %r' % uid)
_data_store.delete(uid)
_get_data_store().delete(uid)
def get_properties(uid):
logging.debug('dbus_helpers.get_properties: %s' % uid)
return _data_store.get_properties(uid)
return _get_data_store().get_properties(uid)
def get_filename(uid):
filename = _data_store.get_filename(uid)
filename = _get_data_store().get_filename(uid)
logging.debug('dbus_helpers.get_filename: %s, %s' % (uid, filename))
return filename
def find(query, reply_handler, error_handler):
logging.debug('dbus_helpers.find: %r' % query)
if reply_handler and error_handler:
return _data_store.find(query, reply_handler=reply_handler,
return _get_data_store().find(query, reply_handler=reply_handler,
error_handler=error_handler)
else:
return _data_store.find(query)
return _get_data_store().find(query)
def mount(uri, options):
return _data_store.mount(uri, options)
return _get_data_store().mount(uri, options)
def unmount(mount_point_id):
_data_store.unmount(mount_point_id)
_get_data_store().unmount(mount_point_id)
def mounts():
return _data_store.mounts()
return _get_data_store().mounts()
def get_unique_values(key):
return _data_store.get_uniquevaluesfor(key, dbus.Dictionary({}, signature='ss'))
return _get_data_store().get_uniquevaluesfor(key, dbus.Dictionary({}, signature='ss'))

View File

@ -150,7 +150,7 @@ class CollapsedEntry(CanvasRoundBox):
self._icon_name = type.icon
if not self._icon_name:
self._icon_name = 'theme:stock-missing'
self._icon_name = 'theme:image-missing'
return self._icon_name

View File

@ -87,9 +87,7 @@ class Palette(gtk.Window):
'invoker' : (object, None, None,
gobject.PARAM_READWRITE),
'position' : (gobject.TYPE_INT, None, None, 0, 6,
0, gobject.PARAM_READWRITE),
'draw-gap' : (bool, None, None, False,
gobject.PARAM_READWRITE)
0, gobject.PARAM_READWRITE)
}
__gsignals__ = {
@ -114,7 +112,6 @@ class Palette(gtk.Window):
self._group_id = None
self._up = False
self._position = self.DEFAULT
self._draw_gap = False
self._palette_popup_sid = None
self._popup_anim = animator.Animator(0.3, 10)
@ -206,9 +203,6 @@ class Palette(gtk.Window):
self._invoker.connect('mouse-leave', self._invoker_mouse_leave_cb)
elif pspec.name == 'position':
self._position = value
elif pspec.name == 'draw-gap':
self._draw_gap = value
self.queue_draw()
else:
raise AssertionError
@ -217,8 +211,6 @@ class Palette(gtk.Window):
return self._invoker
elif pspec.name == 'position':
return self._position
elif pspec.name == 'draw-gap':
return self._draw_gap
else:
raise AssertionError
@ -228,7 +220,7 @@ class Palette(gtk.Window):
def do_expose_event(self, event):
# We want to draw a border with a beautiful gap
if self._draw_gap:
if self._invoker.has_rectangle_gap():
invoker = self._invoker.get_rect()
palette = self.get_rect()
@ -398,6 +390,9 @@ class Palette(gtk.Window):
self.menu.set_active(True)
self.show()
if self._invoker:
self._invoker.notify_popup()
self._up = True
_palette_observer.emit('popup', self)
self.emit('popup')
@ -406,9 +401,13 @@ class Palette(gtk.Window):
if not self._palette_popup_sid is None:
_palette_observer.disconnect(self._palette_popup_sid)
self._palette_popup_sid = None
self.menu.set_active(False)
self.hide()
if self._invoker:
self._invoker.notify_popdown()
self._up = False
self.emit('popdown')
@ -535,6 +534,12 @@ class Invoker(gobject.GObject):
def __init__(self):
gobject.GObject.__init__(self)
def has_rectangle_gap(self):
return False
def draw_rectangle(self, event, palette):
pass
def get_default_position(self):
return Palette.AROUND
@ -543,6 +548,12 @@ class Invoker(gobject.GObject):
height = gtk.gdk.screen_height()
return gtk.gdk.Rectangle(0, 0, width, height)
def notify_popup(self):
pass
def notify_popdown(self):
pass
class WidgetInvoker(Invoker):
def __init__(self, widget):
Invoker.__init__(self)
@ -562,31 +573,24 @@ class WidgetInvoker(Invoker):
return gtk.gdk.Rectangle(x, y, width, height)
def draw_invoker_rect(self, event, palette):
style = self._widget.style
if palette.is_up():
gap = _calculate_gap(self.get_rect(), palette.get_rect())
def has_rectangle_gap(self):
return True
if gap:
style.paint_box_gap(event.window, gtk.STATE_PRELIGHT,
gtk.SHADOW_IN, event.area, self._widget,
"palette-invoker",
self._widget.allocation.x,
self._widget.allocation.y,
self._widget.allocation.width,
self._widget.allocation.height,
gap[0], gap[1], gap[2])
else:
style.paint_box(event.window, gtk.STATE_PRELIGHT,
def draw_rectangle(self, event, palette):
style = self._widget.style
gap = _calculate_gap(self.get_rect(), palette.get_rect())
if gap:
style.paint_box_gap(event.window, gtk.STATE_PRELIGHT,
gtk.SHADOW_IN, event.area, self._widget,
"palette-invoker",
self._widget.allocation.x,
self._widget.allocation.y,
self._widget.allocation.width,
self._widget.allocation.height)
self._widget.allocation.height,
gap[0], gap[1], gap[2])
else:
style.paint_box(event.window, gtk.STATE_PRELIGHT,
gtk.SHADOW_NONE, event.area, self._widget,
gtk.SHADOW_IN, event.area, self._widget,
"palette-invoker",
self._widget.allocation.x,
self._widget.allocation.y,
@ -602,6 +606,12 @@ class WidgetInvoker(Invoker):
def get_toplevel(self):
return self._widget.get_toplevel()
def notify_popup(self):
self._widget.queue_draw()
def notify_popdown(self):
self._widget.queue_draw()
class CanvasInvoker(Invoker):
def __init__(self, item):
Invoker.__init__(self)

View File

@ -40,25 +40,15 @@ class RadioToolButton(gtk.RadioToolButton):
def set_palette(self, palette):
self._palette = palette
self._palette.props.invoker = WidgetInvoker(self.child)
self._palette.props.draw_gap = True
self._palette.connect("popup", self._palette_changed)
self._palette.connect("popdown", self._palette_changed)
def set_tooltip(self, text):
self._palette = Palette(text)
self._palette.props.invoker = WidgetInvoker(self.child)
self._set_palette(Palette(text))
def do_expose_event(self, event):
if self._palette and self._palette.props.draw_gap:
if self._palette.is_up() or self.child.state == gtk.STATE_PRELIGHT:
invoker = self._palette.props.invoker
invoker.draw_invoker_rect(event, self._palette)
if self._palette and self._palette.is_up():
invoker = self._palette.props.invoker
invoker.draw_rectangle(event, self._palette)
gtk.RadioToolButton.do_expose_event(self, event)
def _palette_changed(self, palette):
# Force a redraw to update the invoker rectangle
self.queue_draw()
palette = property(get_palette, set_palette)

View File

@ -39,25 +39,15 @@ class ToggleToolButton(gtk.ToggleToolButton):
def set_palette(self, palette):
self._palette = palette
self._palette.props.invoker = WidgetInvoker(self.child)
self._palette.props.draw_gap = True
self._palette.connect("popup", self._palette_changed)
self._palette.connect("popdown", self._palette_changed)
def set_tooltip(self, text):
self._palette = Palette(text)
self._palette.props.invoker = WidgetInvoker(self.child)
self._set_palette(Palette(text))
def do_expose_event(self, event):
if self._palette and self._palette.props.draw_gap:
if self._palette.is_up() or self.child.state == gtk.STATE_PRELIGHT:
invoker = self._palette.props.invoker
invoker.draw_invoker_rect(event, self._palette)
if self._palette and self._palette.is_up():
invoker = self._palette.props.invoker
invoker.draw_rectangle(event, self._palette)
gtk.ToggleToolButton.do_expose_event(self, event)
def _palette_changed(self, palette):
# Force a redraw to update the invoker rectangle
self.queue_draw()
palette = property(get_palette, set_palette)

View File

@ -42,19 +42,14 @@ class ToolButton(gtk.ToolButton):
def set_palette(self, palette):
self._palette = palette
self._palette.props.invoker = WidgetInvoker(self.child)
self._palette.props.draw_gap = True
self._palette.connect("popup", self._palette_changed)
self._palette.connect("popdown", self._palette_changed)
def set_tooltip(self, text):
self.set_palette(Palette(text))
def do_expose_event(self, event):
if self._palette and self._palette.props.draw_gap:
if self._palette.is_up() or self.child.state == gtk.STATE_PRELIGHT:
invoker = self._palette.props.invoker
invoker.draw_invoker_rect(event, self._palette)
if self._palette and self._palette.is_up():
invoker = self._palette.props.invoker
invoker.draw_rectangle(event, self._palette)
gtk.ToolButton.do_expose_event(self, event)
@ -62,8 +57,4 @@ class ToolButton(gtk.ToolButton):
if self._palette:
self._palette.popdown(True)
def _palette_changed(self, palette):
# Force a redraw to update the invoker rectangle
self.queue_draw()
palette = property(get_palette, set_palette)

View File

@ -37,12 +37,12 @@ def add_snowflake(parent, size):
box.set_layout(layout)
icon = CanvasIcon(scale=0.8, xo_color=XoColor(),
icon_name='theme:object-link')
icon_name='theme:xo')
layout.add_center(icon)
for k in range(0, size):
icon = CanvasIcon(scale=0.4, xo_color=XoColor(),
icon_name='theme:stock-buddy')
icon_name='theme:xo')
layout.add(icon)
window = gtk.Window()

View File

@ -35,7 +35,7 @@ def _create_icon():
scale = 1.0 + random.random() * 1.5
icon = CanvasIcon(scale=scale, xo_color=color,
icon_name='theme:stock-buddy')
icon_name='theme:xo')
icon.set_tooltip('Test')
layout.add(icon)

View File

@ -35,16 +35,20 @@ class TextToolbar(gtk.Toolbar):
self.insert(button, -1)
button.show()
palette = Palette()
palette = Palette('Title')
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)
palette.menu.append(menu_item)
menu_item.show()
menu_item = gtk.MenuItem('Second menu item')
palette.append_menu_item(menu_item)
palette.menu.append(menu_item)
menu_item.show()
menu_item = gtk.MenuItem('Third menu item')
palette.append_menu_item(menu_item)
palette.menu.append(menu_item)
menu_item.show()
class ImageToolbar(gtk.Toolbar):
def __init__(self):