[Sugar-devel] [PATCH v2 Words] Updated translated word when language to translate is changed. (Ticket #2210)

Ishan Bansal ishan at seeta.in
Fri Oct 8 11:13:41 EDT 2010


From: Ishan Bansal <ishan at seeta.in>, Anubhav Aggarwal <anubhav at seeta.in>

New global variable 'newtotranslate' added to update the translated text when
the language to translate is being changed.
---
 pippy_app.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
 v1->v2 : global variable removed and subject updated

diff --git a/pippy_app.py b/pippy_app.py
index b9a5a25..f9b0be7 100644
--- a/pippy_app.py
+++ b/pippy_app.py
@@ -49,6 +49,7 @@ class WordsActivity(ViewSourceActivity):
         self.fromlang = "English"
         self.tolang   = "Spanish"
         self.languagemodel = LanguageModel.LanguageModel()
+        self.newtotranslate = 'none'
 
         # Main layout.
         hbox = gtk.HBox(homogeneous=True)
@@ -151,6 +152,8 @@ class WordsActivity(ViewSourceActivity):
 
     def lang2combo_cb(self, combo):
         self.languagemodel.SetLanguages("English", self.langs[combo.get_active()])
+        self.translated.set_text("")
+        self.totranslate_cb(self.newtotranslate)
         
     def lang1sel_cb(self, column):
         # FIXME: Complete the text entry box
@@ -177,6 +180,7 @@ class WordsActivity(ViewSourceActivity):
 
     def totranslate_cb(self, totranslate):
         entry = totranslate.get_text()
+        self.newtotranslate = totranslate
         # Ask for completion suggestions
         if not entry:
             return
-- 
1.7.0.4



More information about the Sugar-devel mailing list