[Sugar-devel] [PATCH toolkit-gtk3] IconEntry, set_icon_from_name: handle case when icon can not be found cleanly
From: Simon Schampijer Sugar crashes if the sugar theme has not been set (in sugar-session) in the set_icon_from_name method since some if the requested icons can not be found. Handle that case cleanly. Signed-off-by: Simon Schampijer --- src/sugar3/graphics/iconentry.py | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/sugar3/graphics/iconentry.py b/src/sugar3/graphics/iconentry.py index 154dfd0..f64fa5f 100644 --- a/src/sugar3/graphics/iconentry.py +++ b/src/sugar3/graphics/iconentry.py @@ -15,6 +15,8 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. +import logging + from gi.repository import GObject from gi.repository import Gtk from gi.repository import Gdk @@ -42,6 +44,10 @@ class IconEntry(Gtk.Entry): icon_info = icon_theme.lookup_icon(name, Gtk.IconSize.SMALL_TOOLBAR, 0) +if not icon_info: +logging.warning('IconEntry set_icon_from_name: icon %s not ' +'found in the theme.', name) +return if icon_info.get_filename().endswith('.svg'): loader = _SVGLoader() -- 1.7.11.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [Sugar-desarrollo] Update images of "Switch desktop" - Actualizar Imagenes de "Cambiar Escritorio"
Should be good show in the Gnome preview image, one application open, may be the web browser. Can you prepare both images? *Spanish* Seria bueno que la imagen de Gnome tenga alguna aplicacion abierta, por ejemplo el navegador. Podes preparar las imagenes? Gonzalo On Sun, Sep 16, 2012 at 11:25 AM, Ignacio Rodríguez wrote: > For the GNOME comes many varying versions. Therefore I propose that > actualizen images. The Gnome 2.32 is not the same as Fedora 17. If someone > does not understand what I explain in pictures: > [1] to [2] > *Spanish * > Desde hace muchas versiones el GNOME viene variando. Por lo cual propongo > que se actualizen las imagenes. El Gnome 2.32 no es el mismo que el de > Fedora 17. Si alguien no entiende lo explico en imagenes: > [1] pasa a [2] > > [1] : http://wiki.sugarlabs.org/images/b/b0/After_Switch.png > [2] : http://wiki.sugarlabs.org/images/4/4b/Before_Switch.png > > Saludos > > > -- > Juan Ignacio Rodríguez > CeibalJAM! > Activity Central > ___ > Sugar-Desarrollo mailing list > sugar-desarro...@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-desarrollo > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH Browse] Cancel a download if space is very tight SL #394
It checks if there will be more than MIN_DISKFREE_AFTER_DOWNLOAD (20Mb) after downloading the file. If not, Browse will cancel the download process before starting it and an Alert will be shown to the user to inform this situation. Signed-off-by: Manuel Kaufmann --- downloadmanager.py | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/downloadmanager.py b/downloadmanager.py index 9950c16..b3d4feb 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -35,6 +35,8 @@ DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' DS_DBUS_PATH = '/org/laptop/sugar/DataStore' +MIN_DISKFREE_AFTER_DOWNLOAD = 20 * 1024 * 1024 + _active_downloads = [] _dest_to_window = {} @@ -55,6 +57,11 @@ def remove_all_downloads(): download.cleanup() +def free_space(path): +s = os.statvfs(path) +return s.f_bavail * s.f_frsize + + class Download(object): def __init__(self, download, browser): self._download = download @@ -84,8 +91,26 @@ class Download(object): os.close(fd) logging.debug('Download destination path: %s' % self._dest_path) -self._download.set_destination_uri('file://' + self._dest_path) -self._download.start() +# Check free space and if the downloaded file plus an extra +# space will fit on the disk. If not, cancel the download. +total_size = self._download.get_total_size() +logging.debug('Total size of the file: %s', total_size) +if free_space('/') - total_size < MIN_DISKFREE_AFTER_DOWNLOAD: +logging.debug('Download canceled because of Disk Space') +self._canceled_alert = Alert() +self._canceled_alert.props.title = _('Download canceled ' + 'because of Disk Space') +self._canceled_alert.props.msg = \ +_('%s' % self._download.get_suggested_filename()) +ok_icon = Icon(icon_name='dialog-ok') +self._canceled_alert.add_button(Gtk.ResponseType.OK, + _('Ok'), ok_icon) +ok_icon.show() +self._canceled_alert.connect('response', self.__stop_response_cb) +self._activity.add_alert(self._canceled_alert) +else: +self._download.set_destination_uri('file://' + self._dest_path) +self._download.start() def __progress_change_cb(self, download, something): progress = self._download.get_progress() -- 1.7.11.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] MEMORIZE patch for saving game state after exit and restoring last game state when the game is opened.
Hi Ariel, This patch mix many changes, not only what the title say. Please prepare a patch only with the code needed to implement this, and I will review it. If you want propose other changes, send it in different patches. Thanks Gonzalo On Fri, Sep 14, 2012 at 12:31 PM, Ariel Calzada wrote: > From: Ariel Calzada > > --- > activity.py| 88 > +--- > activity/activity.info |2 +- > cardlist.py|3 +- > createtoolbar.py |3 +- > game.py| 13 +-- > memorizetoolbar.py |5 +-- > model.py | 12 ++- > 7 files changed, 105 insertions(+), 21 deletions(-) > > diff --git a/activity.py b/activity.py > index 1fdf8ac..f967976 100644 > --- a/activity.py > +++ b/activity.py > @@ -35,9 +35,17 @@ import gtk > import telepathy > import telepathy.client > > -from sugar.activity.widgets import ActivityToolbarButton > -from sugar.activity.widgets import StopButton > -from sugar.graphics.toolbarbox import ToolbarBox > +# Toolbars > +try: > +from sugar.graphics.toolbarbox import ToolbarBox > +_have_toolbox = True > +except ImportError: > +_have_toolbox = False > + > +if _have_toolbox: > +from sugar.activity.widgets import ActivityToolbarButton > +from sugar.activity.widgets import StopButton > + > from sugar.graphics.toggletoolbutton import ToggleToolButton > from sugar.activity.activity import Activity > from sugar.presence import presenceservice > @@ -53,6 +61,7 @@ import createtoolbar > import cardlist > import createcardpanel > import face > +import time > > SERVICE = 'org.laptop.Memorize' > IFACE = SERVICE > @@ -79,8 +88,33 @@ class MemorizeActivity(Activity): > toolbar_box = ToolbarBox() > self.set_toolbar_box(toolbar_box) > > -self.activity_button = ActivityToolbarButton(self) > -toolbar_box.toolbar.insert(self.activity_button, -1) > +if _have_toolbox: > +toolbar_box = ToolbarBox() > + > +# Activity toolbar > +activity_button = ActivityToolbarButton(self) > +toolbar_box.toolbar.insert(activity_button, 0) > +activity_button.show() > + > +self.set_toolbar_box(toolbar_box) > +toolbar_box.show() > + > +# Save toolbar as attribute > +self._toolbar = toolbar_box.toolbar > + > +else: > +# Use pre-0.86 toolbar design > +games_toolbar = gtk.Toolbar() > +toolbar_box = activity.ActivityToolbox(self) > + > +self.set_toolbox(toolbar_box) > +toolbar_box.add_toolbar(_('Game'), games_toolbar) > +toolbar_box.show() > + > +toolbar_box.set_current_toolbar(1) > + > +# Save toolbar as attribute > +self._toolbar = games_toolbar > > self._memorizeToolbarBuilder = \ > memorizetoolbar.MemorizeToolbarBuilder(self) > @@ -95,18 +129,19 @@ class MemorizeActivity(Activity): > self._createToolbarBuilder = \ > createtoolbar.CreateToolbarBuilder(self) > > -separator = gtk.SeparatorToolItem() > -separator.set_expand(True) > -separator.set_draw(False) > -separator.set_size_request(0, -1) > -toolbar_box.toolbar.insert(separator, -1) > +if _have_toolbox: > +separator = gtk.SeparatorToolItem() > +separator.set_expand(True) > +separator.set_draw(False) > +separator.set_size_request(0, -1) > +self._toolbar.insert(separator, -1) > > -toolbar_box.toolbar.insert(StopButton(self), -1) > +self._toolbar.insert(StopButton(self), -1) > > # Play game mode > self.table = cardtable.CardTable() > self.scoreboard = scoreboard.Scoreboard() > -self.cardlist = cardlist.CardList() > +self.cardlist = cardlist.CardList(self) > self.createcardpanel = createcardpanel.CreateCardPanel() > self.cardlist.connect('pair-selected', > self.createcardpanel.pair_selected) > @@ -124,7 +159,7 @@ class MemorizeActivity(Activity): > self.createcardpanel.clean) > self._createToolbarBuilder.connect('create_equal_pairs', > self.change_equal_pairs) > -self.game = game.MemorizeGame() > +self.game = game.MemorizeGame(self) > > self._edit_button.connect('toggled', self._change_mode_bt) > > @@ -207,6 +242,7 @@ class MemorizeActivity(Activity): > self.game.add_buddy(self.owner) > else: > self.game.add_buddy(self.owner) > + > self.show_all() > > def _change_mode_bt(self, button): > @@ -228,12 +264,17 @@ class MemorizeActivity(Activity): >self.metadata['title'], color) > > def write_file(self, file_path): > +# Wait for graphics events finish > +self.flush_events(
Re: [Sugar-devel] [PATCH toolkit-gtk3] IconEntry, set_icon_from_name: handle case when icon can not be found cleanly
2012/9/17 Simon Schampijer : > From: Simon Schampijer > > Sugar crashes if the sugar theme has not been set (in sugar-session) > in the set_icon_from_name method since some if the requested icons > can not be found. Handle that case cleanly. Good catch Simon, yes let's handle this well. Please push. > > Signed-off-by: Simon Schampijer > --- > src/sugar3/graphics/iconentry.py | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/src/sugar3/graphics/iconentry.py > b/src/sugar3/graphics/iconentry.py > index 154dfd0..f64fa5f 100644 > --- a/src/sugar3/graphics/iconentry.py > +++ b/src/sugar3/graphics/iconentry.py > @@ -15,6 +15,8 @@ > # Free Software Foundation, Inc., 59 Temple Place - Suite 330, > # Boston, MA 02111-1307, USA. > > +import logging > + > from gi.repository import GObject > from gi.repository import Gtk > from gi.repository import Gdk > @@ -42,6 +44,10 @@ class IconEntry(Gtk.Entry): > icon_info = icon_theme.lookup_icon(name, > Gtk.IconSize.SMALL_TOOLBAR, > 0) > +if not icon_info: > +logging.warning('IconEntry set_icon_from_name: icon %s not ' > +'found in the theme.', name) > +return > > if icon_info.get_filename().endswith('.svg'): > loader = _SVGLoader() > -- > 1.7.11.4 > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel -- .. manuq .. ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH toolkit-gtk3] IconEntry, set_icon_from_name: handle case when icon can not be found cleanly
On 09/17/2012 03:42 PM, Manuel Quiñones wrote: 2012/9/17 Simon Schampijer : From: Simon Schampijer Sugar crashes if the sugar theme has not been set (in sugar-session) in the set_icon_from_name method since some if the requested icons can not be found. Handle that case cleanly. Good catch Simon, yes let's handle this well. Please push. Thanks, pushed as d4934d73a70ed98889ae3d0c64d55cdfeab86391 Simon ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [FEATURE] [DESIGN] Display Device
2012/9/14 Gary Martin : > Hi Simon, > > Just going through my sketches and raising a few older threads: > > On 21 Aug 2012, at 13:44, Simon Schampijer wrote: > >> Hi Gary, >> >> thanks for having a look! >> >> On 08/21/2012 02:34 PM, Gary Martin wrote: >>> Hi Simon, >>> >>> On 21 Aug 2012, at 12:18, Simon Schampijer wrote: >>> Hi, this Feature "Display Device" [1] has been proposed for 0.96 inclusion already but did not make it in due to time constraints. With touch the need to expose the 'take-screenshot' and 'adjust-brightness' options in the UI gets more prominent, that is why I want to propose this again for 0.98. The part for the screenshot taking was already done, that part of the patch just needs to be re-based. >>> >>> I'm not happy the design is ready yet for inclusion, some quick comments: >>> >>> - Use of the camera icon (especially in the device frame) suggests it >>> involves camera hardware. >> >> The icon is a placeholder. It should be an icon for the display. > > Have a look at [1] for some variations on the theme. > >> >>> - Is taking a screenshot really a feature that should be in the device >>> section of the frame? >> >> See below. I am happy to hear about other suggestions. At the moment I have >> no other one :/ Previous discussions did not bring something up neither [1]. > > So... two possible suggestions: > > A) I might be able to trigger a screen shot from a maliit extended key, I'm > thinking a long press of the "1" key could raise an extended palette (as used > by accents) and include a 'take screen shot' trigger key (it would just send > a regular key event up the chain to be caught further up). The current the > screen shot mechanism already hides the OSK so this could work pretty much as > the physical keyboard alt-1 does, taking a screenshot of whatever you had on > screen minus the OSK. OT: This could also be a route to use for some other > shortcuts where we have limited space to expose UI buttons (e.g. long press > of space could have a view source cog option). The one hurdle is that maliit > visible key labels == the character they trigger (except for special key > actions that need hard coded into maliit, aka the language switch key that we > need added at some point). > > B) The current screen shot feature is already something you need to be shown > or read about in the documentation i.e. not discoverable without external > help, so we would not be regressing if we made the touch screen shot trigger > something equally hidden like a long-press of the Display device icon... this > is also quite similar to how Android have it in their UI (and better than iOS > that have no visible UI for it at all, there you have to press the physical > home and off buttons simultaneously). I would prefer this one, but should the frame hide to take the pic, or should it stay? Maybe the user wants both functionalities. Then, I would also like to see an entry in the device palette to take a screen shot with a timer, say 5 seconds. Also we can discuss user feedback. Current GNOME has a visual flash (all screen blinks white) and a camera sound. >>> - The device frame is filling up fast and furious in this cycle, we >>> already need to add an icon for raising the OSK, and an icon for >>> controlling the hardware display brightness/monochrome mode. >>> - The palette shown in the screen shot is named Display. >> >> The Palette should contain as well the options for the brightness. At least >> that is what we discussed at one point. The Palette would be named something >> like 'Display', have an option for brightness and one for taking a >> screenshot. > > Brightness is certainly the primary Display device feature needing a visible > UI (especially for touch input). I've made some mockup/sketches around how > the icon and palette could look as per the discussion so far [1], [2], [3], > [4]. I like very much your candidate icon, the one centered in a frame, and the device palette "My Display" too. > Regards, > --Gary > > [1] http://wiki.sugarlabs.org/go/File:Display_device_icons.jpg > [2] http://wiki.sugarlabs.org/go/File:Display_device_location.png > [3] http://wiki.sugarlabs.org/go/File:Candidate_Display_icon.jpg > [4] http://wiki.sugarlabs.org/go/File:Mockup_Display_device_palette.jpg > >> Regards, >> Simon >> >> [1] http://lists.sugarlabs.org/archive/sugar-devel/2011-November/034372.html > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel -- .. manuq .. ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH sugar 1/2] ModalAlert ported to Gtk3
Gtk.VBox.pack_start() and Gtk.Alignment.new() fixed to run over Gtk3 Signed-off-by: Manuel Kaufmann --- src/jarabe/journal/modalalert.py | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/jarabe/journal/modalalert.py b/src/jarabe/journal/modalalert.py index 36f076e..186fd1a 100644 --- a/src/jarabe/journal/modalalert.py +++ b/src/jarabe/journal/modalalert.py @@ -56,25 +56,27 @@ class ModalAlert(Gtk.Window): icon = Icon(icon_name='activity-journal', pixel_size=style.XLARGE_ICON_SIZE, xo_color=color) -self._vbox.pack_start(icon, False) +self._vbox.pack_start(icon, expand=False, fill=False, padding=0) icon.show() self._title = Gtk.Label() self._title.modify_fg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color()) self._title.set_markup('%s' % _('Your Journal is full')) -self._vbox.pack_start(self._title, False) +self._vbox.pack_start(self._title, expand=False, fill=False, padding=0) self._title.show() self._message = Gtk.Label(label=_('Please delete some old Journal' ' entries to make space for new ones.')) self._message.modify_fg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color()) -self._vbox.pack_start(self._message, False) +self._vbox.pack_start(self._message, expand=False, + fill=False, padding=0) self._message.show() -alignment = Gtk.Alignment.new(xalign=0.5, yalign=0.5) -self._vbox.pack_start(alignment, False, True, 0) +alignment = Gtk.Alignment.new(xalign=0.5, yalign=0.5, + xscale=0.0, yscale=0.0) +self._vbox.pack_start(alignment, expand=False, fill=True, padding=0) alignment.show() self._show_journal = Gtk.Button() -- 1.7.11.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar 1/2] ModalAlert ported to Gtk3
Thanks, pushed as: 8c661997e6c54139cf98dc7149749388c91d757f There was as well the window.window -> window.get_window() missing, found with my little test: from gi.repository import Gtk from jarabe.journal.modalalert import ModalAlert def _destroy_cb(widget, data=None): Gtk.main_quit() window = ModalAlert() window.connect("destroy", _destroy_cb) window.show() Gtk.main() On 09/17/2012 06:30 PM, Manuel Kaufmann wrote: Gtk.VBox.pack_start() and Gtk.Alignment.new() fixed to run over Gtk3 Signed-off-by: Manuel Kaufmann --- src/jarabe/journal/modalalert.py | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/jarabe/journal/modalalert.py b/src/jarabe/journal/modalalert.py index 36f076e..186fd1a 100644 --- a/src/jarabe/journal/modalalert.py +++ b/src/jarabe/journal/modalalert.py @@ -56,25 +56,27 @@ class ModalAlert(Gtk.Window): icon = Icon(icon_name='activity-journal', pixel_size=style.XLARGE_ICON_SIZE, xo_color=color) -self._vbox.pack_start(icon, False) +self._vbox.pack_start(icon, expand=False, fill=False, padding=0) icon.show() self._title = Gtk.Label() self._title.modify_fg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color()) self._title.set_markup('%s' % _('Your Journal is full')) -self._vbox.pack_start(self._title, False) +self._vbox.pack_start(self._title, expand=False, fill=False, padding=0) self._title.show() self._message = Gtk.Label(label=_('Please delete some old Journal' ' entries to make space for new ones.')) self._message.modify_fg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color()) -self._vbox.pack_start(self._message, False) +self._vbox.pack_start(self._message, expand=False, + fill=False, padding=0) self._message.show() -alignment = Gtk.Alignment.new(xalign=0.5, yalign=0.5) -self._vbox.pack_start(alignment, False, True, 0) +alignment = Gtk.Alignment.new(xalign=0.5, yalign=0.5, + xscale=0.0, yscale=0.0) +self._vbox.pack_start(alignment, expand=False, fill=True, padding=0) alignment.show() self._show_journal = Gtk.Button() ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [ASLO] Release Graph Plotter-7
Activity Homepage: http://activities.sugarlabs.org/addon/4591 Sugar Platform: 0.86 - 0.98 Download Now: http://activities.sugarlabs.org/downloads/file/28219/graph_plotter-7.xo Release notes: * Solved bug SL#3867. * Added "Command" entry. * Updated Sweetener (Now it's compatible with Sugar 0.86; key accelerator bug fixed). * 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] [DESIGN] Messages to Browse when checking free space
If Browse check before start to download the space available [1] and there are not enough space to do a safe download, what should be a good message to show to the user? May be: "Can't download the file X " "You need NN MB, delete files in the Journal and try again" Gonzalo [1] http://bugs.sugarlabs.org/ticket/394 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] Messages to Browse when checking free space
On Mon, Sep 17, 2012 at 4:57 PM, Gonzalo Odiard wrote: > If Browse check before start to download the space available [1] > and there are not enough space to do a safe download, > what should be a good message to show to the user? > > May be: > "Can't download the file X " Not specific enough > "You need NN MB, delete files in the Journal and try again" Maybe too specific? How about: Not enough space available to download (file size: NN MB; free space: NN MB). -walter > > Gonzalo > > [1] http://bugs.sugarlabs.org/ticket/394 > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] Messages to Browse when checking free space
I was thinking in a a alert with a title and a text. The first line "Can't download the file X " should be the title Gonzalo > > > May be: > > "Can't download the file X " > > Not specific enough > > > "You need NN MB, delete files in the Journal and try again" > > Maybe too specific? > > How about: > > Not enough space available to download (file size: NN MB; free > space: NN MB). > > -walter > > > > > Gonzalo > > > > [1] http://bugs.sugarlabs.org/ticket/394 > > > > ___ > > Sugar-devel mailing list > > Sugar-devel@lists.sugarlabs.org > > http://lists.sugarlabs.org/listinfo/sugar-devel > > > > > > -- > Walter Bender > Sugar Labs > http://www.sugarlabs.org > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] Messages to Browse when checking free space
--- On Mon, 9/17/12, Walter Bender wrote: > From: Walter Bender > Subject: Re: [Sugar-devel] [DESIGN] Messages to Browse when checking free > space > To: "Gonzalo Odiard" > Cc: "Manuel Kaufmann" , "Sugar-dev Devel" > , "Gary Martin" > Date: Monday, September 17, 2012, 5:14 PM > On Mon, Sep 17, 2012 at 4:57 PM, > Gonzalo Odiard > wrote: > > If Browse check before start to download the space > available [1] > > and there are not enough space to do a safe download, > > what should be a good message to show to the user? > > > > May be: > > "Can't download the file X " > > Not specific enough > > > "You need NN MB, delete files in the Journal and try > again" > > Maybe too specific? > > How about: > > Not enough space available to download (file size: NN > MB; free > space: NN MB). > > -walter I just had a random thought -- so disregard if too off-topic: is the information about 'free space', 'what is a kb' and 'how to remove a journal entry if you need to' and similar ideas around the issue of 'file size' 'MB vs KB' part of the basic or intermediate training to kids? is it part of the sugar website/wiki and should it? Or 'will these ideas be confusing to all kids or only some kids (and teachers)'. -kev ___ 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
On Mon, Sep 17, 2012 at 08:24:18AM -0300, Manuel Kaufmann wrote: > It checks if there will be more than MIN_DISKFREE_AFTER_DOWNLOAD (20Mb) > after downloading the file. If not, Browse will cancel the download > process before starting it and an Alert will be shown to the user to > inform this situation. ... > @@ -84,8 +91,26 @@ class Download(object): > os.close(fd) > logging.debug('Download destination path: %s' % self._dest_path) > > -self._download.set_destination_uri('file://' + self._dest_path) > -self._download.start() > +# Check free space and if the downloaded file plus an extra > +# space will fit on the disk. If not, cancel the download. > +total_size = self._download.get_total_size() > +logging.debug('Total size of the file: %s', total_size) > +if free_space('/') - total_size < MIN_DISKFREE_AFTER_DOWNLOAD: '/' might not be the filesystem that the download is going to, could you use the path to the file instead? That way, if we ever use a separate filesystem for user files your code won't need another fix. > +logging.debug('Download canceled because of Disk Space') > +self._canceled_alert = Alert() > +self._canceled_alert.props.title = _('Download canceled ' > + 'because of Disk Space') Cancelled because of what exactly about disk space? Too much, too little, wrong colour? ;-) I've no other comments about the patch. -- James Cameron http://quozl.linux.org.au/ ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-artwork][DESIGN][PROPOSAL] Use the same style as Browse in all GtkNotebooks
Awesome Daniel, thank you very much for your patch, looks great. Comments below: 2012/9/16 Daniel Francis : > BrowseNotebook is already used in Terminal and Browse, let's set it as the > default GtkNotebook style. > > Signed-off-by: Daniel Francis > --- > gtk3/theme/gtk-widgets.css.em | 26 +- > 1 file changed, 9 insertions(+), 17 deletions(-) > > diff --git a/gtk3/theme/gtk-widgets.css.em b/gtk3/theme/gtk-widgets.css.em > index 9059b49..c2351f0 100644 > --- a/gtk3/theme/gtk-widgets.css.em > +++ b/gtk3/theme/gtk-widgets.css.em > @@ -297,36 +297,28 @@ GtkComboBox .separator { > } > > .notebook tab { > -background-color: @button_grey; > -color: @white; > -} > - > -.notebook tab:active { > -background-color: @selection_grey; > -} > - > -/* Browse notebook */ > - > -BrowseNotebook.notebook tab { > background-color: @selection_grey; > +color: @white; > } > > -BrowseNotebook.notebook tab GtkLabel { > +.notebook tab GtkLabel { > color: @white; > } For the label in the tab we will need to add some padding to get the tab height to the right size when the tabs have no buttons. We'll have to play with the calculations until we reach the same height as with buttons (like in Browse and Terminal gtk3). You can see that currently the tab enlarges vertically to fit the close button. I think we can do that in a separate patch, so I added this ticket to follow up: http://bugs.sugarlabs.org/ticket/3923 > > -BrowseNotebook.notebook tab .button { > -border-radius: $(toolbutton_padding)px; > +.notebook tab:active { > +background-color: @toolbar_grey; > } > > -BrowseNotebook.notebook tab:active { > -background-color: @toolbar_grey; > +.notebook tab .button { > +border-radius: $(toolbutton_padding)px; > } > > -BrowseNotebook.notebook tab:active *:active { > +.notebook tab:active *:active { > color: @white; > } I removed that rule and nothing broke :P I think we are safe removing it, as it was there to override the *:active {} global rule already removed. > +/* Browse Widgets */ > + > BrowseLinkInfo { > color: @white; > } We don't have that BrowseLinkInfo class in Browse anymore so I'll remove it too, adding it to the commit message. We will also need to style the background color for the buttons in mouse over (:prelight state) and when they are clicked/tapped (:active state maybe?) I attach a patch with the modifications above. Thanks again! > -- > 1.7.11.4 > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel -- .. manuq .. 0001-Use-the-same-style-as-Browse-in-all-GtkNotebooks-SL-.patch Description: Binary data ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] Messages to Browse when checking free space
On 17 Sep 2012, at 22:14, Walter Bender wrote: > On Mon, Sep 17, 2012 at 4:57 PM, Gonzalo Odiard wrote: >> If Browse check before start to download the space available [1] >> and there are not enough space to do a safe download, >> what should be a good message to show to the user? >> >> May be: >> "Can't download the file X " > > Not specific enough > >> "You need NN MB, delete files in the Journal and try again" > > Maybe too specific? > > How about: > > Not enough space available to download (file size: NN MB; free > space: NN MB). How about: Title: Not enough space to download Text: Download X requires XX MB of free space, only XX MB is available Regards, --Gary > -walter > >> >> Gonzalo >> >> [1] http://bugs.sugarlabs.org/ticket/394 >> >> ___ >> Sugar-devel mailing list >> Sugar-devel@lists.sugarlabs.org >> http://lists.sugarlabs.org/listinfo/sugar-devel >> > > > > -- > Walter Bender > Sugar Labs > http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-artwork][DESIGN][PROPOSAL] Use the same style as Browse in all GtkNotebooks
2012/9/17 Manuel Quiñones : > I attach a patch with the modifications above. Thanks again! Thanks to you, Manu! I'm starting to understand css. What I did is only rename BrowseNotebook to .notebook or if both types exist, mix their rules without know always what are that rules doing and without look at the Browse sources. I think the Gtk theme styling could replace lots of lines of Python code at activities (also sugar toolkit) for provide children the Sugar typical appearance. Specially for "sugarized" applications. Cheers. ~danielf P.S I added myself to the cc list at the bug ticket. ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-artwork][DESIGN][PROPOSAL] Use the same style as Browse in all GtkNotebooks
2012/9/17 S. Daniel Francis : > 2012/9/17 Manuel Quiñones : >> I attach a patch with the modifications above. Thanks again! > Thanks to you, Manu! > > I'm starting to understand css. What I did is only rename > BrowseNotebook to .notebook or if both types exist, mix their rules > without know always what are that rules doing and without look at the > Browse sources. > > I think the Gtk theme styling could replace lots of lines of Python > code at activities (also sugar toolkit) for provide children the Sugar > typical appearance. Specially for "sugarized" applications. Yes Dani, that's the idea, make the styling in the theme once and for all, instead of setting backgrounds and alignments in the code. And your terrific patch helps to do it for the notebooks. Thanks! -- .. manuq .. ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH sugar] Fix screenshot extension, port to cairo - SL #3906
1. API fix, Gdk.Window now has get_width() and get_height(), not get_size(). 2. Use cairo to make the screenshot: paint the window surface in a new surface and then save it as png to the path that will be provided to the datastore. 3. Use the same cairo code as in the toolkit-gtk3 to make a preview of the screenshot surface, store it as an array of bytes. Signed-off-by: Manuel Quiñones --- extensions/globalkey/screenshot.py | 53 ++ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/extensions/globalkey/screenshot.py b/extensions/globalkey/screenshot.py index d5b88ea..5abf15b 100644 --- a/extensions/globalkey/screenshot.py +++ b/extensions/globalkey/screenshot.py @@ -18,6 +18,8 @@ import os import tempfile from gettext import gettext as _ +import StringIO +import cairo from gi.repository import Gtk from gi.repository import Gdk @@ -38,15 +40,15 @@ def handle_key_press(key): os.close(fd) window = Gdk.get_default_root_window() -width, height = window.get_size() -x_orig, y_orig = window.get_origin() +width, height = window.get_width(), window.get_height() -screenshot = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, has_alpha=False, -bits_per_sample=8, width=width, -height=height) -screenshot.get_from_drawable(window, window.get_colormap(), x_orig, -y_orig, 0, 0, width, height) -screenshot.save(file_path, 'png') +window_cr = Gdk.cairo_create(window) +window_surface = window_cr.get_target() +screenshot_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) +cr = cairo.Context(screenshot_surface) +cr.set_source_surface(window_surface) +cr.paint() +screenshot_surface.write_to_png(file_path) client = GConf.Client.get_default() color = client.get_string('/desktop/sugar/user/color') @@ -79,7 +81,7 @@ def handle_key_press(key): jobject.metadata['title'] = title jobject.metadata['keep'] = '0' jobject.metadata['buddies'] = '' -jobject.metadata['preview'] = _get_preview_data(screenshot) +jobject.metadata['preview'] = _get_preview_data(screenshot_surface) jobject.metadata['icon-color'] = color jobject.metadata['mime_type'] = 'image/png' jobject.file_path = file_path @@ -89,14 +91,31 @@ def handle_key_press(key): del jobject -def _get_preview_data(screenshot): -preview = screenshot.scale_simple(style.zoom(300), style.zoom(225), - GdkPixbuf.InterpType.BILINEAR) -preview_data = [] +def _get_preview_data(screenshot_surface): +screenshot_width = screenshot_surface.get_width() +screenshot_height = screenshot_surface.get_height() -def save_func(buf, data): -data.append(buf) +preview_width, preview_height = style.zoom(300), style.zoom(225) +preview_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, + preview_width, preview_height) +cr = cairo.Context(preview_surface) -preview.save_to_callback(save_func, 'png', user_data=preview_data) +scale_w = preview_width * 1.0 / screenshot_width +scale_h = preview_height * 1.0 / screenshot_height +scale = min(scale_w, scale_h) -return dbus.ByteArray(''.join(preview_data)) +translate_x = int((preview_width - (screenshot_width * scale)) / 2) +translate_y = int((preview_height - (screenshot_height * scale)) / 2) + +cr.translate(translate_x, translate_y) +cr.scale(scale, scale) + +cr.set_source_rgba(1, 1, 1, 0) +cr.set_operator(cairo.OPERATOR_SOURCE) +cr.paint() +cr.set_source_surface(screenshot_surface) +cr.paint() + +preview_str = StringIO.StringIO() +preview_surface.write_to_png(preview_str) +return dbus.ByteArray(preview_str.getvalue()) -- 1.7.11.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Issues i have found in os2
Hello! I have a strange problem.I use the command "copy-nand" to install the image but at the end says: "Error writing to NAND FLASH" I try twice and get the same error.. Now, I use "21018o0.img" and have the same problem! I try with the "21018o0.img" and his respective "fs.zip" (using the 4 game-keys buttons) and works! I'm making something wrong? Someone have a similar problem with "copy-nand" ?? This is an old XO-1 (SKU 1) with firmware Q2F13 Regards! Alan Date: Fri, 14 Sep 2012 13:45:14 -0300 From: gonz...@laptop.org To: si...@schampijer.de; ma...@laptop.org; sugar-devel@lists.sugarlabs.org Subject: [Sugar-devel] Issues i have found in os2 First, congrats by the port, is a huge mass of work. I know is early, but I report here a few issues I have found, just if is useful to you: * Palettes in speak and speech don't show. * Palette in central kid icon in the home does not show at times.* In the control panel, Power, Keyboard, Network and Software Update panel does not work.* In the control panel, Language,Switch Desktop panel reset sugar! * In the control panel, Modem panel is bigger than expected* The home is unresponsive at times, in the log there are many errors: favoritesview.py line 210: Expected Gtk.TargetList, but got list Touch stop working in my system at times, and I need restart the XO,was happening with the last images, anybody else see this issue? Gonzalo ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel