[accerciser] Addressing some PyGObject initializer deprecations
- From: Javier Hernández Antúnez <jhernandez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accerciser] Addressing some PyGObject initializer deprecations
- Date: Tue, 19 Aug 2014 17:59:05 +0000 (UTC)
commit 433b4842d1e4bf40a70c8138cac4cd8a282f54f4
Author: Javier Hernández <jhernandez emergya com>
Date: Tue Aug 19 13:58:43 2014 -0400
Addressing some PyGObject initializer deprecations
https://wiki.gnome.org/action/show/Projects/PyGObject/InitializerDeprecations
plugins/api_view.py | 2 +-
src/lib/accerciser/accerciser.py | 2 +-
src/lib/accerciser/accessible_treeview.py | 3 ++-
src/lib/accerciser/bookmarks.py | 12 ++++++------
src/lib/accerciser/hotkey_manager.py | 4 ++--
src/lib/accerciser/main_window.py | 3 ++-
src/lib/accerciser/node.py | 6 ++++--
src/lib/accerciser/plugin/plugin_manager.py | 2 +-
src/lib/accerciser/plugin/view.py | 20 ++++++++++----------
src/lib/accerciser/prefs_dialog.py | 18 +++++++++---------
src/lib/accerciser/ui_manager.py | 2 +-
11 files changed, 39 insertions(+), 35 deletions(-)
---
diff --git a/plugins/api_view.py b/plugins/api_view.py
index 48b9779..4e8c3af 100644
--- a/plugins/api_view.py
+++ b/plugins/api_view.py
@@ -63,7 +63,7 @@ class APIBrowser(ViewportPlugin):
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 = gtk.CheckButton.new_with_label(_('Hide private attributes'))
self.private_toggle.set_active(True)
top_hbox.pack_end(self.private_toggle, False, True, 0)
self.show_all()
diff --git a/src/lib/accerciser/accerciser.py b/src/lib/accerciser/accerciser.py
index d3d6a07..d4a0176 100644
--- a/src/lib/accerciser/accerciser.py
+++ b/src/lib/accerciser/accerciser.py
@@ -72,7 +72,7 @@ class Main(Tools):
# connect signal handlers and show the GUI in its initial state
self.window.show_all()
- main_actions = gtk.ActionGroup('MainActions')
+ main_actions = gtk.ActionGroup.new('MainActions')
ui_manager.uimanager.insert_action_group(main_actions, 0)
main_actions.add_actions([
('Quit', gtk.STOCK_QUIT, None,
diff --git a/src/lib/accerciser/accessible_treeview.py b/src/lib/accerciser/accessible_treeview.py
index 484ef7e..9fef64e 100644
--- a/src/lib/accerciser/accessible_treeview.py
+++ b/src/lib/accerciser/accessible_treeview.py
@@ -449,6 +449,7 @@ class AccessibleModel(gtk.TreeStore, Tools):
@type dummy: boolean
'''
if accessible is not None:
+ print("accessible_name = ", accessible.name)
icon = getIcon(accessible)
name = accessible.name
role = accessible.getLocalizedRoleName()
@@ -544,7 +545,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
self._accEventNameChanged,
'object:property-change:accessible-name')
- self.action_group = gtk.ActionGroup('TreeActions')
+ self.action_group = gtk.ActionGroup.new('TreeActions')
self.action_group.add_toggle_actions(
[('HideShowLeaves', None, _('_Hide/Show Applications without children'), None,
None, self._onHideShowLeaves, False)])
diff --git a/src/lib/accerciser/bookmarks.py b/src/lib/accerciser/bookmarks.py
index e2aff5c..bd2dbf4 100644
--- a/src/lib/accerciser/bookmarks.py
+++ b/src/lib/accerciser/bookmarks.py
@@ -40,7 +40,7 @@ class BookmarkStore(gtk.ListStore):
@type node: L{Node>
'''
gtk.ListStore.__init__(self, object)
- self._bookmarks_action_group = gtk.ActionGroup('BookmarkActions')
+ self._bookmarks_action_group = gtk.ActionGroup.new('BookmarkActions')
ui_manager.uimanager.insert_action_group(self._bookmarks_action_group, 0)
self._buildMenuUI()
self.node = node
@@ -324,8 +324,8 @@ class BookmarkStore(gtk.ListStore):
@param bookmarks_store: Bookmarks manager.
@type bookmarks_store: L{BookmarkStore}
'''
- gtk.Dialog.__init__(self, _('Edit Bookmarks...'),
- buttons=(gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE))
+ gtk.Dialog.__init__(self, name=_('Edit Bookmarks...'))
+ self.add_buttons(gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE)
self.set_default_size(480, 240)
self.connect('response', self._onResponse)
vbox = self.get_children()[0]
@@ -339,13 +339,13 @@ class BookmarkStore(gtk.ListStore):
hbox.pack_start(sw, True, True, 0)
button_vbox = gtk.VBox()
hbox.pack_start(button_vbox, False, False, 0)
- add_button = gtk.Button('gtk-add')
+ add_button = gtk.Button.new_from_stock('gtk-add')
add_button.set_use_stock(True)
add_button.connect('clicked', self._onAddClicked, tv)
- remove_button = gtk.Button('gtk-remove')
+ remove_button = gtk.Button.new_from_stock('gtk-remove')
remove_button.set_use_stock(True)
remove_button.connect('clicked', self._onRemoveClicked, tv)
- jump_button = gtk.Button('gtk-jump-to')
+ jump_button = gtk.Button.new_from_stock('gtk-jump-to')
jump_button.set_use_stock(True)
jump_button.connect('clicked', self._onJumpToClicked, tv)
button_vbox.pack_start(add_button, False, False, 0)
diff --git a/src/lib/accerciser/hotkey_manager.py b/src/lib/accerciser/hotkey_manager.py
index 272c8f2..fb7baaa 100644
--- a/src/lib/accerciser/hotkey_manager.py
+++ b/src/lib/accerciser/hotkey_manager.py
@@ -130,7 +130,7 @@ class HotkeyManager(gtk.ListStore):
self[path][COL_CALLBACK] = callback
else:
gspath = self._getComboGSettingsPath(component, description)
- gsettings = GSettings(schema=HOTKEYS_GSCHEMA, path=gspath)
+ gsettings = GSettings.new_with_path(HOTKEYS_GSCHEMA, gspath)
if gsettings.get_string('hotkey-combo'):
final_keypress, final_modifiers = gtk.accelerator_parse(
gsettings.get_string('hotkey-combo'))
@@ -181,7 +181,7 @@ class HotkeyManager(gtk.ListStore):
gspath = self._getComboGSettingsPath(model[iter][COL_COMPONENT],
model[iter][COL_DESC])
- gsettings = GSettings(schema=HOTKEYS_GSCHEMA, path=gspath)
+ gsettings = GSettings.new_with_path(HOTKEYS_GSCHEMA, gspath)
combo_name = gtk.accelerator_name(model[iter][COL_KEYPRESS],
gdk.ModifierType(model[iter][COL_MOD]))
diff --git a/src/lib/accerciser/main_window.py b/src/lib/accerciser/main_window.py
index 343f5db..427407f 100644
--- a/src/lib/accerciser/main_window.py
+++ b/src/lib/accerciser/main_window.py
@@ -29,6 +29,7 @@ class AccerciserMainWindow(gtk.Window):
@ivar _hpaned: Horizontal paned.
@type _hpaned: gtk.HPaned
'''
+ __gtype_name__ = "AccerciserMainWindow"
def __init__(self, node):
'''
@@ -42,7 +43,7 @@ class AccerciserMainWindow(gtk.Window):
self.set_title(_('Accerciser Accessibility Explorer'))
self.connect('key-press-event', self._onKeyPress)
node.connect('blink-done', self._onBlinkDone)
- self.gsettings = GSettings(schema=GSCHEMA)
+ self.gsettings = GSettings.new(GSCHEMA)
width = self.gsettings.get_int('window-width') or 640
height = self.gsettings.get_int('window-height') or 640
self.set_default_size(width, height)
diff --git a/src/lib/accerciser/node.py b/src/lib/accerciser/node.py
index 537a41b..9605eb7 100644
--- a/src/lib/accerciser/node.py
+++ b/src/lib/accerciser/node.py
@@ -26,7 +26,7 @@ from .tools import Tools, parseColorString
MAX_BLINKS = 6
-gsettings = GSettings(schema='org.a11y.Accerciser')
+gsettings = GSettings.new('org.a11y.Accerciser')
BORDER_COLOR, BORDER_ALPHA = parseColorString(
gsettings.get_string('highlight-border'))
@@ -186,13 +186,15 @@ class _HighLight(gtk.Window):
Highlight box class. Uses compositing when available. When not, it does
transparency client-side.
'''
+ __gtype_name__ = "_Highlight"
+
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, type=gtk.WindowType.POPUP)
# Normalize position for stroke and padding.
self.x, self.y = x - padding, y - padding
diff --git a/src/lib/accerciser/plugin/plugin_manager.py b/src/lib/accerciser/plugin/plugin_manager.py
index 04577d1..33c304a 100644
--- a/src/lib/accerciser/plugin/plugin_manager.py
+++ b/src/lib/accerciser/plugin/plugin_manager.py
@@ -69,7 +69,7 @@ class PluginManager(gtk.ListStore, Tools):
str) # Plugin path
self.node = node
self.hotkey_manager = hotkey_manager
- self.gsettings = GSettings(schema=GSCHEMA)
+ self.gsettings = GSettings.new(GSCHEMA)
self.view_manager = ViewManager(*main_views)
self.message_manager = MessageManager()
self.message_manager.connect('plugin-reload-request',
diff --git a/src/lib/accerciser/plugin/view.py b/src/lib/accerciser/plugin/view.py
index e4b9bd7..bee97ee 100644
--- a/src/lib/accerciser/plugin/view.py
+++ b/src/lib/accerciser/plugin/view.py
@@ -218,7 +218,7 @@ class PluginView(gtk.Notebook):
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))
+ gtk.Notebook.set_tab_label(self, child, gtk.Label.new(name))
def append_page(self, child, tab_label=None):
'''
@@ -289,7 +289,7 @@ class PluginViewWindow(gtk.Window, Tools):
self.add(self.plugin_view)
gspath = NEWPLUGVIEWS_PATH + view_name.lower().replace(' ', '-') + '/'
- gsettings = GSettings(schema=NEWPLUGVIEWS_GSCHEMA, path=gspath)
+ gsettings = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
width = gsettings.get_int('width')
height = gsettings.get_int('height')
self.set_default_size(width, height)
@@ -312,7 +312,7 @@ class PluginViewWindow(gtk.Window, Tools):
'''
view_name = self.plugin_view.view_name
gspath = NEWPLUGVIEWS_PATH + view_name.lower().replace(' ', '-') + '/'
- gsettings = GSettings(schema=NEWPLUGVIEWS_GSCHEMA, path=gspath)
+ gsettings = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
gsettings.set_int('width', self.get_allocated_width())
gsettings.set_int('height', self.get_allocated_height())
@@ -361,7 +361,7 @@ class ViewManager(object):
@type perm_views: list of {PluginView}
'''
self._perm_views = perm_views
- gsettings = GSettings(schema=PLUGVIEWS_GSCHEMA)
+ gsettings = GSettings.new(PLUGVIEWS_GSCHEMA)
single = gsettings.get_boolean('layout-single')
self._initViewModel(single)
self._setupActions()
@@ -371,7 +371,7 @@ class ViewManager(object):
Sets up actions related to plugin layout.
'''
single = isinstance(self._view_model, SingleViewModel)
- layout_action_group = gtk.ActionGroup('PluginActions')
+ layout_action_group = gtk.ActionGroup.new('PluginActions')
ui_manager.uimanager.insert_action_group(layout_action_group, 0)
layout_action_group.add_toggle_actions(
[('SingleViewMode', None, _('_Single plugins view'), '<Control>t',
@@ -403,7 +403,7 @@ class ViewManager(object):
'''
if isinstance(self._view_model, SingleViewModel) == single:
return
- gsettings = GSettings(schema=PLUGVIEWS_GSCHEMA)
+ gsettings = GSettings.new(PLUGVIEWS_GSCHEMA)
gsettings.set_boolean('layout-single', single)
plugins = self._view_model.getViewedPlugins()
self._view_model.close()
@@ -891,13 +891,13 @@ class MultiViewModel(list, BaseViewModel):
self._setPluginLayouts(plugin_layouts)
def _setPluginLayouts(self, plugin_layouts):
- self.plugviews = GSettings(schema=PLUGVIEWS_GSCHEMA)
+ self.plugviews = GSettings.new(PLUGVIEWS_GSCHEMA)
self.plugviews.set_strv('top-panel-layout', plugin_layouts.pop('Top panel'))
self.plugviews.set_strv('bottom-panel-layout', plugin_layouts.pop('Bottom panel'))
for plugview in list(plugin_layouts.keys()):
gspath = NEWPLUGVIEWS_PATH + plugview.lower().replace(' ', '-') + '/'
- newview = GSettings(schema=NEWPLUGVIEWS_GSCHEMA, path=gspath)
+ newview = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
newview.set_strv('layout', plugin_layouts[plugview])
l = self.plugviews.get_strv('available-newviews')
l.append(plugview)
@@ -905,13 +905,13 @@ class MultiViewModel(list, BaseViewModel):
def _getPluginLayouts(self):
plugin_layouts= {}
- self.plugviews = GSettings(schema=PLUGVIEWS_GSCHEMA)
+ self.plugviews = GSettings.new(PLUGVIEWS_GSCHEMA)
plugin_layouts['Top panel'] = self.plugviews.get_strv('top-panel-layout')
plugin_layouts['Bottom panel'] = self.plugviews.get_strv('bottom-panel-layout')
for plugview in self.plugviews.get_strv('available-newviews'):
gspath = NEWPLUGVIEWS_PATH + plugview.lower().replace(' ', '-') + '/'
- newview = GSettings(schema=NEWPLUGVIEWS_GSCHEMA, path=gspath)
+ newview = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
layout = newview.get_strv('layout')
if layout:
plugin_layouts[plugview] = layout
diff --git a/src/lib/accerciser/prefs_dialog.py b/src/lib/accerciser/prefs_dialog.py
index a73f9ad..7148859 100644
--- a/src/lib/accerciser/prefs_dialog.py
+++ b/src/lib/accerciser/prefs_dialog.py
@@ -35,8 +35,8 @@ class AccerciserPreferencesDialog(gtk.Dialog):
@param hotkeys_view: Treeview of global hotkeys.
@type hotkeys_view: L{HotkeyTreeView}
'''
- gtk.Dialog.__init__(self, _('accerciser Preferences'),
- buttons=(gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE))
+ gtk.Dialog.__init__(self, name=_('accerciser Preferences'))
+ self.add_buttons(gtk.STOCK_CLOSE, gtk.ResponseType.CLOSE)
self.connect('response', self._onResponse)
self.set_default_size(500, 250)
notebook = gtk.Notebook()
@@ -50,9 +50,9 @@ class AccerciserPreferencesDialog(gtk.Dialog):
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))
+ notebook.append_page(sw, gtk.Label.new(section))
- notebook.append_page(_HighlighterView(), gtk.Label(_('Highlighting')))
+ notebook.append_page(_HighlighterView(), gtk.Label.new(_('Highlighting')))
def _onResponse(self, dialog, response_id):
'''
@@ -72,30 +72,30 @@ class _HighlighterView(gtk.Alignment):
def __init__(self):
gtk.Alignment.__init__(self)
self.set_padding(12, 12, 18, 12)
- self.gsettings = GSettings(schema='org.a11y.Accerciser')
+ self.gsettings = GSettings.new('org.a11y.Accerciser')
self._buildUI()
def _buildUI(self):
'''
Programatically build the UI.
'''
- table = gtk.Table(3, 2)
+ table = gtk.Table.new(3, 2, True)
table.set_col_spacings(6)
self.add(table)
labels = [None, None, None]
controls = [None, None, None]
- labels[0] = gtk.Label(_('Highlight duration:'))
+ labels[0] = gtk.Label.new(_('Highlight duration:'))
controls[0] = gtk.SpinButton()
controls[0].set_range(0.01, 5)
controls[0].set_digits(2)
controls[0].set_value(self.gsettings.get_double('highlight-duration'))
controls[0].set_increments(0.01, 0.1)
controls[0].connect('value-changed', self._onDurationChanged)
- labels[1] = gtk.Label(_('Border color:'))
+ labels[1] = gtk.Label.new(_('Border color:'))
controls[1] = self._ColorButton(node.BORDER_COLOR, node.BORDER_ALPHA)
controls[1].connect('color-set', self._onColorSet, 'highlight-border')
controls[1].set_tooltip_text(_('The border color of the highlight box'))
- labels[2] = gtk.Label(_('Fill color:'))
+ labels[2] = gtk.Label.new(_('Fill color:'))
controls[2] = self._ColorButton(node.FILL_COLOR, node.FILL_ALPHA)
controls[2].connect('color-set', self._onColorSet, 'highlight-fill')
controls[2].set_tooltip_text(_('The fill color of the highlight box'))
diff --git a/src/lib/accerciser/ui_manager.py b/src/lib/accerciser/ui_manager.py
index c3310f0..94eecbb 100644
--- a/src/lib/accerciser/ui_manager.py
+++ b/src/lib/accerciser/ui_manager.py
@@ -17,7 +17,7 @@ from gi.repository import Gtk as gtk
from .i18n import _, N_, C_
-menu_actions = gtk.ActionGroup('MenuActions')
+menu_actions = gtk.ActionGroup.new('MenuActions')
menu_actions.add_actions([
('File', None, _('_File')),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]