[Dextrose] [PATCH v3 PaintActivity]Paint - Rect. Marquee icon changes erratically(olpc #5882)

anubhav at seeta.in anubhav at seeta.in
Thu Oct 21 13:26:34 EDT 2010


The variable name of estadoTexto has been changed to text_in_progress as
suggested and just before saving the file the text_in_progress is checked if
True ( representing the text field in prgress and not yet saved ) then the
function text() is called from Desenho thus saving the text

v1 -> v2. Updated at suggested

v2 -> v3. Variable name changed , there values changed

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..24a673e 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 == True:
             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..4d42ff3 100644
--- a/Desenho.py
+++ b/Desenho.py
@@ -552,8 +552,8 @@ class Desenho:
 
         """
 
-        if widget.estadoTexto == 0:
-            widget.estadoTexto = 1
+        if widget.text_in_progress == False:
+            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..709322d 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 == True:
+            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



More information about the Dextrose mailing list