[Sugar-devel] [PATCH] Clipboard menu off screen fixed for long text strings(SL #2201)

Mukul Gupta mukul at seeta.in
Tue Oct 26 15:52:40 EDT 2010


Changing maximum text length to a suitable value in clipboardmenu
which is dependent on the screen width and pixel size of
characters
---
 src/jarabe/frame/clipboardmenu.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py
index b998110..b0d141d 100644
--- a/src/jarabe/frame/clipboardmenu.py
+++ b/src/jarabe/frame/clipboardmenu.py
@@ -38,7 +38,10 @@ from jarabe.model import bundleregistry
 class ClipboardMenu(Palette):
 
     def __init__(self, cb_object):
-        Palette.__init__(self, text_maxlen=100)
+        char_lable = gtk.Label()
+        create_layout = char_lable.create_pango_layout("W")
+        Palette.__init__(self, text_maxlen=int(0.75 * gtk.gdk.screen_width
+        () / create_layout.get_pixel_size()[0]))
 
         self._cb_object = cb_object
 
-- 
1.7.0.4



More information about the Sugar-devel mailing list