[orca/introspection] Stop using set_user_time() on windows; start using present_with_time()
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/introspection] Stop using set_user_time() on windows; start using present_with_time()
- Date: Tue, 23 Aug 2011 01:31:09 +0000 (UTC)
commit 43c7307accf5055ea159f190b608eaf0b04ca6cd
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Mon Aug 22 21:30:29 2011 -0400
Stop using set_user_time() on windows; start using present_with_time()
src/orca/orca_gui_find.py | 21 ++++-----------------
src/orca/orca_gui_prefs.py | 25 ++++---------------------
src/orca/orca_gui_profile.py | 25 ++++---------------------
src/orca/orca_quit.py | 22 ++++------------------
src/orca/outline.py | 14 +++++++-------
5 files changed, 23 insertions(+), 84 deletions(-)
---
diff --git a/src/orca/orca_gui_find.py b/src/orca/orca_gui_find.py
index 8015224..e6efaf4 100644
--- a/src/orca/orca_gui_find.py
+++ b/src/orca/orca_gui_find.py
@@ -27,7 +27,6 @@ __license__ = "LGPL"
import os
import sys
-import debug
from gi.repository import Gtk
import locale
@@ -79,22 +78,10 @@ class OrcaFindGUI(orca_gtkbuilder.GtkBuilderWrapper):
"""
findDialog = self.get_widget("findDialog")
-
- # Set the current time on the Find GUI dialog so that it'll
- # get focus. set_user_time is a new call in pygtk 2.9.2 or later.
- # It's surronded by a try/except block here so that if it's not found,
- # then we can fail gracefully.
- #
- try:
- findDialog.realize()
- ts = orca_state.lastInputEventTimestamp
- if ts == 0:
- ts = Gtk.get_current_event_time()
- findDialog.window.set_user_time(ts)
- except AttributeError:
- debug.printException(debug.LEVEL_FINEST)
-
- findDialog.show()
+ ts = orca_state.lastInputEventTimestamp
+ if ts == 0:
+ ts = Gtk.get_current_event_time()
+ findDialog.present_with_time(ts)
# Populate the dialog box from the previous searchQuery, should
# one exist. Note: This is necessary because we are destroying
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index e8913c3..4c21137 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -1895,27 +1895,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
modifierMask,
0)
- # We want the Orca preferences window to have focus when it is
- # shown. First try using the present() call. If this isn't present
- # in the version of pygtk that the user is using, just catch the
- # exception. Then try to set the current time on the Preferences
- # window using set_user_time. If that isn't found, then catch the
- # exception and fail gracefully.
- #
- orcaSetupWindow.realize()
- try:
- if _settingsManager.getSettings('showMainWindow'):
- orcaSetupWindow.present()
- except:
- pass
- try:
- ts = orca_state.lastInputEventTimestamp
- if ts == 0:
- ts = Gtk.get_current_event_time()
- if ts > 0:
- orcaSetupWindow.window.set_user_time(ts)
- except (AttributeError, RuntimeError):
- debug.printException(debug.LEVEL_FINEST)
+ ts = orca_state.lastInputEventTimestamp
+ if ts == 0:
+ ts = Gtk.get_current_event_time()
+ orcaSetupWindow.present_with_time(ts)
# We always want to re-order the text attributes page so that enabled
# items are consistently at the top.
diff --git a/src/orca/orca_gui_profile.py b/src/orca/orca_gui_profile.py
index 69e2590..c1bdcab 100644
--- a/src/orca/orca_gui_profile.py
+++ b/src/orca/orca_gui_profile.py
@@ -29,7 +29,6 @@ __license__ = "LGPL"
import os
import sys
-import debug
from gi.repository import Gtk
import locale
@@ -71,32 +70,16 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.prefsDialog = prefsDialog
profileDialog = self.get_widget("profileDialog")
- # Set the current time on the Find GUI dialog so that it'll
- # get focus. set_user_time is a new call in pygtk 2.9.2 or later.
- # It's surronded by a try/except block here so that if it's not found,
- # then we can fail gracefully.
- #
- try:
- profileDialog.realize()
- ts = orca_state.lastInputEventTimestamp
- if ts == 0:
- ts = Gtk.get_current_event_time()
- profileDialog.window.set_user_time(ts)
- except AttributeError:
- debug.printException(debug.LEVEL_FINEST)
-
try:
profileEntry = self.get_widget("profileEntry")
profileEntry.set_text(self.profileString)
except:
pass
- # 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()
+ ts = orca_state.lastInputEventTimestamp
+ if ts == 0:
+ ts = Gtk.get_current_event_time()
+ profileDialog.present_with_time(ts)
def cancelButtonClicked(self, widget):
"""Signal handler for the "clicked" signal for the cancelButton
diff --git a/src/orca/orca_quit.py b/src/orca/orca_quit.py
index 7ae1c24..87fa2b1 100644
--- a/src/orca/orca_quit.py
+++ b/src/orca/orca_quit.py
@@ -27,7 +27,6 @@ __license__ = "LGPL"
import os
import sys
-import debug
from gi.repository import Gtk
import locale
@@ -51,23 +50,10 @@ class OrcaQuitGUI(orca_gtkbuilder.GtkBuilderWrapper):
quitDialog = self.get_widget("quitDialog")
quitDialog.connect('delete_event', self.quitDialogClosed)
-
- # Set the current time on the quit GUI dialog so that it'll
- # get focus. set_user_time is a new call in pygtk 2.9.2 or later.
- # It's surronded by a try/except block here so that if it's not found,
- # then we can fail gracefully.
- #
- try:
- quitDialog.realize()
- ts = orca_state.lastInputEventTimestamp
- if ts == 0:
- ts = Gtk.get_current_event_time()
- quitDialog.window.set_user_time(ts)
- except (AttributeError, RuntimeError):
- debug.printException(debug.LEVEL_FINEST)
-
- quitDialog.hide()
- quitDialog.show()
+ ts = orca_state.lastInputEventTimestamp
+ if ts == 0:
+ ts = Gtk.get_current_event_time()
+ quitDialog.present_with_time(ts)
def quitNoButtonClicked(self, widget):
"""Signal handler for the "clicked" signal for the quitNoButton
diff --git a/src/orca/outline.py b/src/orca/outline.py
index 4f85665..4f7a671 100644
--- a/src/orca/outline.py
+++ b/src/orca/outline.py
@@ -247,11 +247,11 @@ def draw(x, y, width, height):
_outlineWindows[1].resize(bottomwidth, bottomheight)
_outlineWindows[1].move(bottomx, bottomy)
+ ts = orca_state.lastInputEventTimestamp
+ if ts == 0:
+ ts = Gtk.get_current_event_time()
+
+ # Make sure the windows stay on top.
+ #
for window in _outlineWindows:
- window.present()
- # Make sure the windows stay on top.
- #
- try:
- window.window.set_user_time(orca_state.lastInputEventTimestamp)
- except:
- pass
+ window.present_with_time(ts)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]