[Dextrose] [PATCH v4 PaintActivity] Changes made to save the last added text item. (OLPC #5917)

Manusheel Gupta manu at seeta.in
Thu Oct 21 16:16:42 EDT 2010


Gonzalo,

Patch attached at the ticket site.

Manu

On Fri, Oct 22, 2010 at 12:30 AM, Gonzalo Odiard <godiard at gmail.com> wrote:

> Ok. Attach to the ticket please.
>
> Gonzalo
>
>
> On Thu, Oct 21, 2010 at 3:39 PM, <anubhav at seeta.in> wrote:
>
>> Condition added to save the text when added at last in the paint activity
>> so
>> that it does not disappear. Text disappeared when added at last in the
>> paint
>> activity.
>>
>> v1 -> v2. Updated at suggested
>>
>> v2 -> v3. Variable name changed  , there values changed
>>
>> v3 -> v4. The if condition updated as suggested
>>
>> Co-authored-by: Anubhav Aggarwal<anubhav at seeta.in>, Ishan Bansal <
>> ishan at seeta.in>
>> ---
>>  Area.py            |    6 +++---
>>  Desenho.py         |    6 +++---
>>  OficinaActivity.py |    2 ++
>>  3 files changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/Area.py b/Area.py
>> index 8843406..ba06758 100644
>> --- a/Area.py
>> +++ b/Area.py
>> @@ -165,7 +165,7 @@ class Area(gtk.DrawingArea):
>>          self.pixmap_sel = None
>>         self.desenho = []
>>         self.textos = []
>> -        self.estadoTexto = 0
>> +        self.text_in_progress = False
>>          self.janela = janela
>>         self.d = Desenho(self)
>>         self.line_size = 2
>> @@ -325,7 +325,7 @@ class Area(gtk.DrawingArea):
>>              self.d.text(widget, event)
>>
>>          # This fixes a bug that made the text viewer get stuck in the
>> canvas
>> -        elif self.estadoTexto is 1:
>> +        elif self.text_in_progress:
>>              try:
>>             # This works for a gtk.Entry
>>                 text = self.janela.textview.get_text()
>> @@ -337,7 +337,7 @@ class Area(gtk.DrawingArea):
>>
>>             if text is not None:
>>                  self.d.text(widget, event)
>> -            self.estadoTexto = 0
>> +            self.text_in_progress = False
>>              self.janela.textview.hide()
>>
>>         self.oldx, self.oldy = coords
>> diff --git a/Desenho.py b/Desenho.py
>> index 3be1910..17525e5 100644
>> --- a/Desenho.py
>> +++ b/Desenho.py
>> @@ -552,8 +552,8 @@ class Desenho:
>>
>>         """
>>
>> -        if widget.estadoTexto == 0:
>> -            widget.estadoTexto = 1
>> +        if not widget.text_in_progress:
>> +            widget.text_in_progress = True
>>
>>             #widget.janela.fixed.move(widget.janela.textview,
>>             # int(event.x)+200, int(event.y)+100)
>> @@ -564,7 +564,7 @@ class Desenho:
>>              widget.janela.textview.grab_focus()
>>
>>         else:
>> -            widget.estadoTexto = 0
>> +            widget.text_in_progress = False
>>
>>             try:
>>             # This works for a gtk.Entry
>> diff --git a/OficinaActivity.py b/OficinaActivity.py
>> index 860d3fe..ec8910d 100644
>> --- a/OficinaActivity.py
>> +++ b/OficinaActivity.py
>> @@ -169,6 +169,8 @@ class OficinaActivity(activity.Activity):
>>          width, height = self.area.get_size_request()
>>
>>          logging.debug('writting %s w=%s h=%s' % (file_path, width,
>> height))
>> +        if self.area.text_in_progress:
>> +            self.area.d.text(self.area, event=None)
>>
>>         self.area.getout()
>>         pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8,
>> --
>> 1.7.0.4
>>
>>
>
>
> --
> Gonzalo Odiard
>
>
>
> _______________________________________________
> Dextrose mailing list
> Dextrose at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/dextrose
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20101022/f77b6c19/attachment.html>


More information about the Dextrose mailing list