Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Garg <ajay@activitycentral.com>2012-12-27 07:27:31 (GMT)
committer Ajay Garg <ajay@activitycentral.com>2012-12-27 07:32:15 (GMT)
commit265c8c6de25186f8f74beb424168a52518685630 (patch)
treedd051d4ecbaaa933b3cf7358097bbc5899f69a34
parent3c9643d2e05e41117bcc18da98b07810f4817b0a (diff)
sdxo#2826: Fixing race conditions.
1. Initiating Gdk-threads bootstrapper. 2. When a setting ("Tamano" or "Tipo") is changed, no need to spawn new thread(s) to create a new keyboard instance. Instead, we can first close the current keyboard instance synchronously, and then start the new keyboard instance. 3. The options-dialog need not be re-created for every new instance of the keyboard (as the options-dialog is always the same in "size" and "functionality"). So now, the options-dialog is just hidden, and then again made visible, when a new instance of keyboard is created.
-rw-r--r--src/jarabe/view/virtualkeyboard.py25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/jarabe/view/virtualkeyboard.py b/src/jarabe/view/virtualkeyboard.py
index b8b9fd6..08b100b 100644
--- a/src/jarabe/view/virtualkeyboard.py
+++ b/src/jarabe/view/virtualkeyboard.py
@@ -36,6 +36,7 @@ import jarabe.model.virtualkeyboard
from sugar3.graphics.icon import Icon, get_icon_file_name
GObject.threads_init()
+Gdk.threads_init()
velocidades = {'lenta': 4500, 'media': 3000, 'rapida':1500}
hablar = {'lenta': "170", 'media': "180", 'rapida':"275"}
@@ -84,8 +85,6 @@ class Teclado:
logging.debug('close virtual keyboard')
self.dialog.destroy()
try:
- self.hilo_type._Thread__stop()
- self.hilo_size._Thread__stop()
self.hilo_bloquear._Thread__stop()
self.hilo_hablar._Thread__stop()
except:
@@ -1119,12 +1118,8 @@ class Teclado:
self.set_tipo_teclado(tipo)
- self.hilo_type = threading.Thread(target = self.reset)
- self.hilo_type.start()
- self.hilo_type.quit = True
-
- self.dialog_opciones.destroy()
- self.close()
+ self.dialog_opciones.hide()
+ self.reset()
def on_changed_cbo_size_btn(self, widget):
@@ -1139,12 +1134,8 @@ class Teclado:
self.set_size_botones(size)
- self.hilo_size = threading.Thread(target = self.reset)
- self.hilo_size.start()
- self.hilo_size.quit = True
-
- self.dialog_opciones.destroy()
- self.close()
+ self.dialog_opciones.hide()
+ self.reset()
def on_changed_cbo_time_btn(self, widget):
@@ -1806,11 +1797,7 @@ class Teclado:
self.set_tipo_teclado(tipo)
- self.hilo_type = threading.Thread(target = self.reset)
- self.hilo_type.start()
- self.hilo_type.quit = True
-
- self.close()
+ self.reset()
class Boton(Gtk.Button):
font_desc = ''