[Sugar-devel] [HARMONIC] Harmonic Distribution v0.3 TODO

2012-04-18 Thread Aleksey Lim
Hi all!

TODO for Harmonic Distribution v0.3 was improved. Right now, it is:


http://wiki.sugarlabs.org/go/Platform_Team/Harmonic_Distribution/1.0/Todo#0.2

http://wiki.sugarlabs.org/go/Platform_Team/Harmonic_Distribution/1.0/Todo#0.3

The roadmap is to have v0.3 before the June:

http://wiki.sugarlabs.org/go/Platform_Team/Harmonic_Distribution/1.0/Roadmap

Any comments are welcome, especially from people who are 
willing/already-take-part
to help Puno deployment pilot.

-- 
Aleksey
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ASLO] Release Paint-42

2012-04-18 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4082

Sugar Platform:
0.86 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27979/paint-42.xo

Release notes:
Add color picker icon (Manuel Quiñones)
Implement pick tool - SL #3107
Use FontComboBox, allow the user preview the font in the combo.
Updated translations


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ASLO] Release Memorize-40

2012-04-18 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4063

Sugar Platform:
0.82 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27980/memorize-40.xo

Release notes:
Add combos to enable the user to change the font used in the cards. (Flavio 
Danesse, Ariel Calzada, Gonzalo Odiard)
Updated translations


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Draw accelerator in Palette SL #3459

2012-04-18 Thread Simon Schampijer
The accelerator in the primary information in the Palette
has not been drawn because there was not enough space
reserved for it. The preferred size we get back for the
Palette window does not include the accelerator of the
Gtk.AccelLabel. We need to include that in our calculation for
the Palette size.

In order to make that information available which is part
of the Palette class we need to pass the instance to the
PaletteWindowWidget instance.

Signed-off-by: Simon Schampijer 
---
 src/sugar3/graphics/palette.py   |   15 +--
 src/sugar3/graphics/palettewindow.py |   14 --
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py
index 1f95c11..4bb72ce 100644
--- a/src/sugar3/graphics/palette.py
+++ b/src/sugar3/graphics/palette.py
@@ -301,7 +301,7 @@ class Palette(PaletteWindow):
 or isinstance(self._widget, _PaletteWindowWidget)
 
 if self._widget is None:
-self._widget = _PaletteWindowWidget()
+self._widget = _PaletteWindowWidget(self)
 self._setup_widget()
 
 self._palette_box = Gtk.VBox()
@@ -327,16 +327,11 @@ class Palette(PaletteWindow):
 self._update_accept_focus()
 self._update_separators()
 
-def do_get_preferred_width(self):
-minimum, natural = PaletteWindow.do_get_preferred_width(self)
-
+def get_label_width(self):
 # Gtk.AccelLabel request doesn't include the accelerator.
-label_width = self._label_alignment.size_request()[0] + \
-  self._label.get_accel_width() + \
-  2 * self.get_border_width()
-
-width = max(minimum, label_width, self._full_request[0])
-return width, width
+label_width = self._label_alignment.get_preferred_width()[1] + \
+  self._label.get_accel_width()
+return label_width
 
 def _update_separators(self):
 visible = self._content.get_children()
diff --git a/src/sugar3/graphics/palettewindow.py 
b/src/sugar3/graphics/palettewindow.py
index 7785d10..8bd2bed 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -239,9 +239,10 @@ class _PaletteWindowWidget(Gtk.Window):
 'leave-notify': (GObject.SignalFlags.RUN_FIRST, None, ([])),
 }
 
-def __init__(self):
+def __init__(self, palette=None):
 Gtk.Window.__init__(self)
 
+self._palette = palette
 self.set_decorated(False)
 self.set_resizable(False)
 self.set_position(Gtk.WindowPosition.NONE)
@@ -270,11 +271,12 @@ class _PaletteWindowWidget(Gtk.Window):
 self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
 
 def do_get_preferred_width(self):
-size = 0
-child = self.get_child()
-if child:
-minimum_size, natural_size = child.get_preferred_width()
-size = max(minimum_size, natural_size, style.GRID_CELL_SIZE * 2)
+minimum, natural = Gtk.Window.do_get_preferred_width(self)
+label_width = 0
+if self._palette is not None:
+label_width = self._palette.get_label_width()
+size = max(natural, label_width + 2 * self.get_border_width(),
+   style.GRID_CELL_SIZE * 2)
 return size, size
 
 def do_size_allocate(self, allocation):
-- 
1.7.7.6

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Draw border for palette all the time SL #3383

2012-04-18 Thread Simon Schampijer
gtk_render_frame_gap [1] does expect an initial and an end
coordinate for the gap. paint_box_gap [2] which we used
before expected a starting position of the gap and the width
of the gap as parameter.

The patch does calculate the end coordinate parameter for
the gap from the initial coordinate and the width of the
gap.

Signed-off-by: Simon Schampijer 

[1] 
http://developer.gnome.org/gtk3/3.0/GtkStyleContext.html#gtk-render-frame-gap
[2] http://developer.gnome.org/gtk/2.24/GtkStyle.html#gtk-paint-box-gap
---
 src/sugar3/graphics/palettewindow.py |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar3/graphics/palettewindow.py 
b/src/sugar3/graphics/palettewindow.py
index 8bd2bed..449f550 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -331,7 +331,7 @@ class _PaletteWindowWidget(Gtk.Window):
 context.add_class('toolitem')
 if gap:
 Gtk.render_frame_gap(context, cr, 0, 0, allocation.width, 
allocation.height,
- gap[0], gap[1], gap[2])
+ gap[0], gap[1], gap[1] + gap[2])
 else:
 Gtk.render_frame(context, cr, 0, 0, allocation.width, 
allocation.height)
 return False
@@ -1025,7 +1025,7 @@ class WidgetInvoker(Invoker):
 Gtk.render_frame_gap(context, cr, 0, 0,
  allocation.width,
  allocation.height,
- gap[0], gap[1], gap[2])
+ gap[0], gap[1], gap[1] + gap[2])
 
 def __enter_notify_event_cb(self, widget, event):
 self.notify_mouse_enter()
-- 
1.7.7.6

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Prevent handling network devices twice (OLPC#11782)

2012-04-18 Thread Simon Schampijer

Thanks for the patch, looks good. Please push.

Regards,
   Simon

On 04/16/2012 11:28 PM, Daniel Drake wrote:

Due to the asynchronous way that dbus works, it is possible to
receive a network device listed in the initial GetDevices call,
and as a DeviceAdded signal, if the device appears during Sugar
initialisation.

Check to see that a device is really new before processing it.
Fixes a case seen by Manuel and me where two network device
icons appear.

Signed-off-by: Daniel Drake
---
  extensions/deviceicon/network.py |3 +++
  src/jarabe/desktop/meshbox.py|5 +
  2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py
index 09a3abb..96713fb 100644
--- a/extensions/deviceicon/network.py
+++ b/extensions/deviceicon/network.py
@@ -1020,6 +1020,9 @@ class NetworkManagerObserver(object):
  logging.error('Failed to get devices: %s', err)

  def _check_device(self, device_op):
+if device_op in self._devices:
+return
+
  nm_device = self._bus.get_object(network.NM_SERVICE, device_op)
  props = dbus.Interface(nm_device, dbus.PROPERTIES_IFACE)

diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 0d0c9c1..20dc413 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -350,6 +350,8 @@ class NetworkManagerObserver(object):

  device_type = props.Get(network.NM_DEVICE_IFACE, 'DeviceType')
  if device_type == network.NM_DEVICE_TYPE_WIFI:
+if device_o in self._devices:
+return
  self._devices[device_o] = DeviceObserver(device)
  self._devices[device_o].connect('access-point-added',
  self.__ap_added_cb)
@@ -358,6 +360,8 @@ class NetworkManagerObserver(object):
  if self._have_adhoc_networks:
  self._box.add_adhoc_networks(device)
  elif device_type == network.NM_DEVICE_TYPE_OLPC_MESH:
+if device_o == self._olpc_mesh_device_o:
+return
  self._olpc_mesh_device_o = device_o
  self._box.enable_olpc_mesh(device)

@@ -378,6 +382,7 @@ class NetworkManagerObserver(object):

  if self._olpc_mesh_device_o == device_o:
  self._box.disable_olpc_mesh(device_o)
+self._olpc_mesh_device_o = None

  def __ap_added_cb(self, device_observer, access_point):
  self._box.add_access_point(device_observer.device, access_point)


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar] Fix shortcut for view source

2012-04-18 Thread Simon Schampijer

On 04/16/2012 04:02 PM, Sascha Silbe wrote:

Excerpts from Simon Schampijer's message of 2012-04-16 10:42:39 +0200:

[extensions/globalkey/viewsource.py]

-BOUND_KEYS = ['0xEC', 'v']
+BOUND_KEYS = ['XF86KbdLightOnOff', 'v']


Is "Keyboard light on/off" really a key that we want to trigger View
Source? Maybe it's what current OLPC images call the key, but that's
fixable.

If upstream (Linux) really is averse to adding a new definition for the
"gear" key, the following existing one [1] sounds like a better fit:

KEY_PROPS ("Display the properties of the current document" [2])


That key would be better mapped to opening the Journal details view (for
the current activity session), but if there's really push-back from the
input subsystem maintainers, it would be a reasonable compromise.

Sascha

[1] 
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=include/linux/input.h;hb=HEAD
[2] https://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf (section 15.16)


I guess 'XF86WebCam' for 'open_search' or 'XF86MenuKB' for the 'frame' 
is not much better [1]. Not saying that those are good names but if you 
want to have proper names you should change them all, but...


This is only a temporary solution. See [2] and [3] for using 
gtk_accelerator_parse() or its more flexible variant 
gtk_accelerator_parse_with_keycode() when we port the shell.


Hope that makes it clearer,
   Simon

[1] 
http://git.sugarlabs.org/sugar/mainline/commit/26df35b0c02881864d0f47782f8ff5b5ce5e187c

[2] https://bugzilla.gnome.org/show_bug.cgi?id=672950#c1
[3] http://bugs.sugarlabs.org/ticket/3412
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar] Don't treat SSID as UTF-8 character sequence (fixes SL#2023)

2012-04-18 Thread Simon Schampijer

On 04/17/2012 11:42 PM, Martin Langhoff wrote:

On Mon, Apr 16, 2012 at 3:33 AM, Simon Schampijer  wrote:

Thanks for the patch, looks good. I tested here with my AP that does
announce in non utf-8 char and it works fine.


Cool! Great stuff.

What does your funny-chars AP read like in the UI with this patch?


It displays the correct characters, the non ascii ones in non utf-8 
format. Before Sugar was not able to display it, the Palette text was 
empty and you could not connect to it (dbus error).



We have the short term fix, and now the long term fix is landing. Aye.


And when we port the shell we can use the solution offered by nm-lib, so 
we are well equipped.



About the nulls in the middle of the ESSID -- I hope that the kernel
drivers know how to handle ESSIDs internally (hopefully using an array
of bytes instead of a null-terminated string).

Userland, OTOH, will be more prone to problems with nulls I suspect.
The ESSID will come from a a config file (where usually nulls are not
supported), or from a cmdline parameter, where's C-style string
handling will have trouble with the nulls.




m


I hope so, too :/

Regards,
   Simon
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-18 Thread Manuel Quiñones
There was code in Browse to create a SQlite database under data
directory in the activity profile.  This was for creating a cookie to
authenticate the laptop in a schoolserver.

I have moved the database creation to a new function, that is called
before the one that adds the cookie for the schoolserver.

The database is being attached to the WebKit session so the cookies
are stored there, in a Mozilla compatible SQLite format.

The code is based in Epiphany, embed/ephy-embed-single.c .

Signed-off-by: Manuel Quiñones 
---
 webactivity.py |   63 ++-
 1 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/webactivity.py b/webactivity.py
index aadc29a..db0ba97 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -28,6 +28,7 @@ from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import GdkPixbuf
 from gi.repository import WebKit
+from gi.repository import SoupGNOME
 
 import base64
 import time
@@ -58,6 +59,7 @@ PROFILE_VERSION = 2
 _profile_version = 0
 _profile_path = os.path.join(activity.get_activity_root(), 'data/gecko')
 _version_file = os.path.join(_profile_path, 'version')
+_cookies_db_path = os.path.join(_profile_path, 'cookies.sqlite')
 
 if os.path.exists(_version_file):
 f = open(_version_file)
@@ -76,12 +78,42 @@ if _profile_version < PROFILE_VERSION:
 f.close()
 
 
+def _create_cookies_database():
+"""Creates a SQlite database to store cookies.
+
+Cookies are stored in the Mozilla format.
+
+"""
+try:
+cookies_db = sqlite3.connect(_cookies_db_path)
+cursor = cookies_db.cursor()
+cursor.execute('''CREATE TABLE IF NOT EXISTS
+   moz_cookies
+   (id INTEGER PRIMARY KEY,
+name TEXT,
+value TEXT,
+host TEXT,
+path TEXT,
+expiry INTEGER,
+lastAccessed INTEGER,
+isSecure INTEGER,
+isHttpOnly INTEGER)''')
+cookies_db.commit()
+cookies_db.close()
+except sqlite3.Error:
+_logger.exception('Could not create cookies database')
+
+
 def _seed_xs_cookie():
-''' Create a HTTP Cookie to authenticate with the Schoolserver
-'''
+"""Create a HTTP Cookie to authenticate with the Schoolserver.
+
+Do nothing if the laptop is not registered with Schoolserver, or
+if the cookie already exists.
+
+"""
 client = GConf.Client.get_default()
 backup_url = client.get_string('/desktop/sugar/backup_url')
-if not backup_url:
+if backup_url == '':
 _logger.debug('seed_xs_cookie: Not registered with Schoolserver')
 return
 
@@ -92,23 +124,9 @@ def _seed_xs_cookie():
 cookie_data = {'color': profile.get_color().to_string(),
'pkey_hash': sha1(pubkey).hexdigest()}
 
-db_path = os.path.join(_profile_path, 'cookies.sqlite')
 try:
-cookies_db = sqlite3.connect(db_path)
+cookies_db = sqlite3.connect(_cookies_db_path)
 c = cookies_db.cursor()
-
-c.execute('''CREATE TABLE IF NOT EXISTS
- moz_cookies
- (id INTEGER PRIMARY KEY,
-  name TEXT,
-  value TEXT,
-  host TEXT,
-  path TEXT,
-  expiry INTEGER,
-  lastAccessed INTEGER,
-  isSecure INTEGER,
-  isHttpOnly INTEGER)''')
-
 c.execute('''SELECT id
  FROM moz_cookies
  WHERE name=? AND host=? AND path=?''',
@@ -167,9 +185,16 @@ class WebActivity(activity.Activity):
 
 _logger.debug('Starting the web activity')
 
+_create_cookies_database()
+_seed_xs_cookie()
+
 session = WebKit.get_default_session()
 session.set_property('accept-language-auto', True)
 
+# Attach the cookies database to the web session:
+jar = SoupGNOME.CookieJarSqlite.new(_cookies_db_path, False)
+session.add_feature(jar)
+
 # FIXME
 # downloadmanager.remove_old_parts()
 
@@ -177,8 +202,6 @@ class WebActivity(activity.Activity):
 self._tabbed_view = TabbedView()
 self._tabbed_view.connect('focus-url-entry', self._on_focus_url_entry)
 
-_seed_xs_cookie()
-
 # HACK
 # Currently, the multiple tabs feature crashes the Browse activity
 # on cairo versions 1.8.10 or later. The exact cause for this
-- 
1.7.7.6

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Python-DBUS problem

2012-04-18 Thread Alan Jhonn Aguiar Schwyn


Hi,
Yesterday, I update my Ubuntu to 12.04.
When make it, appears a error with sugar. When I try usethe TurtleArt activity 
give this error:
Traceback (most recent call last):  File "/usr/bin/sugar-activity", line 21, in 
main.main()  File 
"/usr/lib/python2.7/dist-packages/sugar/activity/main.py", line 121, in main
module = __import__(module_name)  File 
"/home/alan/Activities/TurtleBots.activity/TurtleArtActivity.py", line 68, in 
from TurtleArt.tacollaboration import Collaboration  File 
"/home/alan/Activities/TurtleBots.activity/TurtleArt/tacollaboration.py", line 
23, in from dbus.gobject_service import ExportedGObject  File 
"/usr/lib/python2.7/dist-packages/dbus/gobject_service.py", line 27, in 
from gi.repository import GObject as gobject  File 
"/usr/lib/python2.7/dist-packages/gi/__init__.py", line 23, in from 
._gi import _API, RepositoryImportError: could not import gobject (error was: 
ImportError('When using gi.repository you must not import static modules like 
"gobject". Please change all occurrences of "import gobject" to "from 
gi.repository import GObject".',))
The problem: a new python-dbus library.In Oneiric, I have the  Python dbus 
0.84.0-2.With the new Ubuntu, it install: 1.0.0-1 and giveme that problem..
Downgrading the version of 1.0.0-1 to 0.84.0-2 (manually) the problem is 
solved..
Someone know more about this? The ideal was the new library works good with all 
oldcodes..
Regards!
alan




  ___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel