From 10db544b1ed646b3b27310bafb19d45a933a5212 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 10 Jan 2008 11:04:09 +0100 Subject: [PATCH 1/5] set XO clock to use UTC #5648 --- shell/controlpanel/control.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shell/controlpanel/control.py b/shell/controlpanel/control.py index 580536a8..a3fa1a46 100644 --- a/shell/controlpanel/control.py +++ b/shell/controlpanel/control.py @@ -404,10 +404,9 @@ def set_timezone(timezone): # Write info to the /etc/sysconfig/clock file fd = open(_TIMEZONE_CONFIG, "w") - fd.write('# The ZONE parameter is only evaluated by sugarcontrol.\n') - fd.write('# The timezone of the system ' + - 'is defined by the contents of /etc/localtime.\n') + fd.write('# use sugar-control-panel to change this\n') fd.write('ZONE="%s"\n' % timezone) + fd.write('UTC=true\n') fd.close() else: print (_("Error timezone does not exist.")) From 6c5025bd74040d25f31d259a6bc09b9072ffcde5 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 10 Jan 2008 15:32:44 +0100 Subject: [PATCH 2/5] Properly check for the owner, fix #5573. --- shell/view/BuddyMenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/view/BuddyMenu.py b/shell/view/BuddyMenu.py index 7f2501dd..e7e12ca5 100644 --- a/shell/view/BuddyMenu.py +++ b/shell/view/BuddyMenu.py @@ -37,7 +37,7 @@ class BuddyMenu(Palette): self._buddy.connect('nick-changed', self._buddy_nick_changed_cb) owner = self._get_shell_model().get_owner() - if buddy.get_nick() != owner.get_nick(): + if not buddy.is_owner(): self._add_items() def _get_shell_model(self): From 802267cd2172eb0929bdadafc309f3c7322f4300 Mon Sep 17 00:00:00 2001 From: Reinier Heeres Date: Thu, 10 Jan 2008 17:55:57 +0100 Subject: [PATCH 3/5] Implement Activity.can_close(), #5493 --- lib/sugar/activity/activity.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/sugar/activity/activity.py b/lib/sugar/activity/activity.py index d9886f97..f6dbd378 100644 --- a/lib/sugar/activity/activity.py +++ b/lib/sugar/activity/activity.py @@ -838,12 +838,24 @@ class Activity(Window, gtk.Container): if response_id == gtk.RESPONSE_OK: self.close(skip_save=True) - def close(self, skip_save=False): + def can_close(self): + """Activities should override this function if they want to perform + extra checks before actually closing.""" + + return True + + def close(self, force=False, skip_save=False): """Request that the activity be stopped and saved to the Journal Activities should not override this method, but should implement write_file() to - do any state saving instead. + do any state saving instead. If the application wants to control wether it can + close, it should override can_close(). """ + + if not force: + if not self.can_close(): + return + try: if not skip_save: self.save() From e85a07e2d25036388168dfbb3eb67a607e0ac333 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 10 Jan 2008 18:33:50 +0100 Subject: [PATCH 4/5] Work around for numpy/gtk issue with turkish locale. Fix #5559. --- bin/sugar-shell | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/sugar-shell b/bin/sugar-shell index b0f66b4b..ef69fc1a 100755 --- a/bin/sugar-shell +++ b/bin/sugar-shell @@ -20,6 +20,10 @@ import os from ConfigParser import ConfigParser import gettext +# HACK we need to import numpy before gtk otherwise we traceback in +# some locales. See http://dev.laptop.org/ticket/5559. +import numpy + import pygtk pygtk.require('2.0') import gtk From 676035742349f01f608eae50c4662fa3578a4c8b Mon Sep 17 00:00:00 2001 From: Reinier Heeres Date: Thu, 10 Jan 2008 19:21:29 +0100 Subject: [PATCH 5/5] Support for ellipsis in palette texts, #4562/#5765 --- lib/sugar/graphics/menuitem.py | 7 ++++++- lib/sugar/graphics/palette.py | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/sugar/graphics/menuitem.py b/lib/sugar/graphics/menuitem.py index 1b908434..908cc1f0 100644 --- a/lib/sugar/graphics/menuitem.py +++ b/lib/sugar/graphics/menuitem.py @@ -18,11 +18,16 @@ import gtk from sugar.graphics.icon import Icon +import pango + class MenuItem(gtk.ImageMenuItem): - def __init__(self, text_label=None, icon_name=None): + def __init__(self, text_label=None, icon_name=None, text_maxlen=0): gtk.ImageMenuItem.__init__(self, text_label) if icon_name: icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_MENU) self.set_image(icon) icon.show() + if text_maxlen > 0: + self.child.set_ellipsize(pango.ELLIPSIZE_MIDDLE) + self.child.set_max_width_chars(text_maxlen) diff --git a/lib/sugar/graphics/palette.py b/lib/sugar/graphics/palette.py index a24a8064..3a279230 100644 --- a/lib/sugar/graphics/palette.py +++ b/lib/sugar/graphics/palette.py @@ -21,6 +21,7 @@ import gtk import gobject import time import hippo +import pango from sugar.graphics import palettegroup from sugar.graphics import animator @@ -140,7 +141,8 @@ class Palette(gtk.Window): gobject.TYPE_NONE, ([])) } - def __init__(self, label, accel_path=None, menu_after_content=False): + def __init__(self, label, accel_path=None, menu_after_content=False, + text_maxlen=0): gtk.Window.__init__(self) self.set_decorated(False) @@ -178,6 +180,11 @@ class Palette(gtk.Window): - 2*self.get_border_width()) self._label.set_alignment(0, 0.5) self._label.set_padding(style.DEFAULT_SPACING, 0) + + if text_maxlen > 0: + self._label.set_max_width_chars(text_maxlen) + self._label.set_ellipsize(pango.ELLIPSIZE_MIDDLE) + vbox.pack_start(self._label, False) self._secondary_box = gtk.VBox()