Much better.<br>Now you can change <br><br>if self.area.text_in_progress == True:<br>by <br>if self.area.text_in_progress:<br><br>and<br><br>if self.area.text_in_progress == True:<br>by <br>if not self.area.text_in_progress:<br>
<br>Gonzalo<br><br><div class="gmail_quote">On Thu, Oct 21, 2010 at 2:26 PM, <span dir="ltr"><<a href="mailto:anubhav@seeta.in">anubhav@seeta.in</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;">
The variable name of estadoTexto has been changed to text_in_progress as<br>
suggested and just before saving the file the text_in_progress is checked if<br>
True ( representing the text field in prgress and not yet saved ) then the<br>
function text() is called from Desenho thus saving the text<br>
<br>
v1 -> v2. Updated at suggested<br>
<br>
v2 -> v3. Variable name changed , there values changed<br>
<br>
Co-authored-by: Anubhav Aggarwal<<a href="mailto:anubhav@seeta.in">anubhav@seeta.in</a>>, Ishan Bansal <<a href="mailto:ishan@seeta.in">ishan@seeta.in</a>><br>
---<br>
Area.py | 6 +++---<br>
Desenho.py | 6 +++---<br>
OficinaActivity.py | 2 ++<br>
3 files changed, 8 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/Area.py b/Area.py<br>
index 8843406..24a673e 100644<br>
--- a/Area.py<br>
+++ b/Area.py<br>
@@ -165,7 +165,7 @@ class Area(gtk.DrawingArea):<br>
self.pixmap_sel = None<br>
self.desenho = []<br>
self.textos = []<br>
- self.estadoTexto = 0<br>
+ self.text_in_progress = False<br>
self.janela = janela<br>
self.d = Desenho(self)<br>
self.line_size = 2<br>
@@ -325,7 +325,7 @@ class Area(gtk.DrawingArea):<br>
self.d.text(widget, event)<br>
<br>
# This fixes a bug that made the text viewer get stuck in the canvas<br>
- elif self.estadoTexto is 1:<br>
+ elif self.text_in_progress == True:<br>
try:<br>
# This works for a gtk.Entry<br>
text = self.janela.textview.get_text()<br>
@@ -337,7 +337,7 @@ class Area(gtk.DrawingArea):<br>
<br>
if text is not None:<br>
self.d.text(widget, event)<br>
- self.estadoTexto = 0<br>
+ self.text_in_progress = False<br>
self.janela.textview.hide()<br>
<br>
self.oldx, self.oldy = coords<br>
diff --git a/Desenho.py b/Desenho.py<br>
index 3be1910..4d42ff3 100644<br>
--- a/Desenho.py<br>
+++ b/Desenho.py<br>
@@ -552,8 +552,8 @@ class Desenho:<br>
<br>
"""<br>
<br>
- if widget.estadoTexto == 0:<br>
- widget.estadoTexto = 1<br>
+ if widget.text_in_progress == False:<br>
+ widget.text_in_progress = True<br>
<br>
#widget.janela.fixed.move(widget.janela.textview,<br>
# int(event.x)+200, int(event.y)+100)<br>
@@ -564,7 +564,7 @@ class Desenho:<br>
widget.janela.textview.grab_focus()<br>
<br>
else:<br>
- widget.estadoTexto = 0<br>
+ widget.text_in_progress = False<br>
<br>
try:<br>
# This works for a gtk.Entry<br>
diff --git a/OficinaActivity.py b/OficinaActivity.py<br>
index 860d3fe..709322d 100644<br>
--- a/OficinaActivity.py<br>
+++ b/OficinaActivity.py<br>
@@ -169,6 +169,8 @@ class OficinaActivity(activity.Activity):<br>
width, height = self.area.get_size_request()<br>
<br>
logging.debug('writting %s w=%s h=%s' % (file_path, width, height))<br>
+ if self.area.text_in_progress == True:<br>
+ self.area.d.text(self.area, event=None)<br>
<br>
self.area.getout()<br>
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8,<br>
<font color="#888888">--<br>
1.7.0.4<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Gonzalo Odiard<br><br><br>