diff --git a/services/clipboard/typeregistry.py b/services/clipboard/typeregistry.py index 9666c9b5..0a1aaa2f 100644 --- a/services/clipboard/typeregistry.py +++ b/services/clipboard/typeregistry.py @@ -1,4 +1,5 @@ import logging +from gettext import gettext as _ class FileType: def __init__(self, formats): @@ -22,7 +23,7 @@ class TextFileType(FileType): _types = set(['text/plain', 'UTF8_STRING', 'STRING']) def get_name(self): - return 'Text snippet' + return _('Text snippet') def get_icon(self): return 'activity-xbook' @@ -30,7 +31,11 @@ class TextFileType(FileType): def get_preview(self): for format, data in self._formats.iteritems(): if format in TextFileType._types: - return str(data.get_data()) + text = str(data.get_data()) + if len(text) < 50: + return text + else: + return text[0:49] + "..." return '' @@ -43,7 +48,7 @@ class ImageFileType(FileType): _types = set(['image/jpeg', 'image/gif', 'image/png', 'image/tiff']) def get_name(self): - return 'Image' + return _('Image') def get_icon(self): return 'activity-sketch' @@ -60,7 +65,7 @@ class UriFileType(FileType): _types = set(['_NETSCAPE_URL']) def get_name(self): - return 'URL' + return _('Web Page') def get_icon(self): return 'activity-web' @@ -83,7 +88,7 @@ class PdfFileType(FileType): _types = set(['application/pdf']) def get_name(self): - return 'PDF file' + return _('PDF file') def get_icon(self): return 'activity-xbook' @@ -100,7 +105,7 @@ class MsWordFileType(FileType): _types = set(['application/msword']) def get_name(self): - return 'MS Word file' + return _('MS Word file') def get_icon(self): return 'activity-abiword' @@ -117,7 +122,7 @@ class RtfFileType(FileType): _types = set(['application/rtf', 'text/rtf']) def get_name(self): - return 'RTF file' + return _('RTF file') def get_icon(self): return 'activity-abiword' @@ -131,7 +136,7 @@ class RtfFileType(FileType): class UnknownFileType(FileType): def get_name(self): - return 'Object' + return _('Object') def get_icon(self): return 'stock-missing' diff --git a/shell/view/clipboardmenu.py b/shell/view/clipboardmenu.py index bcd16cb2..031a49ac 100644 --- a/shell/view/clipboardmenu.py +++ b/shell/view/clipboardmenu.py @@ -31,7 +31,7 @@ class ClipboardMenu(Menu): self._remove_icon = None self._stop_icon = None - self.add_item(preview) + self.add_item(preview, wrap=True) self._update_icons(percent) diff --git a/shell/view/frame/clipboardpanelwindow.py b/shell/view/frame/clipboardpanelwindow.py index fd0d7f01..f001476d 100644 --- a/shell/view/frame/clipboardpanelwindow.py +++ b/shell/view/frame/clipboardpanelwindow.py @@ -44,7 +44,7 @@ class ClipboardPanelWindow(PanelWindow): key = util.unique_id() cb_service = clipboardservice.get_instance() - cb_service.add_object(key, "name") + cb_service.add_object(key, name="") cb_service.set_object_percent(key, percent = 100) targets = clipboard.wait_for_targets() diff --git a/sugar/graphics/menu.py b/sugar/graphics/menu.py index 153c5bc1..f453b166 100644 --- a/sugar/graphics/menu.py +++ b/sugar/graphics/menu.py @@ -76,12 +76,14 @@ class Menu(gtk.Window): orientation=hippo.ORIENTATION_HORIZONTAL) self._root.append(self._action_box) - def add_item(self, label, action_id=None): + def add_item(self, label, action_id=None, wrap=False): if not self._item_box: self._create_item_box() text = hippo.CanvasText(text=label) style.apply_stylesheet(text, 'menu.Item') + if wrap: + text.set_property("size-mode", "wrap-word") # FIXME need a way to make hippo items activable in python if action_id: