<br>
I think it was bernie who mentioned the need for terminal access in some cases, which seems valid to me.<br><br>So, it allows activities too, but when it create/modify a journal entry it will activate the modal window again... From what i see in eben's comments, this modal window it is supposed to insist on unnecessary entries deletion, because is a critical moment.<br>
<br><div class="gmail_quote">On Wed, Dec 8, 2010 at 1:35 AM, Martin Abente <span dir="ltr"><<a href="mailto:martin.abente.lahaye@gmail.com">martin.abente.lahaye@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Forgot to mention, activities are allowed ;).<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Tue, Dec 7, 2010 at 9:03 PM, Gary Martin <span dir="ltr"><<a href="mailto:garycmartin@googlemail.com" target="_blank">garycmartin@googlemail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Martin,<br>
<br>
Hmmmm....<br>
<div><br>
On 7 Dec 2010, at 21:04, Martin Abente <<a href="mailto:martin.abente.lahaye@gmail.com" target="_blank">martin.abente.lahaye@gmail.com</a>> wrote:<br>
<br>
> Based on the comments from #630<br>
><br>
> When available space reaches the _PREEMPTIVE_SPACE_TRESHOLD<br>
> (75MB) a message notification will be displayed on every startup.<br>
><br>
> When available space reaches the _SPACE_TRESHOLD (50MB) the<br>
> ModalaAlert will be displayed.<br>
><br>
> Changes on the ModaAlert:<br>
><br>
> * It will remain active until there is enough available space again.<br>
> * It will be deactivated when the journal is on the foreground<br>
>  and it will be activated again otherwise.<br>
<br>
</div>So, as a coder who does use XOs for dev work, I'm stuck with this modal alert blocking my path while trying to use Terminal to access the filesystem to clean up some yum install that has got out of hand, or some git clone that's grabbed too much?<br>


<br>
Regards,<br>
--Gary<br>
<div><div></div><div><br>
> * It contains a new progressbar to determine intuitively how much<br>
>  deletion is required to reach the safe state again.<br>
> ---<br>
> src/jarabe/journal/journalactivity.py |   47 +++++++++++++++++++++++++-------<br>
> src/jarabe/journal/modalalert.py      |   28 +++++++++++++++++--<br>
> 2 files changed, 61 insertions(+), 14 deletions(-)<br>
><br>
> diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py<br>
> index eab292b..66299c9 100644<br>
> --- a/src/jarabe/journal/journalactivity.py<br>
> +++ b/src/jarabe/journal/journalactivity.py<br>
> @@ -45,13 +45,16 @@ from jarabe.journal.journalentrybundle import JournalEntryBundle<br>
> from jarabe.journal.objectchooser import ObjectChooser<br>
> from jarabe.journal.modalalert import ModalAlert<br>
> from jarabe.journal import model<br>
> +from jarabe.frame import get_view<br>
><br>
> J_DBUS_SERVICE = 'org.laptop.Journal'<br>
> J_DBUS_INTERFACE = 'org.laptop.Journal'<br>
> J_DBUS_PATH = '/org/laptop/Journal'<br>
><br>
> _SPACE_TRESHOLD = 52428800<br>
> +_PREEMPTIVE_SPACE_TRESHOLD = _SPACE_TRESHOLD * 1.5<br>
> _BUNDLE_ID = 'org.laptop.JournalActivity'<br>
> +_JOURNAL_ICON = 'activity-journal'<br>
><br>
> class JournalActivityDBusService(dbus.service.Object):<br>
>     def __init__(self, parent):<br>
> @@ -139,7 +142,7 @@ class JournalActivity(Window):<br>
>         self.iconify()<br>
><br>
>         self._critical_space_alert = None<br>
> -        self._check_available_space()<br>
> +        self._check_available_space(startup=True)<br>
><br>
>     def _alert_notify_cb(self, gobject, strerror, severity):<br>
>         alert = ErrorAlert()<br>
> @@ -273,6 +276,9 @@ class JournalActivity(Window):<br>
>                 kwargs['object_id'] == self._detail_view.props.metadata['uid']:<br>
>             self.show_main_view()<br>
><br>
> +        if self._critical_space_alert:<br>
> +           self._check_available_space(display=False)<br>
> +<br>
>     def _focus_in_event_cb(self, window, event):<br>
>         self.search_grab_focus()<br>
>         self._list_view.update_dates()<br>
> @@ -324,32 +330,51 @@ class JournalActivity(Window):<br>
>             visible = not state & gtk.gdk.WINDOW_STATE_ICONIFIED<br>
>             self._list_view.set_is_visible(visible)<br>
><br>
> +            if self._critical_space_alert and not visible:<br>
> +                self._check_available_space()<br>
> +<br>
>     def __visibility_notify_event_cb(self, window, event):<br>
>         logging.debug('visibility_notify_event_cb %r', self)<br>
>         visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED<br>
>         self._list_view.set_is_visible(visible)<br>
><br>
> -    def _check_available_space(self):<br>
> +    def _check_available_space(self, startup=False, display=True):<br>
>         ''' Check available space on device<br>
><br>
>             If the available space is below 50MB an alert will be<br>
>             shown which encourages to delete old journal entries.<br>
>         '''<br>
> -<br>
> -        if self._critical_space_alert:<br>
> -            return<br>
>         stat = os.statvfs(env.get_profile_path())<br>
>         free_space = stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL]<br>
> -        if free_space < _SPACE_TRESHOLD:<br>
> +<br>
> +        if self._critical_space_alert and free_space >= _SPACE_TRESHOLD:<br>
> +            self._critical_space_alert.destroy()<br>
> +            self._critical_space_alert = None<br>
> +<br>
> +        elif free_space < _SPACE_TRESHOLD:<br>
> +            space_fraction = 1.0 - (float(free_space) / float(_SPACE_TRESHOLD))<br>
> +            self._setup_space_alert(space_fraction, display)<br>
> +<br>
> +        elif startup and free_space < _PREEMPTIVE_SPACE_TRESHOLD:<br>
> +            body = _('Your Journal currently contains too much entries'<br>
> +                    ' please consider removing unnecessary ones')<br>
> +<br>
> +            frame = get_view()<br>
> +            frame.add_message(body, icon_name=_JOURNAL_ICON)<br>
> +<br>
> +    def _setup_space_alert(self, space_fraction, display):<br>
> +        if self._critical_space_alert is None:<br>
>             self._critical_space_alert = ModalAlert()<br>
> -            self._critical_space_alert.connect('destroy',<br>
> -                                               self.__alert_closed_cb)<br>
> -            self._critical_space_alert.show()<br>
> +            self._critical_space_alert.connect('show-journal',<br>
> +                                               self.__show_journal_cb)<br>
> +        self._critical_space_alert.update_space_fraction(space_fraction)<br>
> +        if display:<br>
> +            self._critical_space_alert.present()<br>
><br>
> -    def __alert_closed_cb(self, data):<br>
> +    def __show_journal_cb(self, data):<br>
>         self.show_main_view()<br>
>         self.reveal()<br>
> -        self._critical_space_alert = None<br>
> +        self._critical_space_alert.hide()<br>
><br>
>     def set_active_volume(self, mount):<br>
>         self._volumes_toolbar.set_active_volume(mount)<br>
> diff --git a/src/jarabe/journal/modalalert.py b/src/jarabe/journal/modalalert.py<br>
> index c7c6a0a..0c774e7 100644<br>
> --- a/src/jarabe/journal/modalalert.py<br>
> +++ b/src/jarabe/journal/modalalert.py<br>
> @@ -17,6 +17,7 @@<br>
> import gtk<br>
> from gettext import gettext as _<br>
> import gconf<br>
> +import gobject<br>
><br>
> from sugar.graphics.icon import Icon<br>
> from sugar.graphics import style<br>
> @@ -26,6 +27,10 @@ class ModalAlert(gtk.Window):<br>
><br>
>     __gtype_name__ = 'SugarModalAlert'<br>
><br>
> +    __gsignals__ = {<br>
> +        'show-journal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([]))<br>
> +    }<br>
> +<br>
>     def __init__(self):<br>
>         gtk.Window.__init__(self)<br>
><br>
> @@ -35,6 +40,7 @@ class ModalAlert(gtk.Window):<br>
>         height = gtk.gdk.screen_height() - offset * 2<br>
>         self.set_size_request(width, height)<br>
>         self.set_position(gtk.WIN_POS_CENTER_ALWAYS)<br>
> +        self.set_accept_focus(True)<br>
>         self.set_decorated(False)<br>
>         self.set_resizable(False)<br>
>         self.set_modal(True)<br>
> @@ -71,6 +77,16 @@ class ModalAlert(gtk.Window):<br>
>         self._vbox.pack_start(self._message, False)<br>
>         self._message.show()<br>
><br>
> +        self._space_bar = gtk.ProgressBar()<br>
> +        self._vbox.pack_start(self._space_bar, False)<br>
> +        self._space_bar.show()<br>
> +<br>
> +        advice = gtk.Label(_('Delete entries until this bar is empty'))<br>
> +        advice.modify_fg(gtk.STATE_NORMAL,<br>
> +                        style.COLOR_WHITE.get_gdk_color())<br>
> +        self._vbox.pack_start(advice, False)<br>
> +        advice.show()<br>
> +<br>
>         alignment = gtk.Alignment(xalign=0.5, yalign=0.5)<br>
>         self._vbox.pack_start(alignment, expand=False)<br>
>         alignment.show()<br>
> @@ -91,7 +107,13 @@ class ModalAlert(gtk.Window):<br>
>         self.window.set_accept_focus(True)<br>
><br>
>     def __show_journal_cb(self, button):<br>
> -        '''The opener will listen on the destroy signal<br>
> -        '''<br>
> -        self.destroy()<br>
> +        self.emit('show-journal')<br>
> +<br>
> +    def update_space_fraction(self, fraction):<br>
> +        if fraction > 1.0:<br>
> +            fraction = 1.0<br>
> +        elif fraction < 0.0:<br>
> +            fraction = 0.0<br>
> +<br>
> +        self._space_bar.set_fraction(fraction)<br>
><br>
> --<br>
> 1.7.1<br>
><br>
</div></div>> _______________________________________________<br>
> Dextrose mailing list<br>
> <a href="mailto:Dextrose@lists.sugarlabs.org" target="_blank">Dextrose@lists.sugarlabs.org</a><br>
> <a href="http://lists.sugarlabs.org/listinfo/dextrose" target="_blank">http://lists.sugarlabs.org/listinfo/dextrose</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>