[orca] Fix for bug #637661 - We should be careful when using run() in Orca dialogs because we can become un
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bug #637661 - We should be careful when using run() in Orca dialogs because we can become un
- Date: Mon, 20 Dec 2010 20:02:28 +0000 (UTC)
commit e8dc40b9876c6cebfbddad11f1f03e0d91c8bd62
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Mon Dec 20 15:01:29 2010 -0500
Fix for bug #637661 - We should be careful when using run() in Orca dialogs because we can become unresponsive
src/orca/orca_gui_prefs.py | 7 ++++++-
src/orca/orca_gui_profile.py | 19 +++++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index d1b6040..d781423 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -4528,7 +4528,12 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
def showProfileGUI(self, widget):
"""Show profile Dialog to add a new one"""
- profileToSaveLabel = orca_gui_profile.showProfileUI()
+ orca_gui_profile.showProfileUI(self)
+
+ def saveProfile(self, profileToSaveLabel):
+ """Creates a new profile based on the name profileToSaveLabel and
+ updates the Preferences dialog combo boxes accordingly."""
+
if not profileToSaveLabel:
return
profileToSave = profileToSaveLabel.replace(' ','_').lower()
diff --git a/src/orca/orca_gui_profile.py b/src/orca/orca_gui_profile.py
index bbda316..3c65806 100644
--- a/src/orca/orca_gui_profile.py
+++ b/src/orca/orca_gui_profile.py
@@ -57,16 +57,18 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
#
self.searchString = None
self.profileString = None
+ self.prefsDialog = None
def init(self):
# Initialize the dialog box controls.
self.profileString = ""
- def showGUI(self):
+ def showGUI(self, prefsDialog):
"""Show the Orca profile dialog. This assumes that the GUI has
already been created.
"""
+ self.prefsDialog = prefsDialog
profileDialog = self.get_widget("profileDialog")
# Set the current time on the Find GUI dialog so that it'll
@@ -89,7 +91,12 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
except:
pass
- profileDialog.run()
+ # It is not safe to use run() in Orca because if the dialog loses
+ # focus, Orca stops presenting things to the user because run()
+ # blocks in a recursive main loop until the dialog emits the
+ # "response" signal or is destroyed.
+ #
+ profileDialog.show()
def cancelButtonClicked(self, widget):
"""Signal handler for the "clicked" signal for the cancelButton
@@ -119,6 +126,8 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
newProfile = self.get_widget("profileEntry").get_text()
self.get_widget("profileDialog").destroy()
+ if self.prefsDialog:
+ self.prefsDialog.saveProfile(newProfile)
# From now, this method can't have sense ...
def onProfileEntryChanged(self, widget, data=None):
@@ -152,7 +161,7 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
return _settingsManager.availableProfiles()
-def showProfileUI():
+def showProfileUI(prefsDialog=None):
global OS
global newProfile
@@ -167,10 +176,8 @@ def showProfileUI():
OS = OrcaProfileGUI(uiFile, "profileDialog")
OS.init()
- OS.showGUI()
+ OS.showGUI(prefsDialog)
- return newProfile
-
def main():
locale.setlocale(locale.LC_ALL, '')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]