[accerciser] Merge branch 'pygi' into master
- From: Javier HernÃndez AntÃnez <jhernandez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accerciser] Merge branch 'pygi' into master
- Date: Mon, 29 Aug 2011 19:27:48 +0000 (UTC)
commit 48b8c06d598f84943ab7a0af1259408b7409484d
Author: Javier HernÃndez <jhernandez emergya es>
Date: Mon Aug 29 21:20:52 2011 +0200
Merge branch 'pygi' into master
plugins/api_view.py | 23 ++--
plugins/console.py | 5 +-
plugins/event_monitor.py | 68 +++++----
plugins/interface_view.py | 53 ++++---
plugins/ipython_view.py | 40 +++--
plugins/quick_select.py | 21 ++-
plugins/validate.py | 31 ++--
pyreqs.py | 15 +-
src/accerciser.in | 37 ++---
src/lib/accerciser/about_dialog.py | 22 ++--
src/lib/accerciser/accerciser.py | 38 +++---
src/lib/accerciser/accessible_treeview.py | 103 +++++++-----
src/lib/accerciser/bookmarks.py | 58 ++++---
src/lib/accerciser/hotkey_manager.py | 59 ++++---
src/lib/accerciser/icons.py | 25 ++--
src/lib/accerciser/main_window.py | 50 ++++---
src/lib/accerciser/node.py | 225 +++++++++++++++++++--------
src/lib/accerciser/plugin/base_plugin.py | 34 ++--
src/lib/accerciser/plugin/message.py | 68 +++++----
src/lib/accerciser/plugin/plugin_manager.py | 29 ++--
src/lib/accerciser/plugin/view.py | 123 ++++++++-------
src/lib/accerciser/prefs_dialog.py | 34 +++--
src/lib/accerciser/script_playback.py | 7 +-
src/lib/accerciser/tools.py | 15 +-
src/lib/accerciser/ui_manager.py | 5 +-
25 files changed, 697 insertions(+), 491 deletions(-)
---
diff --git a/plugins/api_view.py b/plugins/api_view.py
index 62b1e37..48b9779 100644
--- a/plugins/api_view.py
+++ b/plugins/api_view.py
@@ -10,7 +10,7 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
+from gi.repository import Gtk as gtk
from accerciser.plugin import ViewportPlugin
from accerciser.i18n import _, N_
import pyatspi
@@ -51,21 +51,21 @@ class APIBrowser(ViewportPlugin):
self.plugin_area.add(vbox)
top_hbox = gtk.HBox()
bottom_hbox = gtk.HBox()
- vbox.pack_start(top_hbox, False)
- vbox.pack_start(bottom_hbox)
+ vbox.pack_start(top_hbox, False, True, 0)
+ vbox.pack_start(bottom_hbox, True, True, 0)
self.method_tree = gtk.TreeView()
scrolled_window = gtk.ScrolledWindow()
scrolled_window.add(self.method_tree)
- bottom_hbox.pack_start(scrolled_window)
+ bottom_hbox.pack_start(scrolled_window, True, True, 0)
self.property_tree = gtk.TreeView()
scrolled_window = gtk.ScrolledWindow()
scrolled_window.add(self.property_tree)
- bottom_hbox.pack_start(scrolled_window)
- self.iface_combo = gtk.combo_box_new_text()
- top_hbox.pack_start(self.iface_combo, False)
+ bottom_hbox.pack_start(scrolled_window, True, True, 0)
+ self.iface_combo = gtk.ComboBoxText.new()
+ top_hbox.pack_start(self.iface_combo, False, True, 0)
self.private_toggle = gtk.CheckButton(_('Hide private attributes'))
self.private_toggle.set_active(True)
- top_hbox.pack_end(self.private_toggle, False)
+ top_hbox.pack_end(self.private_toggle, False, True, 0)
self.show_all()
def _initTreeViews(self):
@@ -78,7 +78,7 @@ class APIBrowser(ViewportPlugin):
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Method'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=0)
+ tvc.add_attribute(crt, 'text', 0)
self.method_tree.append_column(tvc)
# property view
@@ -87,12 +87,12 @@ class APIBrowser(ViewportPlugin):
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Property'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=0)
+ tvc.add_attribute(crt, 'text', 0)
self.property_tree.append_column(tvc)
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Value'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=1)
+ tvc.add_attribute(crt, 'text', 1)
self.property_tree.append_column(tvc)
def onAccChanged(self, acc):
@@ -118,6 +118,7 @@ class APIBrowser(ViewportPlugin):
@type widget: gtk.Widget
'''
iface = self.iface_combo.get_active_text()
+
try:
query_func = getattr(self.acc, 'query%s' % iface)
except AttributeError:
diff --git a/plugins/console.py b/plugins/console.py
index 53ea518..fd73ebe 100644
--- a/plugins/console.py
+++ b/plugins/console.py
@@ -11,11 +11,14 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+import gi
+
+from gi.repository import Gtk as gtk
+
from accerciser.plugin import ViewportPlugin
from accerciser.i18n import N_, _
import os
import pyatspi
-import gtk
import ipython_view
if ipython_view.IPython == None:
diff --git a/plugins/event_monitor.py b/plugins/event_monitor.py
index 3c818d4..16ca1ff 100644
--- a/plugins/event_monitor.py
+++ b/plugins/event_monitor.py
@@ -10,15 +10,18 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GObject
+from gi.repository import Pango
+
import pyatspi
-import gobject
import os.path
import gettext, os, sys, locale
from accerciser.plugin import ViewportPlugin
from accerciser.i18n import _, N_, DOMAIN
-import pango
-from gtk import keysyms, gdk
UI_FILE = os.path.join(os.path.dirname(__file__),
'event_monitor.ui')
@@ -60,14 +63,18 @@ class EventMonitor(ViewportPlugin):
'''
self.global_hotkeys = [(N_('Highlight last event entry'),
self._onHighlightEvent,
- keysyms.e, gdk.MOD1_MASK | gdk.CONTROL_MASK),
+ gdk.KEY_e, gdk.ModifierType.MOD1_MASK | \
+ gdk.ModifierType.CONTROL_MASK),
(N_('Start/stop event recording'),
self._onStartStop,
- keysyms.r, gdk.MOD1_MASK | gdk.CONTROL_MASK),
+ gdk.KEY_r, gdk.ModifierType.MOD1_MASK | \
+ gdk.ModifierType.CONTROL_MASK),
(N_('Clear event log'),
self._onClearlog,
- keysyms.t, gdk.MOD1_MASK | gdk.CONTROL_MASK)]
+ gdk.KEY_t, gdk.ModifierType.MOD1_MASK | \
+ gdk.ModifierType.CONTROL_MASK)]
+ self.source_filter = None
self.main_xml = gtk.Builder()
self.main_xml.set_translation_domain(DOMAIN)
self.main_xml.add_from_file(UI_FILE)
@@ -115,7 +122,7 @@ class EventMonitor(ViewportPlugin):
events.extend(sub_events)
events = list(set([event.strip(':') for event in events]))
events.sort()
- gobject.idle_add(self._appendChildren, None, '', 0, events)
+ GObject.idle_add(self._appendChildren, None, '', 0, events)
def _initTextView(self):
'''
@@ -154,7 +161,7 @@ class EventMonitor(ViewportPlugin):
iter = self.events_model.append(parent_iter,
[event.split(':')[-1],
event, False, False])
- gobject.idle_add(self._appendChildren, iter, event, level + 1, events)
+ GObject.idle_add(self._appendChildren, iter, event, level + 1, events)
return False
def _onToggled(self, renderer_toggle, path):
@@ -179,7 +186,7 @@ class EventMonitor(ViewportPlugin):
'''
pyatspi.Registry.deregisterEventListener(self._handleAccEvent,
*self.listen_list)
- self.listen_list = self._getEnabledEvents(self.events_model.get_iter_root())
+ self.listen_list = self._getEnabledEvents(self.events_model.get_iter_first())
if self.monitor_toggle.get_active():
pyatspi.Registry.registerEventListener(self._handleAccEvent,
*self.listen_list)
@@ -273,7 +280,7 @@ class EventMonitor(ViewportPlugin):
@param button: Button that was clicked
@type button: gtk.Button
'''
- iter = self.events_model.get_iter_root()
+ iter = self.events_model.get_iter_first()
while iter:
self._iterToggle(iter, True)
iter = self.events_model.iter_next(iter)
@@ -286,7 +293,7 @@ class EventMonitor(ViewportPlugin):
@param button: Button that was clicked.
@type button: gtk.Button
'''
- iter = self.events_model.get_iter_root()
+ iter = self.events_model.get_iter_first()
while iter:
self._iterToggle(iter, False)
iter = self.events_model.iter_next(iter)
@@ -357,7 +364,7 @@ class EventMonitor(ViewportPlugin):
hyperlink = self.monitor_buffer.create_tag(
None,
foreground='blue',
- underline=pango.UNDERLINE_SINGLE)
+ underline=Pango.Underline.SINGLE)
hyperlink.connect('event', self._onLinkClicked)
hyperlink.set_data('acc', acc)
hyperlink.set_data('islink', True)
@@ -372,11 +379,11 @@ class EventMonitor(ViewportPlugin):
@param widget: The widget that received event.
@type widget: gtk.Widget
@param event: The event object.
- @type event: gtk.gdk.Event
+ @type event: gdk.Event
@param iter: The text iter that was clicked.
@type iter: gtk.TextIter
'''
- if event.type == gtk.gdk.BUTTON_RELEASE and \
+ if event.type == gdk.EventType.BUTTON_RELEASE and \
event.button == 1 and not self.monitor_buffer.get_has_selection():
self.node.update(tag.get_data('acc'))
@@ -388,11 +395,11 @@ class EventMonitor(ViewportPlugin):
@param textview: Textview that was pressed.
@type textview: gtk.TextView
@param event: Event object.
- @type event: gtk.gdk.Event
+ @type event: gdk.Event
'''
- if event.keyval in (gtk.keysyms.Return,
- gtk.keysyms.KP_Enter,
- gtk.keysyms.space):
+ if event.keyval in (gdk.KEY_Return,
+ gdk.KEY_KP_Enter,
+ gdk.KEY_space):
buffer = textview.get_buffer()
iter = buffer.get_iter_at_mark(buffer.get_insert())
acc = None
@@ -409,21 +416,22 @@ class EventMonitor(ViewportPlugin):
@param textview: Monitors text view.
@type textview: gtk.TextView
@param event: Event object
- @type event: gtk.gdk.Event
+ @type event: gdk.Event
@return: Return False so event continues in callback chain.
@rtype: boolean
'''
- x, y = textview.window_to_buffer_coords(gtk.TEXT_WINDOW_WIDGET,
+ x, y = textview.window_to_buffer_coords(gtk.TextWindowType.WIDGET,
int(event.x), int(event.y))
iter = textview.get_iter_at_location(x, y)
- cursor = gtk.gdk.Cursor(gtk.gdk.XTERM)
+ cursor = gdk.Cursor(gdk.CursorType.XTERM)
for tag in iter.get_tags():
if tag.get_data('islink'):
- cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
+ cursor = gdk.Cursor(gdk.CursorType.HAND2)
break
- textview.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(cursor)
- textview.window.get_pointer()
+ window = textview.get_window(gtk.TextWindowType.TEXT)
+ window.set_cursor(cursor)
+ window.get_pointer()
return False
def _handleAccEvent(self, event):
@@ -447,14 +455,14 @@ class EventMonitor(ViewportPlugin):
'''
save_dialog = gtk.FileChooserDialog(
'Save monitor output',
- action=gtk.FILE_CHOOSER_ACTION_SAVE,
- buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_OK, gtk.RESPONSE_OK))
+ action=gtk.FileChooserAction.SAVE,
+ buttons=(gtk.ButtonsType.CANCEL, gtk.ResponseType.CANCEL,
+ gtk.ButtonsType.OK, gtk.ResponseType.OK))
save_dialog.set_do_overwrite_confirmation(True)
- save_dialog.set_default_response(gtk.RESPONSE_OK)
+ save_dialog.set_default_response(gtk.ResponseType.OK)
response = save_dialog.run()
save_dialog.show_all()
- if response == gtk.RESPONSE_OK:
+ if response == gtk.ResponseType.OK:
save_to = open(save_dialog.get_filename(), 'w')
save_to.write(
self.monitor_buffer.get_text(self.monitor_buffer.get_start_iter(),
diff --git a/plugins/interface_view.py b/plugins/interface_view.py
index 279c356..edab7ac 100644
--- a/plugins/interface_view.py
+++ b/plugins/interface_view.py
@@ -11,11 +11,15 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import GdkPixbuf
+from gi.repository.GLib import markup_escape_text
+
import pyatspi
-import gtk
import os.path
-import pango
-from gobject import markup_escape_text
+
from accerciser.plugin import ViewportPlugin
from accerciser.icons import getIcon
from accerciser.i18n import _, N_, DOMAIN
@@ -307,12 +311,12 @@ class _SectionAccessible(_InterfaceSection):
self.relations_view = ui_xml.get_object('relations_view')
self.relations_model = ui_xml.get_object('relations_treestore')
# preset the different bg colors
- style = gtk.Style ()
- self.header_bg = style.bg[gtk.STATE_NORMAL].to_string()
- self.relation_bg = style.base[gtk.STATE_NORMAL].to_string()
+ style = self.relations_view.get_style_context()
+ self.header_bg = style.get_background_color(gtk.StateFlags.NORMAL).to_string()
+ self.relation_bg = style.get_color(gtk.StateFlags.NORMAL).to_string()
selection = self.relations_view.get_selection()
- selection.set_select_function(self._relationSelectFunc)
+ selection.set_select_function(self._relationSelectFunc, None)
show_button = ui_xml.get_object('button_relation_show')
show_button.set_sensitive(self._isSelectedInView(selection))
@@ -699,34 +703,39 @@ class _SectionHypertext(_InterfaceSection):
int, # End offset
object) # Anchor object
treeview.set_model(self.links_model)
+
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Name'))
- tvc.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
+ tvc.set_sizing(gtk.TreeViewColumnSizing.AUTOSIZE)
tvc.set_resizable(True)
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=1)
+ tvc.add_attribute(crt, 'text', 1)
treeview.append_column(tvc)
+
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('URI'))
- tvc.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
+ tvc.set_sizing(gtk.TreeViewColumnSizing.AUTOSIZE)
tvc.set_resizable(True)
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=3)
+ tvc.add_attribute(crt, 'text', 3)
treeview.append_column(tvc)
+
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Start'))
- tvc.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
+ tvc.set_sizing(gtk.TreeViewColumnSizing.AUTOSIZE)
tvc.set_resizable(True)
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=4)
+ tvc.add_attribute(crt, 'text', 4)
treeview.append_column(tvc)
+
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('End'))
- tvc.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
+ tvc.set_sizing(gtk.TreeViewColumnSizing.AUTOSIZE)
tvc.set_resizable(True)
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=5)
- treeview.append_column(tvc)
+ tvc.add_attribute(crt, 'text', 5)
+ treeview.append_column(tvc)
+
selection = treeview.get_selection()
show_button = ui_xml.get_object('button_hypertext_show')
show_button.set_sensitive(self._isSelectedInView(selection))
@@ -856,7 +865,7 @@ class _SectionSelection(_InterfaceSection):
'''
# configure selection tree view
treeview = ui_xml.get_object('treeview_selection')
- self.sel_model = gtk.ListStore(gtk.gdk.Pixbuf, str, object)
+ self.sel_model = gtk.ListStore(GdkPixbuf.Pixbuf, str, object)
treeview.set_model(self.sel_model)
# connect selection changed signal
self.sel_selection = treeview.get_selection()
@@ -878,10 +887,10 @@ class _SectionSelection(_InterfaceSection):
@type acc: Accessibility.Accessible
'''
if acc.childCount > 50:
- theme = gtk.icon_theme_get_default()
+ theme = gtk.IconTheme.get_default()
self.sel_model.append(
[theme.load_icon('gtk-dialog-warning', 24,
- gtk.ICON_LOOKUP_USE_BUILTIN),
+ gtk.IconLookupFlags.USE_BUILTIN),
_('Too many selectable children'), None])
# Set section as insensitive, but leave expander label sensitive.
section_widgets = self.expander.get_children()
@@ -902,9 +911,9 @@ class _SectionSelection(_InterfaceSection):
self.button_select_all.set_sensitive(multiple_selections)
if multiple_selections:
- self.sel_selection.set_mode = gtk.SELECTION_MULTIPLE
+ self.sel_selection.set_mode = gtk.SelectionMode.MULTIPLE
else:
- self.sel_selection.set_mode = gtk.SELECTION_SINGLE
+ self.sel_selection.set_mode = gtk.SelectionMode.SINGLE
def _onSelectionSelected(self, selection):
'''
@@ -1390,7 +1399,7 @@ class _SectionText(_InterfaceSection):
return
x, y = event.get_coords()
- x, y = self.text_view.window_to_buffer_coords(gtk.TEXT_WINDOW_WIDGET,
+ x, y = self.text_view.window_to_buffer_coords(gtk.TextWindowType.WIDGET,
int(x), int(y))
iter = self.text_view.get_iter_at_location(x, y)
diff --git a/plugins/ipython_view.py b/plugins/ipython_view.py
index 67be806..bfa3d7d 100755
--- a/plugins/ipython_view.py
+++ b/plugins/ipython_view.py
@@ -12,11 +12,17 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk, gobject
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GObject
+from gi.repository import Pango
+
import re
import sys
import os
-import pango
+
from StringIO import StringIO
try:
@@ -268,7 +274,7 @@ class ConsoleView(gtk.TextView):
Initialize console view.
'''
gtk.TextView.__init__(self)
- self.modify_font(pango.FontDescription('Mono'))
+ self.modify_font(Pango.FontDescription('Mono'))
self.set_cursor_visible(True)
self.text_buffer = self.get_buffer()
self.mark = self.text_buffer.create_mark('scroll_mark',
@@ -287,7 +293,7 @@ class ConsoleView(gtk.TextView):
self.connect('key-press-event', self.onKeyPress)
def write(self, text, editable=False):
- gobject.idle_add(self._write, text, editable)
+ GObject.idle_add(self._write, text, editable)
def _write(self, text, editable=False):
'''
@@ -321,7 +327,7 @@ class ConsoleView(gtk.TextView):
def showPrompt(self, prompt):
- gobject.idle_add(self._showPrompt, prompt)
+ GObject.idle_add(self._showPrompt, prompt)
def _showPrompt(self, prompt):
'''
@@ -335,7 +341,7 @@ class ConsoleView(gtk.TextView):
self.text_buffer.get_end_iter())
def changeLine(self, text):
- gobject.idle_add(self._changeLine, text)
+ GObject.idle_add(self._changeLine, text)
def _changeLine(self, text):
'''
@@ -362,7 +368,7 @@ class ConsoleView(gtk.TextView):
return rv
def showReturned(self, text):
- gobject.idle_add(self._showReturned, text)
+ GObject.idle_add(self._showReturned, text)
def _showReturned(self, text):
'''
@@ -403,16 +409,17 @@ class ConsoleView(gtk.TextView):
selection_mark = self.text_buffer.get_selection_bound()
selection_iter = self.text_buffer.get_iter_at_mark(selection_mark)
start_iter = self.text_buffer.get_iter_at_mark(self.line_start)
- if event.keyval == gtk.keysyms.Home:
- if event.state & gtk.gdk.CONTROL_MASK or event.state & gtk.gdk.MOD1_MASK:
+ if event.keyval == gdk.KEY_Home:
+ if event.state & gdk.ModifierType.CONTROL_MASK or \
+ event.state & gdk.ModifierType.MOD1_MASK:
pass
- elif event.state & gtk.gdk.SHIFT_MASK:
+ elif event.state & gdk.ModifierType.SHIFT_MASK:
self.text_buffer.move_mark(insert_mark, start_iter)
return True
else:
self.text_buffer.place_cursor(start_iter)
return True
- elif event.keyval == gtk.keysyms.Left:
+ elif event.keyval == gdk.KEY_Left:
insert_iter.backward_cursor_position()
if not insert_iter.editable(True):
return True
@@ -484,21 +491,20 @@ class IPythonView(ConsoleView, IterableIPShell):
@return: True if event should not trickle.
@rtype: boolean
'''
-
- if event.state & gtk.gdk.CONTROL_MASK and event.keyval == 99:
+ if event.state & gdk.ModifierType.CONTROL_MASK and event.keyval == 99:
self.interrupt = True
self._processLine()
return True
- elif event.keyval == gtk.keysyms.Return:
+ elif event.keyval == gdk.KEY_Return:
self._processLine()
return True
- elif event.keyval == gtk.keysyms.Up:
+ elif event.keyval == gdk.KEY_Up:
self.changeLine(self.historyBack())
return True
- elif event.keyval == gtk.keysyms.Down:
+ elif event.keyval == gdk.KEY_Down:
self.changeLine(self.historyForward())
return True
- elif event.keyval == gtk.keysyms.Tab:
+ elif event.keyval == gdk.KEY_Tab:
if not self.getCurrentLine().strip():
return False
completed, possibilities = self.complete(self.getCurrentLine())
diff --git a/plugins/quick_select.py b/plugins/quick_select.py
index b70605e..751af40 100644
--- a/plugins/quick_select.py
+++ b/plugins/quick_select.py
@@ -1,8 +1,13 @@
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import Wnck as wnck
+
from accerciser.plugin import Plugin
from accerciser.i18n import N_, _
-import gtk
+
import pyatspi
-import wnck
class QuickSelect(Plugin):
'''
@@ -19,12 +24,12 @@ class QuickSelect(Plugin):
'''
self.global_hotkeys = [(N_('Inspect last focused accessible'),
self._inspectLastFocused,
- gtk.keysyms.a,
- gtk.gdk.CONTROL_MASK | gtk.gdk.MOD1_MASK),
+ gdk.KEY_a, gdk.ModifierType.CONTROL_MASK | \
+ gdk.ModifierType.MOD1_MASK),
(N_('Inspect accessible under mouse'),
self._inspectUnderMouse,
- gtk.keysyms.question,
- gtk.gdk.CONTROL_MASK | gtk.gdk.MOD1_MASK)]
+ gdk.KEY_question, gdk.ModifierType.CONTROL_MASK | \
+ gdk.ModifierType.MOD1_MASK)]
pyatspi.Registry.registerEventListener(self._accEventFocusChanged,
'object:state-changed')
@@ -68,7 +73,7 @@ class QuickSelect(Plugin):
'''
Inspect accessible of widget under mouse.
'''
- display = gtk.gdk.Display(gtk.gdk.get_display())
+ display = gdk.Display(gdk.get_display())
screen, x, y, flags = display.get_pointer()
del screen # A workaround http://bugzilla.gnome.org/show_bug.cgi?id=593732
@@ -82,7 +87,7 @@ class QuickSelect(Plugin):
# Inspect accessible under mouse
desktop = pyatspi.Registry.getDesktop(0)
- 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()]
top_window = (None, -1)
for app in desktop:
diff --git a/plugins/validate.py b/plugins/validate.py
index b600639..a228d43 100644
--- a/plugins/validate.py
+++ b/plugins/validate.py
@@ -10,8 +10,11 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
-import gobject
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import GObject
+
import os
import traceback
import sys
@@ -184,7 +187,7 @@ class ValidatorViewport(ViewportPlugin):
self.validator_buffer = gtk.TextBuffer()
# model for the combobox
- model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
+ model = gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
self.schema.set_model(model)
# append all schema names/descriptions
@@ -207,7 +210,7 @@ class ValidatorViewport(ViewportPlugin):
col = gtk.TreeViewColumn(_('Level'))
rend = gtk.CellRendererText()
col.pack_start(rend, True)
- col.set_attributes(rend, text=0)
+ col.add_attribute(rend, 'text', 0)
self.report.append_column(col)
# description column
rend = gtk.CellRendererText()
@@ -295,16 +298,16 @@ class ValidatorViewport(ViewportPlugin):
'''
save_dialog = gtk.FileChooserDialog(
'Save validator output',
- action=gtk.FILE_CHOOSER_ACTION_SAVE,
- buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_OK, gtk.RESPONSE_OK))
+ action=gtk.FileChooserAction.SAVE,
+ buttons=(gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL,
+ gtk.STOCK_OK, gtk.ResponseType.OK))
#save_dialog.connect("response", self._savedDiagResponse)
save_dialog.set_do_overwrite_confirmation(True)
- save_dialog.set_default_response(gtk.RESPONSE_OK)
+ save_dialog.set_default_response(gtk.ResponseType.OK)
response = save_dialog.run()
- if response == gtk.RESPONSE_OK:
+ if response == gtk.ResponseType.OK:
self.save_to = open(save_dialog.get_filename(), 'w')
- gobject.idle_add(self._writeFile)
+ GObject.idle_add(self._writeFile)
save_dialog.destroy()
def _onClear(self, button):
@@ -342,7 +345,7 @@ class ValidatorViewport(ViewportPlugin):
self.write_in_progress = True
self._setDefaultSaveVars()
# register an idle callback
- self.idle_save_id = gobject.idle_add(self._onSaveIdle)
+ self.idle_save_id = GObject.idle_add(self._onSaveIdle)
self.progress.set_text(_('Saving'))
# disable controls
self.validate.set_sensitive(False)
@@ -354,7 +357,7 @@ class ValidatorViewport(ViewportPlugin):
components to their enabled states.
'''
# stop callbacks
- gobject.source_remove(self.idle_save_id)
+ GObject.source_remove(self.idle_save_id)
# reset progress
self.progress.set_fraction(0.0)
self.progress.set_text(_('Idle'))
@@ -390,7 +393,7 @@ class ValidatorViewport(ViewportPlugin):
# build our walk generator
self.walk = self._traverse(self.acc, state)
# register an idle callback
- self.idle_validate_id = gobject.idle_add(self._onValidateIdle)
+ self.idle_validate_id = GObject.idle_add(self._onValidateIdle)
self.progress.set_text(_('Validating'))
# disable controls
self.schema.set_sensitive(False)
@@ -404,7 +407,7 @@ class ValidatorViewport(ViewportPlugin):
various UI components to their enabled states.
'''
# stop callbacks
- gobject.source_remove(self.idle_validate_id)
+ GObject.source_remove(self.idle_validate_id)
# destroy generator
self.walk = None
# reset progress
diff --git a/pyreqs.py b/pyreqs.py
index 747064a..f2906c6 100644
--- a/pyreqs.py
+++ b/pyreqs.py
@@ -25,25 +25,22 @@ except KeyError:
pass
# test for python modules
-modules = ['pygtk', 'gtk', 'gtk.gdk', 'wnck', 'pyatspi']
+modules = ['pyatspi', 'cairo', 'rsvg', 'gi', 'gi.repository.Gtk', \
+ 'gi.repository.GConf', 'gi.repository.Gdk', 'gi.repository.Atk', \
+ 'gi.repository.GObject', 'gi.repository.GdkPixbuf', \
+ 'gi.repository.Wnck', 'gi.repository.Gio']
+
for name in modules:
try:
m = __import__(name)
print name,
except ImportError, e:
- if name == 'wnck' and e.args[0].find('gtk') > -1:
- # just no display, continue
- continue
print name, '*MISSING*'
sys.exit(1)
except RuntimeError:
# ignore other errors which might be from lack of a display
continue
- if name == 'pygtk':
- m.require('2.0')
- elif name == 'gtk':
- m.check_version(*GTK_VERSION)
- elif name =='pyatspi':
+ if name =='pyatspi':
try:
compared = map(lambda x: cmp(*x), zip(PYATSPI_REQ, m.__version__))
except AttributeError:
diff --git a/src/accerciser.in b/src/accerciser.in
index d74680b..424eb60 100755
--- a/src/accerciser.in
+++ b/src/accerciser.in
@@ -12,6 +12,8 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+import gi
+
import sys, os
# Load gail module no matter what the desktop-wide settings are.
os.environ['GTK_MODULES'] = 'gail:atk-bridge'
@@ -25,31 +27,28 @@ libs = os.path.join(sys.prefix, 'lib',
# point to the proper site-packages path
sys.path.insert(1, libs)
-# TODO: Remove unnecessary stuff here
-# We're commenting lines below for a sanity check
-# regarding gsettings calls.
-#
-#import pygtk
-#pygtk.require('2.0')
+# TODO: Remove completely gnome dependency
+# make this program accessible
#
#import gnome
## make this program accessible
#props = { gnome.PARAM_APP_DATADIR : os.path.join(sys.prefix, 'share')}
#gnome.program_init('accerciser', '@VERSION@',
# properties=props, argv=['accerciser'] + sys.argv[1:])
-#
-#import gtk
-## initialize threads
-## get global icon resources
-#it = gtk.IconTheme()
-#try:
-# icons = [it.load_icon('@PACKAGE@', size, gtk.ICON_LOOKUP_NO_SVG)
-# for size in (16, 22, 32)]
-#except Exception:
-# # ignore errors, and just don't use the icon
-# pass
-#else:
-# gtk.window_set_default_icon_list(*icons)
+
+from gi.repository import Gtk as gtk
+# initialize threads
+# get global icon resources
+it = gtk.IconTheme()
+try:
+ icons = [it.load_icon('@PACKAGE@', size, gtk.IconLookupFlags.NO_SVG)
+ for size in (16, 22, 32)]
+except Exception:
+ # ignore errors, and just don't use the icon
+ pass
+else:
+ # TODO: REVIEW
+ gtk.Window.set_default_icon_list(icons)
import accerciser
accerciser.main()
diff --git a/src/lib/accerciser/about_dialog.py b/src/lib/accerciser/about_dialog.py
index 3927ce4..caa7797 100644
--- a/src/lib/accerciser/about_dialog.py
+++ b/src/lib/accerciser/about_dialog.py
@@ -13,12 +13,10 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
-from gnome import program_get, url_show
-from i18n import _
-
-gtk.about_dialog_set_url_hook(lambda dialog, url, data: url_show(url), None)
+import gi
+from gi.repository import Gtk as gtk
+from i18n import _
class AccerciserAboutDialog(gtk.AboutDialog):
'''
@@ -44,14 +42,16 @@ class AccerciserAboutDialog(gtk.AboutDialog):
@type WEB_LABEL: string
'''
AUTHORS = ['Eitan Isaacson <eitan ascender com>',
- 'Peter Parente <pparente us ibm com>']
+ 'Peter Parente <pparente us ibm com>',
+ 'Brian Nitz <brian nitz oracle com>',
+ 'Javier HernÃndez <jhernandez emergya es>']
ARTISTS = ['Eitan Isaacson <eitan ascender com>',
'James Stipp <James_Stipp us ibm com>',
- 'Vincent Geddes <vincent geddes gmail com']
+ 'Vincent Geddes <vincent geddes gmail com>']
DOCUMENTERS = ['Eitan Isaacson <eitan ascender com>']
TRANSLATORS = _('translator-credits')
COMMENTS = _('An interactive Python accessibility explorer')
- COPYRIGHT = _('accerciser Copyright  2006, 2007 IBM Corporation (BSD)')
+ COPYRIGHT = _('accerciser Copyright (c) 2006, 2007 IBM Corporation (BSD)')
LICENSE = \
_('The New BSD License See the COPYING and NOTICE files for details.')
WEB_URL = 'http://live.gnome.org/Accerciser'
@@ -60,7 +60,6 @@ class AccerciserAboutDialog(gtk.AboutDialog):
'''
Initialize dialog.
'''
- program = program_get()
gtk.AboutDialog.__init__(self)
self.connect('response', self._onResponse)
gtk.AboutDialog.set_authors(self, self.AUTHORS)
@@ -70,7 +69,7 @@ class AccerciserAboutDialog(gtk.AboutDialog):
gtk.AboutDialog.set_copyright(self, self.COPYRIGHT)
gtk.AboutDialog.set_license(self, self.LICENSE)
gtk.AboutDialog.set_logo_icon_name(self, 'accerciser')
- gtk.AboutDialog.set_version(self, program.get_app_version())
+# gtk.AboutDialog.set_version(self, program.get_app_version())
gtk.AboutDialog.set_website(self, self.WEB_URL)
gtk.AboutDialog.set_website_label(self, self.WEB_LABEL)
@@ -83,4 +82,5 @@ class AccerciserAboutDialog(gtk.AboutDialog):
@param response_id: Response ID recieved.
@type response_id: integer
'''
- self.destroy()
+ self.destroy()
+
diff --git a/src/lib/accerciser/accerciser.py b/src/lib/accerciser/accerciser.py
index 6094075..9a5443e 100644
--- a/src/lib/accerciser/accerciser.py
+++ b/src/lib/accerciser/accerciser.py
@@ -14,18 +14,19 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import Wnck as wnck
+from gi.repository import GConf as gconf
+from gi.repository import GObject
+from gi.repository import Atk as atk
from gi.repository.Gio import Settings
+
a11yAppSettings = Settings('org.gnome.desktop.interface')
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
-import gtk.gdk
import os, sys, locale
from icons import getIcon
import os
-import atk
from bookmarks import BookmarkStore
from accessible_treeview import *
from node import Node
@@ -33,7 +34,6 @@ from plugin import PluginManager
from plugin import PluginView
from tools import Tools
from i18n import _, N_
-import wnck
from hotkey_manager import HotkeyManager, HotkeyTreeView
from about_dialog import AccerciserAboutDialog
from prefs_dialog import AccerciserPreferencesDialog
@@ -96,7 +96,7 @@ class Main(Tools):
action = main_actions.get_action(action_name)
ui_manager.uimanager.add_ui(ui_manager.uimanager.new_merge_id(),
menu_path, action_name, action_name,
- gtk.UI_MANAGER_MENUITEM, False)
+ gtk.UIManagerItemType.MENUITEM, False)
self.last_focused = None
@@ -108,7 +108,7 @@ class Main(Tools):
'''
# Tell user if desktop accessibility is disabled.
self._showNoA11yDialog()
- gobject.timeout_add(200, self._pumpEvents)
+ GObject.timeout_add(200, self._pumpEvents)
try:
pyatspi.Registry.start(async=True, gil=False)
except KeyboardInterrupt:
@@ -128,20 +128,20 @@ class Main(Tools):
message = _('Accerciser could not see the applications on your desktop. '
'You must enable desktop accessibility to fix this problem. '
'Do you want to enable it now?')
- dialog = gtk.MessageDialog(self.window,type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_YES_NO,
+ dialog = gtk.MessageDialog(self.window,type=gtk.MessageType.ERROR,
+ buttons=gtk.ButtonsType.YES_NO,
message_format=message)
dialog.connect('response', self._onNoA11yResponse)
dialog.show_all()
def _onNoA11yResponse(self, dialog, response_id):
dialog.destroy()
- if response_id == gtk.RESPONSE_YES:
+ if response_id == gtk.ResponseType.YES:
a11yAppSettings.set_boolean('toolkit-accessibility', True)
dialog = gtk.MessageDialog(
self.window,
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_OK,
+ type=gtk.MessageType.INFO,
+ buttons=gtk.ButtonsType.OK,
message_format=_('Note: Changes only take effect after logout.'))
dialog.connect('response', lambda dia, resp: dia.destroy())
dialog.show_all()
@@ -153,7 +153,7 @@ class Main(Tools):
self.window.saveState()
self.plugin_manager.close()
- def _onQuit(self, obj):
+ def _onQuit(self, obj, data=None):
'''
Quits the app.
@@ -163,7 +163,7 @@ class Main(Tools):
self._shutDown()
pyatspi.Registry.stop()
- def _onAbout(self, action):
+ def _onAbout(self, action, data=None):
'''
Shows the about dialog.
@@ -171,7 +171,7 @@ class Main(Tools):
@type widget: L{gtk.Widget}
'''
about = AccerciserAboutDialog()
- about.show_all()
+ about.run()
def _onHelp(self, action, page=""):
'''
@@ -183,12 +183,12 @@ class Main(Tools):
uri = "ghelp:accerciser"
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())
return True
- def _onShowPreferences(self, action):
+ def _onShowPreferences(self, action, data=None):
'''
Shows the preferences dialog.
diff --git a/src/lib/accerciser/accessible_treeview.py b/src/lib/accerciser/accessible_treeview.py
index 185066b..a6b247b 100644
--- a/src/lib/accerciser/accessible_treeview.py
+++ b/src/lib/accerciser/accessible_treeview.py
@@ -12,10 +12,13 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
-import gobject
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GdkPixbuf
+from gi.repository import GObject
+
import pyatspi
-import atk, os
+import os
import ui_manager
from icons import getIcon
from node import Node
@@ -43,16 +46,16 @@ class AccessibleModel(gtk.TreeStore, Tools):
@type acc_cache: list
'''
__gsignals__ = {'row-filled' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_PYOBJECT,)),
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_PYOBJECT,)),
'start-populating' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
()),
'end-populating' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
())}
def __init__(self, desktop_acc):
@@ -61,7 +64,7 @@ class AccessibleModel(gtk.TreeStore, Tools):
Connects required signals.
'''
self.acc_cache = [desktop_acc]
- gtk.TreeStore.__init__(self, gtk.gdk.Pixbuf, str, str, str, bool, bool, object)
+ gtk.TreeStore.__init__(self, GdkPixbuf.Pixbuf, str, str, str, bool, bool, object)
self.connect('row-changed', self._onRowChanged)
self.connect('row-filled', self._onRowFilled)
self.desktop = desktop_acc
@@ -187,13 +190,17 @@ class AccessibleModel(gtk.TreeStore, Tools):
@type iter: L{gtk.TreeIter}
'''
if iter:
- row_reference = gtk.TreeRowReference(self, self.get_path(iter))
+ tree_path = self.get_path(iter)
+ path = tuple(tree_path.get_indices())
+
+ row_reference = gtk.TreeRowReference.new(self, tree_path)
+ #row_reference = gtk.TreeRowReference()
else:
row_reference = None
self._populating_tasks += 1
if self._populating_tasks == 1:
self.emit('start-populating')
- gobject.idle_add(self._popOnIdle, row_reference)
+ GObject.idle_add(self._popOnIdle, row_reference)
def _popOnIdle(self, row_reference):
'''
@@ -215,7 +222,9 @@ class AccessibleModel(gtk.TreeStore, Tools):
return False
iter = self.get_iter(row_reference.get_path())
parent = self[iter][COL_ACC]
- if self[(row_reference.get_path())+(0,)][COL_DUMMY]:
+ tree_path = row_reference.get_path()
+ path = tuple(tree_path.get_indices())
+ if self[path+(0,)][COL_DUMMY]:
remove_iter = self.iter_children(iter)
already_populated_num = self.iter_n_children(iter)
@@ -289,7 +298,8 @@ class AccessibleModel(gtk.TreeStore, Tools):
@type iter: gtk.TreeIter
'''
if iter and self._path_to_populate:
- path = self.get_path(iter)
+ tree_path = self.get_path(iter)
+ path = tuple(tree_path.get_indices())
if self._path_to_populate[:len(path)] == path:
if self._walkThroughFilled(self._path_to_populate):
self._path_to_populate = None
@@ -308,7 +318,7 @@ class AccessibleModel(gtk.TreeStore, Tools):
'''
path = ()
child = acc
- while child.parent:
+ while child.get_parent():
try:
index_in_parent = child.getIndexInParent()
if index_in_parent < 0:
@@ -316,7 +326,7 @@ class AccessibleModel(gtk.TreeStore, Tools):
path = (index_in_parent,) + path
except Exception, e:
return None
- child = child.parent
+ child = child.get_parent()
try:
path = (list(self.desktop).index(child),) + path
except Exception, e:
@@ -389,8 +399,8 @@ class AccessibleTreeView(gtk.TreeView, Tools):
tvc = gtk.TreeViewColumn(_('Name'))
tvc.pack_start(crp, False)
tvc.pack_start(crt, True)
- tvc.set_attributes(crp, pixbuf=COL_ICON)
- tvc.set_attributes(crt, text=COL_NAME)
+ tvc.add_attribute(crp, 'pixbuf', COL_ICON)
+ tvc.add_attribute(crt, 'text', COL_NAME)
tvc.set_resizable(True)
tvc.set_cell_data_func(crt, self._accCellDataFunc)
tvc.set_cell_data_func(crp, self._accCellDataFunc)
@@ -398,14 +408,14 @@ class AccessibleTreeView(gtk.TreeView, Tools):
crt= gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Role'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=COL_ROLE)
+ tvc.add_attribute(crt, 'text', COL_ROLE)
tvc.set_resizable(True)
tvc.set_cell_data_func(crt, self._accCellDataFunc)
self.append_column(tvc)
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Children'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=COL_CHILDCOUNT)
+ tvc.add_attribute(crt, 'text', COL_CHILDCOUNT)
tvc.set_resizable(True)
tvc.set_cell_data_func(crt, self._accCellDataFunc)
self.append_column(tvc)
@@ -420,7 +430,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
selection = self.get_selection()
selection.unselect_all()
selection.connect('changed', self._onSelectionChanged)
- selection.set_select_function(self._selectFunc)
+ selection.set_select_function(self._selectFunc, None)
self.connect('row-expanded', self._onExpanded)
pyatspi.Registry.registerEventListener(self._accEventChildChanged,
@@ -470,13 +480,13 @@ class AccessibleTreeView(gtk.TreeView, Tools):
return False
path = self.get_path_at_pos(int(event.x), int(event.y))[0]
selection = self.get_selection()
- selection.set_mode(gtk.SELECTION_NONE)
- self.set_cursor(path)
- selection.set_mode(gtk.SELECTION_SINGLE)
+ selection.set_mode(gtk.SelectionMode.NONE)
+ self.set_cursor(path, None, False)
+ selection.set_mode(gtk.SelectionMode.SINGLE)
time = event.time
button = event.button
func = None
- extra_data = None
+ extra_data = int()
else:
path, col= self.get_cursor()
time = gtk.get_current_event_time()
@@ -488,7 +498,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
menu.popup(None, None, func, button, time, extra_data)
return True
- def _refreshTopLevel(self, action=None):
+ def _refreshTopLevel(self, action=None, data=None):
'''
Refreshes the entire tree at the desktop level.
@@ -499,7 +509,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
self.model.popLevel(None)
# iter over all apps in the desktop too
- def _refreshCurrentLevel(self, action):
+ def _refreshCurrentLevel(self, action, data=None):
'''
Refreshes the current level. Selects and expands the parent of the level.
@@ -602,7 +612,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
# We do this because an application won't have an icon loaded in
# the window manager when it is first registered to at-spi
if new_child == new_child.getApplication():
- gobject.timeout_add(1000, self._refreshIcon, new_child)
+ GObject.timeout_add(1000, self._refreshIcon, new_child)
def _refreshIcon(self, app):
'''
@@ -631,7 +641,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
if parent_iter:
iter = self.model.iter_children(parent_iter)
else:
- iter = self.model.get_iter_root()
+ iter = self.model.get_iter_first()
while iter:
if self.model[iter][COL_ACC] not in parent:
if not self.model.remove(iter):
@@ -686,7 +696,9 @@ class AccessibleTreeView(gtk.TreeView, Tools):
self.node.update(new_acc)
self.node.handler_unblock(self._changed_handler)
if iter:
- path = model.get_path(iter)
+ tree_path = model.get_path(iter)
+ path = tuple(tree_path.get_indices())
+
self.node.tree_path = list(path[1:])
def _onAccChanged(self, node, acc):
@@ -738,7 +750,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@type iter: gtk.TreeIter
'''
if iter and self._path_to_expand and \
- self._path_to_expand[:-1] == model.get_path(iter):
+ self._path_to_expand[:-1] == model.get_path(iter).get_indices():
self._selectExistingPath(self._path_to_expand)
self._path_to_expand = None
@@ -749,8 +761,9 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@param path: Path to select.
@type path: tuple
'''
+ tree_path = gtk.TreePath(path[:-1])
if len(path) > 1:
- self.expand_to_path(path[:-1])
+ self.expand_to_path(tree_path)
self.scroll_to_cell(path)
selection = self.get_selection()
selection.select_path(path)
@@ -763,8 +776,9 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@param model: Model that emitted the signal.
@type model: L{AccessibleModel}
'''
- if self.window:
- self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+ if self.get_window():
+ window = self.get_window()
+ window.set_cursor(gdk.Cursor(gdk.CursorType.WATCH))
def _onEndPop(self, model):
'''
@@ -773,10 +787,11 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@param model: Model that emitted the signal.
@type model: L{AccessibleModel}
'''
- if self.window:
- self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.TOP_LEFT_ARROW))
+ if self.get_window():
+ window = self.get_window()
+ window.set_cursor(gdk.Cursor(gdk.CursorType.TOP_LEFT_ARROW))
- def _accCellDataFunc(self, tvc, cellrenderer, model, iter):
+ def _accCellDataFunc(self, tvc, cellrenderer, model, iter_id, iter_type):
'''
A cellrenderer data function. renderer's this application's node as insensitive.
@@ -790,9 +805,9 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@type iter: L{gtk.TreeIter}
'''
# TODO: Remove idle_add when at-spi2 reentrancy issues are fixed
- gobject.idle_add(self._accCellDataFuncReal, tvc, cellrenderer, model, iter)
+ GObject.idle_add(self._accCellDataFuncReal, tvc, cellrenderer, model, iter_id)
- def _accCellDataFuncReal(self, tvc, cellrenderer, model, iter):
+ def _accCellDataFuncReal(self, tvc, cellrenderer, model, iter_id):
'''
Called by _acCellDataFunc when idle
@@ -805,8 +820,8 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@param iter: The iter at the given row.
@type iter: L{gtk.TreeIter}
'''
- if model.iter_is_valid(iter):
- acc = model.get_value(iter, COL_ACC)
+ if model.iter_is_valid(iter_id):
+ acc = model.get_value(iter_id, COL_ACC)
else:
acc = None
if self.isMyApp(acc):
@@ -814,7 +829,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
else:
cellrenderer.set_property('sensitive', True)
- def _selectFunc(self, path):
+ def _selectFunc(self, tree_selection, acc_model, tree_path, foo3, foo4):
'''
A selection function. Does not allow his application's node to be selected.
@@ -824,6 +839,8 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@return: True if the row's accessible is not this app.
@rtype: boolean
'''
+ path = tuple(tree_path.get_indices())
+
acc = self.model[path][COL_ACC]
return not self.isMyApp(acc)
diff --git a/src/lib/accerciser/bookmarks.py b/src/lib/accerciser/bookmarks.py
index cfc18ca..35c0ea5 100644
--- a/src/lib/accerciser/bookmarks.py
+++ b/src/lib/accerciser/bookmarks.py
@@ -1,10 +1,12 @@
-import gtk, atk, os
+from gi.repository import Gtk as gtk
+from gi.repository import Atk as atk
+
+import os
from xml.dom.minidom import getDOMImplementation, parse, Element
from i18n import _
from pyatspi import getPath
from random import random
import random
-import gobject
import ui_manager
COL_NAME = 0
@@ -71,14 +73,14 @@ class BookmarkStore(gtk.ListStore):
action_name = action.get_name()
ui_manager.uimanager.add_ui(merge_id, ui_manager.BOOKMARKS_MENU_PATH,
action_name, action_name,
- gtk.UI_MANAGER_MENUITEM, False)
+ gtk.UIManagerItemType.MENUITEM, False)
ui_manager.uimanager.add_ui(ui_manager.uimanager.new_merge_id(),
ui_manager.BOOKMARKS_MENU_PATH,
'sep', None,
- gtk.UI_MANAGER_SEPARATOR, False)
+ gtk.UIManagerItemType.SEPARATOR, False)
- def _onAddBookmark(self, action):
+ def _onAddBookmark(self, action, data=None):
'''
Callback for AddBookmark action.
@@ -90,13 +92,13 @@ class BookmarkStore(gtk.ListStore):
bookmark = self[iter][0]
dialog = self._NewBookmarkDialog(bookmark)
response_id = dialog.run()
- if response_id == gtk.RESPONSE_OK:
+ if response_id == gtk.ResponseType.OK:
bookmark.title, bookmark.app, bookmark.path = dialog.getFields()
else:
self.remove(iter)
dialog.destroy()
- def _onEditBookmarks(self, action):
+ def _onEditBookmarks(self, action, data=None):
'''
Callback for EditBookmark action.
@@ -148,7 +150,7 @@ class BookmarkStore(gtk.ListStore):
self._bookmarks_action_group.add_action(bookmark)
ui_manager.uimanager.add_ui(merge_id,
'/MainMenuBar/Bookmarks', name, name,
- gtk.UI_MANAGER_MENUITEM, False)
+ gtk.UIManagerItemType.MENUITEM, False)
self[iter][0] = bookmark
return iter
@@ -188,7 +190,7 @@ class BookmarkStore(gtk.ListStore):
return filter(lambda x: isinstance(x, Element),
self._xmldoc.documentElement.childNodes)
- def _onRowChanged(self, model, path, iter):
+ def _onRowChanged(self, model, tree_path, iter):
'''
Callback for row changes. Persist changes to disk.
@@ -199,6 +201,7 @@ class BookmarkStore(gtk.ListStore):
@param iter: Iter of row that changed.
@type iter: gtk.TreeIter
'''
+ path = tuple(tree_path.get_indices())
node = self._getElements()[path[0]]
bookmark = model[iter][0]
if bookmark is None: return
@@ -207,7 +210,7 @@ class BookmarkStore(gtk.ListStore):
node.setAttribute(attr, getattr(bookmark, attr))
self._persist()
- def _onRowDeleted(self, model, path):
+ def _onRowDeleted(self, model, tree_path):
'''
Callback for row deletions. Persist changes to disk, and update UI.
@@ -216,6 +219,7 @@ class BookmarkStore(gtk.ListStore):
@param path: Path of row that got deleted.
@type path: tuple
'''
+ path = tuple(tree_path.get_indices())
node = self._getElements()[path[0]]
self._xmldoc.documentElement.removeChild(node)
self._persist()
@@ -321,19 +325,20 @@ class BookmarkStore(gtk.ListStore):
@type bookmarks_store: L{BookmarkStore}
'''
gtk.Dialog.__init__(self, _('Edit Bookmarks...'),
- buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ buttons=(gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE))
self.set_default_size(480,240)
self.connect('response', self._onResponse)
+ vbox = self.get_children()[0]
hbox = gtk.HBox()
hbox.set_spacing(3)
tv = self._createTreeView(bookmarks_store)
sw = gtk.ScrolledWindow()
- sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- sw.set_shadow_type(gtk.SHADOW_IN)
+ sw.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
+ sw.set_shadow_type(gtk.ShadowType.IN)
sw.add(tv)
- hbox.pack_start(sw)
+ hbox.pack_start(sw, True, True, 0)
button_vbox = gtk.VBox()
- hbox.pack_start(button_vbox, False, False)
+ hbox.pack_start(button_vbox, False, False, 0)
add_button = gtk.Button('gtk-add')
add_button.set_use_stock(True)
add_button.connect('clicked', self._onAddClicked, tv)
@@ -343,10 +348,10 @@ class BookmarkStore(gtk.ListStore):
jump_button = gtk.Button('gtk-jump-to')
jump_button.set_use_stock(True)
jump_button.connect('clicked', self._onJumpToClicked, tv)
- button_vbox.pack_start(add_button, False, False)
- button_vbox.pack_start(remove_button, False, False)
- button_vbox.pack_start(jump_button, False, False)
- self.vbox.add(hbox)
+ button_vbox.pack_start(add_button, False, False, 0)
+ button_vbox.pack_start(remove_button, False, False, 0)
+ button_vbox.pack_start(jump_button, False, False, 0)
+ vbox.add(hbox)
hbox.set_border_width(3)
self.show_all()
@@ -510,14 +515,15 @@ class BookmarkStore(gtk.ListStore):
@type bookmark: L{BookmarkStore._Bookmark}
'''
gtk.Dialog.__init__(self, _('Add Bookmark...'))
- self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
- ok_button = self.add_button(gtk.STOCK_ADD, gtk.RESPONSE_OK)
+ self.add_button(gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL)
+ ok_button = self.add_button(gtk.STOCK_ADD, gtk.ResponseType.OK)
ok_button.set_sensitive(False)
- self.set_default_response(gtk.RESPONSE_OK)
+ self.set_default_response(gtk.ResponseType.OK)
table = gtk.Table(3, 2, False)
table.set_row_spacings(3)
table.set_col_spacings(3)
- self.vbox.add(table)
+ vbox = self.get_children()[0]
+ vbox.add(table)
self._title_entry = gtk.Entry()
self._title_entry.connect('changed', self._onChanged, ok_button)
self._app_entry = gtk.Entry()
@@ -538,9 +544,9 @@ class BookmarkStore(gtk.ListStore):
label_widget.set_alignment(0.0,0.5)
label_acc = label_widget.get_accessible()
entry_acc = entry.get_accessible()
- label_acc.add_relationship(atk.RELATION_LABEL_FOR, entry_acc)
- entry_acc.add_relationship(atk.RELATION_LABELLED_BY, label_acc)
- table.attach(gtk.Label(label), 0, 1, i, i+1, gtk.FILL, 0)
+ label_acc.add_relationship(atk.RelationType.LABEL_FOR, entry_acc)
+ entry_acc.add_relationship(atk.RelationType.LABELLED_BY, label_acc)
+ table.attach(gtk.Label(label), 0, 1, i, i+1, gtk.AttachOptions.FILL, 0)
table.attach(entry, 1, 2, i, i+1)
self.show_all()
diff --git a/src/lib/accerciser/hotkey_manager.py b/src/lib/accerciser/hotkey_manager.py
index 292bedf..8caf721 100644
--- a/src/lib/accerciser/hotkey_manager.py
+++ b/src/lib/accerciser/hotkey_manager.py
@@ -10,7 +10,10 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk, gconf
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GConf as gconf
+
from i18n import _
import pyatspi
@@ -35,9 +38,9 @@ def _charToKeySym(key):
@rtype: long
'''
try:
- rv = gtk.gdk.unicode_to_keyval(ord(key))
+ rv = gdk.unicode_to_keyval(ord(key))
except:
- rv = getattr(gtk.keysyms, key)
+ rv = getattr(gdk, 'KEY_%s' % key)
return rv
class HotkeyManager(gtk.ListStore):
@@ -52,7 +55,7 @@ class HotkeyManager(gtk.ListStore):
'''
gtk.ListStore.__init__(self, str, str, object, int, int, str)
self.connect('row-changed', self._onComboChanged)
- self.gconf_client = gconf.client_get_default()
+ self.gconf_client = gconf.Client.get_default()
masks = [mask for mask in pyatspi.allModifiers()]
pyatspi.Registry.registerKeystrokeListener(
@@ -82,12 +85,14 @@ class HotkeyManager(gtk.ListStore):
@param modifiers: The modifiers that were depressed during the keystroke.
@type modifiers: integer
'''
- km = gtk.gdk.keymap_get_default()
+ km = gdk.Keymap.get_default()
+
callback = None
+
for combo in self:
- entries = km.get_entries_for_keyval(combo[COL_KEYPRESS])
- if not entries: continue
- if key in [keycode[0] for keycode in entries] and \
+ success, entries = km.get_entries_for_keyval(combo[COL_KEYPRESS])
+ if not success: continue
+ if key in [int(entry.keycode) for entry in entries] and \
modifiers & combo[COL_MOD] == combo[COL_MOD]:
callback = combo[COL_CALLBACK]
if callback:
@@ -131,7 +136,7 @@ class HotkeyManager(gtk.ListStore):
else:
final_keypress, final_modifiers = keypress, modifiers
self.append([component, description, callback,
- final_keypress, final_modifiers, localized_component])
+ int(final_keypress), final_modifiers, localized_component])
def removeKeyCombo(self, component, description, callback, key, modifiers):
'''
@@ -152,7 +157,7 @@ class HotkeyManager(gtk.ListStore):
be perfomed.
@type modifiers: int
'''
- iter = self.get_iter_root()
+ iter = self.get_iter_first()
while iter:
if self[iter][COL_CALLBACK] == callback:
# We never really remove it, just set the callback to None
@@ -175,7 +180,8 @@ class HotkeyManager(gtk.ListStore):
combo_gconf_key = self._getComboGConfKey(model[iter][COL_COMPONENT],
model[iter][COL_DESC])
combo_name = gtk.accelerator_name(model[iter][COL_KEYPRESS],
- model[iter][COL_MOD])
+ gdk.ModifierType(model[iter][COL_MOD]))
+
if self.gconf_client.get_string(combo_gconf_key) != combo_name:
self.gconf_client.set_string(combo_gconf_key, combo_name)
@@ -213,20 +219,20 @@ class HotkeyTreeView(gtk.TreeView):
'''
gtk.TreeView.__init__(self)
self.hotkey_manager = hotkey_manager
- modelfilter = self.hotkey_manager.filter_new()
- modelfilter.set_visible_func(self._rowVisibleFunc)
+ modelfilter = self.hotkey_manager.filter_new(None)
+ modelfilter.set_visible_func(self._rowVisibleFunc, None)
self.set_model(modelfilter)
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Component'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=COL_COMPONENT)
+ tvc.add_attribute(crt, 'text', COL_COMPONENT)
tvc.set_cell_data_func(crt, self._componentDataFunc, COL_COMPONENT)
self.append_column(tvc)
crt = gtk.CellRendererText()
tvc = gtk.TreeViewColumn(_('Task'))
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=COL_DESC)
+ tvc.add_attribute(crt, 'text', COL_DESC)
tvc.set_cell_data_func(crt, self._translateDataFunc, COL_DESC)
self.append_column(tvc)
@@ -234,31 +240,32 @@ class HotkeyTreeView(gtk.TreeView):
tvc = gtk.TreeViewColumn(_('Key'))
tvc.set_min_width(64)
tvc.pack_start(crt, True)
- tvc.set_attributes(crt, text=COL_KEYPRESS)
+ crt.props.editable = True
+ tvc.add_attribute(crt, 'text', COL_KEYPRESS)
tvc.set_cell_data_func(crt, self._keyCellFunc)
- crt.set_property('editable', True)
crt.connect('edited', self._onKeyChanged)
self.append_column(tvc)
crt = gtk.CellRendererToggle()
tvc = gtk.TreeViewColumn(_('Alt'))
tvc.pack_start(crt, True)
- tvc.set_cell_data_func(crt, self._modCellFunc, gtk.gdk.MOD1_MASK)
- crt.connect('toggled', self._onModToggled, gtk.gdk.MOD1_MASK)
+ tvc.set_cell_data_func(crt, self._modCellFunc, gdk.ModifierType.MOD1_MASK)
+ crt.connect('toggled', self._onModToggled, gdk.ModifierType.MOD1_MASK)
self.append_column(tvc)
crt = gtk.CellRendererToggle()
tvc = gtk.TreeViewColumn(_('Ctrl'))
tvc.pack_start(crt, True)
- tvc.set_cell_data_func(crt, self._modCellFunc, gtk.gdk.CONTROL_MASK)
- crt.connect('toggled', self._onModToggled, gtk.gdk.CONTROL_MASK)
+ tvc.set_cell_data_func(crt, self._modCellFunc, \
+ gdk.ModifierType.CONTROL_MASK)
+ crt.connect('toggled', self._onModToggled, gdk.ModifierType.CONTROL_MASK)
self.append_column(tvc)
crt = gtk.CellRendererToggle()
tvc = gtk.TreeViewColumn(_('Shift'))
tvc.pack_start(crt, True)
- tvc.set_cell_data_func(crt, self._modCellFunc, gtk.gdk.SHIFT_MASK)
- crt.connect('toggled', self._onModToggled, gtk.gdk.SHIFT_MASK)
+ tvc.set_cell_data_func(crt, self._modCellFunc, gdk.ModifierType.SHIFT_MASK)
+ crt.connect('toggled', self._onModToggled, gdk.ModifierType.SHIFT_MASK)
self.append_column(tvc)
def _translateDataFunc(self, column, cell, model, iter, column_id):
@@ -292,7 +299,7 @@ class HotkeyTreeView(gtk.TreeView):
cell.set_property('text', model[iter][COL_LOCALIZED_COMP] or \
model[iter][COL_COMPONENT])
- def _keyCellFunc(self, column, cell, model, iter):
+ def _keyCellFunc(self, column, cell, model, iter, foo=None):
'''
Show the key symbol as a string for easy readability.
@@ -307,7 +314,7 @@ class HotkeyTreeView(gtk.TreeView):
'''
if model[iter][COL_KEYPRESS] > 0:
cell.set_property('text',
- gtk.gdk.keyval_name(model[iter][COL_KEYPRESS]))
+ gdk.keyval_name(model[iter][COL_KEYPRESS]))
cell.set_property('sensitive', True)
else:
cell.set_property('text', '<select key>')
@@ -364,7 +371,7 @@ class HotkeyTreeView(gtk.TreeView):
'''
self.hotkey_manager[path][COL_MOD] ^= mask
- def _rowVisibleFunc(self, model, iter):
+ def _rowVisibleFunc(self, model, iter, foo=None):
'''
A filter function to hide the rows that do not contain valid callbacks.
This is usually the case when a plugin is disabled.
diff --git a/src/lib/accerciser/icons.py b/src/lib/accerciser/icons.py
index 13ae137..76d26c5 100644
--- a/src/lib/accerciser/icons.py
+++ b/src/lib/accerciser/icons.py
@@ -12,10 +12,15 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import GdkPixbuf
+from gi.repository import Wnck as wnck
+from gi.repository import GObject
+
import sys, os, glob
-import gtk
-import gobject
-import wnck
+
from pyatspi.constants import *
ICONS_PATH = os.path.join(sys.prefix, 'share',
@@ -30,18 +35,18 @@ def getIcon(acc):
the current theme or wnck to get application icons. Uses icons from
at-poke for widgets.
'''
- theme = gtk.icon_theme_get_default()
+ theme = gtk.IconTheme.get_default()
try:
role_name = acc.getRoleName()
role = acc.getRole()
if role_name == 'application':
# try the theme first
try:
- return theme.load_icon(acc.name, 24, gtk.ICON_LOOKUP_USE_BUILTIN)
- except gobject.GError:
+ return theme.load_icon(acc.name, 24, gtk.IconLookupFlags.USE_BUILTIN)
+ except GObject.GError:
pass
# then try wnck
- s = wnck.screen_get_default()
+ s = wnck.Screen.get_default()
s.force_update()
for win in s.get_windows():
wname = win.get_name()
@@ -53,10 +58,10 @@ def getIcon(acc):
name = role_name.replace(' ', '')
try:
fn = os.path.join(ICONS_PATH, '%s.png' % name)
- return gtk.gdk.pixbuf_new_from_file(fn)
- except gobject.GError:
+ return GdkPixbuf.Pixbuf.new_from_file(fn)
+ except GObject.GError:
pass
except Exception, e:
pass
fn = os.path.join(ICONS_PATH, 'filler.png')
- return gtk.gdk.pixbuf_new_from_file(fn)
+ return GdkPixbuf.Pixbuf.new_from_file(fn)
diff --git a/src/lib/accerciser/main_window.py b/src/lib/accerciser/main_window.py
index 53f4448..e141353 100644
--- a/src/lib/accerciser/main_window.py
+++ b/src/lib/accerciser/main_window.py
@@ -1,4 +1,7 @@
-import gtk, gconf
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GConf as gconf
+
from plugin import PluginView
from i18n import _, N_
from accessible_treeview import *
@@ -39,7 +42,7 @@ class AccerciserMainWindow(gtk.Window):
self.set_title(_('Accerciser Accessibility Explorer'))
self.connect('key-press-event', self._onKeyPress)
node.connect('blink-done', self._onBlinkDone)
- cl = gconf.client_get_default()
+ cl = gconf.Client.get_default()
width = cl.get_int(GCONF_GENERAL+'/window_width') or 640
height = cl.get_int(GCONF_GENERAL+'/window_height') or 640
self.set_default_size(width, height)
@@ -59,13 +62,13 @@ class AccerciserMainWindow(gtk.Window):
'''
main_vbox = gtk.VBox()
menu_bar = ui_manager.uimanager.get_widget(ui_manager.MAIN_MENU_PATH)
- main_vbox.pack_start(menu_bar, False)
+ main_vbox.pack_start(menu_bar, False, True, 0)
self._vpaned = gtk.VPaned()
self._vpaned.set_position(350)
self._vpaned.set_name('vpaned')
- main_vbox.pack_start(self._vpaned)
+ main_vbox.pack_start(self._vpaned, True, True, 0)
self.statusbar = gtk.Statusbar()
- main_vbox.pack_start(self.statusbar, False)
+ main_vbox.pack_start(self.statusbar, False, True, 0)
self._hpaned = gtk.HPaned()
self._hpaned.set_position(250)
self._hpaned.set_name('hpaned')
@@ -80,8 +83,8 @@ class AccerciserMainWindow(gtk.Window):
self._vpaned.add2(self.pluginview2)
self._hpaned.add2(self.pluginview1)
sw = gtk.ScrolledWindow()
- sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- sw.set_shadow_type(gtk.SHADOW_IN)
+ sw.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
+ sw.set_shadow_type(gtk.ShadowType.IN)
self.treeview = AccessibleTreeView(node)
ui_manager.uimanager.insert_action_group(self.treeview.action_group, 0)
for action in self.treeview.action_group.list_actions():
@@ -89,21 +92,21 @@ class AccerciserMainWindow(gtk.Window):
action_name = action.get_name()
ui_manager.uimanager.add_ui(merge_id, ui_manager.TREE_ACTIONS_PATH,
action_name, action_name,
- gtk.UI_MANAGER_MENUITEM, False)
+ gtk.UIManagerItemType.MENUITEM, False)
merge_id = ui_manager.uimanager.new_merge_id()
action_name = self.treeview.refresh_current_action.get_name()
ui_manager.uimanager.add_ui(merge_id, ui_manager.POPUP_MENU_PATH,
action_name, action_name,
- gtk.UI_MANAGER_MENUITEM, False)
+ gtk.UIManagerItemType.MENUITEM, False)
sw.add(self.treeview)
self._hpaned.add1(sw)
- cl = gconf.client_get_default()
+ cl = gconf.Client.get_default()
for paned in (self._vpaned, self._hpaned):
- if not cl.get(GCONF_GENERAL+'/'+paned.name): continue
- paned_position = cl.get_int(GCONF_GENERAL+'/'+paned.name)
+ if not cl.get(GCONF_GENERAL+'/'+paned.get_name()): continue
+ paned_position = cl.get_int(GCONF_GENERAL+'/'+paned.get_name())
paned.set_position(paned_position)
paned.set_data('last_position', paned.get_position())
@@ -128,11 +131,11 @@ class AccerciserMainWindow(gtk.Window):
self._vpaned.set_position(last_pos or 350)
elif pluginview.get_n_pages() == 0:
self._vpaned.set_data('last_position', self._vpaned.get_position())
- self._vpaned.set_position(self._vpaned.allocation.height - 30)
+ self._vpaned.set_position(self._vpaned.get_allocated_height() - 30)
def _onBottomPanelRealize(self, pluginview):
if pluginview.get_n_pages() == 0:
- self._vpaned.set_position(self._vpaned.allocation.height - 30)
+ self._vpaned.set_position(self._vpaned.get_allocated_height() - 30)
def _onKeyPress(self, widget, event):
'''
@@ -144,10 +147,10 @@ class AccerciserMainWindow(gtk.Window):
@param event: The event that accured.
@type event: L{gtk.gdk.Event}
'''
- if event.state & gtk.gdk.MOD1_MASK and \
- event.keyval in xrange(gtk.gdk.keyval_from_name('0'),
- gtk.gdk.keyval_from_name('9')):
- tab_num = event.keyval - gtk.gdk.keyval_from_name('0') or 10
+ if event.state & gdk.ModifierType.MOD1_MASK and \
+ event.keyval in xrange(gdk.keyval_from_name('0'),
+ gdk.keyval_from_name('9')):
+ tab_num = event.keyval - gdk.keyval_from_name('0') or 10
pages_count1 = self.pluginview1.getNVisiblePages()
pages_count2 = self.pluginview2.getNVisiblePages()
if pages_count1 + pages_count2 < tab_num:
@@ -161,9 +164,9 @@ class AccerciserMainWindow(gtk.Window):
'''
Save the dimensions of the main window, and the position of the panes.
'''
- cl = gconf.client_get_default()
- cl.set_int(GCONF_GENERAL+'/window_width', self.allocation.width)
- cl.set_int(GCONF_GENERAL+'/window_height', self.allocation.height)
+ cl = gconf.Client.get_default()
+ cl.set_int(GCONF_GENERAL+'/window_width', self.get_allocated_width())
+ cl.set_int(GCONF_GENERAL+'/window_height', self.get_allocated_height())
cl.set_int(GCONF_GENERAL+'/hpaned', self._hpaned.get_position())
if self.pluginview2.get_n_pages():
position = self._vpaned.get_position()
@@ -193,7 +196,10 @@ class AccerciserMainWindow(gtk.Window):
context_id = self.statusbar.get_context_id('lineage')
if not iter:
return
- path = map(str, model.get_path(iter))
+ tree_path = model.get_path(iter)
+ path_tuple = tuple(tree_path.get_indices())
+
+ path = map(str, path_tuple)
self.statusbar.pop(context_id)
if len(path) > 1:
self.statusbar.push(context_id, 'Path: '+' '.join(path[1:]))
diff --git a/src/lib/accerciser/node.py b/src/lib/accerciser/node.py
index 8dd905e..c1933bc 100644
--- a/src/lib/accerciser/node.py
+++ b/src/lib/accerciser/node.py
@@ -11,19 +11,21 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
-import gtk.gdk
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GObject
+from gi.repository import GConf as gconf
+#from gi.repository import cairo
+import cairo
import pyatspi
-import gobject
import string
-import rsvg
-import cairo
from tools import Tools, parseColorString
-import gconf
MAX_BLINKS = 6
-cl = gconf.client_get_default()
+cl = gconf.Client.get_default()
BORDER_COLOR, BORDER_ALPHA = parseColorString(
cl.get_string('/apps/accerciser/highlight_border') or '#ff0000ff')
@@ -42,7 +44,7 @@ class Bag(object):
def __str__(self):
return ', '.join(vars(self).keys())
-class Node(gobject.GObject, Tools):
+class Node(GObject.GObject, Tools):
'''
Node class that contains convient references to accessibility information
for the currently selected node. A L{Node} instance will emit an
@@ -57,19 +59,19 @@ class Node(gobject.GObject, Tools):
@type extents: L{Bag}
'''
__gsignals__ = {'accessible-changed' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_PYOBJECT,)),
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_PYOBJECT,)),
'blink-done' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
())}
def __init__(self):
self.desktop = pyatspi.Registry.getDesktop(0)
self.acc = None
self.extents = None
self.tree_path = None
- gobject.GObject.__init__(self)
+ GObject.GObject.__init__(self)
def update(self, acc):
'''
@@ -144,17 +146,17 @@ class Node(gobject.GObject, Tools):
self.max_blinks = times
self.blinks = 0
# get info for drawing higlight rectangles
- display = gtk.gdk.display_get_default()
+ display = gdk.Display.get_default()
screen = display.get_default_screen()
self.root = screen.get_root_window()
self.gc = self.root.new_gc()
- self.gc.set_subwindow(gtk.gdk.INCLUDE_INFERIORS)
- self.gc.set_function(gtk.gdk.INVERT)
- self.gc.set_line_attributes(3, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_BUTT,
- gtk.gdk.JOIN_MITER)
+ self.gc.set_subwindow(gdk.SubwindowMode.INCLUDE_INFERIORS)
+ self.gc.set_function(gdk.Function.INVERT)
+ self.gc.set_line_attributes(3, gdk.LineStyle.ON_OFF_DASH, \
+ gdk.CapStyle.BUTT, gdk.JoinStyle.MITER)
self.inv = gtk.Invisible()
self.inv.set_screen(screen)
- gobject.timeout_add(30, self._drawRectangle)
+ GObject.timeout_add(30, self._drawRectangle)
def _drawRectangle(self):
'''
@@ -177,47 +179,39 @@ class Node(gobject.GObject, Tools):
return False
return True
+
class _HighLight(gtk.Window):
'''
Highlight box class. Uses compositing when available. When not, it does
transparency client-side.
'''
- _svg = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns="http://www.w3.org/2000/svg">
- <rect
- style="fill:$fill;fill-opacity:$fill_opacity;fill-rule:evenodd;stroke:$stroke;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:$stroke_opacity"
- id="highlight"
- width="$width"
- height="$height"
- x="$x"
- y="$y"
- rx="2"
- ry="2" />
-</svg>
-"""
def __init__(self, x, y, w, h,
fill_color, fill_alpha,
stroke_color, stroke_alpha,
stroke_width, padding=0):
# Initialize window.
- gtk.Window.__init__(self, gtk.WINDOW_POPUP)
+ #gtk.Window.__init__(self, gtk.WindowType.POPUP)
+ gtk.Window.__init__(self)
# Normalize position for stroke and padding.
self.x, self.y = x - padding, y - padding
self.w, self.h = w + padding*2, h + padding*2
+ self.fill_color = fill_color
# Determine if we are compositing.
- self._composited = self.is_composited()
+ self._composited = True #self.is_composited()
if self._composited:
# Prepare window for transparency.
screen = self.get_screen()
- colormap = screen.get_rgba_colormap()
- self.set_colormap(colormap)
+ visual = screen.get_rgba_visual()
+ self.set_visual(visual)
else:
# Take a screenshot for compositing on the client side.
- self.root = gtk.gdk.get_default_root_window().get_image(
+ self.root = gdk.get_default_root_window().get_image(
self.x, self.y, self.w, self.h)
+ #self.root = gtk.Image(self.x, self.y, self.w, self.h)
+
# Place window, and resize it, and set proper properties.
self.set_app_paintable(True)
@@ -227,39 +221,37 @@ class _HighLight(gtk.Window):
self.resize(self.w, self.h)
self.set_accept_focus(False)
self.set_sensitive(False)
+ self.set_opacity(fill_alpha)
- # Create SVG with given parameters.
- offset = stroke_width/2.0
- self.svg = string.Template(self._svg).substitute(
- x=offset, y=offset,
- width=int(self.w - stroke_width), height=int(self.h - stroke_width),
- fill=fill_color,
- stroke_width=stroke_width,
- stroke=stroke_color,
- fill_opacity=fill_alpha,
- stroke_opacity=stroke_alpha)
+# # Create SVG with given parameters.
+# offset = stroke_width/2.0
+# self.svg = string.Template(self._svg).substitute(
+# x=offset, y=offset,
+# width=int(self.w - stroke_width), height=int(self.h - stroke_width),
+# fill=fill_color,
+# stroke_width=stroke_width,
+# stroke=stroke_color,
+# fill_opacity=fill_alpha,
+# stroke_opacity=stroke_alpha)
- # Connect "expose" event.
- self.connect("expose-event", self._onExpose)
+ da = gtk.DrawingArea()
+ # Connect "draw"
+ da.connect("draw", self._onExpose)
+ self.add(da)
+ self.show_all()
def highlight(self, duration=500):
if duration > 0:
- gobject.timeout_add(duration, lambda w: w.destroy(), self)
+ GObject.timeout_add(duration, lambda w: w.destroy(), self)
self.show_all()
else:
self.destroy()
def _onExpose(self, widget, event):
- svgh = rsvg.Handle()
- try:
- svgh.write(self.svg)
- except (gobject.GError, KeyError, ValueError), ex:
- print 'Error reading SVG for display: %s\r\n%s', ex, self.svg
- svgh.close()
- return
- svgh.close()
-
- if not self._composited:
+ window = widget.get_window()
+ cr = window.cairo_create()
+
+ if not self.is_composited():
# Draw the screengrab of the underlaying window, and set the drawing
# operator to OVER.
self.window.draw_image(self.style.black_gc, self.root,
@@ -269,13 +261,116 @@ class _HighLight(gtk.Window):
cairo_operator = cairo.OPERATOR_OVER
else:
cairo_operator = cairo.OPERATOR_SOURCE
- cr = self.window.cairo_create()
- cr.set_source_rgba(1.0, 1.0, 1.0, 0.0)
cr.set_operator(cairo_operator)
+
+ color = gdk.color_parse(self.fill_color)
+
+ #TODO: look for for set_source_rgb and Gdk.Color issues
+ cr.set_source_rgb(color.red, color.green, color.blue)
cr.paint()
- svgh.render_cairo( cr )
- del svgh
+
+#class _HighLight(gtk.Window):
+# '''
+# Highlight box class. Uses compositing when available. When not, it does
+# transparency client-side.
+# '''
+# _svg = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+#<svg xmlns="http://www.w3.org/2000/svg">
+# <rect
+# style="fill:$fill;fill-opacity:$fill_opacity;fill-rule:evenodd;stroke:$stroke;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:$stroke_opacity"
+# id="highlight"
+# width="$width"
+# height="$height"
+# x="$x"
+# y="$y"
+# rx="2"
+# ry="2" />
+#</svg>
+#"""
+# def __init__(self, x, y, w, h,
+# fill_color, fill_alpha,
+# stroke_color, stroke_alpha,
+# stroke_width, padding=0):
+#
+# # Initialize window.
+# #gtk.Window.__init__(self, gtk.WindowType.POPUP)
+# gtk.Window.__init__(self)
+#
+# # Normalize position for stroke and padding.
+# self.x, self.y = x - padding, y - padding
+# self.w, self.h = w + padding*2, h + padding*2
+#
+# # Determine if we are compositing.
+# self._composited = self.is_composited()
+# if self._composited:
+# # Prepare window for transparency.
+# screen = self.get_screen()
+# visual = screen.get_rgba_visual()
+# self.set_visual(visual)
+# else:
+# # Take a screenshot for compositing on the client side.
+# self.root = gdk.get_default_root_window().get_image(
+# self.x, self.y, self.w, self.h)
+#
+# # Place window, and resize it, and set proper properties.
+# self.set_app_paintable(True)
+# self.set_decorated(False)
+# self.set_keep_above(True)
+# self.move(self.x, self.y)
+# self.resize(self.w, self.h)
+# self.set_accept_focus(False)
+# self.set_sensitive(False)
+#
+# # Create SVG with given parameters.
+# offset = stroke_width/2.0
+# self.svg = string.Template(self._svg).substitute(
+# x=offset, y=offset,
+# width=int(self.w - stroke_width), height=int(self.h - stroke_width),
+# fill=fill_color,
+# stroke_width=stroke_width,
+# stroke=stroke_color,
+# fill_opacity=fill_alpha,
+# stroke_opacity=stroke_alpha)
+#
+# # Connect "draw"
+# self.connect("draw", self._onExpose)
+#
+# def highlight(self, duration=500):
+# if duration > 0:
+# GObject.timeout_add(duration, lambda w: w.destroy(), self)
+# self.show_all()
+# else:
+# self.destroy()
+#
+# def _onExpose(self, widget, event):
+# svgh = rsvg.Handle()
+# try:
+# svgh.write(self.svg)
+# except (GObject.GError, KeyError, ValueError), ex:
+# print 'Error reading SVG for display: %s\r\n%s', ex, self.svg
+# svgh.close()
+# return
+# svgh.close()
+#
+# if not self._composited:
+# # Draw the screengrab of the underlaying window, and set the drawing
+# # operator to OVER.
+# self.window.draw_image(self.style.black_gc, self.root,
+# event.area.x,event.area.y,
+# event.area.x, event.area.y,
+# event.area.width, event.area.height)
+# cairo_operator = cairo.OPERATOR_OVER
+# else:
+# cairo_operator = cairo.OPERATOR_SOURCE
+# window = self.get_window()
+# cr = window.cairo_create()
+# cr.set_source_rgba(1.0, 1.0, 1.0, 0.0)
+# cr.set_operator(cairo_operator)
+# cr.paint()
+#
+# svgh.render_cairo( cr )
+# del svgh
if __name__ == "__main__":
hl = _HighLight(200, 200, 200, 200, '#ff0000',
diff --git a/src/lib/accerciser/plugin/base_plugin.py b/src/lib/accerciser/plugin/base_plugin.py
index 760f405..a13784e 100644
--- a/src/lib/accerciser/plugin/base_plugin.py
+++ b/src/lib/accerciser/plugin/base_plugin.py
@@ -11,10 +11,11 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
+import gi
+
+from gi.repository import Gtk as gtk
from accerciser.tools import Tools
import traceback
-import gobject, pango
class Plugin(Tools):
'''
@@ -207,10 +208,10 @@ class ViewportPlugin(Plugin, gtk.ScrolledWindow):
Plugin.__init__(self, node, message_manager)
gtk.ScrolledWindow.__init__(self)
- self.set_policy(gtk.POLICY_AUTOMATIC,
- gtk.POLICY_AUTOMATIC)
+ self.set_policy(gtk.PolicyType.AUTOMATIC,
+ gtk.PolicyType.AUTOMATIC)
self.set_border_width(3)
- self.set_shadow_type(gtk.SHADOW_NONE)
+ self.set_shadow_type(gtk.ShadowType.NONE)
self.viewport = gtk.Viewport()
vbox = gtk.VBox()
self.viewport.add(vbox)
@@ -218,12 +219,12 @@ class ViewportPlugin(Plugin, gtk.ScrolledWindow):
self.add(self.viewport)
# Message area
self.message_area = gtk.VBox()
- vbox.pack_start(self.message_area, False, False)
+ vbox.pack_start(self.message_area, False, False, 0)
# Plugin area
self.plugin_area = gtk.Frame()
- self.plugin_area.set_shadow_type(gtk.SHADOW_NONE)
- vbox.pack_start(self.plugin_area)
+ self.plugin_area.set_shadow_type(gtk.ShadowType.NONE)
+ vbox.pack_start(self.plugin_area, True, True, 0)
def _onScrollToFocus(self, container, widget):
'''
@@ -237,18 +238,19 @@ class ViewportPlugin(Plugin, gtk.ScrolledWindow):
if widget is None: return
child = widget
while isinstance(child, gtk.Container) and \
- child.focus_child is not None:
- child = child.focus_child
+ child.get_focus_child() is not None:
+ child = child.get_focus_child()
x, y = child.translate_coordinates(self.viewport, 0, 0)
- w, h = child.allocation.width, child.allocation.height
- vw, vh = self.viewport.allocation.width, self.viewport.allocation.height
+ w, h = child.get_allocation().width, child.get_allocation().height
+ vw, vh = self.viewport.get_allocation().width, self.viewport.get_allocation().height
adj = self.viewport.get_vadjustment()
if y+h > vh:
- adj.value += min((y+h) - vh + 2, y)
+ value = adj.get_value() + min((y+h) - vh + 2, y)
+ adj.set_value(value)
elif y < 0:
- adj.value = max(adj.value + y - 2, adj.lower)
+ adj.set_value(max(adj.get_value() + y - 2, adj.get_lower()))
def _onMessageResponse(self, error_message, response_id):
'''
@@ -259,9 +261,9 @@ class ViewportPlugin(Plugin, gtk.ScrolledWindow):
@param response_id: response ID
@type response_id: integer
'''
- if response_id == gtk.RESPONSE_APPLY:
+ if response_id == gtk.ResponseType.APPLY:
pass
- elif response_id == gtk.RESPONSE_CLOSE:
+ elif response_id == gtk.ResponseType.CLOSE:
error_message.destroy()
class ConsolePlugin(ViewportPlugin):
diff --git a/src/lib/accerciser/plugin/message.py b/src/lib/accerciser/plugin/message.py
index 5343caf..c8dd434 100644
--- a/src/lib/accerciser/plugin/message.py
+++ b/src/lib/accerciser/plugin/message.py
@@ -11,10 +11,15 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk, gobject, pango
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import GObject
+from gi.repository import Pango
+
from accerciser.i18n import _
-class MessageManager(gobject.GObject):
+class MessageManager(GObject.GObject):
'''
Centralizes all plugin message handling. If the plugin is a visible widget,
it displays the message within the plugin. If not it displays the message in
@@ -24,21 +29,21 @@ class MessageManager(gobject.GObject):
responses to messages.
'''
__gsignals__ = {'plugin-reload-request' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_PYOBJECT,
- gobject.TYPE_PYOBJECT)),
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_PYOBJECT,
+ GObject.TYPE_PYOBJECT)),
'module-reload-request' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_PYOBJECT,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING))}
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_PYOBJECT,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING))}
def __init__(self):
'''
Initialize the manager.
'''
- gobject.GObject.__init__(self)
+ GObject.GObject.__init__(self)
self.message_tab = None
def getMessageTab(self):
@@ -74,7 +79,7 @@ class MessageManager(gobject.GObject):
message = PluginErrorMessage(error_message, details)
message.connect('response', self._onPluginResponseRefresh, plugin_class)
if getattr(plugin_instance, 'parent', None):
- plugin_instance.message_area.pack_start(message)
+ plugin_instance.message_area.pack_start(message, True, True, 0)
message.show_all()
else:
self.message_tab.addMessage(message)
@@ -92,7 +97,7 @@ class MessageManager(gobject.GObject):
@param plugin_class: The plugin class of the failed plugin.
@type plugin_class: type
'''
- if response_id == gtk.RESPONSE_APPLY:
+ if response_id == gtk.ResponseType.APPLY:
self.emit('plugin-reload-request', message, plugin_class)
def newModuleError(self, module, path, error_message, details):
@@ -132,7 +137,7 @@ class MessageManager(gobject.GObject):
@param path: Failed module's path.
@type path: string
'''
- if response_id == gtk.RESPONSE_APPLY:
+ if response_id == gtk.ResponseType.APPLY:
self.emit('module-reload-request', message, module, path)
class MessageTab(gtk.ScrolledWindow):
@@ -158,7 +163,7 @@ class MessageManager(gobject.GObject):
@param message: The message to be added.
@type message: L{PluginMessage}
'''
- self._vbox.pack_start(message, False)
+ self._vbox.pack_start(message, False, True, 0)
self.show()
self._vbox.show_all()
@@ -197,9 +202,9 @@ class PluginMessage(gtk.Frame):
@type message_style: gtk.Style
'''
__gsignals__ = {'response' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_INT,))}
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_INT,))}
def __init__(self):
'''
Initialize the message object.
@@ -214,14 +219,15 @@ class PluginMessage(gtk.Frame):
w = gtk.Window()
w.set_name('gtk-tooltip')
w.ensure_style()
- self.message_style = w.rc_get_style()
+ #self.message_style = w.rc_get_style()
+ self.message_style = gtk.rc_get_style(w)
event_box = gtk.EventBox()
event_box.set_style(self.message_style)
self.add(event_box)
hbox = gtk.HBox()
event_box.add(hbox)
- hbox.pack_start(self.vbox, padding=3)
+ hbox.pack_start(self.vbox, True, True, 3)
hbox.pack_start(self.action_area, False, False, 3)
def add_button(self, button_text, response_id):
@@ -240,7 +246,7 @@ class PluginMessage(gtk.Frame):
button.set_use_stock(True)
button.set_label(button_text)
button.connect('clicked', self._onActionActivated, response_id)
- self.action_area.pack_start(button, False, False)
+ self.action_area.pack_start(button, False, False, 0)
return button
def _onActionActivated(self, button, response_id):
@@ -270,22 +276,22 @@ class PluginErrorMessage(PluginMessage):
PluginMessage.__init__(self)
hbox = gtk.HBox()
hbox.set_spacing(6)
- self.vbox.pack_start(hbox, False, False)
+ self.vbox.pack_start(hbox, False, False, 0)
image = gtk.Image()
image.set_from_stock(gtk.STOCK_DIALOG_WARNING,
- gtk.ICON_SIZE_SMALL_TOOLBAR)
- hbox.pack_start(image, False, False)
+ gtk.IconSize.SMALL_TOOLBAR)
+ hbox.pack_start(image, False, False, 0)
label = gtk.Label()
- label.set_ellipsize(pango.ELLIPSIZE_END)
+ label.set_ellipsize(Pango.EllipsizeMode.END)
label.set_selectable(True)
label.set_markup('<b>%s</b>' % error_message)
- hbox.pack_start(label)
+ hbox.pack_start(label, True, True, 0)
label = gtk.Label(details)
- label.set_ellipsize(pango.ELLIPSIZE_END)
+ label.set_ellipsize(Pango.EllipsizeMode.END)
label.set_selectable(True)
self.vbox.add(label)
- self.add_button(gtk.STOCK_CLEAR, gtk.RESPONSE_CLOSE)
- self.add_button(gtk.STOCK_REFRESH, gtk.RESPONSE_APPLY)
+ self.add_button(gtk.STOCK_CLEAR, gtk.ResponseType.CLOSE)
+ self.add_button(gtk.STOCK_REFRESH, gtk.ResponseType.APPLY)
self.connect('response', self._onResponse)
def _onResponse(self, plugin_message, response_id):
@@ -297,5 +303,5 @@ class PluginErrorMessage(PluginMessage):
@param response_id: The response ID
@type response_id: integer
'''
- if response_id == gtk.RESPONSE_CLOSE:
+ if response_id == gtk.ResponseType.CLOSE:
plugin_message.destroy()
diff --git a/src/lib/accerciser/plugin/plugin_manager.py b/src/lib/accerciser/plugin/plugin_manager.py
index 8b62135..bbd5470 100644
--- a/src/lib/accerciser/plugin/plugin_manager.py
+++ b/src/lib/accerciser/plugin/plugin_manager.py
@@ -11,8 +11,11 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
-import gobject
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import GConf as gconf
+
from base_plugin import Plugin
from view import ViewManager
from accerciser.tools import Tools, GConfListWrapper, getTreePathBoundingBox
@@ -21,7 +24,6 @@ import os
import sys
import imp
import traceback
-import gconf
from accerciser.i18n import _, N_, C_
GCONF_PLUGIN_DISABLED = '/apps/accerciser/disabled_plugins'
@@ -92,6 +94,7 @@ class PluginManager(gtk.ListStore, Tools):
'''
Load all plugins in global and local plugin paths.
'''
+ # AQUI PETAA
for plugin_dir, plugin_fn in self._getPluginFiles():
self._loadPluginFile(plugin_dir, plugin_fn)
self.view_manager.initialView()
@@ -162,14 +165,15 @@ class PluginManager(gtk.ListStore, Tools):
continue
if is_plugin:
self.handler_block(self._row_changed_handler)
- iter = self.append([None, plugin_locals[symbol], plugin_dir])
+
+ iter_id = self.append([None, plugin_locals[symbol], plugin_dir])
self.handler_unblock(self._row_changed_handler)
# if a plugin class is found, initialize
enabled = plugin_locals[symbol].plugin_name not in \
GConfListWrapper(GCONF_PLUGIN_DISABLED)
if enabled:
- self._enablePlugin(iter)
- self.row_changed(self.get_path(iter), iter)
+ self._enablePlugin(iter_id)
+ self.row_changed(self.get_path(iter_id), iter_id)
def _enablePlugin(self, iter):
'''
@@ -218,7 +222,8 @@ class PluginManager(gtk.ListStore, Tools):
if isinstance(plugin_instance, gtk.Widget):
plugin_instance.destroy()
plugin_instance._close()
- self[iter][self.COL_INSTANCE] = None
+
+ self[iter][self.COL_INSTANCE] = False
def _reloadPlugin(self, iter):
'''
@@ -300,7 +305,7 @@ class PluginManager(gtk.ListStore, Tools):
self._disablePlugin(iter)
else:
self._reloadPlugin(iter)
-
+
def _onPluginRowChanged(self, model, path, iter):
'''
Callback for model row changes. Persists plugins state (enabled/disabled)
@@ -359,10 +364,10 @@ class PluginManager(gtk.ListStore, Tools):
self.connect('popup-menu', self._onPopupMenu)
crc = gtk.CellRendererToggle()
- crc.connect('toggled', self._onPluginToggled)
tvc = gtk.TreeViewColumn()
tvc.pack_start(crc, True)
tvc.set_cell_data_func(crc, self._pluginStateDataFunc)
+ crc.connect('toggled', self._onPluginToggled)
self.append_column(tvc)
crt = gtk.CellRendererText()
@@ -433,7 +438,7 @@ class PluginManager(gtk.ListStore, Tools):
menu = self.view_manager.Menu(plugin, self.get_toplevel())
menu.popup(None, None, pos_func, button, time, data)
- def _viewNameDataFunc(self, column, cell, model, iter):
+ def _viewNameDataFunc(self, column, cell, model, iter, foo=None):
'''
Function for determining the displayed data in the tree's view column.
@@ -456,7 +461,7 @@ class PluginManager(gtk.ListStore, Tools):
cell.set_property('sensitive', False)
cell.set_property('text', _(view_name))
- def _pluginNameDataFunc(self, column, cell, model, iter):
+ def _pluginNameDataFunc(self, column, cell, model, iter, foo=None):
'''
Function for determining the displayed data in the tree's plugin column.
@@ -473,7 +478,7 @@ class PluginManager(gtk.ListStore, Tools):
cell.set_property('text', plugin_class.plugin_name_localized or \
plugin_class.plugin_name)
- def _pluginStateDataFunc(self, column, cell, model, iter):
+ def _pluginStateDataFunc(self, column, cell, model, iter, foo=None):
'''
Function for determining the displayed state of the plugin's checkbox.
diff --git a/src/lib/accerciser/plugin/view.py b/src/lib/accerciser/plugin/view.py
index 78dab48..808c811 100644
--- a/src/lib/accerciser/plugin/view.py
+++ b/src/lib/accerciser/plugin/view.py
@@ -10,9 +10,11 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import GConf as gconf
+from gi.repository import GObject
-import gtk
-import gobject
from base_plugin import Plugin
from accerciser.tools import *
from message import MessageManager
@@ -20,7 +22,7 @@ import os
import sys
import imp
from accerciser.i18n import _, N_
-import gconf, gc
+import gc
from accerciser import ui_manager
GCONF_PLUGINVIEWS = '/apps/accerciser/pluginviews'
@@ -35,24 +37,24 @@ class PluginView(gtk.Notebook):
@cvar TARGET_ROOTWIN: Drag and drop target ID for root window.
@type TARGET_ROOTWIN: integer
@ivar NOTEBOOK_GROUP: Group ID for detachable tabs.
- @type NOTEBOOK_GROUP: integer
+ @type NOTEBOOK_GROUP: string
@ivar view_name: Name of view.
@type view_name: string
'''
__gsignals__ = {'plugin_drag_end' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_OBJECT,)),
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_OBJECT,)),
'tab_popup_menu' :
- (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_PYOBJECT,
- gobject.TYPE_OBJECT))}
+ (GObject.SignalFlags.RUN_FIRST,
+ None,
+ (GObject.TYPE_PYOBJECT,
+ GObject.TYPE_OBJECT))}
TARGET_PLUGINVIEW = 0
TARGET_ROOTWIN = 1
- NOTEBOOK_GROUP = 1
+ NOTEBOOK_GROUP = 'NOTEBOOK_GROUP'
def __init__(self, view_name):
'''
@@ -64,9 +66,9 @@ class PluginView(gtk.Notebook):
gtk.Notebook.__init__(self)
self.view_name = view_name
self.set_scrollable(True)
- self.set_group_id(self.NOTEBOOK_GROUP)
- self.connect('drag_end', self._onDragEnd)
- self.connect('drag_data_get', self._onDragDataGet)
+ self.set_group_name(self.NOTEBOOK_GROUP)
+ self.connect('drag-end', self._onDragEnd)
+ self.connect('drag-data-get', self._onDragDataGet)
self.connect('key-press-event', self._onKeyPress)
self.connect('button-press-event', self._onButtonPress)
@@ -94,7 +96,7 @@ class PluginView(gtk.Notebook):
@param event: Event object.
@type event: gtk.dk.Event
'''
- if event.keyval == gtk.keysyms.Menu and \
+ if event.keyval == gdk.KEY_Menu and \
self.get_property('has-focus'):
page_num = self.get_current_page()
child = self.get_nth_page(page_num)
@@ -115,7 +117,8 @@ class PluginView(gtk.Notebook):
'''
for child in self.getPlugins():
tab = self.get_tab_label(child)
- if tab != None and tab.flags() & gtk.MAPPED:
+ # TODO-JH: Don't really know if this is correct
+ if tab != None and tab.get_state_flags() & tab.get_mapped():
x, y, w, h = self.getTabAlloc(tab)
if event_x >= x and \
event_x <= x + w and \
@@ -134,10 +137,14 @@ class PluginView(gtk.Notebook):
@return: X, Y, width any height coordinates.
@rtype: tuple
'''
- gdk_window = widget.window
- origin_x, origin_y = gdk_window.get_origin()
- x, y, width, height = widget.get_allocation()
- if widget.flags() & gtk.NO_WINDOW:
+ gdk_window = widget.get_window()
+ origin_z, origin_x, origin_y = gdk_window.get_origin()
+ alloc = widget.get_allocation()
+ x, y, width, height = \
+ alloc.x, alloc.y, alloc.width, alloc.height
+ # TODO-JH: Review this conversion
+ has_window = not(widget.get_has_window())
+ if bool(widget.get_state_flags().value_names) & has_window:
origin_x += x
origin_y += y
return origin_x, origin_y, width, height
@@ -158,7 +165,7 @@ class PluginView(gtk.Notebook):
@type time: float
'''
self.dest_type = info
- selection_data.set(selection_data.target, 8, '')
+ selection_data.set(selection_data.get_target(), 8, '')
def _onDragEnd(self, widget, drag_context):
'''
@@ -203,9 +210,9 @@ class PluginView(gtk.Notebook):
name = tab_label
elif isinstance(child, Plugin):
name = getattr(child,'plugin_name_localized', None) or child.plugin_name
- elif child.name:
- name = child.name
- gtk.Notebook.append_page(self, child)
+ elif child.get_name():
+ name = child.get_name()
+ gtk.Notebook.append_page(self, child, None)
gtk.Notebook.reorder_child(self, child, position)
gtk.Notebook.set_tab_label(self, child, gtk.Label(name))
@@ -278,7 +285,7 @@ class PluginViewWindow(gtk.Window, Tools):
self.plugin_view = PluginView(view_name)
self.add(self.plugin_view)
- cl = gconf.client_get_default()
+ cl = gconf.Client.get_default()
escaped_view_name = '/%s' % gconf.escape_key(view_name, len(view_name))
width = cl.get_int(GCONF_PLUGINVIEWS+escaped_view_name+'/width') or 480
height = cl.get_int(GCONF_PLUGINVIEWS+escaped_view_name+'/height') or 480
@@ -286,7 +293,7 @@ class PluginViewWindow(gtk.Window, Tools):
self.connect('key_press_event', self._onKeyPress)
self.plugin_view.connect_after('page_removed', self._onPluginRemoved)
self.set_title(view_name)
- self.set_position(gtk.WIN_POS_MOUSE)
+ self.set_position(gtk.WindowPosition.MOUSE)
self.show_all()
self.connect('size-allocate', self._onResize)
@@ -304,9 +311,9 @@ class PluginViewWindow(gtk.Window, Tools):
key_prefix = '%s/%s' % \
(GCONF_PLUGINVIEWS,
gconf.escape_key(view_name, len(view_name)))
- cl = gconf.client_get_default()
- cl.set_int(key_prefix+'/width', self.allocation.width)
- cl.set_int(key_prefix+'/height', self.allocation.height)
+ cl = gconf.Client.get_default()
+ cl.set_int(key_prefix+'/width', self.get_allocated_width())
+ cl.set_int(key_prefix+'/height', self.get_allocated_height())
def _onPluginRemoved(self, pluginview, page, page_num):
'''
@@ -332,10 +339,10 @@ class PluginViewWindow(gtk.Window, Tools):
@param event: Event object
@type event: gtk.gdk.Event
'''
- if event.state & gtk.gdk.MOD1_MASK and \
- event.keyval in xrange(gtk.gdk.keyval_from_name('0'),
- gtk.gdk.keyval_from_name('9')):
- tab_num = event.keyval - gtk.gdk.keyval_from_name('0') or 10
+ if event.state & gdk.ModifierType.MOD1_MASK and \
+ event.keyval in xrange(gdk.keyval_from_name('0'),
+ gdk.keyval_from_name('9')):
+ tab_num = event.keyval - gdk.keyval_from_name('0') or 10
pages_count = self.plugin_view.get_n_pages()
if pages_count >= tab_num:
self.plugin_view.focusTab(tab_num - 1)
@@ -353,7 +360,7 @@ class ViewManager(object):
@type perm_views: list of {PluginView}
'''
self._perm_views = perm_views
- cl = gconf.client_get_default()
+ cl = gconf.Client.get_default()
single = cl.get_bool(GCONF_LAYOUT_SINGLE)
self._initViewModel(single)
self._setupActions()
@@ -374,10 +381,10 @@ class ViewManager(object):
action_name = action.get_name()
ui_manager.uimanager.add_ui(merge_id, ui_manager.PLUGIN_LAYOUT_PATH,
action_name, action_name,
- gtk.UI_MANAGER_MENUITEM, True)
+ gtk.UIManagerItemType.MENUITEM, True)
- def _onSingleViewToggled(self, action):
+ def _onSingleViewToggled(self, action, data=None):
'''
Callback for single view toggle action.
@@ -395,14 +402,14 @@ class ViewManager(object):
'''
if isinstance(self._view_model, SingleViewModel) == single:
return
- cl = gconf.client_get_default()
+ cl = gconf.Client.get_default()
cl.set_bool(GCONF_LAYOUT_SINGLE, single)
plugins = self._view_model.getViewedPlugins()
self._view_model.close()
del self._view_model
for plugin in plugins:
- if plugin.parent:
- plugin.parent.remove(plugin)
+ if plugin.get_parent():
+ plugin.get_parent().remove(plugin)
self._initViewModel(single)
for plugin in plugins:
self._view_model.addElement(plugin)
@@ -821,14 +828,14 @@ class MultiViewModel(list, BaseViewModel):
'''
menu = self.Menu(plugin, view.get_toplevel())
if hasattr(event, 'button'):
- menu.popup(None, None, None, event.button, event.time)
+ menu.popup(None, None, None, None, event.button, event.time)
else:
tab = view.get_tab_label(plugin)
x, y, w, h = view.getTabAlloc(tab)
- rect = gtk.gdk.Rectangle(x, y, w, h)
+ rect = gdk.Rectangle(x, y, w, h)
menu.popup(None, None,
lambda m, r: (r.x+r.width/2, r.y+r.height/2, True),
- 0, event.time, rect)
+ rect, 0, event.time)
def _connectSignals(self, view):
'''
@@ -837,8 +844,8 @@ class MultiViewModel(list, BaseViewModel):
@param view: Plugin view to connect.
@type view: :{PluginView}
'''
- if isinstance(view.parent, PluginViewWindow):
- view.parent.connect('delete_event', Proxy(self._onViewDelete))
+ if isinstance(view.get_parent(), PluginViewWindow):
+ view.get_parent().connect('delete_event', Proxy(self._onViewDelete))
view.connect('plugin_drag_end', Proxy(self._onPluginDragEnd))
view.connect('tab_popup_menu', Proxy(self._onTabPopupMenu))
view.connect('page_added', Proxy(self._onViewLayoutChanged), 'added')
@@ -953,7 +960,7 @@ class MultiViewModel(list, BaseViewModel):
@type new_view_name: string
'''
if not plugin or not isinstance(plugin, gtk.Widget): return
- old_view = plugin.parent
+ old_view = plugin.get_parent()
new_view = self._getViewOrNewView(new_view_name)
if old_view is not new_view:
old_view.remove(plugin)
@@ -1018,16 +1025,17 @@ class MultiViewModel(list, BaseViewModel):
'''
menu_item = None
for view in self.view_manager:
- menu_item = gtk.RadioMenuItem(menu_item, view.view_name)
+ menu_item = gtk.RadioMenuItem(label = view.view_name)
+ menu_item.set_name(view.view_name)
menu_item.connect('toggled', self._onItemToggled, view, context_plugin)
- menu_item.set_active(view == context_plugin.parent)
+ menu_item.set_active(view == context_plugin.get_parent())
self.append(menu_item)
menu_item.show()
menu_item = gtk.SeparatorMenuItem()
self.append(menu_item)
menu_item.show()
- menu_item = gtk.MenuItem(_('<i>_New view...</i>'))
- menu_item.child.set_use_markup(True)
+ menu_item = gtk.MenuItem(label=_('<i>_New view...</i>'))
+ menu_item.get_child().set_use_markup(True)
menu_item.connect('activate', self._onItemActivated,
context_plugin, transient_window)
self.append(menu_item)
@@ -1063,7 +1071,7 @@ class MultiViewModel(list, BaseViewModel):
self._NewViewDialog(self.view_manager, transient_window)
response_id = new_view_dialog.run()
plugin_name = new_view_dialog.getEntryText()
- if response_id == gtk.RESPONSE_OK and plugin_name:
+ if response_id == gtk.ResponseType.OK and plugin_name:
self.view_manager.changeView(context_plugin, plugin_name)
new_view_dialog.destroy()
@@ -1083,9 +1091,9 @@ class MultiViewModel(list, BaseViewModel):
'''
self.view_manager = view_manager
gtk.Dialog.__init__(self, _('New View...'), transient_window)
- self.add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK,
- gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
- self.set_default_response(gtk.RESPONSE_OK)
+ self.add_buttons(gtk.STOCK_OK, gtk.ResponseType.OK,
+ gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE)
+ self.set_default_response(gtk.ResponseType.OK)
completion = gtk.EntryCompletion()
complete_model = gtk.ListStore(str)
for view in self.view_manager:
@@ -1095,6 +1103,7 @@ class MultiViewModel(list, BaseViewModel):
self.entry = gtk.Entry()
self.entry.set_completion(completion)
self.entry.connect('activate', self._onEntryActivate)
+ self.vbox = self.get_children()[0]
self.vbox.add(self.entry)
self.entry.show()
@@ -1114,7 +1123,7 @@ class MultiViewModel(list, BaseViewModel):
@param entry: Entry box that was activated.
@type entry: gtk.Entry
'''
- self.response(gtk.RESPONSE_OK)
+ self.response(gtk.ResponseType.OK)
class _StoredViewsLayout(object):
'''
@@ -1122,7 +1131,7 @@ class MultiViewModel(list, BaseViewModel):
view layout lists.
'''
def __init__(self):
- self.gconf_client = gconf.client_get_default()
+ self.gconf_client = gconf.Client.get_default()
def __len__(self):
view_dirs = self.gconf_client.all_dirs(GCONF_PLUGINVIEWS)
return len(view_dirs)
@@ -1136,7 +1145,7 @@ class MultiViewModel(list, BaseViewModel):
def __setitem__(self, key, value):
gconf_key = '%s/%s/layout' % \
(GCONF_PLUGINVIEWS, gconf.escape_key(key, len(key)))
- self.gconf_client.set_list(gconf_key, gconf.VALUE_STRING, value)
+ self.gconf_client.set_list(gconf_key, gconf.ValueType.STRING, value)
def __iter__(self):
view_dirs = self.gconf_client.all_dirs(GCONF_PLUGINVIEWS)
for dir in view_dirs:
diff --git a/src/lib/accerciser/prefs_dialog.py b/src/lib/accerciser/prefs_dialog.py
index cc39ca0..44c936a 100644
--- a/src/lib/accerciser/prefs_dialog.py
+++ b/src/lib/accerciser/prefs_dialog.py
@@ -11,10 +11,14 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
+import gi
+
+from gi.repository import Gtk as gtk
+from gi.repository import Gdk as gdk
+from gi.repository import Atk as atk
+from gi.repository import GConf as gconf
+
from i18n import _
-import atk
-import gconf
import node
from tools import parseColorString
@@ -32,17 +36,19 @@ class AccerciserPreferencesDialog(gtk.Dialog):
@type hotkeys_view: L{HotkeyTreeView}
'''
gtk.Dialog.__init__(self, _('accerciser Preferences'),
- buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ buttons=(gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE))
self.connect('response', self._onResponse)
self.set_default_size(500,250)
notebook = gtk.Notebook()
- self.vbox.add(notebook)
+ vbox = self.get_children()[0]
+ vbox.add(notebook)
for view, section in [(plugins_view, _('Plugins')),
(hotkeys_view, _('Global Hotkeys'))]:
if view is not None:
sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_IN)
- sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ sw.set_shadow_type(gtk.ShadowType.IN)
+ sw.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
+ sw.set_size_request(500, 150)
sw.add(view)
notebook.append_page(sw, gtk.Label(section))
@@ -66,7 +72,7 @@ class _HighlighterView(gtk.Alignment):
def __init__(self):
gtk.Alignment.__init__(self)
self.set_padding(12, 12, 18, 12)
- self.gconf_cl = gconf.client_get_default()
+ self.gconf_cl = gconf.Client.get_default()
self._buildUI()
def _buildUI(self):
@@ -97,13 +103,13 @@ class _HighlighterView(gtk.Alignment):
for label, control, row in zip(labels, controls, range(3)):
label.set_alignment(0, 0.5)
- table.attach(label, 0, 1, row, row + 1, gtk.FILL)
- table.attach(control, 1, 2, row, row + 1, gtk.FILL)
+ table.attach(label, 0, 1, row, row + 1, gtk.AttachOptions.FILL)
+ table.attach(control, 1, 2, row, row + 1, gtk.AttachOptions.FILL)
for label, control in zip(map(lambda x: x.get_accessible(),labels),
map(lambda x: x.get_accessible(),controls)):
- label.add_relationship(atk.RELATION_LABEL_FOR, control)
- control.add_relationship(atk.RELATION_LABELLED_BY, label)
+ label.add_relationship(atk.RelationType.LABEL_FOR, control)
+ control.add_relationship(atk.RelationType.LABELLED_BY, label)
def _onDurationChanged(self, spin_button):
'''
@@ -143,9 +149,11 @@ class _HighlighterView(gtk.Alignment):
ColorButton derivative with useful methods for us.
'''
def __init__(self, color, alpha):
- gtk.ColorButton.__init__(self, gtk.gdk.color_parse(color))
+ color = gdk.color_parse(color)
+ gtk.ColorButton.__init__(self)
self.set_use_alpha(True)
self.set_alpha(int(alpha*0xffff))
+ self.set_color(color)
def get_rgba_string(self):
'''
diff --git a/src/lib/accerciser/script_playback.py b/src/lib/accerciser/script_playback.py
index 4a30154..66f67e1 100644
--- a/src/lib/accerciser/script_playback.py
+++ b/src/lib/accerciser/script_playback.py
@@ -1,6 +1,9 @@
+import gi
+
+from gi.repository import Wnck as wnck
+
import sys
from time import sleep, time
-import wnck
import gobject, gtk
from re import split
import pyatspi
@@ -44,7 +47,7 @@ keySymAliases = {
class _WindowManager:
def __init__(self):
self.loop = None
- self.screen = wnck.screen_get_default()
+ self.screen = wnck.Screen.get_default()
def getApp(self, app_name):
self.loop = gobject.MainLoop()
self.returned_app = None
diff --git a/src/lib/accerciser/tools.py b/src/lib/accerciser/tools.py
index d1877f6..f119f42 100644
--- a/src/lib/accerciser/tools.py
+++ b/src/lib/accerciser/tools.py
@@ -10,11 +10,12 @@ All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
+from gi.repository import GConf as gconf
+
import os
import pickle
import weakref
import new
-import gconf
class Tools(object):
'''
@@ -87,6 +88,9 @@ class GConfListWrapper(object):
return self._wrap('__setslice__', i, j, sequence)
def __delslice__(self, i, j):
return self._wrap('__delslice__', i, j)
+ def __contains__(self, i):
+ l = [x.type for x in self]#if x.type == gconf.ValueType.STRING]
+ return self.wrapped_list.__contains__(i)
def _wrap(self, name, *args, **kwargs):
obj = self._CallWrapper(name, self.gconf_key)
return obj(*args, **kwargs)
@@ -105,12 +109,11 @@ class GConfListWrapper(object):
self.name = name
self.gconf_key = gconf_key
def __call__(self, *args, **kwargs):
- cl = gconf.client_get_default()
- l = cl.get_list(self.gconf_key,
- gconf.VALUE_STRING)
+ cl = gconf.Client.get_default()
+ gcval = cl.get(self.gconf_key)
+ l = gcval.get_list()
rv = getattr(l, self.name)(*args, **kwargs)
- cl.set_list(self.gconf_key,
- gconf.VALUE_STRING, l)
+ cl.set_list(self.gconf_key, gconf.ValueType.STRING, l)
return rv
class Proxy(object):
diff --git a/src/lib/accerciser/ui_manager.py b/src/lib/accerciser/ui_manager.py
index 985a6a3..4c68259 100644
--- a/src/lib/accerciser/ui_manager.py
+++ b/src/lib/accerciser/ui_manager.py
@@ -11,7 +11,10 @@ available under the terms of the BSD which accompanies this distribution, and
is available at U{http://www.opensource.org/licenses/bsd-license.php}
'''
-import gtk
+import gi
+
+from gi.repository import Gtk as gtk
+
from i18n import _, N_, C_
menu_actions = gtk.ActionGroup('MenuActions')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]