[Sugar-devel] [PATCH sugar-toolkit] Clipboard menu off screen #2201
Aleksey Lim
alsroot at member.fsf.org
Fri Dec 17 06:34:08 EST 2010
By default, set palette title width to a half of screen widht.
---
src/sugar/graphics/palette.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index 46f167b..8d5794d 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -41,15 +41,19 @@ from sugar.graphics.palettewindow import MouseSpeedDetector, Invoker, \
class Palette(PaletteWindow):
PRIMARY = 0
SECONDARY = 1
+ CHAR_WIDTH = gtk.Label().create_pango_layout('W').get_pixel_size()[0]
__gtype_name__ = 'SugarPalette'
def __init__(self, label=None, accel_path=None, menu_after_content=False,
- text_maxlen=60, **kwargs):
+ text_maxlen=-1, **kwargs):
# DEPRECATED: label is passed with the primary-text property,
# accel_path is set via the invoker property, and menu_after_content
# is not used
+ if text_maxlen < 0:
+ text_maxlen = int(gtk.gdk.screen_width() * .5 / Palette.CHAR_WIDTH)
+
self._primary_text = None
self._secondary_text = None
self._icon = None
--
1.7.3.3
More information about the Sugar-devel
mailing list