[Sugar-devel] [PATCH] ActivityListPalette: fix displaying of Palette

2012-09-12 Thread Simon Schampijer
From: Simon Schampijer si...@laptop.org

- uncommented some code that was commented by mistake
- listen to the destroy signal of the menu for doing the
  cleanup: the structure of Palettes has changed. The
  Palette is either a Gtk.Menu or a Gtk.Window which is
  encapsulated in the Palette class, in this case the
  Palette contains a Gtk.Menu and we can listen on it
  for the destroy signal.

To display the Palette this patch depends on the CellrendererInvoker
fixup patch for the toolkit.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/jarabe/desktop/activitieslist.py | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/jarabe/desktop/activitieslist.py 
b/src/jarabe/desktop/activitieslist.py
index 8958d60..ab62b58 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -283,8 +283,6 @@ class CellRendererActivityIcon(CellRendererIcon):
 self._tree_view = tree_view
 
 def create_palette(self):
-pass
-'''
 model = self._tree_view.get_model()
 row = model[self.props.palette_invoker.path]
 bundle_id = row[ListModel.COLUMN_BUNDLE_ID]
@@ -293,7 +291,7 @@ class CellRendererActivityIcon(CellRendererIcon):
 palette = ActivityListPalette(registry.get_bundle(bundle_id))
 palette.connect('erase-activated', self.__erase_activated_cb)
 return palette
-'''
+
 def __erase_activated_cb(self, palette, bundle_id):
 self.emit('erase-activated', bundle_id)
 
@@ -417,7 +415,7 @@ class ActivityListPalette(ActivityPalette):
 self.__activity_changed_cb)
 self._update_favorite_item()
 
-#self.connect('destroy', self.__destroy_cb)
+self.menu.connect('destroy', self.__destroy_cb)
 
 def _add_erase_option(self, registry, activity_info):
 menu_item = MenuItem(_('Erase'), 'list-remove')
-- 
1.7.11.4

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


[Sugar-devel] [PATCH toolkit-gtk3] CellRendererInvoker: various fixups

2012-09-12 Thread Simon Schampijer
From: Simon Schampijer si...@laptop.org

- the GtkCellRenderer (which our CellRenderer derives from) is not a
  GtkWidget and therefor the 'get_display' method does not exist, we
  fallback to the default display in that case [1]
- the get_rect method should return a Gdk.Rectangle now, see other
  invokers
- check if event.mode is Gdk.CrossingMode.NORMAL to trigger a mouse
  leave see 289787e8c6cfca7781046b77b8d60a84821219ed for a similar
  case
- todo: the Palette does not go away when the mouse leaves the
  widget

[1] http://developer.gnome.org/gtk3/3.4/GtkCellRenderer.html

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/sugar3/graphics/palettewindow.py | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/sugar3/graphics/palettewindow.py 
b/src/sugar3/graphics/palettewindow.py
index 45ff543..ab7e2f2 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -400,7 +400,10 @@ class MouseSpeedDetector(GObject.GObject):
 self._state = None
 
 def _get_mouse_position(self):
-display = self.parent.get_display()
+if hasattr(self.parent, 'get_display'):
+display = self.parent.get_display()
+else:
+display = Gdk.Display.get_default()
 manager = display.get_device_manager()
 pointer_device = manager.get_client_pointer()
 screen, x, y = pointer_device.get_position()
@@ -745,7 +748,10 @@ class Invoker(GObject.GObject):
 invoker_valign = alignment[3]
 
 if self._cursor_x == -1 or self._cursor_y == -1:
-display = self.parent.get_display()
+if hasattr(self.parent, 'get_display'):
+display = self.parent.get_display()
+else:
+display = Gdk.Display.get_default()
 manager = display.get_device_manager()
 pointer_device = manager.get_client_pointer()
 screen, x, y = pointer_device.get_position()
@@ -1167,7 +1173,7 @@ class CellRendererInvoker(Invoker):
 self._release_hid = tree_view.connect('button-release-event',
   self.__button_release_event_cb)
 
-self.attach(cell_renderer)
+Invoker.attach(self, cell_renderer)
 
 def detach(self):
 Invoker.detach(self)
@@ -1186,13 +1192,14 @@ class CellRendererInvoker(Invoker):
 x = 0
 y = 0
 
-x += allocation.x
-y += allocation.y
+rect = Gdk.Rectangle()
+rect.x = x + allocation.x
+rect.y = y + allocation.y
 
-width = allocation.width
-height = allocation.height
+rect.width = allocation.width
+rect.height = allocation.height
 
-return (x, y, width, height)
+return rect
 
 def __motion_notify_event_cb(self, widget, event):
 if event.window != widget.get_bin_window():
@@ -1231,7 +1238,9 @@ class CellRendererInvoker(Invoker):
 self._tree_view.queue_draw_area(x, y, area.width, area.height)
 
 def __leave_notify_event_cb(self, widget, event):
-self.notify_mouse_leave()
+if event.mode == Gdk.CrossingMode.NORMAL:
+self.notify_mouse_leave()
+return False
 
 def __button_release_event_cb(self, widget, event):
 if event.button == 1 and self._point_in_cell_renderer(event.x,
-- 
1.7.11.4

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


[Sugar-devel] [PATCH toolkit-gtk3] Frame Device icons: Palette is not drawn at the correct position

2012-09-12 Thread Simon Schampijer
From: Simon Schampijer si...@laptop.org

We are adding the x value twice (from the allocation and from the origin)
in get_rect of the WidgetInvoker which we derive from in the FrameInvoker.
In the toolkit-gtk2 code [1] we did add the allocation.x value when
the widget does not provide its own gtk.gdk.Window (gtk.NO_WINDOW) [2]. This
is the same check we do above if the widget has a window and we set x and y
to 0 there which sounds sane enough to me.

[1] 
http://git.sugarlabs.org/sugar-toolkit/mainline/blobs/d1f68419e79376381fc2c3b111466714f044dfc0/src/sugar/graphics/palettewindow.py#line716
[2] http://www.pygtk.org/docs/pygtk/class-gtkobject.html#method-gtkobject--flags

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/sugar3/graphics/palettewindow.py | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/sugar3/graphics/palettewindow.py 
b/src/sugar3/graphics/palettewindow.py
index ab7e2f2..a4088be 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -998,24 +998,18 @@ class WidgetInvoker(Invoker):
 allocation = self._widget.get_allocation()
 window = self._widget.get_window()
 if window is not None:
-res, x, y = window.get_origin()
+res_, x, y = window.get_origin()
 else:
 logging.warning(
 Trying to position palette with invoker that's not realized.)
 x = 0
 y = 0
 
-x += allocation.x
-y += allocation.y
-
-width = allocation.width
-height = allocation.height
-
 rect = Gdk.Rectangle()
 rect.x = x
 rect.y = y
-rect.width = width
-rect.height = height
+rect.width = allocation.width
+rect.height = allocation.height
 return rect
 
 def has_rectangle_gap(self):
-- 
1.7.11.4

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


[Sugar-devel] [PATCH shell] Replace cairo.RectangleInt with Gdk.Rectangle

2012-09-12 Thread Simon Schampijer
From: Simon Schampijer si...@laptop.org

The Gdk.Rectangle is basically a cairo.RectangleInt but that way we
do not need to import the dynamic cairo bindings explicitly.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/jarabe/desktop/favoriteslayout.py | 15 +++
 src/jarabe/desktop/grid.py|  6 +++---
 src/jarabe/frame/frameinvoker.py  |  3 +--
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/jarabe/desktop/favoriteslayout.py 
b/src/jarabe/desktop/favoriteslayout.py
index 13b5095..a367ab6 100644
--- a/src/jarabe/desktop/favoriteslayout.py
+++ b/src/jarabe/desktop/favoriteslayout.py
@@ -22,7 +22,6 @@ from gettext import gettext as _
 
 from gi.repository import Gtk
 from gi.repository import Gdk
-from gi.repository import cairo
 
 from sugar3.graphics import style
 
@@ -86,7 +85,7 @@ class ViewLayout(Layout):
 y -= owner_height / 2
 
 # calculate x coordinate and create allocation
-owner_icon_allocation = cairo.RectangleInt()
+owner_icon_allocation = Gdk.Rectangle()
 owner_icon_allocation.x = (width - owner_width) / 2
 owner_icon_allocation.y = allocation.y + y
 owner_icon_allocation.width = owner_width
@@ -107,7 +106,7 @@ class ViewLayout(Layout):
 # Position the current activity below the XO icon
 # FIXME must ensure we cross into next grid cell here..
 activity_request = activity_icon.size_request()
-activity_icon_allocation = cairo.RectangleInt()
+activity_icon_allocation = Gdk.Rectangle()
 activity_icon_allocation.x = (width - activity_request.width) / 2
 activity_icon_allocation.y = owner_icon_allocation.y + owner_height
 activity_icon_allocation.width = activity_request.width
@@ -130,7 +129,7 @@ class ViewLayout(Layout):
 child_request = child.size_request()
 rect = self._grid.get_child_rect(child)
 
-child_allocation = cairo.RectangleInt()
+child_allocation = Gdk.Rectangle()
 child_allocation.x = int(round(rect.x * _CELL_SIZE))
 child_allocation.y = int(round(rect.y * _CELL_SIZE))
 child_allocation.width = child_request.width
@@ -146,7 +145,7 @@ class ViewLayout(Layout):
 def __grid_child_changed_cb(self, grid, child):
 request = child.size_request()
 rect = self._grid.get_child_rect(child)
-child_allocation = cairo.RectangleInt()
+child_allocation = Gdk.Rectangle()
 child_allocation.x = int(round(rect.x * _CELL_SIZE))
 child_allocation.y = int(round(rect.y * _CELL_SIZE))
 child_allocation.width = request.width
@@ -175,7 +174,7 @@ class SpreadLayout(ViewLayout):
 
 requisition = child.size_request()
 rect = self._grid.get_child_rect(child)
-child_allocation = cairo.RectangleInt()
+child_allocation = Gdk.Rectangle()
 child_allocation.x = int(round(rect.x * _CELL_SIZE))
 child_allocation.y = int(round(rect.y * _CELL_SIZE)) + allocation.y
 child_allocation.width = requisition.width
@@ -248,7 +247,7 @@ class RandomLayout(SpreadLayout):
x / _CELL_SIZE, y / _CELL_SIZE)
 
 rect = self._grid.get_child_rect(child)
-child_allocation = cairo.RectangleInt()
+child_allocation = Gdk.Rectangle()
 child_allocation.x = int(round(rect.x * _CELL_SIZE))
 child_allocation.y = int(round(rect.y * _CELL_SIZE)) + allocation.y
 child_allocation.width = child_requisition.width
@@ -380,7 +379,7 @@ class RingLayout(ViewLayout):
 allocation.height)
 child.size_request()
 child.set_size(icon_size)
-child_allocation = cairo.RectangleInt()
+child_allocation = Gdk.Rectangle()
 child_allocation.x = allocation.x + x
 child_allocation.y = allocation.y + y
 child_allocation.width = icon_size
diff --git a/src/jarabe/desktop/grid.py b/src/jarabe/desktop/grid.py
index aa7dce2..851c23e 100644
--- a/src/jarabe/desktop/grid.py
+++ b/src/jarabe/desktop/grid.py
@@ -19,7 +19,7 @@ import random
 
 from gi.repository import GObject
 from gi.repository import Gtk
-from gi.repository import cairo
+from gi.repository import Gdk
 
 from gi.repository import SugarExt
 
@@ -49,7 +49,7 @@ class Grid(SugarExt.Grid):
 
 def add(self, child, width, height, x=None, y=None, locked=False):
 if x is not None and y is not None:
-rect = cairo.RectangleInt()
+rect = Gdk.Rectangle()
 rect.x = x
 rect.y = y
 rect.width = width
@@ -59,7 +59,7 @@ class Grid(SugarExt.Grid):
 trials = _PLACE_TRIALS
 weight = _MAX_WEIGHT
 while trials  0 and weight:
-rect = cairo.RectangleInt()
+rect = Gdk.Rectangle()
 rect.x = 

Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Manuel Kaufmann
On Tue, Sep 11, 2012 at 10:27 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
  - During the webkit download -- most probable stage where you'll hit
 it. How does Webkit behave? Does Browse need to do anything?

I'm attaching an example that downloads a file with WebKit.

I tried it setting up a tmpfs with 1Mb as you suggested and aftert
that, I ran this script. WebKit tells us about the insufficient space
on the disk by raising the error signal. I catched it and I printed
the arguments of the signal:

'Error downloading URI code %s, detail %s: %s' % (err_code, err_detail, reason)

===  Error downloading URI code 0, detail 1: Error writing to file:
No space left on device

err_detail: 
http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitdownload.html#WebKitDownloadError

 * WEBKIT_DOWNLOAD_ERROR_DESTINATION - The download failed due to
disk write failure

I will keep taking a look at the other possibilities.

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/


download_file_with_webkit.py
Description: Binary data
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Manuel Kaufmann
On Tue, Sep 11, 2012 at 10:27 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
  - During datastore.write() -- I truly believe that the
 datastore.write() call doesn't literally make a copy of the file --
 should just create/update the hardlink and associated metadata
 (including progress bar). It is not very likely that we'll run out of
 space during this call, but it should be handled, I believe.

OK. I was taking a look at the datastore source code and I understood
that the file is copied, using the traditional way and when the copy
finishes the source file is unlinked.

Here are the source files that I took a look and how I found this:

sugar-toolkit-gtk3/src/sugar3/datastore/datastore.py L340 (def write)
   --- L316 (def _update_ds_entry)
   --- L45 (def _get_data_store)

sugar-datastore/src/carquinyol/datastore.py L242 (def update)

src/carquinyol/filestore.py L34 (def store)
   --- L215 (def start)
   --- L181 (def _copy_block)

Please, let me know if I am wrong.

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Martin Langhoff
On Wed, Sep 12, 2012 at 7:50 AM, Manuel Kaufmann humi...@gmail.com wrote:
 I'm attaching an example that downloads a file with WebKit.

 I tried it setting up a tmpfs with 1Mb as you suggested and aftert
 that, I ran this script. WebKit tells us about the insufficient space
 on the disk by raising the error signal. I catched it and I printed
 the arguments of the signal:

That's very good handling on webkit's side. And does it remove the
file? IOWs, when you get the signal, what do you see in the tmpfs? Is
there a file filling it, or has the file been removed?

cheers,



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Manuel Kaufmann
On Wed, Sep 12, 2012 at 9:21 AM, Martin Langhoff
martin.langh...@gmail.com wrote:
 That's very good handling on webkit's side. And does it remove the
 file? IOWs, when you get the signal, what do you see in the tmpfs? Is
 there a file filling it, or has the file been removed?

Oh, sorry. I forgot to mention this. The file is still there with the
size that webkit could get (in my case 904kb). Webkit didn't remove
it.

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Martin Langhoff
On Wed, Sep 12, 2012 at 8:20 AM, Manuel Kaufmann humi...@gmail.com wrote:
 OK. I was taking a look at the datastore source code and I understood
 that the file is copied, using the traditional way and when the copy
 finishes the source file is unlinked.

Ouch! I haven't reviewed the code (have to run some personal errands
today, can't dig into it as I'd like), but if you are correct, there
are two worries

 - Downloading a 100MB file needs 200MB+ free.
 - All that passing around the file to update the percentage bar is
causing pointless file copies -- if you are downloading a large file,
it is pretty screwed.

cheers,


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Martin Langhoff
On Wed, Sep 12, 2012 at 8:24 AM, Manuel Kaufmann humi...@gmail.com wrote:
 On Wed, Sep 12, 2012 at 9:21 AM, Martin Langhoff
 martin.langh...@gmail.com wrote:
 That's very good handling on webkit's side. And does it remove the
 file? IOWs, when you get the signal, what do you see in the tmpfs? Is
 there a file filling it, or has the file been removed?

 Oh, sorry. I forgot to mention this. The file is still there with the
 size that webkit could get (in my case 904kb). Webkit didn't remove
 it.

Hmmm. Ok, so it's leaving it up to the download manager code (our
browse code) to handle the remains. AIUI, Webkit will be using the
filename (or filename template) we passed it, so we know enough to
find the file and remove it in that case. We should :-)

cheers,



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394

2012-09-12 Thread Gonzalo Odiard
On Wed, Sep 12, 2012 at 9:26 AM, Martin Langhoff
martin.langh...@gmail.comwrote:

 On Wed, Sep 12, 2012 at 8:20 AM, Manuel Kaufmann humi...@gmail.com
 wrote:
  OK. I was taking a look at the datastore source code and I understood
  that the file is copied, using the traditional way and when the copy
  finishes the source file is unlinked.

 Ouch! I haven't reviewed the code (have to run some personal errands
 today, can't dig into it as I'd like), but if you are correct, there
 are two worries

  - Downloading a 100MB file needs 200MB+ free.


Yes, we need verify this.


  - All that passing around the file to update the percentage bar is
 causing pointless file copies -- if you are downloading a large file,
 it is pretty screwed.


I think the percentage is related to the metadata, no to the file size
change.

Gonzalo



 cheers,


 m
 --
  martin.langh...@gmail.com
  mar...@laptop.org -- Software Architect - OLPC
  - ask interesting questions
  - don't get distracted with shiny stuff  - working code first
  - http://wiki.laptop.org/go/User:Martinlanghoff

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


[Sugar-devel] Problem downloading a lease.sig file on an XO

2012-09-12 Thread Juan Cubillo

Hello,

Our project would like to give kids the posibility of downloading a 
lease.sig file and unlock a friends or family XO without having to 
contact our tech support team. In order to do this, I setup a public 
dropbox link to a nightly generated lease.sig file that gives the XOs 
some extra activation time.
Problem is that when an XO downloads the file, its name gets and extra 
.asc extension so it ends up as  lease.sig.asc.
Since kids will be doing this, I wanted to give them only the basic 
steps to be able to re-activate laptops: 1-Download file. 2-place it on 
an empty usb memory. 3-Conect to xo and turn on.
Re-naming the file would mean that they have to go to terminal, cd into 
the thumbdrive directory, change filename, etc... it's just way too much.


So... couple questions:
1. Is there a security problem/concern with having our project's 
lease.sig file publicly available? (we only generate activations for 
non-stolen XOs)

2. Why is the XO adding this .asc extension or how can it be avoided?

Regards,

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



Re: [Sugar-devel] Problem downloading a lease.sig file on an XO

2012-09-12 Thread Samuel Greenfeld
This might be a better question for the OLPC development lists.

On Wed, Sep 12, 2012 at 8:39 PM, Juan Cubillo jcubi...@fundacionqt.orgwrote:

 Hello,

 Our project would like to give kids the posibility of downloading a
 lease.sig file and unlock a friends or family XO without having to contact
 our tech support team. In order to do this, I setup a public dropbox link
 to a nightly generated lease.sig file that gives the XOs some extra
 activation time.
 Problem is that when an XO downloads the file, its name gets and extra
 .asc extension so it ends up as  lease.sig.asc.
 Since kids will be doing this, I wanted to give them only the basic steps
 to be able to re-activate laptops: 1-Download file. 2-place it on an empty
 usb memory. 3-Conect to xo and turn on.
 Re-naming the file would mean that they have to go to terminal, cd into
 the thumbdrive directory, change filename, etc... it's just way too much.

 So... couple questions:
 1. Is there a security problem/concern with having our project's lease.sig
 file publicly available? (we only generate activations for non-stolen XOs)


I will leave it this to deployment staff to answer authoritatively, but the
only practical attack I can think of is thieves will know where to find a
lease if a XO is not reported stolen, or before it is reported stolen.
They can then use this lease to use or sell the XO.

Theoretically it might be possible to reverse engineer your private lease
key given lots and lots of sample leases but I seriously doubt any real
thief can do that.  The mathematics skills required to do this are not
trivial.

2. Why is the XO adding this .asc extension or how can it be avoided?


Are you having the students download the lease in Browse from within
Sugar?  If so Sugar's journal internally uses mime types, not file
extensions, until a file is written to an external device or folder.  The
extension .asc is one possible choice for plain text.(*)   I was able to
reproduce this problem given this approach.

I agree that this is not the best behavior, especially if Browse can
potentially determine the original extension while downloading.

If your XO images have the GNOME desktop in them, using the web browser
included for GNOME (Firefox or Epiphany) to download the file to USB should
not alter the file name.  Just make sure the kids know how to eject the
USB stick when they are done.

(*) The .asc choice could be due to
http://bugs.sugarlabs.org/ticket/2267(also
http://bugs.sugarlabs.org/ticket/3226)


 Regards,

  - Juan Cubillo
 __**_
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.**org Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/**listinfo/sugar-develhttp://lists.sugarlabs.org/listinfo/sugar-devel

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


[Sugar-devel] [PATCH sugar-toolkit-gtk3] Style the palette menu header - SL #3879 #3836

2012-09-12 Thread Manuel Quiñones
- Make the first item of the menu a custom class, to make the children
  widget allocate using all the available space.  And so it can be
  styled in the theme.

- Remove the set_sensitive(False) from the header item, this was just
  for styling to make it look like an informational, unclickeable
  item.  But this will be done in the theme instead.

- Add a separator below the header.  Is a custom class so it can be
  styled in the theme.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 src/sugar3/graphics/palette.py | 44 +++---
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py
index 4bb72ce..8b98f9f 100644
--- a/src/sugar3/graphics/palette.py
+++ b/src/sugar3/graphics/palette.py
@@ -40,6 +40,34 @@ from sugar3.graphics.palettewindow import 
MouseSpeedDetector, Invoker, \
 WidgetInvoker, CursorInvoker, ToolInvoker, CellRendererInvoker
 
 
+class _HeaderItem(Gtk.MenuItem):
+
+A MenuItem with a custom child widget that gets all the available
+space.
+
+
+
+__gtype_name__ = 'SugarPaletteHeader'
+
+def __init__(self, widget):
+super(_HeaderItem, self).__init__()
+if self.get_child() is not None:
+self.remove(self.get_child())
+self.add(widget)
+
+def do_size_allocate(self, allocation):
+self.set_allocation(allocation)
+self.get_child().size_allocate(allocation)
+
+
+class _HeaderSeparator(Gtk.SeparatorMenuItem):
+
+__gtype_name__ = 'SugarPaletteHeaderSeparator'
+
+def __init__(self):
+super(_HeaderSeparator, self).__init__()
+
+
 class Palette(PaletteWindow):
 
 Floating palette implementation.
@@ -375,20 +403,14 @@ class Palette(PaletteWindow):
 
 self._widget = _PaletteMenuWidget()
 
-self._label_menuitem = Gtk.MenuItem()
-child = self._label_menuitem.get_child()
-if child is not None:
-self._label_menuitem.remove(child)
-self._label_menuitem.add(self._primary_box)
-
-# Mark the menuitem as insensitive so that it appears as an
-# informational element, rather than a clickable item in the menu.
-# TODO: see if we can do this better in GTK.
-self._label_menuitem.set_sensitive(False)
-
+self._label_menuitem = _HeaderItem(self._primary_box)
 self._label_menuitem.show()
 self._widget.append(self._label_menuitem)
 
+separator = _HeaderSeparator()
+self._widget.append(separator)
+separator.show()
+
 self._setup_widget()
 
 return self._widget
-- 
1.7.11.4

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


[Sugar-devel] [PATCH sugar-artwork] Style general menus and the Sugar palette menus - SL #3879

2012-09-12 Thread Manuel Quiñones
- Add bottom padding to the menu.

- Style separators in menu.

- Add exception for the header menu item of the Sugar palette,
  1. correct padding and 2. set a background color so it doesn't look
  clickeable, and look an informational header instead.

- Add exception for the first separator in the Sugar palette.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 gtk3/theme/gtk-widgets.css.em | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gtk3/theme/gtk-widgets.css.em b/gtk3/theme/gtk-widgets.css.em
index f338bc9..9059b49 100644
--- a/gtk3/theme/gtk-widgets.css.em
+++ b/gtk3/theme/gtk-widgets.css.em
@@ -419,7 +419,7 @@ SugarPaletteWindow SugarGroupBox *:insensitive {
 -GtkMenu-horizontal-offset : 0;
 -GtkMenu-vertical-offset   : 0;
 
-padding: 0px;
+padding: 0px 0px $(subcell_size)px 0px;
 border-width: 2px;
 border-color: @button_grey;
 border-style: solid;
@@ -437,6 +437,23 @@ SugarPaletteWindow SugarGroupBox *:insensitive {
 background-color: @button_grey;
 }
 
+.menuitem.separator {
+padding: $(subcell_size)px 0px;
+color: @button_grey;
+}
+
+SugarPaletteHeader.menuitem {
+padding: 0px $((subcell_size * 3 - font_height) / 2)px;
+}
+
+SugarPaletteHeader.menuitem:prelight {
+background-color: @black;
+}
+
+SugarPaletteHeaderSeparator.menuitem.separator {
+padding: 0px 0px $(subcell_size)px 0px;
+}
+
 .tooltip {
 background-color: @black;
 border-style: solid;
-- 
1.7.11.4

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


[Sugar-devel] [PATCH sugar] Increment the insert offset in the activity palette menu - SL #3879

2012-09-12 Thread Manuel Quiñones
This is to consider the added separator item below the palette header
to get the styling OK.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 src/jarabe/desktop/favoritesview.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/desktop/favoritesview.py 
b/src/jarabe/desktop/favoritesview.py
index e44a750..125637a 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -511,7 +511,7 @@ class ActivityIcon(EventIcon):
 class FavoritePalette(ActivityPalette):
 __gtype_name__ = 'SugarFavoritePalette'
 
-_PALETTE_LABEL_OFFSET = 1
+_PALETTE_LABEL_OFFSET = 2
 
 __gsignals__ = {
 'entry-activate': (GObject.SignalFlags.RUN_FIRST,
@@ -553,7 +553,8 @@ class FavoritePalette(ActivityPalette):
 separator.show()
 
 for i in range(0, len(menu_items)):
-# the first menu_item is the label so we need the offset
+# the first menu_item is the label and the second is a
+# separator so we need the offset
 self.menu.insert(menu_items[i], i + self._PALETTE_LABEL_OFFSET)
 
 def __resume_entry_cb(self, menu_item, entry):
-- 
1.7.11.4

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