[orca/introspection] Introspection port work in progress.
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/introspection] Introspection port work in progress.
- Date: Mon, 22 Aug 2011 18:25:17 +0000 (UTC)
commit 4e763734750a45378609093d71512c5637527850
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Mon Aug 22 14:20:49 2011 -0400
Introspection port work in progress.
configure.ac | 6 +-
src/orca/app_gui_prefs.py | 6 +-
src/orca/braille.py | 20 +-
src/orca/brlmon.py | 22 +-
src/orca/chat.py | 84 +++---
src/orca/event_manager.py | 4 +-
src/orca/gsmag.py | 4 +-
src/orca/keybindings.py | 46 ++--
src/orca/liveregions.py | 4 +-
src/orca/mouse_review.py | 23 +-
src/orca/orca-mainwin.ui | 1 -
src/orca/orca-setup.ui | 6 +-
src/orca/orca.py | 23 +-
src/orca/orca_console_prefs.py | 10 +-
src/orca/orca_gtkbuilder.py | 12 +-
src/orca/orca_gui_find.py | 6 +-
src/orca/orca_gui_main.py | 10 +-
src/orca/orca_gui_prefs.py | 276 ++++++++++----------
src/orca/orca_gui_profile.py | 6 +-
src/orca/orca_gui_splash.py | 19 +-
src/orca/orca_prefs.py | 2 +-
src/orca/orca_quit.py | 8 +-
src/orca/outline.py | 49 ++--
src/orca/script.py | 4 +-
src/orca/script_utilities.py | 4 +-
src/orca/scripts/apps/Thunderbird/script.py | 6 +-
src/orca/scripts/apps/gnome-search-tool/script.py | 6 +-
src/orca/scripts/apps/packagemanager/script.py | 14 +-
src/orca/scripts/apps/soffice/script.py | 74 +++---
src/orca/scripts/apps/yelp/yelp_v2/script.py | 4 +-
src/orca/scripts/default.py | 4 +-
src/orca/scripts/toolkits/CALLY/script.py | 15 +-
src/orca/scripts/toolkits/Gecko/script.py | 204 +++++++-------
.../scripts/toolkits/J2SE-access-bridge/script.py | 16 +-
src/orca/scripts/toolkits/WebKitGtk/script.py | 6 +-
src/orca/settings.py | 19 +--
src/orca/speechdispatcherfactory.py | 8 +-
37 files changed, 495 insertions(+), 536 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b2e8e55..810b8fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,8 @@ m4_define([orca_micro_version], [90pre])
m4_define([orca_version],
[orca_major_version.orca_minor_version.orca_micro_version])
+m4_define(pygobject_required_version, 2.90.1)
+
AC_INIT([orca],
[orca_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=orca],
@@ -26,6 +28,8 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [gettext package])
GNOME_DOC_INIT([0.17.3])
+PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= pygobject_required_version)
+
dnl Needed programs
AC_PROG_INSTALL
@@ -67,7 +71,7 @@ if test x$louis_available = "xyes"; then
fi
AC_SUBST(LOUIS_TABLE_DIR)
-dnl Check for the OS. On *Solaris systems the PATH must be setted
+dnl Check for the OS. On *Solaris systems the PATH must be set
PLATFORM=`uname -a`
case "${PLATFORM}" in
*SunOS*)
diff --git a/src/orca/app_gui_prefs.py b/src/orca/app_gui_prefs.py
index ee1f943..b4ecf16 100644
--- a/src/orca/app_gui_prefs.py
+++ b/src/orca/app_gui_prefs.py
@@ -25,7 +25,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2007-2009 Sun Microsystems Inc."
__license__ = "LGPL"
-import gtk
+from gi.repository import Gtk
import locale
import os
import sys
@@ -107,7 +107,7 @@ class OrcaSetupGUI(orca_gui_prefs.OrcaSetupGUI):
vbox = self.appScript.getAppPreferencesGUI()
if vbox:
- label = gtk.Label(orca_state.activeScript.app.name)
+ label = Gtk.Label(label=orca_state.activeScript.app.name)
self.get_widget("notebook").append_page(vbox, label)
def _createPronunciationTreeView(self, pronunciations=None):
@@ -366,7 +366,7 @@ def main():
showPreferencesUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/braille.py b/src/orca/braille.py
index fc4b1c4..923b8c8 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -37,8 +37,8 @@ log = logging.getLogger("braille")
import signal
import os
-import gobject
-gobject.threads_init()
+from gi.repository import GObject
+GObject.threads_init()
try:
import louis
@@ -1464,7 +1464,7 @@ def killFlash(restoreSaved=True):
global viewport
if _flashEventSourceId:
if _flashEventSourceId > 0:
- gobject.source_remove(_flashEventSourceId)
+ GObject.source_remove(_flashEventSourceId)
if restoreSaved:
(_lines, _regionWithFocus, viewport, flashTime) = _saved
refresh(panToCursor=False, stopFlash=False)
@@ -1473,9 +1473,9 @@ def killFlash(restoreSaved=True):
def resetFlashTimer():
global _flashEventSourceId
if _flashEventSourceId > 0:
- gobject.source_remove(_flashEventSourceId)
+ GObject.source_remove(_flashEventSourceId)
flashTime = _saved[3]
- _flashEventSourceId = gobject.timeout_add(flashTime, _flashCallback)
+ _flashEventSourceId = GObject.timeout_add(flashTime, _flashCallback)
def _initFlash(flashTime):
"""Sets up the state needed to flash a message or clears any existing
@@ -1494,13 +1494,13 @@ def _initFlash(flashTime):
if _flashEventSourceId:
if _flashEventSourceId > 0:
- gobject.source_remove(_flashEventSourceId)
+ GObject.source_remove(_flashEventSourceId)
_flashEventSourceId = 0
else:
_saved = (_lines, _regionWithFocus, viewport, flashTime)
if flashTime > 0:
- _flashEventSourceId = gobject.timeout_add(flashTime, _flashCallback)
+ _flashEventSourceId = GObject.timeout_add(flashTime, _flashCallback)
elif flashTime < 0:
_flashEventSourceId = -666
@@ -1782,8 +1782,8 @@ def init(callback=None, tty=7):
debug.println(\
debug.LEVEL_CONFIGURATION,
"Braille module has been initialized using tty=%d" % tty)
- _brlAPISourceId = gobject.io_add_watch(_brlAPI.fileDescriptor,
- gobject.IO_IN,
+ _brlAPISourceId = GObject.io_add_watch(_brlAPI.fileDescriptor,
+ GObject.IO_IN,
_brlAPIKeyReader)
except:
debug.println(debug.LEVEL_CONFIGURATION,
@@ -1826,7 +1826,7 @@ def shutdown():
if _brlAPIRunning:
_brlAPIRunning = False
- gobject.source_remove(_brlAPISourceId)
+ GObject.source_remove(_brlAPISourceId)
_brlAPISourceId = 0
try:
_brlAPI.leaveTtyMode()
diff --git a/src/orca/brlmon.py b/src/orca/brlmon.py
index d10aeb3..ca621ee 100644
--- a/src/orca/brlmon.py
+++ b/src/orca/brlmon.py
@@ -26,7 +26,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
__license__ = "LGPL"
-import gtk
+from gi.repository import Gtk
# Attribute/Selection mask strings:
#
@@ -52,7 +52,7 @@ ATTRIBUTE_8 = " underline='error'"
ATTRIBUTE_78 = " underline='double'"
-class BrlMon(gtk.Window):
+class BrlMon(Gtk.Window):
"""Displays a GUI braille monitor that mirrors what is being
shown on the braille display. This currently needs a lot of
@@ -71,18 +71,18 @@ class BrlMon(gtk.Window):
- cellHeight: height of each cell in pixels
"""
- gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+ Gtk.Window.__init__(self)
self.set_title("Braille Monitor")
self.set_size_request(cellWidth * numCells, cellHeight)
- hbox = gtk.HBox(True)
+ hbox = Gtk.HBox(homogeneous=True)
self.add(hbox)
self.cellFrames = []
self.cellLabels = []
i = 0
while (i < numCells):
- frame = gtk.Frame()
- frame.set_shadow_type(gtk.SHADOW_OUT)
- label = gtk.Label(" ")
+ frame = Gtk.Frame()
+ frame.set_shadow_type(Gtk.ShadowType.OUT)
+ label = Gtk.Label(label=" ")
label.set_use_markup(True)
frame.add(label)
hbox.add(frame)
@@ -114,7 +114,7 @@ class BrlMon(gtk.Window):
for i in range(0, len(string)):
- # Handle special chars so they are not interpreted by pango.
+ # Handle special chars so they are not interpreted by Pango.
#
if string[i] == "<":
char = "<"
@@ -132,10 +132,10 @@ class BrlMon(gtk.Window):
else:
markup += CURSOR_CELL
self.cellFrames[i].set_shadow_type(
- gtk.SHADOW_IN)
+ Gtk.ShadowType.IN)
else:
self.cellFrames[i].set_shadow_type(
- gtk.SHADOW_OUT)
+ Gtk.ShadowType.OUT)
try:
if mask:
@@ -156,4 +156,4 @@ class BrlMon(gtk.Window):
for i in range(len(string), len(self.cellFrames)):
self.cellLabels[i].set_text(" ")
self.cellFrames[i].set_shadow_type(
- gtk.SHADOW_OUT)
+ Gtk.ShadowType.OUT)
diff --git a/src/orca/chat.py b/src/orca/chat.py
index b41513b..8daa36f 100644
--- a/src/orca/chat.py
+++ b/src/orca/chat.py
@@ -402,20 +402,20 @@ class Chat:
GUI items for the current application.
"""
- import gtk
+ from gi.repository import Gtk
- vbox = gtk.VBox(False, 0)
+ vbox = Gtk.VBox(False, 0)
vbox.set_border_width(12)
- gtk.Widget.show(vbox)
+ Gtk.Widget.show(vbox)
# Translators: If this checkbox is checked, then Orca will speak
# the name of the chat room.
#
label = _("_Speak Chat Room name")
- self.speakNameCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakNameCheckButton)
- gtk.Box.pack_start(vbox, self.speakNameCheckButton, False, False, 0)
- gtk.ToggleButton.set_active(
+ self.speakNameCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakNameCheckButton)
+ Gtk.Box.pack_start(vbox, self.speakNameCheckButton, False, False, 0)
+ Gtk.ToggleButton.set_active(
self.speakNameCheckButton,
_settingsManager.getSetting('chatSpeakRoomName'))
@@ -423,10 +423,10 @@ class Chat:
# you when one of your buddies is typing a message.
#
label = _("Announce when your _buddies are typing")
- self.buddyTypingCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.buddyTypingCheckButton)
- gtk.Box.pack_start(vbox, self.buddyTypingCheckButton, False, False, 0)
- gtk.ToggleButton.set_active(
+ self.buddyTypingCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.buddyTypingCheckButton)
+ Gtk.Box.pack_start(vbox, self.buddyTypingCheckButton, False, False, 0)
+ Gtk.ToggleButton.set_active(
self.buddyTypingCheckButton,
_settingsManager.getSetting('chatAnnounceBuddyTyping'))
@@ -436,28 +436,28 @@ class Chat:
# chat rooms that they are currently in.
#
label = _("Provide chat room specific _message histories")
- self.chatRoomHistoriesCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.chatRoomHistoriesCheckButton)
- gtk.Box.pack_start(vbox, self.chatRoomHistoriesCheckButton,
+ self.chatRoomHistoriesCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.chatRoomHistoriesCheckButton)
+ Gtk.Box.pack_start(vbox, self.chatRoomHistoriesCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.chatRoomHistoriesCheckButton,
_settingsManager.getSetting('chatRoomHistories'))
# "Speak Messages" frame.
#
- messagesFrame = gtk.Frame()
- gtk.Widget.show(messagesFrame)
- gtk.Box.pack_start(vbox, messagesFrame, False, False, 5)
+ messagesFrame = Gtk.Frame()
+ Gtk.Widget.show(messagesFrame)
+ Gtk.Box.pack_start(vbox, messagesFrame, False, False, 5)
- messagesAlignment = gtk.Alignment(0.5, 0.5, 1, 1)
- gtk.Widget.show(messagesAlignment)
- gtk.Container.add(messagesFrame, messagesAlignment)
- gtk.Alignment.set_padding(messagesAlignment, 0, 0, 12, 0)
+ messagesAlignment = Gtk.Alignment.new(0.5, 0.5, 1, 1)
+ Gtk.Widget.show(messagesAlignment)
+ Gtk.Container.add(messagesFrame, messagesAlignment)
+ Gtk.Alignment.set_padding(messagesAlignment, 0, 0, 12, 0)
- messagesVBox = gtk.VBox(False, 0)
- gtk.Widget.show(messagesVBox)
- gtk.Container.add(messagesAlignment, messagesVBox)
+ messagesVBox = Gtk.VBox(False, 0)
+ Gtk.Widget.show(messagesVBox)
+ Gtk.Container.add(messagesAlignment, messagesVBox)
verbosity = _settingsManager.getSetting('chatMessageVerbosity')
@@ -465,11 +465,11 @@ class Chat:
# irrespective of whether the chat application currently has focus.
# This is the default behaviour.
#
- self.allMessagesRadioButton = gtk.RadioButton(None, _("All cha_nnels"))
- gtk.Widget.show(self.allMessagesRadioButton)
- gtk.Box.pack_start(messagesVBox, self.allMessagesRadioButton,
+ self.allMessagesRadioButton = Gtk.RadioButton(None, _("All cha_nnels"))
+ Gtk.Widget.show(self.allMessagesRadioButton)
+ Gtk.Box.pack_start(messagesVBox, self.allMessagesRadioButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.allMessagesRadioButton,
verbosity == settings.CHAT_SPEAK_ALL)
@@ -477,38 +477,38 @@ class Chat:
# that currently has focus, irrespective of whether the chat
# application has focus.
#
- self.focusedChannelRadioButton = gtk.RadioButton(
+ self.focusedChannelRadioButton = Gtk.RadioButton(
self.allMessagesRadioButton,
_("A channel only if its _window is active"))
- gtk.Widget.show(self.focusedChannelRadioButton)
- gtk.Box.pack_start(messagesVBox, self.focusedChannelRadioButton,
+ Gtk.Widget.show(self.focusedChannelRadioButton)
+ Gtk.Box.pack_start(messagesVBox, self.focusedChannelRadioButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.focusedChannelRadioButton,
verbosity == settings.CHAT_SPEAK_FOCUSED_CHANNEL)
# Translators: Orca will speak new chat messages for all channels
# only when the chat application has focus.
#
- self.allChannelsRadioButton = gtk.RadioButton(
+ self.allChannelsRadioButton = Gtk.RadioButton(
self.allMessagesRadioButton,
_("All channels when an_y %s window is active") \
% self._script.app.name)
- gtk.Widget.show(self.allChannelsRadioButton)
- gtk.Box.pack_start(messagesVBox, self.allChannelsRadioButton,
+ Gtk.Widget.show(self.allChannelsRadioButton)
+ Gtk.Box.pack_start(messagesVBox, self.allChannelsRadioButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.allChannelsRadioButton,
verbosity == settings.CHAT_SPEAK_ALL_IF_FOCUSED)
# Translators: this is the title of a panel holding options for
# how messages in this application's chat rooms should be spoken.
#
- messagesLabel = gtk.Label("<b>%s</b>" % _("Speak messages from"))
- gtk.Widget.show(messagesLabel)
- gtk.Frame.set_label_widget(messagesFrame, messagesLabel)
- messagesFrame.set_shadow_type(gtk.SHADOW_NONE)
- gtk.Label.set_use_markup(messagesLabel, True)
+ messagesLabel = Gtk.Label(label="<b>%s</b>" % _("Speak messages from"))
+ Gtk.Widget.show(messagesLabel)
+ Gtk.Frame.set_label_widget(messagesFrame, messagesLabel)
+ messagesFrame.set_shadow_type(Gtk.ShadowType.NONE)
+ Gtk.Label.set_use_markup(messagesLabel, True)
return vbox
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index 8fe328a..be29898 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -24,7 +24,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2011. Orca Team."
__license__ = "LGPL"
-import gobject
+from gi.repository import GObject
import pyatspi
import Queue
import threading
@@ -139,7 +139,7 @@ class EventManager:
if asyncMode and not self._gidleId:
if settings.gilSleepTime:
time.sleep(settings.gilSleepTime)
- self._gidleId = gobject.idle_add(self._dequeue)
+ self._gidleId = GObject.idle_add(self._dequeue)
if debugging:
debug.println(debug.LEVEL_ALL, " releasing lock...")
diff --git a/src/orca/gsmag.py b/src/orca/gsmag.py
index c9b4417..2b6810a 100644
--- a/src/orca/gsmag.py
+++ b/src/orca/gsmag.py
@@ -44,8 +44,8 @@ import debug
#
_isActive = False
-import gtk
-_display = gtk.gdk.display_get_default()
+from gi.repository import Gdk
+_display = Gdk.Display.get_default()
_screen = _display.get_default_screen()
_screenWidth = _screen.get_width()
_screenHeight = _screen.get_height()
diff --git a/src/orca/keybindings.py b/src/orca/keybindings.py
index a2390c2..61de230 100644
--- a/src/orca/keybindings.py
+++ b/src/orca/keybindings.py
@@ -26,15 +26,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
__license__ = "LGPL"
-try:
- # This can fail due to gtk not being available. We want to
- # be able to recover from that if possible. The main driver
- # for this is to allow "orca --text-setup" to work even if
- # the desktop is not running.
- #
- import gtk
-except ImportError:
- pass
+from gi.repository import Gdk
import pyatspi
import debug
@@ -58,7 +50,7 @@ def getAllKeysyms(keysym):
# Find the numerical value of the keysym
#
- keyval = gtk.gdk.keyval_from_name(keysym)
+ keyval = Gdk.keyval_from_name(keysym)
if keyval != 0:
# Find the keycodes for the keysym. Since a keysym
@@ -67,7 +59,7 @@ def getAllKeysyms(keysym):
# level (each entry is of the form [keycode, group,
# level]).
#
- keymap = gtk.gdk.keymap_get_default()
+ keymap = Gdk.Keymap.get_default()
entries = keymap.get_entries_for_keyval(keyval)
keycode = 0
if entries:
@@ -80,13 +72,12 @@ def getAllKeysyms(keysym):
# we are looking for.
#
if keycode != 0:
- entries = keymap.get_entries_for_keycode(keycode)
- if entries:
- for entry in entries:
- keyval = entry[0]
- name = gtk.gdk.keyval_name(keyval)
- if name and (name != keysym):
- _keysymsCache[keysym].append(name)
+ success, entries = keymap.get_entries_for_keycode(keycode)
+ for entry in entries:
+ keyval = entry[0]
+ name = Gdk.keyval_name(keyval)
+ if name and (name != keysym):
+ _keysymsCache[keysym].append(name)
return _keysymsCache[keysym]
@@ -120,11 +111,11 @@ def getKeycode(keysym):
return 0
if keysym not in _keycodeCache:
- keymap = gtk.gdk.keymap_get_default()
+ keymap = Gdk.Keymap.get_default()
# Find the numerical value of the keysym
#
- keyval = gtk.gdk.keyval_from_name(keysym)
+ keyval = Gdk.keyval_from_name(keysym)
if keyval == 0:
return 0
@@ -134,14 +125,13 @@ def getKeycode(keysym):
# entry is of the form [keycode, group, level]).
#
_keycodeCache[keysym] = 0
- entries = keymap.get_entries_for_keyval(keyval)
- if entries:
- for entry in entries:
- if entry[1] == 0: # group = 0
- _keycodeCache[keysym] = entry[0]
- break
- if _keycodeCache[keysym] == 0:
- _keycodeCache[keysym] = entries[0][0]
+ success, entries = keymap.get_entries_for_keyval(keyval)
+ for entry in entries:
+ if entry.group == 0:
+ _keycodeCache[keysym] = entry.keycode
+ break
+ if _keycodeCache[keysym] == 0:
+ _keycodeCache[keysym] = entries[0].keycode
#print keysym, keyval, entries, _keycodeCache[keysym]
diff --git a/src/orca/liveregions.py b/src/orca/liveregions.py
index 3b225c7..d246b65 100644
--- a/src/orca/liveregions.py
+++ b/src/orca/liveregions.py
@@ -1,5 +1,5 @@
import bisect
-import gobject
+from gi.repository import GObject
import orca_state
import pyatspi
import speech
@@ -182,7 +182,7 @@ class LiveRegionManager:
message = self._getMessage(event)
if message:
if len(self.msg_queue) == 0:
- gobject.timeout_add(100, self.pumpMessages)
+ GObject.timeout_add(100, self.pumpMessages)
self.msg_queue.enqueue(message, politeness, event.source)
def pumpMessages(self):
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 62e52d7..a53f0a0 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -28,15 +28,15 @@ __license__ = "LGPL"
import debug
try:
- import wnck
+ from gi.repository import Wnck
_mouseReviewCapable = True
except:
debug.println(debug.LEVEL_WARNING, \
"Python module wnck not found, mouse review not available.")
_mouseReviewCapable = False
-import gtk
-import gobject
+from gi.repository import Gdk
+from gi.repository import GObject
import orca
import pyatspi
@@ -50,8 +50,7 @@ class BoundingBox:
"""A bounding box, currently it is used to test if a given point is
inside the bounds of the box.
"""
- # TODO: Find if we pygtk or something already has this,
- # if not, maybe this needs to be in a different Orca file.
+
def __init__(self, x, y, width, height):
"""Initialize a bounding box.
@@ -149,7 +148,7 @@ class MouseReviewer:
return
# Need to do this and allow the main loop to cycle once to get any info
- wnck_screen = wnck.screen_get_default()
+ wnck_screen = Wnck.Screen.get_default()
self.active = False
self._currentMouseOver = _ItemContext()
self._oldMouseOver = _ItemContext()
@@ -183,7 +182,7 @@ class MouseReviewer:
- event: The event we recieved.
"""
if settings.mouseDwellDelay:
- gobject.timeout_add(settings.mouseDwellDelay,
+ GObject.timeout_add(settings.mouseDwellDelay,
self._mouseDwellTimeout,
event.detail1,
event.detail2)
@@ -195,10 +194,10 @@ class MouseReviewer:
component.
Arguments:
- - prev_x: Previuos X coordinate of mouse pointer.
- - prev_y: Previuos Y coordinate of mouse pointer.
+ - prev_x: Previous X coordinate of mouse pointer.
+ - prev_y: Previous Y coordinate of mouse pointer.
"""
- display = gtk.gdk.Display(gtk.gdk.get_display())
+ display = Gdk.Display.get_default()
screen, x, y, flags = display.get_pointer()
if abs(prev_x - x) <= settings.mouseDwellMaxDrift \
and abs(prev_y - y) <= settings.mouseDwellMaxDrift \
@@ -281,7 +280,7 @@ class MouseReviewer:
Returns position of given window in window-managers stack.
"""
# This is neccesary because z-order is still broken in AT-SPI.
- wnck_screen = wnck.screen_get_default()
+ wnck_screen = Wnck.screen_get_default()
window_order = \
[w.get_name() for w in wnck_screen.get_windows_stacked()]
return window_order.index(frame_name)
@@ -332,7 +331,7 @@ class MouseReviewer:
return top_window[0]
# Initialize a singleton reviewer.
-if gtk.gdk.display_get_default():
+if Gdk.Display.get_default():
mouse_reviewer = MouseReviewer()
else:
raise RuntimeError('Cannot initialize mouse review, no display')
diff --git a/src/orca/orca-mainwin.ui b/src/orca/orca-mainwin.ui
index 4cc941b..3e7d860 100644
--- a/src/orca/orca-mainwin.ui
+++ b/src/orca/orca-mainwin.ui
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
<interface>
- <!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="mainWindow">
<property name="width_request">0</property>
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 5e2a6d9..9e65017 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -1322,7 +1322,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="progressBarVerbosity">
+ <object class="GtkComboBoxText" id="progressBarVerbosity">
<property name="visible">True</property>
<property name="model">model7</property>
<accessibility>
@@ -1461,7 +1461,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="sayAllStyle">
+ <object class="GtkComboBoxText" id="sayAllStyle">
<property name="visible">True</property>
<property name="model">model2</property>
<accessibility>
@@ -2308,7 +2308,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="orcaModifierComboBox">
+ <object class="GtkComboBoxText" id="orcaModifierComboBox">
<property name="visible">True</property>
<property name="model">model8</property>
<signal name="changed" handler="orcaModifierChanged"/>
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 6fbcb07..c7d6fa4 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -35,12 +35,10 @@ import time
import unicodedata
import shutil
-# This must happen BEFORE we import gtk (until we start using
-# introspection).
from gi.repository.Gio import Settings
a11yAppSettings = Settings('org.gnome.desktop.a11y.applications')
-# We're going to force the name of the app to "orca" so pygtk
+# We're going to force the name of the app to "orca" so we
# will end up showing us as "orca" to the AT-SPI. If we don't
# do this, the name can end up being "-c". See bug 364452 at
# http://bugzilla.gnome.org/show_bug.cgi?id=364452 for more
@@ -48,15 +46,14 @@ a11yAppSettings = Settings('org.gnome.desktop.a11y.applications')
#
sys.argv[0] = "orca"
import pyatspi
-import pygtk
-pygtk.require('2.0')
try:
# This can fail due to gtk not being available. We want to
# be able to recover from that if possible. The main driver
# for this is to allow "orca --text-setup" to work even if
# the desktop is not running.
#
- import gtk
+ from gi.repository import Gtk
+ from gi.repository import Gdk
except:
pass
@@ -99,7 +96,7 @@ class Options:
self.desktopRunning = False
try:
- if gtk.gdk.display_get_default():
+ if Gdk.Display.get_default():
self.desktopRunning = True
except:
pass
@@ -1161,12 +1158,12 @@ def _processKeyCaptured(event):
# If it's not on the keypad, get the name of the unshifted
# character. (i.e. "1" instead of "!")
#
- keymap = gtk.gdk.keymap_get_default()
- entries = keymap.get_entries_for_keycode(event.hw_code)
- event.event_string = gtk.gdk.keyval_name(entries[0][0])
+ keymap = Gdk.Keymap.get_default()
+ success, entries = keymap.get_entries_for_keycode(event.hw_code)
+ event.event_string = Gdk.keyval_name(entries[0].keycode)
if event.event_string.startswith("KP") and \
event.event_string != "KP_Enter":
- name = gtk.gdk.keyval_name(entries[1][0])
+ name = Gdk.keyval_name(entries[1].keycode)
if name.startswith("KP"):
event.event_string = name
@@ -1694,9 +1691,9 @@ def helpForOrca(script=None, inputEvent=None, page=""):
uri = "ghelp:orca"
if page:
uri += "?%s" % page
- gtk.show_uri(gtk.gdk.screen_get_default(),
+ Gtk.show_uri(Gdk.Screen.get_default(),
uri,
- gtk.get_current_event_time())
+ Gtk.get_current_event_time())
return True
def listShortcuts(event):
diff --git a/src/orca/orca_console_prefs.py b/src/orca/orca_console_prefs.py
index a95930c..e3849f0 100644
--- a/src/orca/orca_console_prefs.py
+++ b/src/orca/orca_console_prefs.py
@@ -37,8 +37,8 @@ import time
desktopRunning = False
try:
- import gtk
- if gtk.gdk.display_get_default():
+ from gi.repository import Gdk
+ if Gdk.Display.get_default():
desktopRunning = True
except:
pass
@@ -607,9 +607,9 @@ def showPreferencesUI(commandLineSettings):
speechVoiceChoice)
time.sleep(2)
- import gobject
- gobject.threads_init()
- gobject.idle_add(logoutUser)
+ from gi.repository import GObject
+ GObject.threads_init()
+ GObject.idle_add(logoutUser)
break
except:
stop = False
diff --git a/src/orca/orca_gtkbuilder.py b/src/orca/orca_gtkbuilder.py
index 3d65f6e..a2c2654 100644
--- a/src/orca/orca_gtkbuilder.py
+++ b/src/orca/orca_gtkbuilder.py
@@ -26,7 +26,7 @@ __copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
__license__ = "LGPL"
import gettext
-import gtk
+from gi.repository import Gtk
from orca_i18n import _
@@ -44,7 +44,7 @@ class GtkBuilderWrapper:
def __init__(self, fileName, windowName):
# Load GtkBuilder file.
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
self.builder.set_translation_domain(gettext.textdomain())
self.builder.add_from_file(fileName)
self.gtkWindow = self.builder.get_object(windowName)
@@ -68,7 +68,7 @@ class GtkBuilderWrapper:
default for all application windows.
"""
- icon_theme = gtk.icon_theme_get_default()
+ icon_theme = Gtk.IconTheme.get_default()
try:
icon16 = icon_theme.load_icon("orca", 16, 0)
icon22 = icon_theme.load_icon("orca", 22, 0)
@@ -78,11 +78,11 @@ class GtkBuilderWrapper:
except:
return
else:
- gtk.window_set_default_icon_list(icon16,
+ Gtk.Window.set_default_icon_list((icon16,
icon22,
icon24,
icon32,
- icon48)
+ icon48))
def get_widget(self, attribute):
"""Return the requested widget. This routine has been introduced
@@ -125,7 +125,7 @@ class GtkBuilderWrapper:
useMarkup = False
useUnderline = False
- if isinstance(obj, gtk.Frame):
+ if isinstance(obj, Gtk.Frame):
# For some reason, if we localize the frame, which has a label
# but does not (itself) support use_markup, we get unmarked
# labels which are not bold but which do have <b></b>. If we
diff --git a/src/orca/orca_gui_find.py b/src/orca/orca_gui_find.py
index 3e15daf..8015224 100644
--- a/src/orca/orca_gui_find.py
+++ b/src/orca/orca_gui_find.py
@@ -28,7 +28,7 @@ __license__ = "LGPL"
import os
import sys
import debug
-import gtk
+from gi.repository import Gtk
import locale
import find
@@ -89,7 +89,7 @@ class OrcaFindGUI(orca_gtkbuilder.GtkBuilderWrapper):
findDialog.realize()
ts = orca_state.lastInputEventTimestamp
if ts == 0:
- ts = gtk.get_current_event_time()
+ ts = Gtk.get_current_event_time()
findDialog.window.set_user_time(ts)
except AttributeError:
debug.printException(debug.LEVEL_FINEST)
@@ -261,7 +261,7 @@ def main():
showFindUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/orca_gui_main.py b/src/orca/orca_gui_main.py
index 3fa6846..c31dc11 100644
--- a/src/orca/orca_gui_main.py
+++ b/src/orca/orca_gui_main.py
@@ -27,7 +27,7 @@ __license__ = "LGPL"
import os
import sys
-import gtk
+from gi.repository import Gtk
import locale
import orca
@@ -54,10 +54,10 @@ class OrcaMainGUI(orca_gtkbuilder.GtkBuilderWrapper):
mainWindow = self.get_widget("mainWindow")
- accelGroup = gtk.AccelGroup()
+ accelGroup = Gtk.AccelGroup()
mainWindow.add_accel_group(accelGroup)
helpButton = self.get_widget("helpButton")
- (keyVal, modifierMask) = gtk.accelerator_parse("F1")
+ (keyVal, modifierMask) = Gtk.accelerator_parse("F1")
helpButton.add_accelerator("clicked",
accelGroup,
keyVal,
@@ -130,7 +130,7 @@ class OrcaMainGUI(orca_gtkbuilder.GtkBuilderWrapper):
"\nBoston MA 02110-1301 USA.")
url = "http://live.gnome.org/Orca"
- self.aboutDialog = gtk.AboutDialog()
+ self.aboutDialog = Gtk.AboutDialog()
self.aboutDialog.set_authors(authors)
self.aboutDialog.set_documenters(documenters)
self.aboutDialog.set_translator_credits(translatorCredits)
@@ -220,7 +220,7 @@ def main():
showMainUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index cf7f438..e8913c3 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -27,14 +27,14 @@ __license__ = "LGPL"
import os
import sys
-import debug
-import gtk
-import gobject
-import pango # for ellipsize property constants of CellRendererText
+from gi.repository import Gtk
+from gi.repository import GObject
+from gi.repository import Pango
import locale
import time
import acss
+import debug
import orca
import orca_gtkbuilder
import orca_state
@@ -192,32 +192,32 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
for column in self.keyBindView.get_columns():
self.keyBindView.remove_column(column)
- self.keyBindingsModel = gtk.TreeStore(
- gobject.TYPE_STRING, # Handler name
- gobject.TYPE_STRING, # Human Readable Description
- gobject.TYPE_STRING, # Modifier mask 1
- gobject.TYPE_STRING, # Used Modifiers 1
- gobject.TYPE_STRING, # Modifier key name 1
- gobject.TYPE_STRING, # Click count 1
- gobject.TYPE_STRING, # Original Text of the Key Binding Shown 1
- gobject.TYPE_STRING, # Text of the Key Binding Shown 1
- gobject.TYPE_STRING, # Modifier mask 2
- gobject.TYPE_STRING, # Used Modifiers 2
- gobject.TYPE_STRING, # Modifier key name 2
- gobject.TYPE_STRING, # Click count 2
- gobject.TYPE_STRING, # Original Text of the Key Binding Shown 2
- gobject.TYPE_STRING, # Text of the Key Binding Shown 2
- gobject.TYPE_BOOLEAN, # Key Modified by User
- gobject.TYPE_BOOLEAN) # Row with fields editable or not
-
- self.planeCellRendererText = gtk.CellRendererText()
-
- self.cellRendererText = gtk.CellRendererText()
- self.cellRendererText.set_property("ellipsize", pango.ELLIPSIZE_END)
+ self.keyBindingsModel = Gtk.TreeStore(
+ GObject.TYPE_STRING, # Handler name
+ GObject.TYPE_STRING, # Human Readable Description
+ GObject.TYPE_STRING, # Modifier mask 1
+ GObject.TYPE_STRING, # Used Modifiers 1
+ GObject.TYPE_STRING, # Modifier key name 1
+ GObject.TYPE_STRING, # Click count 1
+ GObject.TYPE_STRING, # Original Text of the Key Binding Shown 1
+ GObject.TYPE_STRING, # Text of the Key Binding Shown 1
+ GObject.TYPE_STRING, # Modifier mask 2
+ GObject.TYPE_STRING, # Used Modifiers 2
+ GObject.TYPE_STRING, # Modifier key name 2
+ GObject.TYPE_STRING, # Click count 2
+ GObject.TYPE_STRING, # Original Text of the Key Binding Shown 2
+ GObject.TYPE_STRING, # Text of the Key Binding Shown 2
+ GObject.TYPE_BOOLEAN, # Key Modified by User
+ GObject.TYPE_BOOLEAN) # Row with fields editable or not
+
+ self.planeCellRendererText = Gtk.CellRendererText()
+
+ self.cellRendererText = Gtk.CellRendererText()
+ self.cellRendererText.set_property("ellipsize", Pango.EllipsizeMode.END)
# HANDLER - invisble column
#
- column = gtk.TreeViewColumn("Handler",
+ column = Gtk.TreeViewColumn("Handler",
self.planeCellRendererText,
text=HANDLER)
column.set_resizable(True)
@@ -233,7 +233,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# what action Orca will take when the user invokes an Orca-specific
# keyboard command.
#
- column = gtk.TreeViewColumn(_("Function"),
+ column = Gtk.TreeViewColumn(_("Function"),
self.cellRendererText,
text=DESCRIP)
column.set_resizable(True)
@@ -243,7 +243,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# MOD_MASK1 - invisble column
#
- column = gtk.TreeViewColumn("Mod.Mask 1",
+ column = Gtk.TreeViewColumn("Mod.Mask 1",
self.planeCellRendererText,
text=MOD_MASK1)
column.set_visible(False)
@@ -253,7 +253,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# MOD_USED1 - invisble column
#
- column = gtk.TreeViewColumn("Use Mod.1",
+ column = Gtk.TreeViewColumn("Use Mod.1",
self.planeCellRendererText,
text=MOD_USED1)
column.set_visible(False)
@@ -263,7 +263,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# KEY1 - invisble column
#
- column = gtk.TreeViewColumn("Key1",
+ column = Gtk.TreeViewColumn("Key1",
self.planeCellRendererText,
text=KEY1)
column.set_resizable(True)
@@ -273,7 +273,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# CLICK_COUNT1 - invisble column
#
- column = gtk.TreeViewColumn("ClickCount1",
+ column = Gtk.TreeViewColumn("ClickCount1",
self.planeCellRendererText,
text=CLICK_COUNT1)
column.set_resizable(True)
@@ -286,7 +286,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# buttons being pressed. This will prevent automatic
# resorting each time a cell is edited.
#
- column = gtk.TreeViewColumn("OldText1",
+ column = Gtk.TreeViewColumn("OldText1",
self.planeCellRendererText,
text=OLDTEXT1)
column.set_resizable(True)
@@ -296,7 +296,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# TEXT1
#
- rendererText = gtk.CellRendererText()
+ rendererText = Gtk.CellRendererText()
rendererText.connect("editing-started",
self.editingKey,
self.keyBindingsModel)
@@ -311,7 +311,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# the cells in the column represent keyboard combinations
# the user can press to invoke Orca commands.
#
- column = gtk.TreeViewColumn(_("Key Binding"),
+ column = Gtk.TreeViewColumn(_("Key Binding"),
rendererText,
text=TEXT1,
editable=EDITABLE)
@@ -321,7 +321,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# MOD_MASK2 - invisble column
#
- column = gtk.TreeViewColumn("Mod.Mask 2",
+ column = Gtk.TreeViewColumn("Mod.Mask 2",
self.planeCellRendererText,
text=MOD_MASK2)
column.set_visible(False)
@@ -331,7 +331,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# MOD_USED2 - invisble column
#
- column = gtk.TreeViewColumn("Use Mod.2",
+ column = Gtk.TreeViewColumn("Use Mod.2",
self.planeCellRendererText,
text=MOD_USED2)
column.set_visible(False)
@@ -341,7 +341,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# KEY2 - invisble column
#
- column = gtk.TreeViewColumn("Key2", rendererText, text=KEY2)
+ column = Gtk.TreeViewColumn("Key2", rendererText, text=KEY2)
column.set_resizable(True)
column.set_visible(False)
column.set_sort_column_id(KEY2)
@@ -349,7 +349,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# CLICK_COUNT2 - invisble column
#
- column = gtk.TreeViewColumn("ClickCount2",
+ column = Gtk.TreeViewColumn("ClickCount2",
self.planeCellRendererText,
text=CLICK_COUNT2)
column.set_resizable(True)
@@ -362,7 +362,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# buttons being pressed. This will prevent automatic
# resorting each time a cell is edited.
#
- column = gtk.TreeViewColumn("OldText2",
+ column = Gtk.TreeViewColumn("OldText2",
self.planeCellRendererText,
text=OLDTEXT2)
column.set_resizable(True)
@@ -372,7 +372,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# TEXT2
#
- rendererText = gtk.CellRendererText()
+ rendererText = Gtk.CellRendererText()
rendererText.connect("editing-started",
self.editingKey,
self.keyBindingsModel)
@@ -390,7 +390,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# addition to the key bindings in the "Key Bindings"
# column.
#
- column = gtk.TreeViewColumn(_("Alternate"),
+ column = Gtk.TreeViewColumn(_("Alternate"),
rendererText,
text=TEXT2,
editable=EDITABLE)
@@ -400,7 +400,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# MODIF
#
- rendererToggle = gtk.CellRendererToggle()
+ rendererToggle = Gtk.CellRendererToggle()
rendererToggle.connect('toggled',
self.keyModifiedToggle,
self.keyBindingsModel,
@@ -410,7 +410,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# cells represent whether a key binding has been modified
# from the default key binding.
#
- column = gtk.TreeViewColumn(_("Modified"),
+ column = Gtk.TreeViewColumn(_("Modified"),
rendererToggle,
active=MODIF,
activatable=EDITABLE)
@@ -421,9 +421,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# EDITABLE - invisble column
#
- rendererToggle = gtk.CellRendererToggle()
+ rendererToggle = Gtk.CellRendererToggle()
rendererToggle.set_property('activatable', False)
- column = gtk.TreeViewColumn("Modified",
+ column = Gtk.TreeViewColumn("Modified",
rendererToggle,
active=EDITABLE)
column.set_visible(False)
@@ -1002,10 +1002,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
attrDict[attrList[i]])
if localizedKey == model[path][NAME]:
thisIter = model.get_iter(path)
- model.set(thisIter,
- NAME, localizedKey,
- IS_SPOKEN, state,
- VALUE, localizedValue)
+ model.set_value(thisIter, NAME, localizedKey)
+ model.set_value(thisIter, IS_SPOKEN, state)
+ model.set_value(thisIter, VALUE, localizedValue)
if moveToTop:
thisIter = model.get_iter(path)
otherIter = model.get_iter(i)
@@ -1039,7 +1038,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
text_attribute_names.getTextAttributeName(attrList[i])
if localizedKey == model[path][NAME]:
thisIter = model.get_iter(path)
- model.set(thisIter, IS_BRAILLED, state)
+ model.set_value(thisIter, IS_BRAILLED, state)
break
view.set_model(model)
@@ -1179,10 +1178,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
for column in self.getTextAttributesView.get_columns():
self.getTextAttributesView.remove_column(column)
- model = gtk.ListStore(gobject.TYPE_STRING,
- gobject.TYPE_BOOLEAN,
- gobject.TYPE_BOOLEAN,
- gobject.TYPE_STRING)
+ model = Gtk.ListStore(GObject.TYPE_STRING,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_STRING)
# Initially setup the list store model based on the values of all
# the known text attributes.
@@ -1197,11 +1196,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
localizedValue = \
text_attribute_names.getTextAttributeName( \
allAttrDict[allAttrList[i]])
- model.set(thisIter,
- NAME, localizedKey,
- IS_SPOKEN, False,
- IS_BRAILLED, False,
- VALUE, localizedValue)
+ model.set_value(thisIter, NAME, localizedKey)
+ model.set_value(thisIter, IS_SPOKEN, False)
+ model.set_value(thisIter, IS_BRAILLED, False)
+ model.set_value(thisIter, VALUE, localizedValue)
self.getTextAttributesView.set_model(model)
@@ -1210,12 +1208,12 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# Translators: Attribute here refers to text attributes such
# as bold, underline, family-name, etc.
#
- column = gtk.TreeViewColumn(_("Attribute Name"))
+ column = Gtk.TreeViewColumn(_("Attribute Name"))
column.set_min_width(250)
column.set_resizable(True)
- renderer = gtk.CellRendererText()
+ renderer = Gtk.CellRendererText()
column.pack_end(renderer, True)
- column.set_attributes(renderer, text=NAME)
+ column.add_attribute(renderer, 'text', NAME)
self.getTextAttributesView.insert_column(column, 0)
# Attribute Speak column (IS_SPOKEN).
@@ -1226,10 +1224,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# presses Orca_Modifier+F.
#
speakAttrColumnLabel = _("Speak")
- column = gtk.TreeViewColumn(speakAttrColumnLabel)
- renderer = gtk.CellRendererToggle()
+ column = Gtk.TreeViewColumn(speakAttrColumnLabel)
+ renderer = Gtk.CellRendererToggle()
column.pack_start(renderer, False)
- column.set_attributes(renderer, active=IS_SPOKEN)
+ column.add_attribute(renderer, 'active', IS_SPOKEN)
renderer.connect("toggled",
self.textAttributeSpokenToggled,
model)
@@ -1244,10 +1242,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# the refreshable braille display.
#
markAttrColumnLabel = _("Mark in braille")
- column = gtk.TreeViewColumn(markAttrColumnLabel)
- renderer = gtk.CellRendererToggle()
+ column = Gtk.TreeViewColumn(markAttrColumnLabel)
+ renderer = Gtk.CellRendererToggle()
column.pack_start(renderer, False)
- column.set_attributes(renderer, active=IS_BRAILLED)
+ column.add_attribute(renderer, 'active', IS_BRAILLED)
renderer.connect("toggled",
self.textAttributeBrailledToggled,
model)
@@ -1269,11 +1267,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# value of underline is none (i.e. when it's not underlined).
# "Present" here is being used as a verb.
#
- column = gtk.TreeViewColumn(_("Present Unless"))
- renderer = gtk.CellRendererText()
+ column = Gtk.TreeViewColumn(_("Present Unless"))
+ renderer = Gtk.CellRendererText()
renderer.set_property('editable', True)
column.pack_end(renderer, True)
- column.set_attributes(renderer, text=VALUE)
+ column.add_attribute(renderer, 'text', VALUE)
renderer.connect("edited", self.textAttrValueEdited, model)
self.getTextAttributesView.insert_column(column, 4)
@@ -1358,8 +1356,8 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
for column in self.pronunciationView.get_columns():
self.pronunciationView.remove_column(column)
- model = gtk.ListStore(gobject.TYPE_STRING,
- gobject.TYPE_STRING)
+ model = Gtk.ListStore(GObject.TYPE_STRING,
+ GObject.TYPE_STRING)
# Initially setup the list store model based on the values of all
# existing entries in the pronunciation dictionary.
@@ -1392,13 +1390,13 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# or a particular word that is pronounced differently then the way
# that it looks.
#
- column = gtk.TreeViewColumn(_("Actual String"))
+ column = Gtk.TreeViewColumn(_("Actual String"))
column.set_min_width(250)
column.set_resizable(True)
- renderer = gtk.CellRendererText()
+ renderer = Gtk.CellRendererText()
renderer.set_property('editable', True)
column.pack_end(renderer, True)
- column.set_attributes(renderer, text=ACTUAL)
+ column.add_attribute(renderer, 'text', ACTUAL)
renderer.connect("edited", self.pronActualValueEdited, model)
self.pronunciationView.insert_column(column, 0)
@@ -1409,11 +1407,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# For example: if the actual string was "MHz", then the replacement
# (spoken) string would be "megahertz".
#
- column = gtk.TreeViewColumn(_("Replacement String"))
- renderer = gtk.CellRendererText()
+ column = Gtk.TreeViewColumn(_("Replacement String"))
+ renderer = Gtk.CellRendererText()
renderer.set_property('editable', True)
column.pack_end(renderer, True)
- column.set_attributes(renderer, text=REPLACEMENT)
+ column.add_attribute(renderer, 'text', REPLACEMENT)
renderer.connect("edited", self.pronReplacementValueEdited, model)
self.pronunciationView.insert_column(column, 1)
@@ -1647,7 +1645,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
selectedTable = prefs["brailleContractionTable"] or \
braille.getDefaultTable()
if tableDict:
- tablesModel = gtk.ListStore(str, str)
+ tablesModel = Gtk.ListStore(str, str)
names = tableDict.keys()
names.sort()
for name in names:
@@ -1757,8 +1755,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.get_widget("quitOrcaNoConfirmationCheckButton").set_active(
prefs["quitOrcaNoConfirmation"])
self.get_widget("presentToolTipsCheckButton").set_active(
- prefs["presentToolTips"] \
- and _settingsManager.getSetting('canPresentToolTips'))
+ prefs["presentToolTips"])
if prefs["keyboardLayout"] == settings.GENERAL_KEYBOARD_LAYOUT_DESKTOP:
self.get_widget("generalDesktopButton").set_active(True)
@@ -1812,7 +1809,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
- items: the list of strings with which to populate it
"""
- model = gtk.ListStore(str)
+ model = Gtk.ListStore(str)
for item in items:
model.append([item])
combobox.set_model(model)
@@ -1888,10 +1885,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
orcaSetupWindow = self.get_widget("orcaSetupWindow")
- accelGroup = gtk.AccelGroup()
+ accelGroup = Gtk.AccelGroup()
orcaSetupWindow.add_accel_group(accelGroup)
helpButton = self.get_widget("helpButton")
- (keyVal, modifierMask) = gtk.accelerator_parse("F1")
+ (keyVal, modifierMask) = Gtk.accelerator_parse("F1")
helpButton.add_accelerator("clicked",
accelGroup,
keyVal,
@@ -1914,10 +1911,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
try:
ts = orca_state.lastInputEventTimestamp
if ts == 0:
- ts = gtk.get_current_event_time()
+ ts = Gtk.get_current_event_time()
if ts > 0:
orcaSetupWindow.window.set_user_time(ts)
- except AttributeError:
+ except (AttributeError, RuntimeError):
debug.printException(debug.LEVEL_FINEST)
# We always want to re-order the text attributes page so that enabled
@@ -1937,7 +1934,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
- combobox: the GtkComboBox to initialize.
"""
- cell = gtk.CellRendererText()
+ cell = Gtk.CellRendererText()
combobox.pack_start(cell, True)
# We only want to display one column; not two.
#
@@ -1946,12 +1943,12 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
combobox.add_attribute(columnToDisplay, 'text', 1)
except:
combobox.add_attribute(cell, 'text', 1)
- model = gtk.ListStore(int, str)
+ model = Gtk.ListStore(int, str)
combobox.set_model(model)
# Force the display comboboxes to be left aligned.
#
- if isinstance(combobox, gtk.ComboBoxEntry):
+ if isinstance(combobox, Gtk.ComboBoxText):
size = combobox.size_request()
cell.set_fixed_size(size[0] - 29, -1)
@@ -1999,14 +1996,13 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
model = self.keyBindingsModel
myiter = model.append(None)
- model.set(myiter,
- DESCRIP, appName,
- MODIF, False)
+ model.set_value(myiter, DESCRIP, appName)
+ model.set_value(myiter, MODIF, False)
return myiter
def _getIterOf(self, appName):
- """Returns the gtk.TreeIter of the TreeStore model
+ """Returns the Gtk.TreeIter of the TreeStore model
that matches the application name passed as argument
Arguments:
@@ -2072,13 +2068,14 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
text = keybindings.getModifierNames(kb.modifiers) \
+ kb.keysymstring \
+ clickCount
- model.set(iterChild,
- MOD_MASK2, str(kb.modifier_mask),
- MOD_USED2, str(kb.modifiers),
- KEY2, kb.keysymstring,
- CLICK_COUNT2, str(kb.click_count),
- OLDTEXT2, text,
- TEXT2, text)
+
+
+ model.set_value(iterChild, MOD_MASK2, str(kb.modifier_mask))
+ model.set_value(iterChild, MOD_USED2, str(kb.modifiers))
+ model.set_value(iterChild, KEY2, kb.keysymstring)
+ model.set_value(iterChild, CLICK_COUNT2, str(kb.click_count))
+ model.set_value(iterChild, OLDTEXT2, text)
+ model.set_value(iterChild, TEXT2, text)
iterChild = model.iter_next(iterChild)
myiter = model.iter_next(myiter)
@@ -2093,7 +2090,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
- parent: the parent node of the treeview, where to append the kb
- modif: whether to check the modified field or not.
- Returns a gtk.TreeIter pointing at the new row.
+ Returns a Gtk.TreeIter pointing at the new row.
"""
model = self.keyBindingsModel
@@ -2110,17 +2107,19 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
text = keybindings.getModifierNames(kb.modifiers) \
+ kb.keysymstring \
+ clickCount
- model.set (myiter,
- HANDLER, handl,
- DESCRIP, kb.handler.description,
- MOD_MASK1, str(kb.modifier_mask),
- MOD_USED1, str(kb.modifiers),
- KEY1, kb.keysymstring,
- CLICK_COUNT1, str(kb.click_count),
- OLDTEXT1, text,
- TEXT1, text,
- MODIF, modif,
- EDITABLE, True)
+
+ model.set_value(myiter, HANDLER, handl)
+ model.set_value(myiter, DESCRIP, kb.handler.description)
+ model.set_value(myiter, MOD_MASK1, str(kb.modifier_mask))
+ model.set_value(myiter, MOD_USED1, str(kb.modifiers))
+ model.set_value(myiter, KEY1, kb.keysymstring)
+ model.set_value(myiter, CLICK_COUNT1, str(kb.click_count))
+ if text != None:
+ model.set_value(myiter, OLDTEXT1, text)
+ model.set_value(myiter, TEXT1, text)
+ model.set_value(myiter, MODIF, modif)
+ model.set_value(myiter, EDITABLE, True)
+
return myiter
else:
return None
@@ -2136,7 +2135,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
- parent: the parent node of the treeview, where to append the kb
- modif: whether to check the modified field or not.
- Returns a gtk.TreeIter pointing at the new row.
+ Returns a Gtk.TreeIter pointing at the new row.
"""
model = self.keyBindingsModel
@@ -2151,13 +2150,12 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
if parent != None:
myiter = model.append(parent)
- model.set (myiter,
- HANDLER, handl,
- DESCRIP, inputEvHand.description,
- KEY1, str(com),
- TEXT1, braille.command_name[com],
- MODIF, modif,
- EDITABLE, False)
+ model.set_value(myiter, HANDLER, handl)
+ model.set_value(myiter, DESCRIP, inputEvHand.description)
+ model.set_value(myiter, KEY1, str(com))
+ model.set_value(myiter, TEXT1, braille.command_name[com])
+ model.set_value(myiter, MODIF, modif)
+ model.set_value(myiter, EDITABLE, False)
return myiter
else:
return None
@@ -2198,7 +2196,6 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.keyBindView.set_model(None)
self.keyBindView.set_headers_visible(False)
- self.keyBindView.hide_all()
self.keyBindView.hide()
if clearModel:
self.keyBindingsModel.clear()
@@ -2251,7 +2248,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.keyBindView.set_model(self.keyBindingsModel)
self.keyBindView.set_headers_visible(True)
self.keyBindView.expand_all()
- self.keyBindingsModel.set_sort_column_id(OLDTEXT1, gtk.SORT_ASCENDING)
+ self.keyBindingsModel.set_sort_column_id(OLDTEXT1, Gtk.SortType.ASCENDING)
self.keyBindView.show()
# Keep track of new/unbound keybindings that have yet to be applied.
@@ -2457,7 +2454,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# The name of the setting that will be changed is: settingName
# The id of the widget in the ui should be: settingNameCheckButton
#
- settingName = gtk.Buildable.get_name(widget)
+ settingName = Gtk.Buildable.get_name(widget)
# strip "CheckButton" from the end.
settingName = settingName[:-11]
self.prefsDict[settingName] = widget.get_active()
@@ -3026,9 +3023,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
- widget: the component that generated the signal.
"""
- self.prefsDict["presentToolTips"] = \
- widget.get_active() \
- and _settingsManager.getSetting('canPresentToolTips')
+ self.prefsDict["presentToolTips"] = widget.get_active()
def keyboardLayoutChanged(self, widget):
"""Signal handler for the "toggled" signal for the generalDesktopButton,
@@ -3373,9 +3368,6 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.keyBindView.set_headers_visible(False)
self.getTextAttributesView.set_headers_visible(False)
self.pronunciationView.set_headers_visible(False)
- self.keyBindView.hide_all()
- self.getTextAttributesView.hide_all()
- self.pronunciationView.hide_all()
self.keyBindView.hide()
self.getTextAttributesView.hide()
self.pronunciationView.hide()
@@ -3420,17 +3412,17 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
"Continue updating the existing profile with " \
"these new changes?") % profileToSaveLabel
- dialog = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_YES_NO)
+ dialog = Gtk.MessageDialog(None,
+ Gtk.DialogFlags.MODAL,
+ type=Gtk.MessageType.INFO,
+ buttons=Gtk.ButtonsType.YES_NO)
dialog.set_markup(_("<b>User Profile Conflict!</b>"))
dialog.format_secondary_markup(message)
dialog.set_title(_("Save Profile As Conflict"))
response = dialog.run()
- if response == gtk.RESPONSE_YES:
+ if response == Gtk.ResponseType.YES:
dialog.destroy()
saveActiveProfile(False)
else:
@@ -3449,17 +3441,17 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
"be dropped at profile load.\n\n" \
"Continue loading profile discarding previous changes?")
- dialog = gtk.MessageDialog(None,
- gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_YES_NO)
+ dialog = Gtk.MessageDialog(None,
+ Gtk.DialogFlags.MODAL,
+ type=Gtk.MessageType.INFO,
+ buttons=Gtk.ButtonsType.YES_NO)
dialog.set_markup(_("<b>Load user profile info</b>"))
dialog.format_secondary_markup(message)
dialog.set_title(_("Load User Profile"))
response = dialog.run()
- if response == gtk.RESPONSE_YES:
+ if response == Gtk.ResponseType.YES:
dialog.destroy()
self.loadSelectedProfile()
else:
@@ -3571,7 +3563,7 @@ def main():
showPreferencesUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/orca_gui_profile.py b/src/orca/orca_gui_profile.py
index 3c65806..69e2590 100644
--- a/src/orca/orca_gui_profile.py
+++ b/src/orca/orca_gui_profile.py
@@ -30,7 +30,7 @@ __license__ = "LGPL"
import os
import sys
import debug
-import gtk
+from gi.repository import Gtk
import locale
import orca_gtkbuilder
@@ -80,7 +80,7 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
profileDialog.realize()
ts = orca_state.lastInputEventTimestamp
if ts == 0:
- ts = gtk.get_current_event_time()
+ ts = Gtk.get_current_event_time()
profileDialog.window.set_user_time(ts)
except AttributeError:
debug.printException(debug.LEVEL_FINEST)
@@ -184,7 +184,7 @@ def main():
showProfileUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/orca_gui_splash.py b/src/orca/orca_gui_splash.py
index 4506e8e..85ba04a 100644
--- a/src/orca/orca_gui_splash.py
+++ b/src/orca/orca_gui_splash.py
@@ -28,16 +28,14 @@ __license__ = "LGPL"
import os
import sys
import debug
-import gtk
-import gobject
+from gi.repository import Gtk
+from gi.repository import GObject
import locale
import orca_gtkbuilder
import orca_state
import orca_platform
-from orca_i18n import _
-
OS = None
class OrcaSplashGUI(orca_gtkbuilder.GtkBuilderWrapper):
@@ -52,6 +50,7 @@ class OrcaSplashGUI(orca_gtkbuilder.GtkBuilderWrapper):
"""
orca_gtkbuilder.GtkBuilderWrapper.__init__(self, fileName, windowName)
+ self.activeScript = None
def init(self):
""" Initialize the splash screen dialog. """
@@ -67,12 +66,12 @@ class OrcaSplashGUI(orca_gtkbuilder.GtkBuilderWrapper):
"gfx",
"orca-splash.png")
- image = gtk.Image()
+ image = Gtk.Image()
image.set_from_file(imageFile)
splashScreen = self.get_widget("splashWindow")
box = self.get_widget("splash_vbox")
- box.pack_start(image, True, True)
+ box.pack_start(image, True, True, 0)
try:
splashScreen.realize()
@@ -83,10 +82,10 @@ class OrcaSplashGUI(orca_gtkbuilder.GtkBuilderWrapper):
box.grab_focus()
splashScreen.show_all()
- gobject.timeout_add(3000, splashScreen.hide)
+ GObject.timeout_add(3000, splashScreen.hide)
- while gtk.events_pending():
- gtk.main_iteration()
+ while Gtk.events_pending():
+ Gtk.main_iteration()
return splashScreen
@@ -123,7 +122,7 @@ def main():
showSplashUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/orca_prefs.py b/src/orca/orca_prefs.py
index f4d58e0..ad325bc 100644
--- a/src/orca/orca_prefs.py
+++ b/src/orca/orca_prefs.py
@@ -418,7 +418,7 @@ class OrcaPrefs:
Arguments:
- prefs: text string - file to write the key binding to.
- tupl: tuple - a tuple with the values of the
- keybinding (gtk.TreeStore model columns)
+ keybinding (Gtk.TreeStore model columns)
"""
prefs.writelines(" keyB.removeByHandler(script.inputEventHandlers['" \
diff --git a/src/orca/orca_quit.py b/src/orca/orca_quit.py
index 7aee571..7ae1c24 100644
--- a/src/orca/orca_quit.py
+++ b/src/orca/orca_quit.py
@@ -28,7 +28,7 @@ __license__ = "LGPL"
import os
import sys
import debug
-import gtk
+from gi.repository import Gtk
import locale
import orca
@@ -61,9 +61,9 @@ class OrcaQuitGUI(orca_gtkbuilder.GtkBuilderWrapper):
quitDialog.realize()
ts = orca_state.lastInputEventTimestamp
if ts == 0:
- ts = gtk.get_current_event_time()
+ ts = Gtk.get_current_event_time()
quitDialog.window.set_user_time(ts)
- except AttributeError:
+ except (AttributeError, RuntimeError):
debug.printException(debug.LEVEL_FINEST)
quitDialog.hide()
@@ -133,7 +133,7 @@ def main():
showQuitUI()
- gtk.main()
+ Gtk.main()
sys.exit(0)
if __name__ == "__main__":
diff --git a/src/orca/outline.py b/src/orca/outline.py
index 00233be..4f85665 100644
--- a/src/orca/outline.py
+++ b/src/orca/outline.py
@@ -26,24 +26,17 @@ __copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
__license__ = "LGPL"
import cairo
-
-try:
- # This can fail due to gtk not being available. We want to
- # be able to recover from that if possible. The main driver
- # for this is to allow "orca --text-setup" to work even if
- # the desktop is not running.
- #
- import gtk
- display = gtk.gdk.display_get_default()
- screen = display.get_default_screen()
- screen_width = screen.get_width()
- screen_height = screen.get_height()
-except:
- pass
+from gi.repository import Gtk
+from gi.repository import Gdk
import orca_state
import settings
+display = Gdk.Display.get_default()
+screen = display.get_default_screen()
+screen_width = screen.get_width()
+screen_height = screen.get_height()
+
def _adjustToScreen(x, y, width, height):
if x < 0:
width = width + x
@@ -69,7 +62,7 @@ def _adjustToScreen(x, y, width, height):
#
_outlineWindows = []
-class Line(gtk.Window):
+class Line(Gtk.Window):
"""Draws a simple filled box on the display using
settings.outlineColor for the color.
@@ -77,12 +70,11 @@ class Line(gtk.Window):
- x, y, width, height: the dimensions of the box
"""
def __init__(self, x, y, width, height):
- gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
-
- self.modify_bg(gtk.STATE_NORMAL,
- gtk.gdk.Color(settings.outlineColor[0],
- settings.outlineColor[1],
- settings.outlineColor[2]))
+ Gtk.Window.__init__(self)
+ self.modify_bg(Gtk.StateType.NORMAL,
+ Gdk.Color(settings.outlineColor[0],
+ settings.outlineColor[1],
+ settings.outlineColor[2]))
self.set_property("accept-focus", False)
self.set_decorated(False)
@@ -113,9 +105,9 @@ class Wedge(Line):
# Create a bitmap to draw into. This will be the mask
# for the shape of the window.
#
- width, height = allocation.width, allocation.height
- bitmap = gtk.gdk.Pixmap(None, width, height, 1)
- cr = bitmap.cairo_create()
+ width, height = win.get_size()
+ surface = cairo.ImageSurface(cairo.FORMAT_A1, width, height)
+ cr = cairo.Context(surface)
# Clear the bitmap
#
@@ -158,12 +150,13 @@ class Box(Line):
def _on_size_allocate(self, win, allocation):
"""Sets the shape of the window to a hollow rectangle."""
+
# Create a bitmap to draw into. This will be the mask
# for the shape of the window.
#
- width, height = allocation.width, allocation.height
- bitmap = gtk.gdk.Pixmap(None, width, height, 1)
- cr = bitmap.cairo_create()
+ width, height = win.get_size()
+ surface = cairo.ImageSurface(cairo.FORMAT_A1, width, height)
+ cr = cairo.Context(surface)
# Clear the bitmap
#
@@ -182,7 +175,7 @@ class Box(Line):
# Set the window shape
#
- win.shape_combine_mask(bitmap, 0, 0)
+ #window.shape_combine_region()
def reset():
"""Destroys all windows we have put on the screen."""
diff --git a/src/orca/script.py b/src/orca/script.py
index 60f2a98..d6b25c0 100644
--- a/src/orca/script.py
+++ b/src/orca/script.py
@@ -446,8 +446,8 @@ class Script:
"""
try:
- import gtk.gdk as gdk
- keyboardEvent.keyval_name = gdk.keyval_name(keyboardEvent.id)
+ from gi.repository import Gdk
+ keyboardEvent.keyval_name = Gdk.keyval_name(keyboardEvent.id)
except:
debug.println(debug.LEVEL_FINE,
"Could not obtain keyval_name for id: %d" \
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 194cfec..587b7d5 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2553,8 +2553,8 @@ class Utilities:
def absoluteMouseCoordinates():
"""Gets the absolute position of the mouse pointer."""
- import gtk
- rootWindow = gtk.Window().get_screen().get_root_window()
+ from gi.repository import Gtk
+ rootWindow = Gtk.Window().get_screen().get_root_window()
x, y, modifiers = rootWindow.get_pointer()
return x, y
diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index 5740cc4..5a729a9 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -25,7 +25,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2004-2008 Sun Microsystems Inc."
__license__ = "LGPL"
-import gtk
+from gi.repository import Gtk
import pyatspi
import orca.orca as orca
@@ -109,14 +109,14 @@ class Script(Gecko.Script):
# Reapply "say all on load" using the Thunderbird specific setting.
#
- gtk.ToggleButton.set_active(self.sayAllOnLoadCheckButton,
+ Gtk.ToggleButton.set_active(self.sayAllOnLoadCheckButton,
script_settings.sayAllOnLoad)
# We need to maintain a separate setting for grabFocusOnAncestor
# because the version of Gecko used by the Thunderbird might be
# different from that used by Firefox. See bug 608149.
#
- gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
+ Gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
script_settings.grabFocusOnAncestor)
return vbox
diff --git a/src/orca/scripts/apps/gnome-search-tool/script.py b/src/orca/scripts/apps/gnome-search-tool/script.py
index bd321ff..343d020 100644
--- a/src/orca/scripts/apps/gnome-search-tool/script.py
+++ b/src/orca/scripts/apps/gnome-search-tool/script.py
@@ -33,8 +33,8 @@ from orca.orca_i18n import ngettext # for gettext support
import pyatspi
import time
-import gobject
-gobject.threads_init()
+from gi.repository import GObject
+GObject.threads_init()
########################################################################
@@ -148,7 +148,7 @@ class Script(default.Script):
frame, pyatspi.ROLE_TABLE)
self.fileTable = allTables[0]
- gobject.idle_add(self._speakSearching)
+ GObject.idle_add(self._speakSearching)
# Check to see if we have just had an "object:state-changed:showing"
# event for the Find button. If the name is "Find", and one of its
diff --git a/src/orca/scripts/apps/packagemanager/script.py b/src/orca/scripts/apps/packagemanager/script.py
index f017fb0..a22bdd3 100644
--- a/src/orca/scripts/apps/packagemanager/script.py
+++ b/src/orca/scripts/apps/packagemanager/script.py
@@ -27,7 +27,7 @@ __copyright__ = "Copyright (c) 2009-2010 Sun Microsystems Inc." \
"Copyright (c) 2010 Joanmarie Diggs"
__license__ = "LGPL"
-import gtk
+from gi.repository import Gtk
import pyatspi
import orca.scripts.default as default
@@ -102,9 +102,9 @@ class Script(default.Script):
GUI items for the current application.
"""
- vbox = gtk.VBox(False, 0)
+ vbox = Gtk.VBox(False, 0)
vbox.set_border_width(12)
- gtk.Widget.show(vbox)
+ Gtk.Widget.show(vbox)
# Translators: The Package Manager application notifies the
# user of minor errors by displaying an icon in the status
@@ -114,11 +114,11 @@ class Script(default.Script):
# the notification icon has appeared.
#
label = _("Notify me when errors have been logged.")
- self.presentLoggedErrorsCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.presentLoggedErrorsCheckButton)
- gtk.Box.pack_start(vbox, self.presentLoggedErrorsCheckButton,
+ self.presentLoggedErrorsCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.presentLoggedErrorsCheckButton)
+ Gtk.Box.pack_start(vbox, self.presentLoggedErrorsCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.presentLoggedErrorsCheckButton,
script_settings.presentLoggedErrors)
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index cc3fcbb..bc1d9ca 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -37,7 +37,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
__license__ = "LGPL"
-import gtk
+from gi.repository import Gtk
import pyatspi
import orca.debug as debug
@@ -298,9 +298,9 @@ class Script(default.Script):
GUI items for the current application.
"""
- vbox = gtk.VBox(False, 0)
+ vbox = Gtk.VBox(False, 0)
vbox.set_border_width(12)
- gtk.Widget.show(vbox)
+ Gtk.Widget.show(vbox)
# Checkbox for "Speak spread sheet cell coordinates".
#
@@ -309,38 +309,38 @@ class Script(default.Script):
# column position within the spread sheet (i.e. A1, B1, C2 ...)
#
label = _("Speak spread sheet cell coordinates")
- self.speakSpreadsheetCoordinatesCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakSpreadsheetCoordinatesCheckButton)
- gtk.Box.pack_start(vbox, self.speakSpreadsheetCoordinatesCheckButton,
+ self.speakSpreadsheetCoordinatesCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakSpreadsheetCoordinatesCheckButton)
+ Gtk.Box.pack_start(vbox, self.speakSpreadsheetCoordinatesCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(\
+ Gtk.ToggleButton.set_active(\
self.speakSpreadsheetCoordinatesCheckButton,
script_settings.speakSpreadsheetCoordinates)
# Table Navigation frame.
#
- tableFrame = gtk.Frame()
- gtk.Widget.show(tableFrame)
- gtk.Box.pack_start(vbox, tableFrame, False, False, 5)
+ tableFrame = Gtk.Frame()
+ Gtk.Widget.show(tableFrame)
+ Gtk.Box.pack_start(vbox, tableFrame, False, False, 5)
- tableAlignment = gtk.Alignment(0.5, 0.5, 1, 1)
- gtk.Widget.show(tableAlignment)
- gtk.Container.add(tableFrame, tableAlignment)
- gtk.Alignment.set_padding(tableAlignment, 0, 0, 12, 0)
+ tableAlignment = Gtk.Alignment.new(0.5, 0.5, 1, 1)
+ Gtk.Widget.show(tableAlignment)
+ Gtk.Container.add(tableFrame, tableAlignment)
+ Gtk.Alignment.set_padding(tableAlignment, 0, 0, 12, 0)
- tableVBox = gtk.VBox(False, 0)
- gtk.Widget.show(tableVBox)
- gtk.Container.add(tableAlignment, tableVBox)
+ tableVBox = Gtk.VBox(False, 0)
+ Gtk.Widget.show(tableVBox)
+ Gtk.Container.add(tableAlignment, tableVBox)
# Translators: this is an option to tell Orca whether or not it
# should speak table cell coordinates in document content.
#
label = _("Speak _cell coordinates")
- self.speakCellCoordinatesCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakCellCoordinatesCheckButton)
- gtk.Box.pack_start(tableVBox, self.speakCellCoordinatesCheckButton,
+ self.speakCellCoordinatesCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakCellCoordinatesCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.speakCellCoordinatesCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.speakCellCoordinatesCheckButton,
_settingsManager.getSetting('speakCellCoordinates'))
@@ -349,11 +349,11 @@ class Script(default.Script):
# rows and columns a particular table cell spans in a table).
#
label = _("Speak _multiple cell spans")
- self.speakCellSpanCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakCellSpanCheckButton)
- gtk.Box.pack_start(tableVBox, self.speakCellSpanCheckButton,
+ self.speakCellSpanCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakCellSpanCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.speakCellSpanCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.speakCellSpanCheckButton,
_settingsManager.getSetting('speakCellSpan'))
@@ -361,11 +361,11 @@ class Script(default.Script):
# the header of a table cell in document content.
#
label = _("Announce cell _header")
- self.speakCellHeadersCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakCellHeadersCheckButton)
- gtk.Box.pack_start(tableVBox, self.speakCellHeadersCheckButton,
+ self.speakCellHeadersCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakCellHeadersCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.speakCellHeadersCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.speakCellHeadersCheckButton,
_settingsManager.getSetting('speakCellHeaders'))
@@ -373,21 +373,21 @@ class Script(default.Script):
# empty/blank cells when navigating tables in document content.
#
label = _("Skip _blank cells")
- self.skipBlankCellsCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.skipBlankCellsCheckButton)
- gtk.Box.pack_start(tableVBox, self.skipBlankCellsCheckButton,
+ self.skipBlankCellsCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.skipBlankCellsCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.skipBlankCellsCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.skipBlankCellsCheckButton,
_settingsManager.getSetting('skipBlankCells'))
# Translators: this is the title of a panel containing options
# for specifying how to navigate tables in document content.
#
- tableLabel = gtk.Label("<b>%s</b>" % _("Table Navigation"))
- gtk.Widget.show(tableLabel)
- gtk.Frame.set_label_widget(tableFrame, tableLabel)
- gtk.Label.set_use_markup(tableLabel, True)
+ tableLabel = Gtk.Label(label="<b>%s</b>" % _("Table Navigation"))
+ Gtk.Widget.show(tableLabel)
+ Gtk.Frame.set_label_widget(tableFrame, tableLabel)
+ Gtk.Label.set_use_markup(tableLabel, True)
return vbox
diff --git a/src/orca/scripts/apps/yelp/yelp_v2/script.py b/src/orca/scripts/apps/yelp/yelp_v2/script.py
index 534a9d2..767b52a 100644
--- a/src/orca/scripts/apps/yelp/yelp_v2/script.py
+++ b/src/orca/scripts/apps/yelp/yelp_v2/script.py
@@ -25,7 +25,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2010 Sun Microsystems Inc."
__license__ = "LGPL"
-import gtk
+from gi.repository import Gtk
import pyatspi
import orca.orca as orca
@@ -78,7 +78,7 @@ class Script(Gecko.Script):
# because the version of Gecko used by Yelp might be different
# from that used by Firefox. See bug 608149.
#
- gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
+ Gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
script_settings.grabFocusOnAncestor)
return vbox
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 0207357..2aecb39 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -1829,8 +1829,8 @@ class Script(script.Script):
self.utilities.adjustTextSelection(obj, caretOffset)
texti = obj.queryText()
startOffset, endOffset = texti.getSelection(0)
- import gtk
- clipboard = gtk.clipboard_get()
+ from gi.repository import Gtk
+ clipboard = Gtk.clipboard_get()
clipboard.set_text(texti.getText(startOffset, endOffset))
return True
diff --git a/src/orca/scripts/toolkits/CALLY/script.py b/src/orca/scripts/toolkits/CALLY/script.py
index 94f795f..4757d51 100644
--- a/src/orca/scripts/toolkits/CALLY/script.py
+++ b/src/orca/scripts/toolkits/CALLY/script.py
@@ -25,10 +25,11 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2010 Igalia, S.L."
__license__ = "LGPL"
+from gi.repository import Gdk
+
import orca.orca as orca
import orca.scripts.default as default
import orca.debug as debug
-import gtk.gdk as gdk
# Set with non printable unicode categories. Full table:
# http://www.fileformat.info/info/unicode/category/index.htm
@@ -135,11 +136,11 @@ class Script(default.Script):
#
keyval = keyboardEvent.id
try:
- keymap = gdk.keymap_get_default()
+ keymap = Gdk.Keymap.get_default()
- if (keymap):
- result = keymap.get_entries_for_keyval (keyval)
- group = result[0][2]
+ if keymap:
+ success, entries = keymap.get_entries_for_keyval(keyval)
+ group = entries[0].group
keyval, egroup, level, consumed = \
keymap.translate_keyboard_state (keyboardEvent.hw_code,
@@ -157,14 +158,14 @@ class Script(default.Script):
keyboardEvent.id = keyval
# if cally doesn't provide a event_string we get that using
- # gdk. I know that it will probably called again computing
+ # Gdk. I know that it will probably called again computing
# keyval_name but to simplify code, and not start to add
# guess-code here I will maintain that in this way
#
if (keyboardEvent.event_string == ""):
debug.println (debug.LEVEL_FINE, "Computing event_string")
try:
- keyboardEvent.event_string = gdk.keyval_name (keyboardEvent.id)
+ keyboardEvent.event_string = Gdk.keyval_name(keyboardEvent.id)
except:
debug.println(debug.LEVEL_FINE,
"Could not obtain keyval_name for id: %d" \
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 9610783..1f37179 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -41,8 +41,8 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2010 Orca Team."
__license__ = "LGPL"
-import atk
-import gtk
+from gi.repository import Atk
+from gi.repository import Gtk
import pyatspi
import re
import time
@@ -664,24 +664,24 @@ class Script(default.Script):
GUI items for the current application.
"""
- vbox = gtk.VBox(False, 0)
+ vbox = Gtk.VBox(False, 0)
vbox.set_border_width(12)
- gtk.Widget.show(vbox)
+ Gtk.Widget.show(vbox)
# General ("Page") Navigation frame.
#
- generalFrame = gtk.Frame()
- gtk.Widget.show(generalFrame)
- gtk.Box.pack_start(vbox, generalFrame, False, False, 5)
+ generalFrame = Gtk.Frame()
+ Gtk.Widget.show(generalFrame)
+ Gtk.Box.pack_start(vbox, generalFrame, False, False, 5)
- generalAlignment = gtk.Alignment(0.5, 0.5, 1, 1)
- gtk.Widget.show(generalAlignment)
- gtk.Container.add(generalFrame, generalAlignment)
- gtk.Alignment.set_padding(generalAlignment, 0, 0, 12, 0)
+ generalAlignment = Gtk.Alignment.new(0.5, 0.5, 1, 1)
+ Gtk.Widget.show(generalAlignment)
+ Gtk.Container.add(generalFrame, generalAlignment)
+ Gtk.Alignment.set_padding(generalAlignment, 0, 0, 12, 0)
- generalVBox = gtk.VBox(False, 0)
- gtk.Widget.show(generalVBox)
- gtk.Container.add(generalAlignment, generalVBox)
+ generalVBox = Gtk.VBox(False, 0)
+ Gtk.Widget.show(generalVBox)
+ Gtk.Container.add(generalAlignment, generalVBox)
# Translators: Gecko native caret navigation is where
# Firefox itself controls how the arrow keys move the caret
@@ -691,12 +691,12 @@ class Script(default.Script):
# Orca mode.
#
label = _("Use _Orca Caret Navigation")
- self.controlCaretNavigationCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.controlCaretNavigationCheckButton)
- gtk.Box.pack_start(generalVBox,
+ self.controlCaretNavigationCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.controlCaretNavigationCheckButton)
+ Gtk.Box.pack_start(generalVBox,
self.controlCaretNavigationCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.controlCaretNavigationCheckButton,
+ Gtk.ToggleButton.set_active(self.controlCaretNavigationCheckButton,
script_settings.controlCaretNavigation)
# Translators: Orca provides keystrokes to navigate HTML content
@@ -704,11 +704,11 @@ class Script(default.Script):
# table, etc.
#
label = _("Use Orca _Structural Navigation")
- self.structuralNavigationCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.structuralNavigationCheckButton)
- gtk.Box.pack_start(generalVBox, self.structuralNavigationCheckButton,
+ self.structuralNavigationCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.structuralNavigationCheckButton)
+ Gtk.Box.pack_start(generalVBox, self.structuralNavigationCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.structuralNavigationCheckButton,
+ Gtk.ToggleButton.set_active(self.structuralNavigationCheckButton,
self.structuralNavigation.enabled)
# Translators: Orca has had to implement its own caret navigation
@@ -721,11 +721,11 @@ class Script(default.Script):
# within Orca.
#
label = _("_Grab focus on objects when navigating")
- self.grabFocusOnAncestorCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.grabFocusOnAncestorCheckButton)
- gtk.Box.pack_start(generalVBox, self.grabFocusOnAncestorCheckButton,
+ self.grabFocusOnAncestorCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.grabFocusOnAncestorCheckButton)
+ Gtk.Box.pack_start(generalVBox, self.grabFocusOnAncestorCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
+ Gtk.ToggleButton.set_active(self.grabFocusOnAncestorCheckButton,
script_settings.grabFocusOnAncestor)
# Translators: when the user arrows up and down in HTML content,
@@ -736,11 +736,11 @@ class Script(default.Script):
#
label = \
_("_Position cursor at start of line when navigating vertically")
- self.arrowToLineBeginningCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.arrowToLineBeginningCheckButton)
- gtk.Box.pack_start(generalVBox, self.arrowToLineBeginningCheckButton,
+ self.arrowToLineBeginningCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.arrowToLineBeginningCheckButton)
+ Gtk.Box.pack_start(generalVBox, self.arrowToLineBeginningCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.arrowToLineBeginningCheckButton,
+ Gtk.ToggleButton.set_active(self.arrowToLineBeginningCheckButton,
script_settings.arrowToLineBeginning)
# Translators: when the user loads a new page in Firefox, they
@@ -749,46 +749,46 @@ class Script(default.Script):
#
label = \
_("Automatically start speaking a page when it is first _loaded")
- self.sayAllOnLoadCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.sayAllOnLoadCheckButton)
- gtk.Box.pack_start(generalVBox, self.sayAllOnLoadCheckButton,
+ self.sayAllOnLoadCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.sayAllOnLoadCheckButton)
+ Gtk.Box.pack_start(generalVBox, self.sayAllOnLoadCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.sayAllOnLoadCheckButton,
+ Gtk.ToggleButton.set_active(self.sayAllOnLoadCheckButton,
script_settings.sayAllOnLoad)
# Translators: this is the title of a panel holding options for
# how to navigate HTML content (e.g., Orca caret navigation,
# positioning of caret, etc.).
#
- generalLabel = gtk.Label("<b>%s</b>" % _("Page Navigation"))
- gtk.Widget.show(generalLabel)
- gtk.Frame.set_label_widget(generalFrame, generalLabel)
- gtk.Label.set_use_markup(generalLabel, True)
+ generalLabel = Gtk.Label(label="<b>%s</b>" % _("Page Navigation"))
+ Gtk.Widget.show(generalLabel)
+ Gtk.Frame.set_label_widget(generalFrame, generalLabel)
+ Gtk.Label.set_use_markup(generalLabel, True)
# Table Navigation frame.
#
- tableFrame = gtk.Frame()
- gtk.Widget.show(tableFrame)
- gtk.Box.pack_start(vbox, tableFrame, False, False, 5)
+ tableFrame = Gtk.Frame()
+ Gtk.Widget.show(tableFrame)
+ Gtk.Box.pack_start(vbox, tableFrame, False, False, 5)
- tableAlignment = gtk.Alignment(0.5, 0.5, 1, 1)
- gtk.Widget.show(tableAlignment)
- gtk.Container.add(tableFrame, tableAlignment)
- gtk.Alignment.set_padding(tableAlignment, 0, 0, 12, 0)
+ tableAlignment = Gtk.Alignment.new(0.5, 0.5, 1, 1)
+ Gtk.Widget.show(tableAlignment)
+ Gtk.Container.add(tableFrame, tableAlignment)
+ Gtk.Alignment.set_padding(tableAlignment, 0, 0, 12, 0)
- tableVBox = gtk.VBox(False, 0)
- gtk.Widget.show(tableVBox)
- gtk.Container.add(tableAlignment, tableVBox)
+ tableVBox = Gtk.VBox(False, 0)
+ Gtk.Widget.show(tableVBox)
+ Gtk.Container.add(tableAlignment, tableVBox)
# Translators: this is an option to tell Orca whether or not it
# should speak table cell coordinates in document content.
#
label = _("Speak _cell coordinates")
- self.speakCellCoordinatesCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakCellCoordinatesCheckButton)
- gtk.Box.pack_start(tableVBox, self.speakCellCoordinatesCheckButton,
+ self.speakCellCoordinatesCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakCellCoordinatesCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.speakCellCoordinatesCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.speakCellCoordinatesCheckButton,
_settingsManager.getSetting('speakCellCoordinates'))
@@ -797,11 +797,11 @@ class Script(default.Script):
# rows and columns a particular table cell spans in a table).
#
label = _("Speak _multiple cell spans")
- self.speakCellSpanCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakCellSpanCheckButton)
- gtk.Box.pack_start(tableVBox, self.speakCellSpanCheckButton,
+ self.speakCellSpanCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakCellSpanCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.speakCellSpanCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.speakCellSpanCheckButton,
_settingsManager.getSetting('speakCellSpan'))
@@ -809,11 +809,11 @@ class Script(default.Script):
# the header of a table cell in document content.
#
label = _("Announce cell _header")
- self.speakCellHeadersCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakCellHeadersCheckButton)
- gtk.Box.pack_start(tableVBox, self.speakCellHeadersCheckButton,
+ self.speakCellHeadersCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakCellHeadersCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.speakCellHeadersCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.speakCellHeadersCheckButton,
_settingsManager.getSetting('speakCellHeaders'))
@@ -821,47 +821,47 @@ class Script(default.Script):
# empty/blank cells when navigating tables in document content.
#
label = _("Skip _blank cells")
- self.skipBlankCellsCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.skipBlankCellsCheckButton)
- gtk.Box.pack_start(tableVBox, self.skipBlankCellsCheckButton,
+ self.skipBlankCellsCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.skipBlankCellsCheckButton)
+ Gtk.Box.pack_start(tableVBox, self.skipBlankCellsCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(
+ Gtk.ToggleButton.set_active(
self.skipBlankCellsCheckButton,
_settingsManager.getSetting('skipBlankCells'))
# Translators: this is the title of a panel containing options
# for specifying how to navigate tables in document content.
#
- tableLabel = gtk.Label("<b>%s</b>" % _("Table Navigation"))
- gtk.Widget.show(tableLabel)
- gtk.Frame.set_label_widget(tableFrame, tableLabel)
- gtk.Label.set_use_markup(tableLabel, True)
+ tableLabel = Gtk.Label(label="<b>%s</b>" % _("Table Navigation"))
+ Gtk.Widget.show(tableLabel)
+ Gtk.Frame.set_label_widget(tableFrame, tableLabel)
+ Gtk.Label.set_use_markup(tableLabel, True)
# Find Options frame.
#
- findFrame = gtk.Frame()
- gtk.Widget.show(findFrame)
- gtk.Box.pack_start(vbox, findFrame, False, False, 5)
+ findFrame = Gtk.Frame()
+ Gtk.Widget.show(findFrame)
+ Gtk.Box.pack_start(vbox, findFrame, False, False, 5)
- findAlignment = gtk.Alignment(0.5, 0.5, 1, 1)
- gtk.Widget.show(findAlignment)
- gtk.Container.add(findFrame, findAlignment)
- gtk.Alignment.set_padding(findAlignment, 0, 0, 12, 0)
+ findAlignment = Gtk.Alignment.new(0.5, 0.5, 1, 1)
+ Gtk.Widget.show(findAlignment)
+ Gtk.Container.add(findFrame, findAlignment)
+ Gtk.Alignment.set_padding(findAlignment, 0, 0, 12, 0)
- findVBox = gtk.VBox(False, 0)
- gtk.Widget.show(findVBox)
- gtk.Container.add(findAlignment, findVBox)
+ findVBox = Gtk.VBox(False, 0)
+ Gtk.Widget.show(findVBox)
+ Gtk.Container.add(findAlignment, findVBox)
# Translators: this is an option to allow users to have Orca
# automatically speak the line that contains the match while
# the user is still in Firefox's Find toolbar.
#
label = _("Speak results during _find")
- self.speakResultsDuringFindCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.speakResultsDuringFindCheckButton)
- gtk.Box.pack_start(findVBox, self.speakResultsDuringFindCheckButton,
+ self.speakResultsDuringFindCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.speakResultsDuringFindCheckButton)
+ Gtk.Box.pack_start(findVBox, self.speakResultsDuringFindCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.speakResultsDuringFindCheckButton,
+ Gtk.ToggleButton.set_active(self.speakResultsDuringFindCheckButton,
script_settings.speakResultsDuringFind)
# Translators: this is an option which dictates whether the line
@@ -870,33 +870,33 @@ class Script(default.Script):
# line which contained the last match.
#
label = _("Onl_y speak changed lines during find")
- self.changedLinesOnlyCheckButton = gtk.CheckButton(label)
- gtk.Widget.show(self.changedLinesOnlyCheckButton)
- gtk.Box.pack_start(findVBox, self.changedLinesOnlyCheckButton,
+ self.changedLinesOnlyCheckButton = Gtk.CheckButton(label)
+ Gtk.Widget.show(self.changedLinesOnlyCheckButton)
+ Gtk.Box.pack_start(findVBox, self.changedLinesOnlyCheckButton,
False, False, 0)
- gtk.ToggleButton.set_active(self.changedLinesOnlyCheckButton,
+ Gtk.ToggleButton.set_active(self.changedLinesOnlyCheckButton,
script_settings.onlySpeakChangedLinesDuringFind)
- hbox = gtk.HBox(False, 0)
- gtk.Widget.show(hbox)
- gtk.Box.pack_start(findVBox, hbox, False, False, 0)
+ hbox = Gtk.HBox(False, 0)
+ Gtk.Widget.show(hbox)
+ Gtk.Box.pack_start(findVBox, hbox, False, False, 0)
# Translators: this option allows the user to specify the number
# of matched characters that must be present before Orca speaks
# the line that contains the results from the Find toolbar.
#
self.minimumFindLengthLabel = \
- gtk.Label(_("Minimum length of matched text:"))
+ Gtk.Label(label=_("Minimum length of matched text:"))
self.minimumFindLengthLabel.set_alignment(0, 0.5)
- gtk.Widget.show(self.minimumFindLengthLabel)
- gtk.Box.pack_start(hbox, self.minimumFindLengthLabel, False, False, 5)
+ Gtk.Widget.show(self.minimumFindLengthLabel)
+ Gtk.Box.pack_start(hbox, self.minimumFindLengthLabel, False, False, 5)
self.minimumFindLengthAdjustment = \
- gtk.Adjustment(script_settings.minimumFindLength, 0, 20, 1)
+ Gtk.Adjustment(script_settings.minimumFindLength, 0, 20, 1)
self.minimumFindLengthSpinButton = \
- gtk.SpinButton(self.minimumFindLengthAdjustment, 0.0, 0)
- gtk.Widget.show(self.minimumFindLengthSpinButton)
- gtk.Box.pack_start(hbox, self.minimumFindLengthSpinButton,
+ Gtk.SpinButton(self.minimumFindLengthAdjustment, 0.0, 0)
+ Gtk.Widget.show(self.minimumFindLengthSpinButton)
+ Gtk.Box.pack_start(hbox, self.minimumFindLengthSpinButton,
False, False, 5)
acc_targets = []
@@ -904,17 +904,17 @@ class Script(default.Script):
relation_set = acc_src.ref_relation_set()
acc_targ = self.minimumFindLengthSpinButton.get_accessible()
acc_targets.append(acc_targ)
- relation = atk.Relation(acc_targets, 1)
- relation.set_property('relation-type', atk.RELATION_LABEL_FOR)
+ relation = Atk.Relation(acc_targets, 1)
+ relation.set_property('relation-type', Atk.RelationType.LABEL_FOR)
relation_set.add(relation)
# Translators: this is the title of a panel containing options
# for using Firefox's Find toolbar.
#
- findLabel = gtk.Label("<b>%s</b>" % _("Find Options"))
- gtk.Widget.show(findLabel)
- gtk.Frame.set_label_widget(findFrame, findLabel)
- gtk.Label.set_use_markup(findLabel, True)
+ findLabel = Gtk.Label(label="<b>%s</b>" % _("Find Options"))
+ Gtk.Widget.show(findLabel)
+ Gtk.Frame.set_label_widget(findFrame, findLabel)
+ Gtk.Label.set_use_markup(findLabel, True)
return vbox
diff --git a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
index 6b14345..0138b2a 100644
--- a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
+++ b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
@@ -91,16 +91,14 @@ class Script(default.Script):
if not keyboardEvent.keyval_name:
return
- import gtk.gdk as gdk
+ from gi.repository import Gdk
- # Standardize the hw_code from a Java-unique one to a gdk one.
- #
- keymap = gdk.keymap_get_default()
- keyval = gdk.keyval_from_name(keyboardEvent.keyval_name)
- entries = keymap.get_entries_for_keyval(keyval)
+ keymap = Gdk.Keymap.get_default()
+ keyval = Gdk.keyval_from_name(keyboardEvent.keyval_name)
+ success, entries = keymap.get_entries_for_keyval(keyval)
for entry in entries:
- if entry[1] == 0: # group = 0
- keyboardEvent.hw_code = entry[0]
+ if entry.group == 0:
+ keyboardEvent.hw_code = entry.keycode
break
# Put the event_string back to what it was prior to the Java
@@ -110,7 +108,7 @@ class Script(default.Script):
#
if keyboardEvent.event_string == keyboardEvent.keyval_name \
and len(keyboardEvent.event_string) > 1:
- keyval = gdk.keyval_from_name(keyboardEvent.keyval_name)
+ keyval = Gdk.keyval_from_name(keyboardEvent.keyval_name)
if 0 < keyval < 256:
keyboardEvent.event_string = unichr(keyval).encode("UTF-8")
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 58d24e2..e38334a 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -124,9 +124,9 @@ class Script(default.Script):
GUI items for the current application.
"""
- import gtk
+ from gi.repository import Gtk
- vbox = gtk.VBox(False, 0)
+ vbox = Gtk.VBox(False, 0)
vbox.set_border_width(12)
vbox.show()
@@ -136,7 +136,7 @@ class Script(default.Script):
#
label = \
_("Automatically start speaking a page when it is first _loaded")
- self.sayAllOnLoadCheckButton = gtk.CheckButton(label)
+ self.sayAllOnLoadCheckButton = Gtk.CheckButton(label)
self.sayAllOnLoadCheckButton.show()
vbox.pack_start(self.sayAllOnLoadCheckButton, False, False, 0)
self.sayAllOnLoadCheckButton.set_active(script_settings.sayAllOnLoad)
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 2a0e7d0..c3a04b5 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -31,30 +31,17 @@ import os
tty = 7
-# Whether tool tips can be presented.
-#
-canPresentToolTips = False
-
try:
# This can fail due to gtk not being available. We want to
# be able to recover from that if possible. The main driver
# for this is to allow "orca --text-setup" to work even if
# the desktop is not running.
#
- import gtk.gdk
- _display = gtk.gdk.display_get_default()
+ from gi.repository import Gdk
+ _display = Gdk.Display.get_default()
_screen = _display.get_default_screen()
_root_window = _screen.get_root_window()
- # The bug that caused gnome-panel to crash is fixed in GTK 2.10.11.
- minimum_gtk_version = (100000 * 2) + \
- (1000 * 10) + \
- 11
- current_gtk_version = (100000 * gtk.gtk_version[0]) + \
- (1000 * gtk.gtk_version[1]) + \
- gtk.gtk_version[2]
- canPresentToolTips = (current_gtk_version >= minimum_gtk_version)
-
# We want to know what the tty is so we can send it to BrlAPI
# if possible.
#
@@ -481,7 +468,7 @@ quitOrcaNoConfirmation = False
# Whether the user wants tooltips presented or not.
#
-presentToolTips = False and canPresentToolTips
+presentToolTips = False
# Keyboard layout options (see keyboardLayout).
#
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 8bc1b0d..5526a3f 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -38,7 +38,7 @@ __author__ = "Tomas Cerha <cerha brailcom org>"
__copyright__ = "Copyright (c) 2006-2008 Brailcom, o.p.s."
__license__ = "LGPL"
-import gobject
+from gi.repository import GObject
import re
import chnames
@@ -350,9 +350,9 @@ class SpeechServer(speechserver.SpeechServer):
context.currentOffset = context.startOffset
elif t == speechserver.SayAllContext.COMPLETED:
context.currentOffset = context.endOffset
- gobject.idle_add(orca_callback, context, t)
+ GObject.idle_add(orca_callback, context, t)
if t == speechserver.SayAllContext.COMPLETED:
- gobject.idle_add(self._say_all, iterator, orca_callback)
+ GObject.idle_add(self._say_all, iterator, orca_callback)
self._speak(context.utterance, acss, callback=callback,
event_types=self._CALLBACK_TYPE_MAP.keys())
return False # to indicate, that we don't want to be called again.
@@ -426,7 +426,7 @@ class SpeechServer(speechserver.SpeechServer):
self._speak(utterance, acss)
def sayAll(self, utteranceIterator, progressCallback):
- gobject.idle_add(self._say_all, utteranceIterator, progressCallback)
+ GObject.idle_add(self._say_all, utteranceIterator, progressCallback)
def speakCharacter(self, character, acss=None):
self._apply_acss(acss)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]