Commit 48b8c06d authored by Javier Hernández's avatar Javier Hernández

Merge branch 'pygi' into master

parent 060c651d
......@@ -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:
......
......@@ -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:
......
......@@ -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(),
......
......@@ -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)
......
......@@ -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())
......
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:
......
......@@ -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
......
......@@ -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:
......
......@@ -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: