Replace stock items with named icons

Stock items have been deprecated since 3.10.
Named icons are now loaded from the default icon theme.
This commit is contained in:
Nick Hall 2015-05-19 22:23:35 +01:00
parent 293556b88e
commit 457ed21c6c
321 changed files with 564 additions and 735 deletions

45
gramps/gui/actiongroup.py Normal file
View File

@ -0,0 +1,45 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2015 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
"""
A replacement ActionGroup that correctly loads named icons from an icon theme.
"""
from gi.repository import Gtk
class ActionGroup(Gtk.ActionGroup):
def add_actions(self, action_list, **kwargs):
Gtk.ActionGroup.add_actions(self, action_list, **kwargs)
self.fix_icon_name(action_list)
def add_toggle_actions(self, action_list, **kwargs):
Gtk.ActionGroup.add_toggle_actions(self, action_list, **kwargs)
self.fix_icon_name(action_list)
def add_radio_actions(self, action_list, **kwargs):
Gtk.ActionGroup.add_radio_actions(self, action_list, **kwargs)
self.fix_icon_name(action_list)
def fix_icon_name(self, action_list):
for action_tuple in action_list:
if action_tuple[1]:
action = self.get_action(action_tuple[0])
action.set_icon_name(action_tuple[1])

View File

@ -74,29 +74,28 @@ WIKI_HELP_SEC = _('manual|Using_the_Clipboard')
#
#-------------------------------------------------------------------------
_stock_image = os.path.join(IMAGE_DIR,'stock_link.png')
LINK_PIC = GdkPixbuf.Pixbuf.new_from_file(_stock_image)
theme = Gtk.IconTheme.get_default()
LINK_PIC = theme.load_icon('stock_link', 16, 0)
ICONS = {}
for (name, file) in (
("media", "gramps-media.png"),
("note", "gramps-notes.png"),
("person", "gramps-person.png"),
("place", "gramps-place.png"),
('address', 'gramps-address.png'),
('attribute', 'gramps-attribute.png'),
('event', 'gramps-event.png'),
('family', 'gramps-family.png'),
('location', 'geo-place-link.png'),
('media', 'gramps-media.png'),
('name', 'geo-show-person.png'),
('repository', 'gramps-repository.png'),
('source', 'gramps-source.png'),
('citation', 'gramps-citation.png'),
('text', 'gramps-font.png'),
('url', 'gramps-geo.png'),
for (name, icon) in (
("media", "gramps-media"),
("note", "gramps-notes"),
("person", "gramps-person"),
("place", "gramps-place"),
('address', 'gramps-address'),
('attribute', 'gramps-attribute'),
('event', 'gramps-event'),
('family', 'gramps-family'),
('location', 'geo-place-link'),
('media', 'gramps-media'),
('name', 'geo-show-person'),
('repository', 'gramps-repository'),
('source', 'gramps-source'),
('citation', 'gramps-citation'),
('text', 'gramps-font'),
('url', 'gramps-geo'),
):
_image = os.path.join(IMAGE_DIR, '16x16', file)
ICONS[name] = GdkPixbuf.Pixbuf.new_from_file(_image)
ICONS[name] = theme.load_icon(icon, 16, 0)
#-------------------------------------------------------------------------
#
@ -174,7 +173,7 @@ def model_contains(model, data):
#
#-------------------------------------------------------------------------
class ClipWrapper(object):
UNAVAILABLE_ICON = Gtk.STOCK_DIALOG_ERROR
UNAVAILABLE_ICON = 'dialog-error'
def __init__(self, dbstate, obj):
dbstate.connect('database-changed', self.database_changed)
@ -1125,7 +1124,7 @@ class ClipboardListView(object):
o = model.get_value(node, 1)
if o._dbid != self.dbstate.db.get_dbid():
if isinstance(o.__class__.UNAVAILABLE_ICON, str):
cell.set_property('stock-id',
cell.set_property('icon-name',
o.__class__.UNAVAILABLE_ICON)
else:
cell.set_property('pixbuf',

View File

@ -104,7 +104,7 @@ class ColumnOrder(Gtk.Box):
self.tree = Gtk.TreeView()
self.tree.set_reorderable(True)
scroll.add(self.tree)
self.apply_button = Gtk.Button(stock='gtk-apply')
self.apply_button = Gtk.Button.new_with_mnemonic(_('_Apply'))
btns = Gtk.ButtonBox()
btns.set_layout(Gtk.ButtonBoxStyle.END)
btns.pack_start(self.apply_button, True, True, 0)

View File

@ -101,7 +101,7 @@ class DisplayNameEditor(ManagedWindow):
self.dbstate = dbstate
self.set_window(
Gtk.Dialog(_('Display Name Editor'),
buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
buttons=(_('_Close'), Gtk.ResponseType.CLOSE)),
None, _('Display Name Editor'), None)
grid = self.dialog._build_custom_name_ui()
label = Gtk.Label(label=_("""The following keywords are replaced with the appropriate name parts:
@ -177,7 +177,7 @@ class ConfigureDialog(ManagedWindow):
ManagedWindow.__init__(self, uistate, [], configobj)
self.set_window(
Gtk.Dialog(dialogtitle,
buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
buttons=(_('_Close'), Gtk.ResponseType.CLOSE)),
None, dialogtitle, None)
self.panel = Gtk.Notebook()
self.panel.set_scrollable(True)
@ -333,7 +333,7 @@ class ConfigureDialog(ManagedWindow):
btn = Gtk.Button()
btn.connect('clicked', callback_sel)
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
image.set_from_icon_name('document-open', Gtk.IconSize.BUTTON)
image.show()
btn.add(image)
hbox.pack_start(entry, True, True, 0)
@ -837,14 +837,14 @@ class GrampsPreferences(ConfigureDialog):
self.selected_fmt = ()
self.iter = None
self.insert_button = Gtk.Button(stock=Gtk.STOCK_ADD)
self.insert_button = Gtk.Button.new_with_mnemonic(_('_Add'))
self.insert_button.connect('clicked', self.__new_name)
self.edit_button = Gtk.Button(stock=Gtk.STOCK_EDIT)
self.edit_button = Gtk.Button.new_with_mnemonic(_('_Edit'))
self.edit_button.connect('clicked', self.__edit_name)
self.edit_button.set_sensitive(False)
self.remove_button = Gtk.Button(stock=Gtk.STOCK_REMOVE)
self.remove_button = Gtk.Button.new_with_mnemonic(_('_Remove'))
self.remove_button.connect('clicked', self.cb_del_fmt_str)
self.remove_button.set_sensitive(False)
@ -1402,9 +1402,9 @@ class GrampsPreferences(ConfigureDialog):
f = Gtk.FileChooserDialog(title=_("Select media directory"),
parent=self.window,
action=Gtk.FileChooserAction.SELECT_FOLDER,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_APPLY,
_('_Apply'),
Gtk.ResponseType.OK)
)
mpath = self.dbstate.db.get_mediapath()
@ -1427,9 +1427,9 @@ class GrampsPreferences(ConfigureDialog):
f = Gtk.FileChooserDialog(title=_("Select database directory"),
parent=self.window,
action=Gtk.FileChooserAction.SELECT_FOLDER,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_APPLY,
_('_Apply'),
Gtk.ResponseType.OK)
)
dbpath = config.get('behavior.database-path')
@ -1485,13 +1485,3 @@ class GrampsPreferences(ConfigureDialog):
def build_menu_names(self, obj):
return (_('Preferences'), _('Preferences'))
# FIXME: is this needed?
def _set_button(self, stock):
button = Gtk.Button()
image = Gtk.Image()
image.set_from_stock(stock, Gtk.IconSize.BUTTON)
image.show()
button.add(image)
button.show()
return button

View File

@ -138,7 +138,7 @@ class DbLoader(CLIDbLoader):
import_dialog = Gtk.FileChooserDialog(_('Gramps: Import Family Tree'),
self.uistate.window,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL,
(_('_Cancel'),
Gtk.ResponseType.CANCEL,
_('Import'),
Gtk.ResponseType.OK))

View File

@ -102,7 +102,7 @@ FILE_COL = 2
DATE_COL = 3
DSORT_COL = 4
OPEN_COL = 5
STOCK_COL = 6
ICON_COL = 6
RCS_BUTTON = { True : _('_Extract'), False : _('_Archive') }
@ -113,9 +113,9 @@ class DbManager(CLIDbManager):
"""
ICON_MAP = {
CLIDbManager.ICON_NONE : None,
CLIDbManager.ICON_RECOVERY : Gtk.STOCK_DIALOG_ERROR,
CLIDbManager.ICON_RECOVERY : 'dialog-error',
CLIDbManager.ICON_LOCK : 'gramps-lock',
CLIDbManager.ICON_OPEN : Gtk.STOCK_OPEN,
CLIDbManager.ICON_OPEN : 'document-open',
}
ERROR = ErrorDialog
@ -231,7 +231,7 @@ class DbManager(CLIDbManager):
is_rev = len(path.get_indices()) > 1
self.rcs.set_label(RCS_BUTTON[is_rev])
if store.get_value(node, STOCK_COL) == Gtk.STOCK_OPEN:
if store.get_value(node, ICON_COL) == 'document-open':
self.connect.set_sensitive(False)
if _RCS_FOUND:
self.rcs.set_sensitive(True)
@ -242,7 +242,7 @@ class DbManager(CLIDbManager):
else:
self.rcs.set_sensitive(False)
if store.get_value(node, STOCK_COL) == Gtk.STOCK_DIALOG_ERROR:
if store.get_value(node, ICON_COL) == 'dialog-error':
path = conv_to_unicode(store.get_value(node, PATH_COL), 'utf8')
backup = os.path.join(path, "person.gbkp")
self.repair.set_sensitive(os.path.isfile(backup))
@ -289,7 +289,7 @@ class DbManager(CLIDbManager):
# build the icon column
render = Gtk.CellRendererPixbuf()
#icon_column = Gtk.TreeViewColumn(_('Status'), render,
#stock_id=STOCK_COL)
#icon_name=ICON_COL)
icon_column = Gtk.TreeViewColumn(_('Status'), render)
icon_column.set_cell_data_func(render, bug_fix)
self.dblist.append_column(icon_column)
@ -350,7 +350,7 @@ class DbManager(CLIDbManager):
if value == Gtk.ResponseType.OK:
store, node = self.selection.get_selected()
# don't open a locked file
if store.get_value(node, STOCK_COL) == 'gramps-lock':
if store.get_value(node, ICON_COL) == 'gramps-lock':
self.__ask_to_break_lock(store, node)
continue
# don't open a version
@ -398,7 +398,7 @@ class DbManager(CLIDbManager):
dbpath = conv_to_unicode(store.get_value(node, PATH_COL), 'utf8')
(tval, last) = time_val(dbpath)
store.set_value(node, OPEN_COL, 0)
store.set_value(node, STOCK_COL, "")
store.set_value(node, ICON_COL, "")
store.set_value(node, DATE_COL, last)
store.set_value(node, DSORT_COL, tval)
except IOError:
@ -966,7 +966,7 @@ def bug_fix(column, renderer, model, iter_, data):
None using the TreeModel set_value method. Instead we set it to an empty
string and convert it to None here.
"""
stock_id = model.get_value(iter_, STOCK_COL)
if stock_id == '':
stock_id = None
renderer.set_property('stock_id', stock_id)
icon_name = model.get_value(iter_, ICON_COL)
if icon_name == '':
icon_name = None
renderer.set_property('icon-name', icon_name)

View File

@ -95,7 +95,7 @@ class BackRefList(EmbeddedList):
This button box is then appended hbox (self).
Method has signature of, and overrides create_buttons from _ButtonTab.py
"""
self.edit_btn = SimpleButton(Gtk.STOCK_EDIT, self.edit_button_clicked)
self.edit_btn = SimpleButton('gtk-edit', self.edit_button_clicked)
self.edit_btn.set_tooltip_text(_('Edit reference'))
hbox = Gtk.Box()

View File

@ -122,9 +122,9 @@ class ButtonTab(GrampsTab):
self.top_label.set_use_markup(True)
self.track_ref_for_deletion("top_label")
self.add_btn = SimpleButton(Gtk.STOCK_ADD, self.add_button_clicked)
self.edit_btn = SimpleButton(Gtk.STOCK_EDIT, self.edit_button_clicked)
self.del_btn = SimpleButton(Gtk.STOCK_REMOVE, self.del_button_clicked)
self.add_btn = SimpleButton('list-add', self.add_button_clicked)
self.edit_btn = SimpleButton('gtk-edit', self.edit_button_clicked)
self.del_btn = SimpleButton('list-remove', self.del_button_clicked)
self.track_ref_for_deletion("add_btn")
self.track_ref_for_deletion("edit_btn")
self.track_ref_for_deletion("del_btn")
@ -134,17 +134,16 @@ class ButtonTab(GrampsTab):
self.del_btn.set_tooltip_text(self._MSG['del'])
if share_button:
self.share_btn = SimpleButton(Gtk.STOCK_INDEX, self.share_button_clicked)
self.share_btn = SimpleButton('gtk-index', self.share_button_clicked)
self.share_btn.set_tooltip_text(self._MSG['share'])
self.track_ref_for_deletion("share_btn")
else:
self.share_btn = None
if move_buttons:
self.up_btn = SimpleButton(Gtk.STOCK_GO_UP, self.up_button_clicked)
self.up_btn = SimpleButton('go-up', self.up_button_clicked)
self.up_btn.set_tooltip_text(self._MSG['up'])
self.down_btn = SimpleButton(Gtk.STOCK_GO_DOWN,
self.down_button_clicked)
self.down_btn = SimpleButton('go-down', self.down_button_clicked)
self.down_btn.set_tooltip_text(self._MSG['down'])
self.track_ref_for_deletion("up_btn")
self.track_ref_for_deletion("down_btn")
@ -153,7 +152,7 @@ class ButtonTab(GrampsTab):
self.down_btn = None
if jump_button:
self.jump_btn = SimpleButton(Gtk.STOCK_JUMP_TO, self.jump_button_clicked)
self.jump_btn = SimpleButton('go-jump', self.jump_button_clicked)
self.track_ref_for_deletion("jump_btn")
self.jump_btn.set_tooltip_text(self._MSG['jump'])
else:

View File

@ -148,16 +148,16 @@ class EmbeddedList(ButtonTab):
"""
if self.share_btn:
itemlist = [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(True, False, _('Share'), self.share_button_clicked),
(False,True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, True, Gtk.STOCK_REMOVE, self.del_button_clicked),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(True, _('Share'), None, self.share_button_clicked),
(False, _('_Edit'), 'gtk-edit', self.edit_button_clicked),
(True, _('_Remove'), 'list-remove', self.del_button_clicked),
]
else:
itemlist = [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(False,True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, True, Gtk.STOCK_REMOVE, self.del_button_clicked),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(False, _('_Edit'), 'gtk-edit', self.edit_button_clicked),
(True, _('_Remove'), 'list-remove', self.del_button_clicked),
]
return itemlist
@ -171,20 +171,15 @@ class EmbeddedList(ButtonTab):
"""
self.__store_menu = Gtk.Menu() #need to keep reference or menu disappears
menu = self.__store_menu
for (needs_write_access, image, title, func) in self.get_popup_menu_items():
if image:
if isinstance(title, tuple):
img_stock, txt = title
item = Gtk.ImageMenuItem.new_with_label(txt)
img = Gtk.Image()
img.set_from_stock(img_stock, Gtk.IconSize.MENU)
item.set_image(img)
else:
item = Gtk.ImageMenuItem.new_from_stock(title, None)
for (need_write, title, icon_name, func) in self.get_popup_menu_items():
if icon_name:
item = Gtk.ImageMenuItem.new_with_mnemonic(title)
img = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
item.set_image(img)
else:
item = Gtk.MenuItem(label=title)
item = Gtk.MenuItem.new_with_mnemonic(title)
item.connect('activate', func)
if needs_write_access and self.dbstate.db.readonly:
if need_write and self.dbstate.db.readonly:
item.set_sensitive(False)
item.show()
menu.append(item)
@ -369,7 +364,7 @@ class EmbeddedList(ButtonTab):
STOCK_JUSTIFY_FILL icon, which in the default GTK style
looks kind of like a list.
"""
return Gtk.STOCK_JUSTIFY_FILL
return 'format-justify-fill'
def del_button_clicked(self, obj):
ref = self.get_selected()
@ -524,7 +519,7 @@ class EmbeddedList(ButtonTab):
raise NotImplementedError('Unknown column type: %s, with column name %s' % (type_col, self._column_names[pair[1]][3]))
if col_icon is not None:
image = Gtk.Image()
image.set_from_stock(col_icon, Gtk.IconSize.MENU)
image.set_from_icon_name(col_icon, Gtk.IconSize.MENU)
image.set_tooltip_text(name)
image.show()
column.set_widget(image)
@ -547,12 +542,12 @@ class EmbeddedList(ButtonTab):
Set the stock icon property of the cell renderer. We use a cell data
function because there is a problem returning None from a model.
'''
stock_id = model.get_value(iter_, col_num)
if stock_id == '' or stock_id == False:
stock_id = None
elif stock_id == True:
stock_id = self.col_icons[col_num]
renderer.set_property('stock_id', stock_id)
icon_name = model.get_value(iter_, col_num)
if icon_name == '' or icon_name == False:
icon_name = None
elif icon_name == True:
icon_name = self.col_icons[col_num]
renderer.set_property('icon-name', icon_name)
def construct_model(self):
"""

View File

@ -309,8 +309,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
return GroupEmbeddedList.get_popup_menu_items(self)
else:
return [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(False,True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(False, _('_Edit'), 'gtk-edit', self.edit_button_clicked),
]
def _non_native_change(self):

View File

@ -125,10 +125,10 @@ class GalleryTab(ButtonTab, DbGUIElement):
def right_click(self, obj, event):
itemlist = [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(True, False, _('Share'), self.share_button_clicked),
(False,True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, True, Gtk.STOCK_REMOVE, self.del_button_clicked),
(True, True, 'list-add', self.add_button_clicked),
(True, False, _('Share'), self.share_button_clicked),
(False,True, 'gtk-edit', self.edit_button_clicked),
(True, True, 'list-remove', self.del_button_clicked),
]
self.menu = Gtk.Menu()
@ -138,7 +138,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
if media_path:
item = Gtk.ImageMenuItem(_('View'))
img = Gtk.Image()
img.set_from_stock("gramps-viewmedia", Gtk.IconSize.MENU)
img.set_from_icon_name("gramps-viewmedia", Gtk.IconSize.MENU)
item.set_image(img)
item.connect('activate', make_launcher(media_path))
item.show()
@ -162,7 +162,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
for (needs_write_access, image, title, func) in itemlist:
if image:
item = Gtk.ImageMenuItem.new_from_stock(title, None)
item = Gtk.ImageMenuItem()
img = Gtk.Image.new_from_icon_name(title, Gtk.IconSize.MENU)
item.set_image(img)
else:
item = Gtk.MenuItem(label=title)
item.connect('activate', func)

View File

@ -108,16 +108,11 @@ class GrampsTab(Gtk.Box):
icon = self.get_icon_name()
if isinstance(icon, tuple):
if icon[0] == 0:
func = Gtk.Image.new_from_icon_name
else:
func = Gtk.Image.new_from_stock
name = icon[1]
else:
func = Gtk.Image.new_from_stock
name = icon
self.tab_image = func(name, Gtk.IconSize.MENU)
self.tab_image = Gtk.Image.new_from_icon_name(name, Gtk.IconSize.MENU)
self.track_ref_for_deletion("tab_image")
self.label = Gtk.Label(label=self.tab_name)
self.track_ref_for_deletion("label")
@ -135,7 +130,7 @@ class GrampsTab(Gtk.Box):
@returns: stock icon name
@rtype: str
"""
return Gtk.STOCK_NEW
return 'document-new'
def get_tab_widget(self):
"""

View File

@ -364,7 +364,7 @@ class GroupEmbeddedList(EmbeddedList):
STOCK_JUSTIFY_FILL icon, which in the default GTK style
looks kind of like a list.
"""
return Gtk.STOCK_JUSTIFY_FILL
return 'format-justify-fill'
def del_button_clicked(self, obj):
ref = self.get_selected()

View File

@ -119,15 +119,15 @@ class NameEmbedList(GroupEmbeddedList):
def get_popup_menu_items(self):
if self._tmpgroup == self._WORKGROUP:
return [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(False,True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, True, Gtk.STOCK_REMOVE, self.del_button_clicked),
(True, False, _('Set as default name'), self.name_button_clicked),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(False, _('_Edit'), 'gtk-edit', self.edit_button_clicked),
(True, _('_Remove'), 'list-remove', self.del_button_clicked),
(True, _('Set as default name'), None, self.name_button_clicked),
]
else:
return [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(False,True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(False,_('_Edit'), 'gtk-edit', self.edit_button_clicked),
]
def name_button_clicked(self, obj):

View File

@ -112,10 +112,10 @@ class WebEmbedList(EmbeddedList):
def get_popup_menu_items(self):
return [
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(False, True, Gtk.STOCK_EDIT, self.edit_button_clicked),
(True, True, Gtk.STOCK_REMOVE, self.del_button_clicked),
(True, True, Gtk.STOCK_JUMP_TO, self.jump_button_clicked),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(False, _('_Edit'), 'gtk-edit', self.edit_button_clicked),
(True, _('_Remove'), 'list-remove', self.del_button_clicked),
(True, _('_Jump to'), 'go-jump', self.jump_button_clicked),
]
def jump_button_clicked(self, obj):

View File

@ -135,14 +135,13 @@ class ChildEmbedList(EmbeddedList):
def get_popup_menu_items(self):
return [
(False, True, (Gtk.STOCK_EDIT, _('Edit child')),
(False, _('Edit child'), 'gtk-edit',
self.edit_child_button_clicked),
(True, True, Gtk.STOCK_ADD, self.add_button_clicked),
(True, False, _('Add an existing child'),
self.share_button_clicked),
(False, True, (Gtk.STOCK_EDIT, _('Edit relationship')),
(True, _('_Add'), 'list-add', self.add_button_clicked),
(True, _('Add an existing child'), None, self.share_button_clicked),
(False, _('Edit relationship'), 'gtk-edit',
self.edit_button_clicked),
(True, True, Gtk.STOCK_REMOVE, self.del_button_clicked),
(True, _('_Remove'), 'list-remove', self.del_button_clicked),
]
def get_middle_click(self):

View File

@ -687,11 +687,11 @@ class EditPerson(EditPrimary):
self.track_ref_for_deletion("home_action")
self.all_action.add_actions([
('ActivePerson', Gtk.STOCK_APPLY, _("Make Active Person"),
('ActivePerson', None, _("Make Active Person"),
None, None, self._make_active),
])
self.home_action.add_actions([
('HomePerson', Gtk.STOCK_HOME, _("Make Home Person"),
('HomePerson', 'go-home', _("Make Home Person"),
None, None, self._make_home_person),
])

View File

@ -57,11 +57,11 @@ class EditPlaceName(ManagedWindow):
window = Gtk.Dialog('', uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT, None)
self.cancel_button = window.add_button(Gtk.STOCK_CANCEL,
self.cancel_button = window.add_button(_('_Cancel'),
Gtk.ResponseType.CANCEL)
self.ok_button = window.add_button(Gtk.STOCK_OK,
self.ok_button = window.add_button(_('_OK'),
Gtk.ResponseType.ACCEPT)
self.help_button = window.add_button(Gtk.STOCK_HELP,
self.help_button = window.add_button(_('_Help'),
Gtk.ResponseType.HELP)
window.connect('response', self.response)

View File

@ -114,9 +114,9 @@ class EditTagList(ManagedWindow):
slist.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
top.vbox.pack_start(slist, 1, 1, 5)
top.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)
top.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
top.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
top.add_button(_('_Help'), Gtk.ResponseType.HELP)
top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
top.add_button(_('_OK'), Gtk.ResponseType.OK)
top.show_all()
return top

View File

@ -262,25 +262,25 @@ class ObjEntry(object):
if use_add:
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.BUTTON)
image.set_from_icon_name('list-remove', Gtk.IconSize.BUTTON)
image.show()
self.share.add(image)
self.share.set_tooltip_text(self.DEL_STR)
if self.add_edt is not None:
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.BUTTON)
image.set_from_icon_name('gtk-edit', Gtk.IconSize.BUTTON)
image.show()
self.add_edt.add(image)
self.add_edt.set_tooltip_text(self.EDIT_STR)
else:
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_INDEX, Gtk.IconSize.BUTTON)
image.set_from_icon_name('gtk-index', Gtk.IconSize.BUTTON)
image.show()
self.share.add(image)
self.share.set_tooltip_text(self.SHARE_STR)
if self.add_edt is not None:
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON)
image.set_from_icon_name('list-add', Gtk.IconSize.BUTTON)
image.show()
self.add_edt.add(image)
self.add_edt.set_tooltip_text(self.ADD_STR)

View File

@ -52,8 +52,8 @@ class SearchBar(object):
self.filterbar = Gtk.Box()
self.filter_text = Gtk.Entry()
self.filter_button = Gtk.Button(stock=Gtk.STOCK_FIND)
self.clear_button = Gtk.Button(stock=Gtk.STOCK_CLEAR)
self.filter_button = Gtk.Button.new_with_mnemonic(_('_Find'))
self.clear_button = Gtk.Button.new_with_mnemonic(_('_Clear'))
self.filter_list = Gtk.ComboBox()
self.filter_model = Gtk.ListStore(GObject.TYPE_STRING,
GObject.TYPE_INT,

View File

@ -53,7 +53,7 @@ class SidebarFilter(DbGUIElement):
self.grid.set_border_width(6)
self.grid.set_row_spacing(6)
self.grid.set_column_spacing(6)
self.apply_btn = Gtk.Button(stock=Gtk.STOCK_FIND)
self.apply_btn = Gtk.Button.new_with_mnemonic(_('_Find'))
self.clear_btn = Gtk.Button()
self._init_interface()
@ -73,7 +73,7 @@ class SidebarFilter(DbGUIElement):
hbox = Gtk.Box()
hbox.show()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.BUTTON)
image.set_from_icon_name('edit-undo', Gtk.IconSize.BUTTON)
image.show()
label = Gtk.Label(label=_('Reset'))
label.show()
@ -226,7 +226,7 @@ class SidebarFilter(DbGUIElement):
"""
hbox = Gtk.Box()
hbox.pack_start(widget, True, True, 0)
hbox.pack_start(widgets.SimpleButton(Gtk.STOCK_EDIT, self.edit_filter),
hbox.pack_start(widgets.SimpleButton('gtk-edit', self.edit_filter),
False, False, 0)
self.add_entry(text, hbox)

View File

@ -106,104 +106,6 @@ except ImportError:
#
#-------------------------------------------------------------------------
def register_stock_icons ():
"""
Add the gramps names for its icons (eg gramps-person) to the GTK icon
factory. This allows all gramps modules to call up the icons by their name
"""
from .pluginmanager import base_reg_stock_icons
#iconpath to the base image. The front of the list has highest priority
if win():
iconpaths = [
(os.path.join(IMAGE_DIR, '48x48'), '.png'),
(IMAGE_DIR, '.png'),
]
else :
iconpaths = [
(os.path.join(IMAGE_DIR, 'scalable'), '.svg'),
(IMAGE_DIR, '.svg'), (IMAGE_DIR, '.png'),
]
#sizes: menu=16, small_toolbar=18, large_toolbar=24,
# button=20, dnd=32, dialog=48
#add to the back of this list to overrule images set at beginning of list
extraiconsize = [
(os.path.join(IMAGE_DIR, '22x22'),
Gtk.IconSize.LARGE_TOOLBAR),
(os.path.join(IMAGE_DIR, '16x16'),
Gtk.IconSize.MENU),
(os.path.join(IMAGE_DIR, '22x22'),
Gtk.IconSize.BUTTON),
]
items = [
('gramps-db', _('Family Trees'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-address', _('Address'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-attribute', _('Attribute'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
#('gramps-bookmark', _('Bookmarks'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
#('gramps-bookmark-delete', _('Delete bookmark'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-bookmark-new', _('_Add bookmark'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-bookmark-edit', _('Organize Bookmarks'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-config', _('Configure'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-date', _('Date'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-date-edit', _('Edit Date'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-event', _('Events'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-family', _('Family'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-fanchart', _('Fan Chart'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-fanchartdesc', _('Descendant Fan Chart'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-font', _('Font'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-font-color', _('Font Color'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-font-bgcolor', _('Font Background Color'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-gramplet', _('Gramplets'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-geo', _('Geography'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-geo-mainmap', _('Geography'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-geo-altmap', _('Geography'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('geo-show-person', _('GeoPerson'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('geo-show-family', _('GeoFamily'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('geo-show-event', _('GeoEvents'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('geo-show-place', _('GeoPlaces'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-lock', _('Public'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-media', _('Media'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-merge', _('Merge'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-notes', _('Notes'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-parents', _('Parents'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-parents-add', _('Add Parents'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-parents-open', _('Select Parents'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-pedigree', _('Pedigree'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-person', _('Person'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-place', _('Places'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-relation', _('Relationships'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-reports', _('Reports'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-repository', _('Repositories'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-source', _('Sources'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-spouse', _('Add Spouse'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-tag', _('Tag'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-tag-new', _('New Tag'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-tools', _('Tools'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-tree-group', _('Grouped List'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-tree-list', _('List'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-tree-select', _('Select'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-unlock', _('Private'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-view', _('View'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-viewmedia', _('View'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-zoom-in', _('Zoom In'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-zoom-out', _('Zoom Out'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-zoom-fit-width', _('Fit Width'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-zoom-best-fit', _('Fit Page'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-citation', _('Citations'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
]
#TODO# the following icons are not yet in new directory structure
# they should be ported in the near future
items_legacy = [
('gramps-export', _('Export'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-import', _('Import'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-undo-history', _('Undo History'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
('gramps-url', _('URL'), Gdk.ModifierType.CONTROL_MASK, 0, ''),
]
base_reg_stock_icons(iconpaths, extraiconsize, items+items_legacy)
def _display_welcome_message():
"""
Display a welcome message to the user.
@ -257,7 +159,10 @@ class Gramps(object):
import gettext
_display_welcome_message()
register_stock_icons()
# Append image directory to the theme search path
theme = Gtk.IconTheme.get_default()
theme.append_search_path(IMAGE_DIR)
if lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN):
LOG.warn("GTK translations missing, GUI will be broken, especially for RTL languages!")

View File

@ -95,7 +95,7 @@ class ErrorView(object):
hbox = Gtk.Box()
hbox.set_spacing(12)
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.DIALOG)
image.set_from_icon_name('dialog-error', Gtk.IconSize.DIALOG)
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>'
% _("Gramps has experienced an unexpected error"))
label.set_use_markup(True)
@ -135,9 +135,9 @@ class ErrorView(object):
vbox.pack_start(tb_expander, True, True, 5)
self.top.add_button(Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL)
self.top.add_button(_("Report"),Gtk.ResponseType.YES)
self.top.add_button(Gtk.STOCK_HELP,Gtk.ResponseType.HELP)
self.top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
self.top.add_button(_("Report"), Gtk.ResponseType.YES)
self.top.add_button(_('_Help'), Gtk.ResponseType.HELP)
self.top.show_all()

View File

@ -38,6 +38,7 @@ from gi.repository import Gdk
#-------------------------------------------------------------------------
from gramps.gen.plug import (START, END)
from .pluginmanager import GuiPluginManager
from .actiongroup import ActionGroup
#-------------------------------------------------------------------------
#
@ -113,7 +114,7 @@ class Navigator(object):
self.__menu_button_pressed)
#close_button = Gtk.Button()
#img = Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
#img = Gtk.Image.new_from_icon_name('window-close', Gtk.IconSize.MENU)
#close_button.set_image(img)
#close_button.set_relief(Gtk.ReliefStyle.NONE)
#close_button.connect('clicked', self.cb_close_clicked)
@ -228,7 +229,7 @@ class Navigator(object):
list(map(uimanager.remove_ui, self.merge_ids))
if cat_num in self.ui_category:
self.cat_view_group = Gtk.ActionGroup(name='viewmenu')
self.cat_view_group = ActionGroup(name='viewmenu')
self.cat_view_group.add_radio_actions(
self.view_toggle_actions[cat_num], value=view_num,
on_change=self.cb_view_clicked, user_data=cat_num)

View File

@ -76,7 +76,7 @@ class LastNameDialog(ManagedWindow):
ManagedWindow.__init__(self, uistate, track, self)
flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT
buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, Gtk.STOCK_OK,
buttons = (_('_Cancel'), Gtk.ResponseType.REJECT, _('_OK'),
Gtk.ResponseType.ACCEPT)
self.__dlg = Gtk.Dialog(None, uistate.window, flags, buttons)
self.__dlg.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
@ -621,7 +621,7 @@ class GuiPersonOption(Gtk.Box):
pevt = Gtk.EventBox()
pevt.add(self.__person_label)
person_button = widgets.SimpleButton(Gtk.STOCK_INDEX,
person_button = widgets.SimpleButton('gtk-index',
self.__get_person_clicked)
person_button.set_relief(Gtk.ReliefStyle.NORMAL)
@ -746,7 +746,7 @@ class GuiFamilyOption(Gtk.Box):
pevt = Gtk.EventBox()
pevt.add(self.__family_label)
family_button = widgets.SimpleButton(Gtk.STOCK_INDEX,
family_button = widgets.SimpleButton('gtk-index',
self.__get_family_clicked)
family_button.set_relief(Gtk.ReliefStyle.NORMAL)
@ -935,7 +935,7 @@ class GuiNoteOption(Gtk.Box):
pevt = Gtk.EventBox()
pevt.add(self.__note_label)
note_button = widgets.SimpleButton(Gtk.STOCK_INDEX,
note_button = widgets.SimpleButton('gtk-index',
self.__get_note_clicked)
note_button.set_relief(Gtk.ReliefStyle.NORMAL)
@ -1039,7 +1039,7 @@ class GuiMediaOption(Gtk.Box):
pevt = Gtk.EventBox()
pevt.add(self.__media_label)
media_button = widgets.SimpleButton(Gtk.STOCK_INDEX,
media_button = widgets.SimpleButton('gtk-index',
self.__get_media_clicked)
media_button.set_relief(Gtk.ReliefStyle.NORMAL)
@ -1161,9 +1161,9 @@ class GuiPersonListOption(Gtk.Box):
# now setup the '+' and '-' pushbutton for adding/removing people from
# the container
self.__add_person = widgets.SimpleButton(Gtk.STOCK_ADD,
self.__add_person = widgets.SimpleButton('list-add',
self.__add_person_clicked)
self.__del_person = widgets.SimpleButton(Gtk.STOCK_REMOVE,
self.__del_person = widgets.SimpleButton('list-remove',
self.__del_person_clicked)
self.__vbbox = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL)
self.__vbbox.add(self.__add_person)
@ -1338,9 +1338,9 @@ class GuiPlaceListOption(Gtk.Box):
# now setup the '+' and '-' pushbutton for adding/removing places from
# the container
self.__add_place = widgets.SimpleButton(Gtk.STOCK_ADD,
self.__add_place = widgets.SimpleButton('list-add',
self.__add_place_clicked)
self.__del_place = widgets.SimpleButton(Gtk.STOCK_REMOVE,
self.__del_place = widgets.SimpleButton('list-remove',
self.__del_place_clicked)
self.__vbbox = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL)
self.__vbbox.add(self.__add_place)
@ -1481,9 +1481,9 @@ class GuiSurnameColorOption(Gtk.Box):
self.scrolled_window.set_shadow_type(Gtk.ShadowType.OUT)
self.pack_start(self.scrolled_window, True, True, 0)
self.add_surname = widgets.SimpleButton(Gtk.STOCK_ADD,
self.add_surname = widgets.SimpleButton('list-add',
self.__add_clicked)
self.del_surname = widgets.SimpleButton(Gtk.STOCK_REMOVE,
self.del_surname = widgets.SimpleButton('list-remove',
self.__del_clicked)
self.vbbox = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL)
self.vbbox.add(self.add_surname)
@ -1647,7 +1647,7 @@ class GuiDestinationOption(Gtk.Box):
self.__button = Gtk.Button()
img = Gtk.Image()
img.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
img.set_from_icon_name('document-open', Gtk.IconSize.BUTTON)
self.__button.add(img)
self.__button.connect('clicked', self.__select_file)
@ -1694,9 +1694,9 @@ class GuiDestinationOption(Gtk.Box):
my_action = Gtk.FileChooserAction.SAVE
fcd = Gtk.FileChooserDialog(_("Save As"), action=my_action,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN,
_('_Open'),
Gtk.ResponseType.OK))
name = os.path.abspath(self.__option.get_value())

View File

@ -100,7 +100,7 @@ class PluginStatus(ManagedWindow):
self.__preg = PluginRegister.get_instance()
self.set_window(Gtk.Dialog("", uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
(_('_Close'), Gtk.ResponseType.CLOSE)),
None, self.title)
self.window.set_size_request(750, 400)
self.window.connect('response', self.close)
@ -249,7 +249,7 @@ class PluginStatus(ManagedWindow):
button = Gtk.Button()
img = Gtk.Image()
img.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
img.set_from_icon_name('document-open', Gtk.IconSize.BUTTON)
button.add(img)
button.connect('clicked', self.__select_file)
install_row.pack_start(self.install_addon_path, True, True, 0)
@ -424,9 +424,9 @@ class PluginStatus(ManagedWindow):
Select a file from the file system.
"""
fcd = Gtk.FileChooserDialog(_("Load Addon"),
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN,
_('_Open'),
Gtk.ResponseType.OK))
name = self.install_addon_path.get_text()
dir = os.path.dirname(name)
@ -673,7 +673,7 @@ class PluginTrace(ManagedWindow):
self.set_window(Gtk.Dialog("", uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
(_('_Close'), Gtk.ResponseType.CLOSE)),
None, title)
self.window.set_size_request(600, 400)
self.window.connect('response', self.close)
@ -729,11 +729,11 @@ class ToolManagedWindowBase(ManagedWindow):
self.set_window(window, None, self.get_title())
#self.window.connect('response', self.close)
self.cancel = self.window.add_button(Gtk.STOCK_CLOSE,
self.cancel = self.window.add_button(_('_Close'),
Gtk.ResponseType.CANCEL)
self.cancel.connect('clicked', self.close)
self.ok = self.window.add_button(Gtk.STOCK_EXECUTE, Gtk.ResponseType.OK)
self.ok = self.window.add_button(_('_Execute'), Gtk.ResponseType.OK)
self.ok.connect('clicked', self.on_ok_clicked)
self.window.set_default_size(600, -1)

View File

@ -271,7 +271,7 @@ class WriterOptionBox(object):
box.pack_start(label, False, True, 0)
box.pack_start(self.filter_obj, True, True, 0)
box.pack_start(
SimpleButton(Gtk.STOCK_EDIT,
SimpleButton('gtk-edit',
lambda obj: self.edit_filter('Person', self.filter_obj)),
False, True, 0)
button.set_tooltip_text(_("Click to see preview after person filter"))
@ -288,7 +288,7 @@ class WriterOptionBox(object):
box.pack_start(label_note, False, True, 0)
box.pack_start(self.filter_note, True, True, 0)
box.pack_start(
SimpleButton(Gtk.STOCK_EDIT,
SimpleButton('gtk-edit',
lambda obj: self.edit_filter('Note', self.filter_note)),
False, True, 0)
button.set_tooltip_text(_("Click to see preview after note filter"))
@ -334,16 +334,14 @@ class WriterOptionBox(object):
if row == 0:
up.set_sensitive(0) # can't go up
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_GO_UP,
Gtk.IconSize.MENU)
image.set_from_icon_name('go-up', Gtk.IconSize.MENU)
up.set_image(image)
up.row = row - 1
self.up_n.append(up)
down = Gtk.Button()
down.connect("clicked", self.swap)
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_GO_DOWN,
Gtk.IconSize.MENU)
image.set_from_icon_name('go-down', Gtk.IconSize.MENU)
down.set_image(image)
down.row = row
if row == 4:
@ -384,15 +382,13 @@ class WriterOptionBox(object):
up = Gtk.Button()
up.set_sensitive(0)
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_GO_UP,
Gtk.IconSize.MENU)
image.set_from_icon_name('go-up', Gtk.IconSize.MENU)
up.set_image(image)
self.spacer.pack_start(up, False, True, 0)
down = Gtk.Button()
down.set_sensitive(0)
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_GO_DOWN,
Gtk.IconSize.MENU)
image.set_from_icon_name('go-down', Gtk.IconSize.MENU)
down.set_image(image)
self.spacer.pack_end(down, False, True, 0)
self.spacer_up = up

View File

@ -59,7 +59,7 @@ class DisplayBuf(ManagedWindow):
document)
self.set_window(Gtk.Dialog("",document.uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
(_('_Close'), Gtk.ResponseType.CLOSE)),
None, title)
self.window.set_size_request(600,400)
scrolled_window = Gtk.ScrolledWindow()

View File

@ -653,27 +653,32 @@ class BookSelector(ManagedWindow):
else:
sensitivity = 0
entries = [
(Gtk.STOCK_GO_UP, self.on_up_clicked, sensitivity),
(Gtk.STOCK_GO_DOWN, self.on_down_clicked, sensitivity),
(_("Setup"), self.on_setup_clicked, sensitivity),
(Gtk.STOCK_REMOVE, self.on_remove_clicked, sensitivity),
(None,None,0),
(Gtk.STOCK_CLEAR, self.on_clear_clicked, 1),
(Gtk.STOCK_SAVE, self.on_save_clicked, 1),
(Gtk.STOCK_OPEN, self.on_open_clicked, 1),
(_("Edit"), self.on_edit_clicked, 1),
(_('_Up'), 'go-up', self.on_up_clicked, sensitivity),
(_('_Down'), 'go-down', self.on_down_clicked, sensitivity),
(_("Setup"), None, self.on_setup_clicked, sensitivity),
(_('_Remove'), 'list-remove', self.on_remove_clicked, sensitivity),
('', None, None, 0),
(_('_Clear'), 'edit-clear', self.on_clear_clicked, 1),
(_('_Save'), 'document-save', self.on_save_clicked, 1),
(_('_Open'), 'document-open', self.on_open_clicked, 1),
(_("Edit"), None, self.on_edit_clicked, 1),
]
menu = Gtk.Menu()
menu.set_title(_('Book Menu'))
for stock_id, callback, sensitivity in entries:
item = Gtk.ImageMenuItem(stock_id)
self.menu = Gtk.Menu()
self.menu.set_title(_('Book Menu'))
for title, icon_name, callback, sensitivity in entries:
if icon_name:
item = Gtk.ImageMenuItem.new_with_mnemonic(title)
img = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
item.set_image(img)
else:
item = Gtk.MenuItem.new_with_mnemonic(title)
if callback:
item.connect("activate", callback)
item.set_sensitive(sensitivity)
item.show()
menu.append(item)
menu.popup(None, None, None, None, event.button, event.time)
self.menu.append(item)
self.menu.popup(None, None, None, None, event.button, event.time)
def build_avail_context_menu(self, event):
"""Builds the menu with the single Add option."""
@ -684,19 +689,24 @@ class BookSelector(ManagedWindow):
else:
sensitivity = 0
entries = [
(Gtk.STOCK_ADD, self.on_add_clicked, sensitivity),
(_('_Add'), 'list-add', self.on_add_clicked, sensitivity),
]
menu = Gtk.Menu()
menu.set_title(_('Available Items Menu'))
for stock_id, callback, sensitivity in entries:
item = Gtk.ImageMenuItem(stock_id)
self.menu = Gtk.Menu()
self.menu.set_title(_('Available Items Menu'))
for title, icon_name, callback, sensitivity in entries:
if icon_name:
item = Gtk.ImageMenuItem.new_with_mnemonic(title)
img = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
item.set_image(img)
else:
item = Gtk.MenuItem.new_with_mnemonic(title)
if callback:
item.connect("activate", callback)
item.set_sensitive(sensitivity)
item.show()
menu.append(item)
menu.popup(None, None, None, None, event.button, event.time)
self.menu.append(item)
self.menu.popup(None, None, None, None, event.button, event.time)
def on_book_ok_clicked(self, obj):
"""

View File

@ -41,7 +41,7 @@ class FileEntry(Gtk.Box):
self.set_homogeneous(False)
self.button = Gtk.Button()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
image.set_from_icon_name('document-open', Gtk.IconSize.BUTTON)
self.button.add(image)
self.button.connect('clicked', self.__select_file)
self.pack_start(self.entry, True, True, 0)
@ -57,9 +57,9 @@ class FileEntry(Gtk.Box):
dialog = Gtk.FileChooserDialog(self.title,
self.parent,
action=my_action,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN,
_('_Open'),
Gtk.ResponseType.OK))
name = os.path.basename(conv_to_unicode(self.entry.get_text()))

View File

@ -154,14 +154,14 @@ class ReportDialog(ManagedWindow):
self.set_window(window, None, self.get_title())
self.window.set_modal(True)
self.help = self.window.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)
self.help = self.window.add_button(_('_Help'), Gtk.ResponseType.HELP)
self.help.connect('clicked', self.on_help_clicked)
self.cancel = self.window.add_button(Gtk.STOCK_CANCEL,
self.cancel = self.window.add_button(_('_Cancel'),
Gtk.ResponseType.CANCEL)
self.cancel.connect('clicked', self.on_cancel)
self.ok = self.window.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
self.ok = self.window.add_button(_('_OK'), Gtk.ResponseType.OK)
self.ok.connect('clicked', self.on_ok_clicked)
self.window.set_position(Gtk.WindowPosition.CENTER)

View File

@ -47,71 +47,6 @@ from gramps.gen.constfunc import win
from gramps.gen.config import config
from gramps.gen.const import ICON
#-------------------------------------------------------------------------
#
# Functions
#
#-------------------------------------------------------------------------
def base_reg_stock_icons(iconpaths, extraiconsize, items):
"""
Reusable base to register stock icons in Gramps
:param iconpaths: list of main directory of the base icon, and extension,
eg:
[(os.path.join(IMAGE_DIR, 'scalable'), '.svg')]
:param extraiconsize: list of dir with extra prepared icon sizes and the
gtk size to use them for, eg:
[(os.path.join(IMAGE_DIR, '22x22'), Gtk.IconSize.LARGE_TOOLBAR)]
:param items: list of icons to register, eg:
[('gramps-db', _('Family Trees'), Gdk.ModifierType.CONTROL_MASK, 0, '')]
"""
# Register our stock items
##TODO GTK3: stock_add does not work on items, it must be Gtk.StockItem, but
## in python one cannot create them, bug http://www.gramps-project.org/bugs/view.php?id=5009
## However, it seems we do not need this line as stock icons are found via Iconset
## Gtk.stock_add (items)
# Add our custom icon factory to the list of defaults
factory = Gtk.IconFactory()
factory.add_default()
for data in items:
pixbuf = 0
for (dirname, ext) in iconpaths:
icon_file = os.path.expanduser(os.path.join(dirname, data[0]+ext))
if os.path.isfile(icon_file):
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file)
break
except:
pass
if not pixbuf :
pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON)
pixbuf = pixbuf.add_alpha(True, 255, 255, 255)
icon_set = Gtk.IconSet.new_from_pixbuf (pixbuf)
#add different sized icons, always png type!
for size in extraiconsize :
pixbuf = 0
icon_file = os.path.expanduser(
os.path.join(size[0], data[0]+'.png'))
if os.path.isfile(icon_file):
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file)
except:
pass
if pixbuf :
source = Gtk.IconSource()
source.set_size_wildcarded(False)
source.set_size(size[1])
source.set_pixbuf(pixbuf)
icon_set.add_source(source)
factory.add (data[0], icon_set)
#-------------------------------------------------------------------------
#
# GuiPluginManager
@ -154,7 +89,9 @@ class GuiPluginManager(Callback):
else:
#use the plugin directory
dir = pdata.directory
self.load_icons(pdata.icons, dir)
# Append icon directory to the theme search path
theme = Gtk.IconTheme.get_default()
theme.append_search_path(dir)
return self.basemgr.load_plugin(pdata)
def reload_plugins(self):
@ -164,52 +101,6 @@ class GuiPluginManager(Callback):
def __getattr__(self, name):
return getattr(self.basemgr, name)
def load_icons(self, icons, dir):
"""
Load icons in the iconfactory of Gramps, so they can be used in the
plugin.
The plugin directory must contain the directories scalable, 48x48, 22x22
and 16x16 with the icons, e.g. in dir we have:
- scalable/gramps_myplugin.svg
- 48x48/gramps_myplugin.png
- 22x22/gramps_myplugin.png
:param icons: New stock icons to register. e.g.
[('gramps_myplugin', _('My Plugin')),
('gramps_myplugin_open', _('Open Plugin'))]
:type icons: A list of tuples (stock_id, icon_label)
:param dir: Directory from where to load the icons
:type dir: str
"""
if win():
iconpaths = [
(os.path.join(dir, '48x48'), '.png'),
(dir, '.png'),
]
else :
iconpaths = [
(os.path.join(dir, 'scalable'), '.svg'),
(dir, '.svg'), (dir, '.png'),
]
#sizes: menu=16, small_toolbar=18, large_toolbar=24,
# button=20, dnd=32, dialog=48
#add to the back of this list to overrule images set at beginning of list
extraiconsize = [
(os.path.join(dir, '22x22'), Gtk.IconSize.LARGE_TOOLBAR),
(os.path.join(dir, '16x16'), Gtk.IconSize.MENU),
(os.path.join(dir, '22x22'), Gtk.IconSize.BUTTON),
]
items = []
for stock_id, label in icons:
items.append((stock_id, label, Gdk.ModifierType.CONTROL_MASK, 0, ''))
base_reg_stock_icons(iconpaths, extraiconsize, items)
def __hidden_changed(self, *args):
#if hidden changed, stored data must be emptied as it could contain
#something that now must be hidden

View File

@ -69,13 +69,13 @@ class UndoHistory(ManagedWindow):
window = Gtk.Dialog("", uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT, None)
self.undo_button = window.add_button(Gtk.STOCK_UNDO,
self.undo_button = window.add_button(_('_Undo'),
Gtk.ResponseType.REJECT)
self.redo_button = window.add_button(Gtk.STOCK_REDO,
self.redo_button = window.add_button(_('_Redo'),
Gtk.ResponseType.ACCEPT)
self.clear_button = window.add_button(Gtk.STOCK_CLEAR,
self.clear_button = window.add_button(_('_Clear'),
Gtk.ResponseType.APPLY)
self.close_button = window.add_button(Gtk.STOCK_CLOSE,
self.close_button = window.add_button(_('_Close'),
Gtk.ResponseType.CLOSE)
self.set_window(window, None, self.title)

View File

@ -167,7 +167,7 @@ class ProgressMeter(object):
if self.__can_cancel:
self.__dialog.set_size_request(350, 170)
self.__cancel_button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
self.__cancel_button = Gtk.Button.new_with_mnemonic(_('_Cancel'))
self.__cancel_button.connect('clicked', self.__cancel_callback)
self.__dialog.vbox.add(self.__cancel_button)
@ -181,7 +181,7 @@ class ProgressMeter(object):
area.add_with_viewport(text)
area.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
self.__dialog.vbox.add(area)
self.message_area_ok = Gtk.Button(stock=Gtk.STOCK_OK)
self.message_area_ok = Gtk.Button.new_with_mnemonic(_('_OK'))
self.message_area_ok.connect("clicked", self.close)
self.message_area_ok.set_sensitive(False)
self.__dialog.vbox.pack_start(self.message_area_ok, expand=False, fill=False)

View File

@ -92,6 +92,7 @@ from gramps.gen.db.exceptions import DbException
from .aboutdialog import GrampsAboutDialog
from .navigator import Navigator
from .views.tags import Tags
from .actiongroup import ActionGroup
#-------------------------------------------------------------------------
#
@ -446,7 +447,8 @@ class ViewManager(CLIManager):
Build the OPEN button. Since GTK's UIManager does not have support for
the Open Recent button, we must build in on our own.
"""
openbtn = Gtk.MenuToolButton.new_from_stock('gramps-db')
openbtn = Gtk.MenuToolButton()
openbtn.set_icon_name('gramps')
openbtn.connect('clicked', self.__open_activate)
openbtn.set_sensitive(False)
openbtn.set_tooltip_text(_("Connect to a recent database"))
@ -472,11 +474,11 @@ class ViewManager(CLIManager):
_("Manage databases"), self.__open_activate),
('OpenRecent', None, _('Open _Recent'), None,
_("Open an existing database")),
('Quit', Gtk.STOCK_QUIT, _('_Quit'), "<PRIMARY>q", None,
('Quit', 'application-exit', _('_Quit'), "<PRIMARY>q", None,
self.quit),
('ViewMenu', None, _('_View')),
('EditMenu', None, _('_Edit')),
('Preferences', Gtk.STOCK_PREFERENCES, _('_Preferences...'), None,
('Preferences', 'preferences-system', _('_Preferences...'), None,
None, self.preferences_activate),
('HelpMenu', None, _('_Help')),
('HomePage', None, _('Gramps _Home Page'), None, None,
@ -487,13 +489,13 @@ class ViewManager(CLIManager):
report_bug_activate),
('ExtraPlugins', None, _('_Extra Reports/Tools'), None, None,
extra_plugins_activate),
('About', Gtk.STOCK_ABOUT, _('_About'), None, None,
('About', 'help-about', _('_About'), None, None,
self.display_about_box),
('PluginStatus', None, _('_Plugin Manager'), None, None,
self.__plugin_status),
('FAQ', None, _('_FAQ'), None, None, faq_activate),
('KeyBindings', None, _('_Key Bindings'), None, None, key_bindings),
('UserManual', Gtk.STOCK_HELP, _('_User Manual'), 'F1', None,
('UserManual', 'help-browser', _('_User Manual'), 'F1', None,
manual_activate),
('TipOfDay', None, _('Tip of the Day'), None, None,
self.tip_of_day_activate),
@ -504,7 +506,7 @@ class ViewManager(CLIManager):
self.export_data),
('Backup', None, _("Make Backup..."), None,
_("Make a Gramps XML backup of the database"), self.quick_backup),
('Abandon', Gtk.STOCK_REVERT_TO_SAVED,
('Abandon', 'document-revert',
_('_Abandon Changes and Quit'), None, None, self.abort),
('Reports', 'gramps-reports', _('_Reports'), None,
_("Open the reports dialog"), self.reports_clicked),
@ -548,7 +550,7 @@ class ViewManager(CLIManager):
]
self._action_action_list = [
('Clipboard', Gtk.STOCK_PASTE, _('Clip_board'), "<PRIMARY>b",
('Clipboard', 'edit-paste', _('Clip_board'), "<PRIMARY>b",
_("Open the Clipboard dialog"), self.clipboard),
('Import', 'gramps-import', _('_Import...'), "<PRIMARY>i", None,
self.import_data),
@ -571,12 +573,12 @@ class ViewManager(CLIManager):
]
self._undo_action_list = [
('Undo', Gtk.STOCK_UNDO, _('_Undo'), '<PRIMARY>z', None,
('Undo', 'edit-undo', _('_Undo'), '<PRIMARY>z', None,
self.undo),
]
self._redo_action_list = [
('Redo', Gtk.STOCK_REDO, _('_Redo'), '<shift><PRIMARY>z', None,
('Redo', 'edit-redo', _('_Redo'), '<shift><PRIMARY>z', None,
self.redo),
]
@ -795,7 +797,7 @@ class ViewManager(CLIManager):
"""
Initialize an action group for the UIManager
"""
new_group = Gtk.ActionGroup(name=name)
new_group = ActionGroup(name=name)
new_group.add_actions(actions)
if toggles:
new_group.add_toggle_actions(toggles)
@ -974,7 +976,7 @@ class ViewManager(CLIManager):
# create icon/label for notebook tab (useful for debugging)
hbox = Gtk.Box()
image = Gtk.Image()
image.set_from_stock(page.get_stock(), Gtk.IconSize.MENU)
image.set_from_icon_name(page.get_stock(), Gtk.IconSize.MENU)
hbox.pack_start(image, False, True, 0)
hbox.add(Gtk.Label(label=pdata.name))
hbox.show_all()
@ -1159,10 +1161,10 @@ class ViewManager(CLIManager):
self.undoactions = Gtk.ActionGroup(name='Undo')
if label:
self.undoactions.add_actions([
('Undo', Gtk.STOCK_UNDO, label, '<PRIMARY>z', None, self.undo)])
('Undo', 'edit-undo', label, '<PRIMARY>z', None, self.undo)])
else:
self.undoactions.add_actions([
('Undo', Gtk.STOCK_UNDO, _('_Undo'),
('Undo', 'edit-undo', _('_Undo'),
'<PRIMARY>z', None, self.undo)])
self.undoactions.set_sensitive(False)
self.uimanager.insert_action_group(self.undoactions, 1)
@ -1175,11 +1177,11 @@ class ViewManager(CLIManager):
self.redoactions = Gtk.ActionGroup(name='Redo')
if label:
self.redoactions.add_actions([
('Redo', Gtk.STOCK_REDO, label, '<shift><PRIMARY>z',
('Redo', 'edit-redo', label, '<shift><PRIMARY>z',
None, self.redo)])
else:
self.redoactions.add_actions([
('Redo', Gtk.STOCK_UNDO, _('_Redo'),
('Redo', 'edit-undo', _('_Redo'),
'<shift><PRIMARY>z', None, self.redo)])
self.redoactions.set_sensitive(False)
self.uimanager.insert_action_group(self.redoactions, 1)
@ -1218,9 +1220,9 @@ class ViewManager(CLIManager):
self.uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT, None)
window.set_size_request(400, -1)
ok_button = window.add_button(Gtk.STOCK_OK,
ok_button = window.add_button(_('_OK'),
Gtk.ResponseType.APPLY)
close_button = window.add_button(Gtk.STOCK_CLOSE,
close_button = window.add_button(_('_Close'),
Gtk.ResponseType.CLOSE)
vbox = window.get_content_area()
hbox = Gtk.Box()
@ -1238,7 +1240,7 @@ class ViewManager(CLIManager):
button.connect("clicked",
lambda widget: self.select_backup_path(widget, path_entry))
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
image.set_from_icon_name('document-open', Gtk.IconSize.BUTTON)
image.show()
button.add(image)
hbox.pack_end(button, False, True, 0)
@ -1337,9 +1339,9 @@ class ViewManager(CLIManager):
title=_("Select backup directory"),
parent=self.window,
action=Gtk.FileChooserAction.SELECT_FOLDER,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_APPLY,
_('_Apply'),
Gtk.ResponseType.OK))
mpath = path_entry.get_text()
if not mpath:

View File

@ -227,14 +227,14 @@ class Bookmarks :
bbox = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL)
bbox.set_layout(Gtk.ButtonBoxStyle.START)
bbox.set_spacing(6)
up = Gtk.Button(stock=Gtk.STOCK_GO_UP)
down = Gtk.Button(stock=Gtk.STOCK_GO_DOWN)
delete = Gtk.Button(stock=Gtk.STOCK_REMOVE)
up = Gtk.Button.new_with_mnemonic(_('_Up'))
down = Gtk.Button.new_with_mnemonic(_('_Down'))
delete = Gtk.Button.new_with_mnemonic(_('_Remove'))
up.connect('clicked', self.up_clicked)
down.connect('clicked', self.down_clicked)
delete.connect('clicked', self.delete_clicked)
self.top.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.top.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)
self.top.add_button(_('_Close'), Gtk.ResponseType.CLOSE)
self.top.add_button(_('_Help'), Gtk.ResponseType.HELP)
self.top.connect('delete-event', self.close)
bbox.add(up)
bbox.add(down)

View File

@ -51,6 +51,7 @@ from gi.repository import Pango
#----------------------------------------------------------------
from .pageview import PageView
from .navigationview import NavigationView
from ..actiongroup import ActionGroup
from ..columnorder import ColumnOrder
from gramps.gen.config import config
from gramps.gen.errors import WindowActiveError
@ -203,23 +204,23 @@ class ListView(NavigationView):
NavigationView.define_actions(self)
self.edit_action = Gtk.ActionGroup(name=self.title + '/ChangeOrder')
self.edit_action = ActionGroup(name=self.title + '/ChangeOrder')
self.edit_action.add_actions([
('Add', Gtk.STOCK_ADD, _("_Add..."), "<PRIMARY>Insert",
self.ADD_MSG, self.add),
('Remove', Gtk.STOCK_REMOVE, _("_Remove"), "<PRIMARY>Delete",
self.DEL_MSG, self.remove),
('Add', 'list-add', _("_Add..."), "<PRIMARY>Insert",
self.ADD_MSG, self.add),
('Remove', 'list-remove', _("_Remove"), "<PRIMARY>Delete",
self.DEL_MSG, self.remove),
('Merge', 'gramps-merge', _('_Merge...'), None,
self.MERGE_MSG, self.merge),
('ExportTab', None, _('Export View...'), None, None,
self.export),
self.export),
])
self._add_action_group(self.edit_action)
self._add_action('Edit', Gtk.STOCK_EDIT, _("action|_Edit..."),
accel="<PRIMARY>Return",
tip=self.EDIT_MSG,
self._add_action('Edit', 'gtk-edit', _("action|_Edit..."),
accel="<PRIMARY>Return",
tip=self.EDIT_MSG,
callback=self.edit)
def build_columns(self):
@ -244,7 +245,7 @@ class ListView(NavigationView):
if col_icon is not None:
image = Gtk.Image()
image.set_from_stock(col_icon, Gtk.IconSize.MENU)
image.set_from_icon_name(col_icon, Gtk.IconSize.MENU)
image.set_tooltip_text(col_name)
image.show()
column.set_widget(image)
@ -265,13 +266,13 @@ class ListView(NavigationView):
def icon(self, column, renderer, model, iter_, col_num):
'''
Set the stock icon property of the cell renderer. We use a cell data
Set the icon-name property of the cell renderer. We use a cell data
function because there is a problem returning None from a model.
'''
stock_id = model.get_value(iter_, col_num)
if stock_id == '':
stock_id = None
renderer.set_property('stock_id', stock_id)
icon_name = model.get_value(iter_, col_num)
if icon_name == '':
icon_name = None
renderer.set_property('icon-name', icon_name)
def foreground_color(self, column, renderer, model, iter_, data=None):
'''
@ -471,7 +472,7 @@ class ListView(NavigationView):
return None
def drag_begin(self, widget, context):
widget.drag_source_set_icon_stock(self.get_stock())
widget.drag_source_set_icon_name(self.get_stock())
def drag_data_get(self, widget, context, sel_data, info, time):
selected_ids = self.selected_handles()
@ -998,8 +999,8 @@ class ListView(NavigationView):
_("Export View as Spreadsheet"),
self.uistate.window,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
(_('_Cancel'), Gtk.ResponseType.CANCEL,
_('_Save'), Gtk.ResponseType.OK))
chooser.set_do_overwrite_confirmation(True)
combobox = Gtk.ComboBoxText()

View File

@ -46,6 +46,7 @@ from gi.repository import Gtk
#
#----------------------------------------------------------------
from .pageview import PageView
from ..actiongroup import ActionGroup
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
from gramps.gen.utils.db import navigation_label
@ -265,7 +266,7 @@ class NavigationView(PageView):
"""
Define the bookmark menu actions.
"""
self.book_action = Gtk.ActionGroup(name=self.title + '/Bookmark')
self.book_action = ActionGroup(name=self.title + '/Bookmark')
self.book_action.add_actions([
('AddBook', 'gramps-bookmark-new', _('_Add Bookmark'),
'<PRIMARY>d', None, self.add_bookmark),
@ -285,29 +286,29 @@ class NavigationView(PageView):
Define the navigation menu actions.
"""
# add the Forward action group to handle the Forward button
self.fwd_action = Gtk.ActionGroup(name=self.title + '/Forward')
self.fwd_action = ActionGroup(name=self.title + '/Forward')
self.fwd_action.add_actions([
('Forward', Gtk.STOCK_GO_FORWARD, _("_Forward"),
"%sRight" % mod_key(), _("Go to the next object in the history"),
('Forward', 'go-next', _("_Forward"),
"%sRight" % mod_key(), _("Go to the next object in the history"),
self.fwd_clicked)
])
# add the Backward action group to handle the Forward button
self.back_action = Gtk.ActionGroup(name=self.title + '/Backward')
self.back_action = ActionGroup(name=self.title + '/Backward')
self.back_action.add_actions([
('Back', Gtk.STOCK_GO_BACK, _("_Back"),
"%sLeft" % mod_key(), _("Go to the previous object in the history"),
('Back', 'go-previous', _("_Back"),
"%sLeft" % mod_key(), _("Go to the previous object in the history"),
self.back_clicked)
])
self._add_action('HomePerson', Gtk.STOCK_HOME, _("_Home"),
accel="%sHome" % mod_key(),
self._add_action('HomePerson', 'go-home', _("_Home"),
accel="%sHome" % mod_key(),
tip=_("Go to the default person"), callback=self.home)
self.other_action = Gtk.ActionGroup(name=self.title + '/PersonOther')
self.other_action = ActionGroup(name=self.title + '/PersonOther')
self.other_action.add_actions([
('SetActive', Gtk.STOCK_HOME, _("Set _Home Person"), None,
None, self.set_default_person),
('SetActive', 'go-home', _("Set _Home Person"), None,
None, self.set_default_person),
])
self._add_action_group(self.back_action)
@ -356,8 +357,8 @@ class NavigationView(PageView):
text.set_activates_default(True)
hbox.pack_start(text, False, True, 0)
dialog.vbox.pack_start(hbox, False, True, 0)
dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_JUMP_TO, Gtk.ResponseType.OK)
dialog.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
_('_Jump to'), Gtk.ResponseType.OK)
dialog.set_default_response(Gtk.ResponseType.OK)
dialog.vbox.show_all()
@ -449,7 +450,7 @@ class NavigationView(PageView):
"%s%d" % (mod_key(), index), None,
make_callback(hobj.push, handle)))
self.mru_action = Gtk.ActionGroup(name=self.title + '/MRU')
self.mru_action = ActionGroup(name=self.title + '/MRU')
self.mru_action.add_actions(data)
self.mru_enable()

View File

@ -50,6 +50,7 @@ from ..dbguielement import DbGUIElement
from ..widgets.grampletbar import GrampletBar
from ..configure import ConfigureDialog
from gramps.gen.config import config
from ..actiongroup import ActionGroup
#------------------------------------------------------------------------------
#
@ -350,14 +351,14 @@ class PageView(DbGUIElement):
Return image associated with the view category, which is used for the
icon for the button.
"""
return Gtk.STOCK_MISSING_IMAGE
return 'image-missing'
def get_viewtype_stock(self):
"""
Return immage associated with the viewtype inside a view category, it
will be used for the icon on the button to select view in the category
"""
return Gtk.STOCK_MISSING_IMAGE
return 'image-missing'
def get_title(self):
"""
@ -414,26 +415,26 @@ class PageView(DbGUIElement):
and self.action_toggle_list. The user should define these in
self.define_actions
"""
self.action_group = Gtk.ActionGroup(name=self.title)
self.action_group = ActionGroup(name=self.title)
if len(self.action_list) > 0:
self.action_group.add_actions(self.action_list)
if len(self.action_toggle_list) > 0:
self.action_group.add_toggle_actions(self.action_toggle_list)
def _add_action(self, name, stock_icon, label, accel=None, tip=None,
def _add_action(self, name, icon_name, label, accel=None, tip=None,
callback=None):
"""
Add an action to the action list for the current view.
"""
self.action_list.append((name, stock_icon, label, accel, tip,
self.action_list.append((name, icon_name, label, accel, tip,
callback))
def _add_toggle_action(self, name, stock_icon, label, accel=None,
def _add_toggle_action(self, name, icon_name, label, accel=None,
tip=None, callback=None, value=False):
"""
Add a toggle action to the action list for the current view.
"""
self.action_toggle_list.append((name, stock_icon, label, accel,
self.action_toggle_list.append((name, icon_name, label, accel,
tip, callback, value))
def _add_toolmenu_action(self, name, label, tooltip, callback,

View File

@ -50,6 +50,7 @@ from gramps.gen.const import URL_MANUAL_PAGE
from ..display import display_help
from ..dialog import ErrorDialog, QuestionDialog2
import gramps.gui.widgets.progressdialog as progressdlg
from ..actiongroup import ActionGroup
#-------------------------------------------------------------------------
#
@ -203,7 +204,7 @@ class Tags(DbGUIElement):
if self.db is None:
self.tag_ui = ''
self.tag_action = Gtk.ActionGroup(name='Tag')
self.tag_action = ActionGroup(name='Tag')
return
tag_menu = '<menuitem action="NewTag"/>'
@ -224,7 +225,7 @@ class Tags(DbGUIElement):
actions.append(('TagButton', 'gramps-tag', _('Tag'), None,
_('Tag selected rows'), self.cb_tag_button))
self.tag_action = Gtk.ActionGroup(name='Tag')
self.tag_action = ActionGroup(name='Tag')
self.tag_action.add_actions(actions)
def cb_tag_button(self, action):
@ -404,18 +405,18 @@ class OrganizeTagsDialog(object):
bbox = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL)
bbox.set_layout(Gtk.ButtonBoxStyle.START)
bbox.set_spacing(6)
up = Gtk.Button(stock=Gtk.STOCK_GO_UP)
down = Gtk.Button(stock=Gtk.STOCK_GO_DOWN)
add = Gtk.Button(stock=Gtk.STOCK_ADD)
edit = Gtk.Button(stock=Gtk.STOCK_EDIT)
remove = Gtk.Button(stock=Gtk.STOCK_REMOVE)
up = Gtk.Button.new_with_mnemonic(_('_Up'))
down = Gtk.Button.new_with_mnemonic(_('_Down'))
add = Gtk.Button.new_with_mnemonic(_('_Add'))
edit = Gtk.Button.new_with_mnemonic(_('_Edit'))
remove = Gtk.Button.new_with_mnemonic(_('_Remove'))
up.connect('clicked', self.cb_up_clicked)
down.connect('clicked', self.cb_down_clicked)
add.connect('clicked', self.cb_add_clicked, top)
edit.connect('clicked', self.cb_edit_clicked, top)
remove.connect('clicked', self.cb_remove_clicked, top)
top.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
top.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)
top.add_button(_('_Close'), Gtk.ResponseType.CLOSE)
top.add_button(_('_Help'), Gtk.ResponseType.HELP)
bbox.add(up)
bbox.add(down)
bbox.add(add)
@ -615,7 +616,7 @@ class EditTag(object):
hbox.pack_start(self.entry, True, True, 5)
hbox.pack_start(self.color, False, False, 5)
top.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
top.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
top.add_button(_('_OK'), Gtk.ResponseType.OK)
top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
top.show_all()
return top

View File

@ -40,18 +40,6 @@ from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
# STOCK_INFO was added only in Gtk 2.8
try:
INFO_ICON = Gtk.STOCK_INFO
except AttributeError:
INFO_ICON = Gtk.STOCK_DIALOG_INFO
#-------------------------------------------------------------------------
#
# IconButton class
@ -59,11 +47,10 @@ except AttributeError:
#-------------------------------------------------------------------------
class IconButton(Gtk.Button):
def __init__(self, func, handle, icon=Gtk.STOCK_EDIT,
size=Gtk.IconSize.MENU):
def __init__(self, func, handle, icon='gtk-edit', size=Gtk.IconSize.MENU):
GObject.GObject.__init__(self)
image = Gtk.Image()
image.set_from_stock(icon, size)
image.set_from_icon_name(icon, size)
image.show()
self.add(image)
self.set_relief(Gtk.ReliefStyle.NONE)
@ -89,7 +76,7 @@ class WarnButton(Gtk.Button):
GObject.GObject.__init__(self)
image = Gtk.Image()
image.set_from_stock(INFO_ICON, Gtk.IconSize.MENU)
image.set_from_icon_name('dialog-information', Gtk.IconSize.MENU)
image.show()
self.add(image)
@ -123,7 +110,7 @@ class SimpleButton(Gtk.Button):
def __init__(self, image, func):
GObject.GObject.__init__(self)
self.set_relief(Gtk.ReliefStyle.NONE)
self.add(Gtk.Image.new_from_stock(image, Gtk.IconSize.BUTTON))
self.add(Gtk.Image.new_from_icon_name(image, Gtk.IconSize.BUTTON))
self.connect('clicked', func)
self.show()
@ -169,13 +156,11 @@ class PrivacyButton(object):
obj.remove(child)
image = Gtk.Image()
if obj.get_active():
# image.set_from_icon_name('stock_lock', Gtk.IconSize.MENU)
image.set_from_stock('gramps-lock', Gtk.IconSize.MENU)
image.set_from_icon_name('gramps-lock', Gtk.IconSize.MENU)
obj.set_tooltip_text(_('Record is private'))
self.obj.set_privacy(True)
else:
# image.set_from_icon_name('stock_lock-open', Gtk.IconSize.MENU)
image.set_from_stock('gramps-unlock', Gtk.IconSize.MENU)
image.set_from_icon_name('gramps-unlock', Gtk.IconSize.MENU)
obj.set_tooltip_text(_('Record is public'))
self.obj.set_privacy(False)
image.show()

View File

@ -57,7 +57,7 @@ class DateEntry(Gtk.Box):
self.entry.set_width_chars(13)
self.pack_start(self.entry, True, True, 0)
image = Gtk.Image()
image.set_from_stock('gramps-date-edit', Gtk.IconSize.BUTTON)
image.set_from_icon_name('gramps-date-edit', Gtk.IconSize.BUTTON)
button = Gtk.Button()
button.set_image(image)
button.set_relief(Gtk.ReliefStyle.NORMAL)

View File

@ -1595,7 +1595,7 @@ class FanChartGrampsGUI(object):
if not person:
return 0
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
go_item = Gtk.ImageMenuItem(name_displayer.display(person))
go_item.set_image(go_image)
@ -1603,15 +1603,17 @@ class FanChartGrampsGUI(object):
go_item.show()
menu.append(go_item)
edit_item = Gtk.ImageMenuItem.new_from_stock(stock_id=Gtk.STOCK_EDIT,
accel_group=None)
edit_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Edit'))
img = Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.MENU)
edit_item.set_image(img)
edit_item.connect("activate", self.edit_person_cb, person_handle)
edit_item.show()
menu.append(edit_item)
if family_handle:
family = self.dbstate.db.get_family_from_handle(family_handle)
edit_fam_item = Gtk.ImageMenuItem.new_from_stock(
stock_id=Gtk.STOCK_EDIT, accel_group=None)
edit_fam_item = Gtk.ImageMenuItem()
img = Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.MENU)
edit_fam_item.set_image(img)
edit_fam_item.set_label(_("Edit family"))
edit_fam_item.connect("activate", self.edit_fam_cb, family_handle)
edit_fam_item.show()
@ -1627,15 +1629,19 @@ class FanChartGrampsGUI(object):
lenfams = len(partner.get_family_handle_list())
if lenfams in [0, 1]:
lenfams = len(partner.get_parent_family_handle_list())
reord_fam_item = Gtk.ImageMenuItem.new_from_stock(
stock_id=Gtk.STOCK_SORT_ASCENDING, accel_group=None)
reord_fam_item = Gtk.ImageMenuItem()
img = Gtk.Image.new_from_icon_name('view-sort-ascending',
Gtk.IconSize.MENU)
reord_fam_item.set_image(img)
reord_fam_item.set_label(_("Reorder families"))
reord_fam_item.connect("activate", self.reord_fam_cb, parth)
reord_fam_item.set_sensitive(lenfams > 1)
reord_fam_item.show()
menu.append(reord_fam_item)
clipboard_item = Gtk.ImageMenuItem.new_from_stock(stock_id=Gtk.STOCK_COPY, accel_group=None)
clipboard_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Copy'))
img = Gtk.Image.new_from_icon_name('edit-copy', Gtk.IconSize.MENU)
clipboard_item.set_image(img)
clipboard_item.connect("activate", self.copy_person_to_clipboard_cb,
person_handle)
clipboard_item.show()
@ -1663,7 +1669,7 @@ class FanChartGrampsGUI(object):
item.set_submenu(Gtk.Menu())
sp_menu = item.get_submenu()
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO, Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
sp_item = Gtk.ImageMenuItem(name_displayer.display(spouse))
sp_item.set_image(go_image)
@ -1703,9 +1709,9 @@ class FanChartGrampsGUI(object):
else:
label = Gtk.Label(label=escape(name_displayer.display(sib)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO, Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
sib_item = Gtk.ImageMenuItem(None)
sib_item = Gtk.ImageMenuItem()
sib_item.set_image(go_image)
label.set_use_markup(True)
label.show()
@ -1740,9 +1746,9 @@ class FanChartGrampsGUI(object):
else:
label = Gtk.Label(label=escape(name_displayer.display(child)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO, Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
child_item = Gtk.ImageMenuItem(None)
child_item = Gtk.ImageMenuItem()
child_item.set_image(go_image)
label.set_use_markup(True)
label.show()
@ -1777,9 +1783,9 @@ class FanChartGrampsGUI(object):
else:
label = Gtk.Label(label=escape(name_displayer.display(par)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO, Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
par_item = Gtk.ImageMenuItem(None)
par_item = Gtk.ImageMenuItem()
par_item.set_image(go_image)
label.set_use_markup(True)
label.show()
@ -1792,7 +1798,9 @@ class FanChartGrampsGUI(object):
if no_parents:
#show an add button
add_item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ADD, None)
add_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Add'))
img = Gtk.Image.new_from_icon_name('list-add', Gtk.IconSize.MENU)
add_item.set_image(img)
add_item.connect("activate", self.on_add_parents, person_handle)
add_item.show()
par_menu.append(add_item)
@ -1818,9 +1826,9 @@ class FanChartGrampsGUI(object):
label = Gtk.Label(label=escape(name_displayer.display(per)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO, Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
per_item = Gtk.ImageMenuItem(None)
per_item = Gtk.ImageMenuItem()
per_item.set_image(go_image)
label.set_use_markup(True)
label.show()
@ -1841,8 +1849,9 @@ class FanChartGrampsGUI(object):
add_menu = item.get_submenu()
if family_handle:
# allow to add a child to this family
add_child_item = Gtk.ImageMenuItem.new_from_stock(
stock_id=Gtk.STOCK_ADD, accel_group=None)
add_child_item = Gtk.ImageMenuItem()
img = Gtk.Image.new_from_icon_name('list-add', Gtk.IconSize.MENU)
add_child_item.set_image(img)
add_child_item.set_label(_("Add child to family"))
add_child_item.connect("activate", self.add_child_to_fam_cb,
family_handle)
@ -1850,16 +1859,18 @@ class FanChartGrampsGUI(object):
add_menu.append(add_child_item)
elif person_handle:
#allow to add a partner to this person
add_partner_item = Gtk.ImageMenuItem.new_from_stock(
stock_id=Gtk.STOCK_ADD, accel_group=None)
add_partner_item = Gtk.ImageMenuItem()
img = Gtk.Image.new_from_icon_name('list-add', Gtk.IconSize.MENU)
add_partner_item.set_image(img)
add_partner_item.set_label(_("Add partner to person"))
add_partner_item.connect("activate", self.add_partner_to_pers_cb,
person_handle)
add_partner_item.show()
add_menu.append(add_partner_item)
add_pers_item = Gtk.ImageMenuItem.new_from_stock(stock_id=Gtk.STOCK_ADD,
accel_group=None)
add_pers_item = Gtk.ImageMenuItem()
img = Gtk.Image.new_from_icon_name('list-add', Gtk.IconSize.MENU)
add_pers_item.set_image(img)
add_pers_item.set_label(_("Add a person"))
add_pers_item.connect("activate", self.add_person_cb)
add_pers_item.show()

View File

@ -612,13 +612,13 @@ class DetachedWindow(ManagedWindow):
self.title)
self.set_window(Gtk.Dialog("", gramplet.uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
(_('_Close'), Gtk.ResponseType.CLOSE)),
None,
self.title)
self.window.move(x_pos, y_pos)
self.window.set_default_size(gramplet.detached_width,
gramplet.detached_height)
self.window.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)
self.window.add_button(_('_Help'), Gtk.ResponseType.HELP)
self.window.connect('response', self.handle_response)
self.notebook = Gtk.Notebook()
@ -640,7 +640,7 @@ class DetachedWindow(ManagedWindow):
"""
Callback for taking care of button clicks.
"""
if response in [Gtk.ResponseType.CLOSE, Gtk.STOCK_CLOSE]:
if response == Gtk.ResponseType.CLOSE:
self.close()
elif response == Gtk.ResponseType.HELP:
# translated name:
@ -703,7 +703,7 @@ class TabLabel(Gtk.Box):
self.closebtn = Gtk.Button()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
image.set_from_icon_name('window-close', Gtk.IconSize.MENU)
self.closebtn.connect("clicked", callback, gramplet)
self.closebtn.set_image(image)
self.closebtn.set_relief(Gtk.ReliefStyle.NONE)

View File

@ -235,11 +235,11 @@ class GrampletWindow(ManagedWindow):
self.title)
self.set_window(Gtk.Dialog("", gramplet.uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
(_('_Close'), Gtk.ResponseType.CLOSE)),
None, self.title)
self.window.set_size_request(gramplet.detached_width,
gramplet.detached_height)
self.window.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)
self.window.add_button(_('_Help'), Gtk.ResponseType.HELP)
# add gramplet:
if self.gramplet.pui:
self.gramplet.pui.active = True
@ -260,7 +260,7 @@ class GrampletWindow(ManagedWindow):
"""
Callback for taking care of button clicks.
"""
if response in [Gtk.ResponseType.CLOSE, Gtk.STOCK_CLOSE]:
if response == Gtk.ResponseType.CLOSE:
self.close()
elif response == Gtk.ResponseType.HELP:
# translated name:
@ -572,7 +572,7 @@ class GuiGramplet(object):
label.set_alignment(1.0, 0.5)
labels.pack_start(label, True, True, 0)
options.pack_start(self.pui.option_dict[item][0], True, True, 0) # widget
save_button = Gtk.Button(stock=Gtk.STOCK_SAVE)
save_button = Gtk.Button.new_with_mnemonic(_('_Save'))
topbox.pack_end(save_button, False, False, 0)
save_button.connect('clicked', self.pui.save_update_options)
frame.add(topbox)
@ -775,11 +775,11 @@ class GridGramplet(GuiGramplet):
self.gvstate.connect('clicked', self.change_state)
self.gvproperties = self.xml.get_object('gvproperties')
self.gvproperties.connect('clicked', self.set_properties)
self.xml.get_object('gvcloseimage').set_from_stock(Gtk.STOCK_CLOSE,
self.xml.get_object('gvcloseimage').set_from_icon_name('window-close',
Gtk.IconSize.MENU)
self.xml.get_object('gvstateimage').set_from_stock(Gtk.STOCK_REMOVE,
self.xml.get_object('gvstateimage').set_from_icon_name('list-remove',
Gtk.IconSize.MENU)
self.xml.get_object('gvpropertiesimage').set_from_stock(Gtk.STOCK_PROPERTIES,
self.xml.get_object('gvpropertiesimage').set_from_icon_name('document-properties',
Gtk.IconSize.MENU)
# source:
@ -864,14 +864,14 @@ class GridGramplet(GuiGramplet):
self.gstate = state
if state == "minimized":
self.scrolledwindow.hide()
self.xml.get_object('gvstateimage').set_from_stock(Gtk.STOCK_ADD,
self.xml.get_object('gvstateimage').set_from_icon_name('list-add',
Gtk.IconSize.MENU)
column = self.mainframe.get_parent() # column
expand, fill, padding, pack = column.query_child_packing(self.mainframe)
column.set_child_packing(self.mainframe, False, fill, padding, pack)
else:
self.scrolledwindow.show()
self.xml.get_object('gvstateimage').set_from_stock(Gtk.STOCK_REMOVE,
self.xml.get_object('gvstateimage').set_from_icon_name('list-remove',
Gtk.IconSize.MENU)
column = self.mainframe.get_parent() # column
expand, fill, padding, pack = column.query_child_packing(self.mainframe)

View File

@ -191,8 +191,8 @@ class EditLabel(Gtk.Box):
Gtk.Box.__init__(self)
label = BasicLabel(text)
self.pack_start(label, False, True, 0)
self.pack_start(Gtk.Image.new_from_stock(Gtk.STOCK_EDIT,
Gtk.IconSize.MENU), False)
self.pack_start(Gtk.Image.new_from_icon_name('gtk-edit',
Gtk.IconSize.MENU), False)
self.set_spacing(4)
self.show_all()

View File

@ -620,7 +620,7 @@ class MonitoredDate(object):
self.button_obj = button
image = Gtk.Image()
image.set_from_stock('gramps-date-edit', Gtk.IconSize.BUTTON)
image.set_from_icon_name('gramps-date-edit', Gtk.IconSize.BUTTON)
self.button_obj.set_image(image)
self.button_obj.set_relief(Gtk.ReliefStyle.NORMAL)
self.pixmap_obj = self.button_obj.get_child()
@ -836,7 +836,7 @@ class MonitoredTagList(object):
self.label.set_alignment(0, 0.5)
self.label.set_ellipsize(Pango.EllipsizeMode.END)
image = Gtk.Image()
image.set_from_stock('gramps-tag', Gtk.IconSize.MENU)
image.set_from_icon_name('gramps-tag', Gtk.IconSize.MENU)
button.set_image (image)
button.set_tooltip_text(_('Edit the tag list'))
button.connect('button-press-event', self.cb_edit)

View File

@ -435,7 +435,7 @@ class _GtkProgressBar(Gtk.Box):
# Only display the cancel button is the operation
# can be canceled.
if long_op_status.can_cancel():
self._cancel = Gtk.Button(stock=Gtk.STOCK_CANCEL)
self._cancel = Gtk.Button.new_with_mnemonic(_('_Cancel'))
self._cancel.connect("clicked",
lambda x: long_op_status.cancel())
self._cancel.show()

View File

@ -310,7 +310,7 @@ class SelectionWidget(Gtk.ScrolledWindow):
Displays a 'missing image' icon in the widget.
"""
self.pixbuf = None
self.image.set_from_stock(Gtk.STOCK_MISSING_IMAGE, Gtk.IconSize.DIALOG)
self.image.set_from_icon_name('image-missing', Gtk.IconSize.DIALOG)
self.image.queue_draw()
# ======================================================

View File

@ -63,6 +63,7 @@ from ..display import display_url
from ..utils import SystemFonts, rgb_to_hex
from gramps.gen.config import config
from gramps.gen.constfunc import has_display
from ..actiongroup import ActionGroup
#-------------------------------------------------------------------------
#
@ -472,12 +473,12 @@ class StyledTextEditor(Gtk.TextView):
# define the actions...
# ...first the toggle actions, which have a ToggleToolButton as proxy
format_toggle_actions = [
(str(StyledTextTagType.ITALIC), Gtk.STOCK_ITALIC, None, None,
(str(StyledTextTagType.ITALIC), 'format-text-italic', None, None,
_('Italic'), self._on_toggle_action_activate),
(str(StyledTextTagType.BOLD), Gtk.STOCK_BOLD, None, None,
(str(StyledTextTagType.BOLD), 'format-text-bold', None, None,
_('Bold'), self._on_toggle_action_activate),
(str(StyledTextTagType.UNDERLINE), Gtk.STOCK_UNDERLINE, None, None,
_('Underline'), self._on_toggle_action_activate),
(str(StyledTextTagType.UNDERLINE), 'format-text-underline', None,
None, _('Underline'), self._on_toggle_action_activate),
]
self.toggle_actions = [action[0] for action in format_toggle_actions]
@ -486,11 +487,11 @@ class StyledTextEditor(Gtk.TextView):
format_actions = [
(str(StyledTextTagType.FONTCOLOR), 'gramps-font-color', None, None,
_('Font Color'), self._on_action_activate),
(str(StyledTextTagType.HIGHLIGHT), 'gramps-font-bgcolor', None, None,
_('Background Color'), self._on_action_activate),
(str(StyledTextTagType.LINK), Gtk.STOCK_JUMP_TO, None, None,
(str(StyledTextTagType.HIGHLIGHT), 'gramps-font-bgcolor', None,
None, _('Background Color'), self._on_action_activate),
(str(StyledTextTagType.LINK), 'go-jump', None, None,
_('Link'), self._on_link_activate),
('clear', Gtk.STOCK_CLEAR, None, None,
('clear', 'edit-clear', None, None,
_('Clear Markup'), self._format_clear_cb),
]
@ -529,14 +530,15 @@ class StyledTextEditor(Gtk.TextView):
}
# create the action group and insert all the actions
self.action_group = Gtk.ActionGroup(name='Format')
self.action_group = ActionGroup(name='Format')
self.action_group.add_toggle_actions(format_toggle_actions)
self.undo_action = Gtk.Action(name="Undo", label=_('Undo'),
tooltip=_('Undo'),
stock_id=Gtk.STOCK_UNDO)
tooltip=_('Undo'))
self.undo_action.set_icon_name('edit-undo')
self.undo_action.connect('activate', self.undo)
self.redo_action = Gtk.Action.new("Redo", _('Redo'), _('Redo'),
Gtk.STOCK_REDO)
self.redo_action = Gtk.Action.new(name="Redo", label=_('Redo'),
tooltip=_('Redo'))
self.redo_action.set_icon_name('edit-redo')
self.redo_action.connect('activate', self.redo)
self.action_group.add_action(self.undo_action)
self.action_group.add_action(self.redo_action)

View File

@ -54,17 +54,6 @@ from gi.repository import Pango
from gramps.gen.errors import MaskError, ValidationError, WindowActiveError
from .undoableentry import UndoableEntry
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
# STOCK_INFO was added only in Gtk 2.8
try:
INFO_ICON = Gtk.STOCK_INFO
except AttributeError:
INFO_ICON = Gtk.STOCK_DIALOG_INFO
#============================================================================
#
# MaskedEntry and ValidatableMaskedEntry copied and merged from the Kiwi
@ -1021,8 +1010,8 @@ class MaskedEntry(UndoableEntry):
def set_pixbuf(self, pixbuf):
self.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, pixbuf)
def set_stock(self, stock_name):
self.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, stock_name)
def set_stock(self, icon_name):
self.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, icon_name)
def update_background(self, color, unset=False):
maxvalcol = 65535.
@ -1100,8 +1089,8 @@ class MaskedEntry(UndoableEntry):
#number = (int, float, long)
VALIDATION_ICON_WIDTH = 16
MANDATORY_ICON = INFO_ICON
ERROR_ICON = Gtk.STOCK_STOP
MANDATORY_ICON = 'dialog-information'
ERROR_ICON = 'process-stop'
class ValidatableMaskedEntry(MaskedEntry):
"""

View File

@ -70,7 +70,8 @@ OPENGL = True
#-------------------------------------------------------------------------
#open_icon = QtGui.QIcon.fromTheme('open')
FAMTREE_ICONPATH = os.path.join(IMAGE_DIR, '22x22', 'gramps.png')
FAMTREE_ICONPATH = os.path.join(IMAGE_DIR, 'hicolor', '22x22', 'actions',
'gramps.png')
class FamTreeWrapper(QtCore.QObject):
"""

View File

@ -43,10 +43,10 @@ class Notes(Gramplet):
top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
hbox = Gtk.Box()
self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
self.left = SimpleButton('go-previous', self.left_clicked)
self.left.set_sensitive(False)
hbox.pack_start(self.left, False, False, 0)
self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
self.right = SimpleButton('go-next', self.right_clicked)
self.right.set_sensitive(False)
hbox.pack_start(self.right, False, False, 0)
self.page = Gtk.Label()

View File

@ -43,19 +43,19 @@ class ToDo(Gramplet):
top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
hbox = Gtk.Box()
self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
self.left = SimpleButton('go-previous', self.left_clicked)
self.left.set_tooltip_text(_('Previous To Do note'))
self.left.set_sensitive(False)
hbox.pack_start(self.left, False, False, 0)
self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
self.right = SimpleButton('go-next', self.right_clicked)
self.right.set_tooltip_text(_('Next To Do note'))
self.right.set_sensitive(False)
hbox.pack_start(self.right, False, False, 0)
self.edit = SimpleButton(Gtk.STOCK_EDIT, self.edit_clicked)
self.edit = SimpleButton('gtk-edit' self.edit_clicked)
self.edit.set_tooltip_text(_('Edit the selected To Do note'))
self.edit.set_sensitive(False)
hbox.pack_start(self.edit, False, False, 0)
self.new = SimpleButton(Gtk.STOCK_NEW, self.new_clicked)
self.new = SimpleButton('document-new', self.new_clicked)
self.new.set_tooltip_text(_('Add a new To Do note'))
hbox.pack_start(self.new, False, False, 0)
self.page = Gtk.Label()

View File

@ -46,19 +46,19 @@ class ToDoGramplet(Gramplet):
top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
hbox = Gtk.Box()
self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
self.left = SimpleButton('go-previous', self.left_clicked)
self.left.set_tooltip_text(_('Previous To Do note'))
self.left.set_sensitive(False)
hbox.pack_start(self.left, False, False, 0)
self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
self.right = SimpleButton('go-next', self.right_clicked)
self.right.set_tooltip_text(_('Next To Do note'))
self.right.set_sensitive(False)
hbox.pack_start(self.right, False, False, 0)
self.edit = SimpleButton(Gtk.STOCK_EDIT, self.edit_clicked)
self.edit = SimpleButton('gtk-edit', self.edit_clicked)
self.edit.set_tooltip_text(_('Edit the selected To Do note'))
self.edit.set_sensitive(False)
hbox.pack_start(self.edit, False, False, 0)
self.new = SimpleButton(Gtk.STOCK_NEW, self.new_clicked)
self.new = SimpleButton('document-new', self.new_clicked)
self.new.set_tooltip_text(_('Add a new To Do note'))
hbox.pack_start(self.new, False, False, 0)
self.page = Gtk.Label()

View File

@ -48,6 +48,7 @@ _LOG = logging.getLogger(".gui.personview")
from gramps.gen.lib import Person, Surname
from gramps.gen.db import DbTxn
from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.actiongroup import ActionGroup
from gramps.gen.utils.string import data_recover_msg
from gramps.gen.display.name import displayer as name_displayer
from gramps.gui.dialog import ErrorDialog, QuestionDialog
@ -336,13 +337,13 @@ class BasePersonView(ListView):
ListView.define_actions(self)
self.all_action = Gtk.ActionGroup(name=self.title + "/PersonAll")
self.edit_action = Gtk.ActionGroup(name=self.title + "/PersonEdit")
self.all_action = ActionGroup(name=self.title + "/PersonAll")
self.edit_action = ActionGroup(name=self.title + "/PersonEdit")
self.all_action.add_actions([
('FilterEdit', None, _('Person Filter Editor'), None, None,
self.filter_editor),
('Edit', Gtk.STOCK_EDIT, _("action|_Edit..."),
('Edit', 'gtk-edit', _("action|_Edit..."),
"<PRIMARY>Return", self.EDIT_MSG, self.edit),
('QuickReport', None, _("Quick View"), None, None, None),
('WebConnect', None, _("Web Connection"), None, None, None),
@ -351,14 +352,14 @@ class BasePersonView(ListView):
self.edit_action.add_actions(
[
('Add', Gtk.STOCK_ADD, _("_Add..."), "<PRIMARY>Insert",
self.ADD_MSG, self.add),
('Remove', Gtk.STOCK_REMOVE, _("_Remove"), "<PRIMARY>Delete",
('Add', 'list-add', _("_Add..."), "<PRIMARY>Insert",
self.ADD_MSG, self.add),
('Remove', 'list-remove', _("_Remove"), "<PRIMARY>Delete",
self.DEL_MSG, self.remove),
('Merge', 'gramps-merge', _('_Merge...'), None,
self.MERGE_MSG, self.merge),
('ExportTab', None, _('Export View...'), None, None,
self.export),
self.export),
])
self._add_action_group(self.edit_action)

View File

@ -142,7 +142,7 @@ class PlaceBaseView(ListView):
"Service (OpenstreetMap, Google Maps, ...)"),
self.gotomap,
_('Select a Map Service'))
self._add_action('GotoMap', Gtk.STOCK_JUMP_TO,
self._add_action('GotoMap', 'go-jump',
_('_Look up with Map Service'),
callback=self.gotomap,
tip=_("Attempt to see this location with a Map "
@ -172,7 +172,8 @@ class PlaceBaseView(ListView):
ListView.change_page(self)
#menutoolbutton has to be made and added in correct place on toolbar
if not self.maptoolbtn:
self.maptoolbtn = Gtk.MenuToolButton.new_from_stock(Gtk.STOCK_JUMP_TO)
self.maptoolbtn = Gtk.MenuToolButton()
self.maptoolbtn.set_icon_name('go-jump')
self.maptoolbtn.connect('clicked', self.gotomap)
self.mmenu = self.__create_maps_menu_actions()
self.maptoolbtn.set_menu(self.mmenu)
@ -201,7 +202,7 @@ class PlaceBaseView(ListView):
lbl.show()
self.mapslistlabel.append(lbl)
widget.set_label_widget(self.mapslistlabel[-1])
widget.set_stock_id(Gtk.STOCK_JUMP_TO)
widget.set_icon_name('go-jump')
if self.drag_info():
self.list.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK,
[],

View File

@ -153,16 +153,11 @@ class GeoGraphyView(OsmGps, NavigationView):
self.places_found = []
self.select_fct = None
self.geo_mainmap = None
path = os.path.join(IMAGE_DIR, "48x48",
('gramps-geo-mainmap' + '.png' ))
with open(path, 'rb') as fh: # this is to avoid bug with cairo 1.8.8
self.geo_mainmap = cairo.ImageSurface.create_from_png(fh)
#self.geo_mainmap = cairo.ImageSurface.create_from_png(path)
path = os.path.join(IMAGE_DIR, "48x48",
('gramps-geo-altmap' + '.png' ))
with open(path, 'rb') as fh: # this is to avoid bug with cairo 1.8.8
self.geo_altmap = cairo.ImageSurface.create_from_png(fh)
#self.geo_altmap = cairo.ImageSurface.create_from_png(path)
theme = Gtk.IconTheme.get_default()
self.geo_mainmap = theme.load_surface('gramps-geo-mainmap', 48, 1,
None, 0)
self.geo_altmap = theme.load_surface('gramps-geo-altmap', 48, 1,
None, 0)
if ( config.get('geography.map_service') in
( constants.OPENSTREETMAP,
constants.MAPS_FOR_FREE,
@ -176,11 +171,8 @@ class GeoGraphyView(OsmGps, NavigationView):
for ident in ( EventType.BIRTH,
EventType.DEATH,
EventType.MARRIAGE ):
path = os.path.join(IMAGE_DIR, "48x48",
(constants.ICONS.get(int(ident), default_image) + '.png' ))
with open(path, 'rb') as fh: # this is to avoid bug with cairo 1.8.8
self.geo_othermap[ident] = cairo.ImageSurface.create_from_png(fh)
#self.geo_othermap[ident] = cairo.ImageSurface.create_from_png(path)
icon = constants.ICONS.get(int(ident))
self.geo_othermap[ident] = theme.load_surface(icon, 48, 1, None, 0)
def add_bookmark(self, menu):
mlist = self.selected_handles()
@ -281,9 +273,9 @@ class GeoGraphyView(OsmGps, NavigationView):
"""
Associate the print button to the PrintView action.
"""
self._add_action('PrintView', Gtk.STOCK_PRINT, _("_Print..."),
accel="<PRIMARY>P",
tip=_("Print or save the Map"),
self._add_action('PrintView', 'document-print', _("_Print..."),
accel="<PRIMARY>P",
tip=_("Print or save the Map"),
callback=self.printview)
def config_connect(self):
@ -944,8 +936,8 @@ class GeoGraphyView(OsmGps, NavigationView):
kml = Gtk.FileChooserDialog(
_("Select a kml file used to add places"),
action=Gtk.FileChooserAction.OPEN,
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_APPLY, Gtk.ResponseType.OK))
buttons=(_('_Cancel'), Gtk.ResponseType.CANCEL,
_('_Apply'), Gtk.ResponseType.OK))
mpath = HOME_DIR
kml.set_current_folder(os.path.dirname(mpath))
kml.set_filter(filter)
@ -1182,9 +1174,9 @@ class GeoGraphyView(OsmGps, NavigationView):
f = Gtk.FileChooserDialog(
_("Select tile cache directory for offline mode"),
action=Gtk.FileChooserAction.SELECT_FOLDER,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_APPLY,
_('_Apply'),
Gtk.ResponseType.OK))
mpath = config.get('geography.path')
if not mpath:

View File

@ -117,7 +117,7 @@ class PlaceSelection(ManagedWindow, OsmGps):
self.layer = layer
self.set_window(
Gtk.Dialog(_('Place Selection in a region'),
buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
buttons=(_('_Close'), Gtk.ResponseType.CLOSE)),
None, _('Place Selection in a region'), None)
label = Gtk.Label(label=_('Choose the radius of the selection.\n'
'On the map you should see a circle or an'

View File

@ -180,9 +180,9 @@ class CategorySidebar(BaseSidebar):
hbox.show()
image = Gtk.Image()
if use_text:
image.set_from_stock(page_stock, Gtk.IconSize.BUTTON)
image.set_from_icon_name(page_stock, Gtk.IconSize.BUTTON)
else:
image.set_from_stock(page_stock, Gtk.IconSize.DND)
image.set_from_icon_name(page_stock, Gtk.IconSize.DND)
image.show()
hbox.pack_start(image, False, False, 0)
hbox.set_spacing(4)

View File

@ -125,7 +125,7 @@ class DropdownSidebar(BaseSidebar):
self.menu = Gtk.Menu()
for item in self.views[cat_num]:
menuitem = Gtk.ImageMenuItem(label=item[1])
image = Gtk.Image.new_from_stock(item[2], Gtk.IconSize.MENU)
image = Gtk.Image.new_from_icon_name(item[2], Gtk.IconSize.MENU)
image.show()
menuitem.set_image(image)
menuitem.connect("activate", self.cb_menu_clicked, cat_num, item[0])
@ -175,9 +175,9 @@ class DropdownSidebar(BaseSidebar):
hbox.show()
image = Gtk.Image()
if use_text:
image.set_from_stock(cat_icon, Gtk.IconSize.BUTTON)
image.set_from_icon_name(cat_icon, Gtk.IconSize.BUTTON)
else:
image.set_from_stock(cat_icon, Gtk.IconSize.DND)
image.set_from_icon_name(cat_icon, Gtk.IconSize.DND)
image.show()
hbox.pack_start(image, False, False, 0)
hbox.set_spacing(4)

View File

@ -73,7 +73,7 @@ class ExpanderSidebar(BaseSidebar):
catbox = Gtk.Box()
image = Gtk.Image()
image.set_from_stock(cat_icon, Gtk.IconSize.BUTTON)
image.set_from_icon_name(cat_icon, Gtk.IconSize.BUTTON)
catbox.pack_start(image, False, False, 4)
if use_text:
label = Gtk.Label(label=cat_name)
@ -190,9 +190,9 @@ class ExpanderSidebar(BaseSidebar):
hbox.show()
image = Gtk.Image()
if use_text:
image.set_from_stock(view_icon, Gtk.IconSize.BUTTON)
image.set_from_icon_name(view_icon, Gtk.IconSize.BUTTON)
else:
image.set_from_stock(view_icon, Gtk.IconSize.DND)
image.set_from_icon_name(view_icon, Gtk.IconSize.DND)
image.show()
hbox.pack_start(image, False, False, 0)
hbox.set_spacing(4)

View File

@ -691,8 +691,8 @@ class CheckIntegrity(object):
logging.warning(' FAIL: references to missing file kept')
fs_top = Gtk.FileChooserDialog("%s - Gramps" % _("Select file"),
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK)
buttons=(_('_Cancel'), Gtk.ResponseType.CANCEL,
_('_OK'), Gtk.ResponseType.OK)
)
fs_top.set_current_folder(self.last_img_dir)
response = fs_top.run()

View File

@ -392,9 +392,9 @@ class DisplayChart(ManagedWindow):
def on_write_table(self, obj):
f = Gtk.FileChooserDialog(_("Select filename"),
action=Gtk.FileChooserAction.SAVE,
buttons=(Gtk.STOCK_CANCEL,
buttons=(_('_Cancel'),
Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE,
_('_Save'),
Gtk.ResponseType.OK))
f.set_current_folder(get_curr_dir())

View File

@ -114,7 +114,7 @@ class PatchNames(tool.BatchTool, ManagedWindow):
winprefix = Gtk.Dialog(_("Default prefix and connector settings"),
self.uistate.window,
Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
(_('_OK'), Gtk.ResponseType.ACCEPT))
winprefix.vbox.set_spacing(5)
hboxpref = Gtk.Box()

View File

@ -84,8 +84,8 @@ class PopulateSources(tool.Tool, ManagedWindow):
dialog = Gtk.Dialog("Populate sources and citations tool",
self.uistate.window,
Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
(_('_Cancel'), Gtk.ResponseType.REJECT,
_('_OK'), Gtk.ResponseType.ACCEPT))
label = Gtk.Label("Enter a valid number of sources and citations."
" This will create the requested number of sources,"
" and for each source, will create the requested"

View File

@ -95,37 +95,37 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
'remove' : self.db.remove_event,
'get_text': self.get_event_text,
'editor' : 'EditEvent',
'stock' : 'gramps-event',
'icon' : 'gramps-event',
'name_ix' : 4},
'sources' : {'get_func': self.db.get_source_from_handle,
'remove' : self.db.remove_source,
'get_text': None,
'editor' : 'EditSource',
'stock' : 'gramps-source',
'icon' : 'gramps-source',
'name_ix' : 2},
'places' : {'get_func': self.db.get_place_from_handle,
'remove' : self.db.remove_place,
'get_text': None,
'editor' : 'EditPlace',
'stock' : 'gramps-place',
'icon' : 'gramps-place',
'name_ix' : 2},
'media' : {'get_func': self.db.get_object_from_handle,
'remove' : self.db.remove_object,
'get_text': None,
'editor' : 'EditMedia',
'stock' : 'gramps-media',
'icon' : 'gramps-media',
'name_ix' : 4},
'repos' : {'get_func': self.db.get_repository_from_handle,
'remove' : self.db.remove_repository,
'get_text': None,
'editor' : 'EditRepository',
'stock' : 'gramps-repository',
'icon' : 'gramps-repository',
'name_ix' : 3},
'notes' : {'get_func': self.db.get_note_from_handle,
'remove' : self.db.remove_note,
'get_text': self.get_note_text,
'editor' : 'EditNote',
'stock' : 'gramps-notes',
'icon' : 'gramps-notes',
'name_ix' : 2},
}
@ -352,8 +352,8 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
def get_image(self, column, cell, model, iter, user_data=None):
the_type = model.get_value(iter, RemoveUnused.OBJ_TYPE_COL)
the_stock = self.tables[the_type]['stock']
cell.set_property('stock-id', the_stock)
the_icon = self.tables[the_type]['icon']
cell.set_property('icon-name', the_icon)
def add_results(self, results):
(the_type, handle, data) = results

View File

@ -241,9 +241,9 @@ class TestcaseGenerator(tool.BatchTool):
self.on_dummy_data_clicked(self.check_persons)
self.top.vbox.pack_start(self.entry_count,0,0,5)
self.top.add_button(Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL)
self.top.add_button(Gtk.STOCK_OK,Gtk.ResponseType.OK)
self.top.add_button(Gtk.STOCK_HELP,Gtk.ResponseType.HELP)
self.top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
self.top.add_button(_('_OK'), Gtk.ResponseType.OK)
self.top.add_button(_('_Help'), Gtk.ResponseType.HELP)
self.top.show_all()
response = self.top.run()

View File

@ -677,9 +677,9 @@ class VerifyResults(ManagedWindow):
def get_image(self, column, cell, model, iter, user_data=None):
the_type = model.get_value(iter, VerifyResults.OBJ_TYPE_COL)
if the_type == 'Person':
cell.set_property('stock-id', 'gramps-person' )
cell.set_property('icon-name', 'gramps-person' )
elif the_type == 'Family':
cell.set_property('stock-id', 'gramps-family' )
cell.set_property('icon-name', 'gramps-family' )
def add_results(self,results):
(msg,gramps_id, name,the_type,rule_id,severity, handle) = results

View File

@ -91,7 +91,7 @@ class DashboardView(PageView):
"""
Defines the UIManager actions.
"""
self._add_action("AddGramplet", Gtk.STOCK_ADD, _("Add a gramplet"))
self._add_action("AddGramplet", 'list-add', _("Add a gramplet"))
self._add_action("RestoreGramplet", None, _("Restore a gramplet"))
def set_inactive(self):

View File

@ -202,9 +202,9 @@ class FamilyView(ListView):
self.all_action = Gtk.ActionGroup(name=self.title + "/FamilyAll")
self.all_action.add_actions([
('MakeFatherActive', Gtk.STOCK_APPLY, _("Make Father Active Person"),
('MakeFatherActive', None, _("Make Father Active Person"),
None, None, self._make_father_active),
('MakeMotherActive', Gtk.STOCK_APPLY, _("Make Mother Active Person"),
('MakeMotherActive', None, _("Make Mother Active Person"),
None, None, self._make_mother_active),
('QuickReport', None, _("Quick View"), None, None, None),
])

View File

@ -100,7 +100,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
self.set_fan(fanchartdesc.FanChartDescWidget(self.dbstate, self.uistate,
self.on_popup))
self.scrolledwindow = Gtk.ScrolledWindow(hadjustment=None,
vadjustment=None)
vadjustment=None)
self.scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
self.fan.show_all()
@ -163,9 +163,9 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
"""
NavigationView.define_actions(self)
self._add_action('PrintView', Gtk.STOCK_PRINT, _("_Print..."),
accel="<PRIMARY>P",
tip=_("Print or save the Fan Chart View"),
self._add_action('PrintView', 'document-print', _("_Print..."),
accel="<PRIMARY>P",
tip=_("Print or save the Fan Chart View"),
callback=self.printview)
def build_tree(self):
"""

View File

@ -98,7 +98,7 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView):
def build_widget(self):
self.set_fan(fanchart.FanChartWidget(self.dbstate, self.uistate, self.on_popup))
self.scrolledwindow = Gtk.ScrolledWindow(hadjustment=None,
vadjustment=None)
vadjustment=None)
self.scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
self.fan.show_all()
@ -161,9 +161,9 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView):
"""
NavigationView.define_actions(self)
self._add_action('PrintView', Gtk.STOCK_PRINT, _("_Print..."),
accel="<PRIMARY>P",
tip=_("Print or save the Fan Chart View"),
self._add_action('PrintView', 'document-print', _("_Print..."),
accel="<PRIMARY>P",
tip=_("Print or save the Fan Chart View"),
callback=self.printview)
def build_tree(self):
"""

View File

@ -1448,9 +1448,9 @@ class PedigreeView(NavigationView):
label.set_use_markup(True)
label.show()
label.set_alignment(0, 0)
menuitem = Gtk.ImageMenuItem(None)
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
menuitem = Gtk.ImageMenuItem()
go_image = Gtk.Image.new_from_icon_name('go-jump',
Gtk.IconSize.MENU)
go_image.show()
menuitem.set_image(go_image)
menuitem.add(label)
@ -1537,16 +1537,16 @@ class PedigreeView(NavigationView):
home_sensitivity = False
# bug 4884: need to translate the home label
entries = [
(Gtk.STOCK_GO_BACK, self.back_clicked, not hobj.at_front()),
(Gtk.STOCK_GO_FORWARD, self.fwd_clicked, not hobj.at_end()),
(_("Home"), self.cb_home, home_sensitivity),
(_("Pre_vious"), 'go-previous', self.back_clicked, not hobj.at_front()),
(_("_Next"), 'go-next', self.fwd_clicked, not hobj.at_end()),
(_("_Home"), 'go-home', self.cb_home, home_sensitivity),
]
for stock_id, callback, sensitivity in entries:
item = Gtk.ImageMenuItem.new_from_stock(stock_id=stock_id, accel_group=None)
for label, icon_name, callback, sensitivity in entries:
item = Gtk.ImageMenuItem.new_with_mnemonic(label)
item.set_sensitive(sensitivity)
if stock_id == _("Home"):
im = Gtk.Image.new_from_stock(Gtk.STOCK_HOME, Gtk.IconSize.MENU)
if icon_name:
im = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
im.show()
item.set_image(im)
if callback:
@ -1569,21 +1569,19 @@ class PedigreeView(NavigationView):
item.set_submenu(Gtk.Menu())
scroll_direction_menu = item.get_submenu()
scroll_direction_image = Gtk.Image.new_from_stock(Gtk.STOCK_APPLY,
Gtk.IconSize.MENU)
scroll_direction_image.show()
entry = Gtk.ImageMenuItem(label=_("Top <-> Bottom"))
entry = Gtk.CheckMenuItem(label=_("Top <-> Bottom"))
entry.set_draw_as_radio(True)
entry.connect("activate", self.cb_change_scroll_direction, False)
if self.scroll_direction == False:
entry.set_image(scroll_direction_image)
entry.set_active(True)
entry.show()
scroll_direction_menu.append(entry)
entry = Gtk.ImageMenuItem(_("Left <-> Right"))
entry = Gtk.CheckMenuItem(_("Left <-> Right"))
entry.set_draw_as_radio(True)
entry.connect("activate", self.cb_change_scroll_direction, True)
if self.scroll_direction == True:
entry.set_image(scroll_direction_image)
entry.set_active(True)
entry.show()
scroll_direction_menu.append(entry)
@ -1597,7 +1595,10 @@ class PedigreeView(NavigationView):
self.menu = Gtk.Menu()
self.menu.set_title(_('People Menu'))
add_item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ADD, None)
add_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Add'))
img = Gtk.Image.new_from_icon_name('list-add', Gtk.IconSize.MENU)
img.show()
add_item.set_image(img)
add_item.connect("activate", self.cb_add_parents, person_handle,
family_handle)
add_item.show()
@ -1627,8 +1628,7 @@ class PedigreeView(NavigationView):
if not person:
return 0
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU)
go_image.show()
go_item = Gtk.ImageMenuItem(label=name_displayer.display(person))
go_item.set_image(go_image)
@ -1636,12 +1636,18 @@ class PedigreeView(NavigationView):
go_item.show()
self.menu.append(go_item)
edit_item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_EDIT, None)
edit_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Edit'))
img = Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.MENU)
img.show()
edit_item.set_image(img)
edit_item.connect("activate", self.cb_edit_person, person_handle)
edit_item.show()
self.menu.append(edit_item)
clipboard_item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_COPY, None)
clipboard_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Copy'))
img = Gtk.Image.new_from_icon_name('edit-copy', Gtk.IconSize.MENU)
img.show()
clipboard_item.set_image(img)
clipboard_item.connect("activate", self.cb_copy_person_to_clipboard,
person_handle)
clipboard_item.show()
@ -1669,8 +1675,8 @@ class PedigreeView(NavigationView):
item.set_submenu(Gtk.Menu())
sp_menu = item.get_submenu()
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump',
Gtk.IconSize.MENU)
go_image.show()
sp_item = Gtk.ImageMenuItem(label=name_displayer.display(spouse))
sp_item.set_image(go_image)
@ -1711,8 +1717,8 @@ class PedigreeView(NavigationView):
else:
label = Gtk.Label(label=escape(name_displayer.display(sib)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump',
Gtk.IconSize.MENU)
go_image.show()
sib_item = Gtk.ImageMenuItem()
sib_item.set_image(go_image)
@ -1750,10 +1756,10 @@ class PedigreeView(NavigationView):
else:
label = Gtk.Label(label=escape(name_displayer.display(child)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump',
Gtk.IconSize.MENU)
go_image.show()
child_item = Gtk.ImageMenuItem(None)
child_item = Gtk.ImageMenuItem()
child_item.set_image(go_image)
label.set_use_markup(True)
label.show()
@ -1790,8 +1796,8 @@ class PedigreeView(NavigationView):
else:
label = Gtk.Label(label=escape(name_displayer.display(par)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump',
Gtk.IconSize.MENU)
go_image.show()
par_item = Gtk.ImageMenuItem()
par_item.set_image(go_image)
@ -1836,8 +1842,8 @@ class PedigreeView(NavigationView):
label = Gtk.Label(label=escape(name_displayer.display(per)))
go_image = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
go_image = Gtk.Image.new_from_icon_name('go-jump',
Gtk.IconSize.MENU)
go_image.show()
per_item = Gtk.ImageMenuItem()
per_item.set_image(go_image)
@ -1874,12 +1880,18 @@ class PedigreeView(NavigationView):
if not family:
return 0
edit_item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_EDIT, None)
edit_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Edit'))
img = Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.MENU)
img.show()
edit_item.set_image(img)
edit_item.connect("activate", self.cb_edit_family, family_handle)
edit_item.show()
self.menu.append(edit_item)
clipboard_item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_COPY, None)
clipboard_item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Copy'))
img = Gtk.Image.new_from_icon_name('edit-copy', Gtk.IconSize.MENU)
img.show()
clipboard_item.set_image(img)
clipboard_item.connect("activate", self.cb_copy_family_to_clipboard,
family_handle)
clipboard_item.show()

View File

@ -60,6 +60,7 @@ from gramps.gen.lib import (ChildRef, EventRoleType, EventType, Family,
from gramps.gen.lib.date import Today
from gramps.gen.db import DbTxn
from gramps.gui.views.navigationview import NavigationView
from gramps.gui.actiongroup import ActionGroup
from gramps.gui.editors import EditPerson, EditFamily
from gramps.gui.editors import FilterEditor
from gramps.gen.display.name import displayer as name_displayer
@ -390,15 +391,15 @@ class RelationshipView(NavigationView):
def define_actions(self):
NavigationView.define_actions(self)
self.order_action = Gtk.ActionGroup(name=self.title + '/ChangeOrder')
self.order_action = ActionGroup(name=self.title + '/ChangeOrder')
self.order_action.add_actions([
('ChangeOrder', Gtk.STOCK_SORT_ASCENDING, _('_Reorder'), None ,
('ChangeOrder', 'view-sort-ascending', _('_Reorder'), None ,
_("Change order of parents and families"), self.reorder),
])
self.family_action = Gtk.ActionGroup(name=self.title + '/Family')
self.family_action = ActionGroup(name=self.title + '/Family')
self.family_action.add_actions([
('Edit', Gtk.STOCK_EDIT, _('Edit...'), "<PRIMARY>Return",
('Edit', 'gtk-edit', _('Edit...'), "<PRIMARY>Return",
_("Edit the active person"), self.edit_active),
('AddSpouse', 'gramps-spouse', _('Partner'), None ,
_("Add a new family with person as parent"), self.add_spouse),
@ -804,28 +805,28 @@ class RelationshipView(NavigationView):
# Show edit-Buttons if toolbar is not visible
if self.reorder_sensitive:
add = widgets.IconButton(self.reorder_button_press, None,
Gtk.STOCK_SORT_ASCENDING)
'view-sort-ascending')
add.set_tooltip_text(ord_msg)
hbox.pack_start(add, False, True, 0)
add = widgets.IconButton(call_fcn, None, Gtk.STOCK_ADD)
add = widgets.IconButton(call_fcn, None, 'list-add')
add.set_tooltip_text(add_msg)
hbox.pack_start(add, False, True, 0)
if is_parent:
add = widgets.IconButton(self.select_family, None,
Gtk.STOCK_INDEX)
'gtk-index')
add.set_tooltip_text(sel_msg)
hbox.pack_start(add, False, True, 0)
if family:
edit = widgets.IconButton(self.edit_family, family.handle,
Gtk.STOCK_EDIT)
'gtk-edit')
edit.set_tooltip_text(edit_msg)
hbox.pack_start(edit, False, True, 0)
if not self.dbstate.db.readonly:
delete = widgets.IconButton(del_fcn, family.handle,
Gtk.STOCK_REMOVE)
'list-remove')
delete.set_tooltip_text(del_msg)
hbox.pack_start(delete, False, True, 0)
@ -938,11 +939,11 @@ class RelationshipView(NavigationView):
hbox = Gtk.Box()
addchild = widgets.IconButton(self.add_child_to_fam,
family.handle,
Gtk.STOCK_ADD)
'list-add')
addchild.set_tooltip_text(_('Add new child to family'))
selchild = widgets.IconButton(self.sel_child_to_fam,
family.handle,
Gtk.STOCK_INDEX)
'gtk-index')
selchild.set_tooltip_text(_('Add existing child to family'))
hbox.pack_start(addchild, False, True, 0)
hbox.pack_start(selchild, False, True, 0)
@ -1270,7 +1271,7 @@ class RelationshipView(NavigationView):
name = name_displayer.display(person)
item = Gtk.ImageMenuItem(None)
image = Gtk.Image.new_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.MENU)
image = Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.MENU)
image.show()
label = Gtk.Label(label=_("Edit %s") % name)
label.show()
@ -1435,11 +1436,11 @@ class RelationshipView(NavigationView):
hbox = Gtk.Box()
addchild = widgets.IconButton(self.add_child_to_fam,
family.handle,
Gtk.STOCK_ADD)
'list-add')
addchild.set_tooltip_text(_('Add new child to family'))
selchild = widgets.IconButton(self.sel_child_to_fam,
family.handle,
Gtk.STOCK_INDEX)
'gtk-index')
selchild.set_tooltip_text(_('Add existing child to family'))
hbox.pack_start(addchild, False, True, 0)
hbox.pack_start(selchild, False, True, 0)

View File

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

View File

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 835 B

View File

Before

Width:  |  Height:  |  Size: 851 B

After

Width:  |  Height:  |  Size: 851 B

View File

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 812 B

After

Width:  |  Height:  |  Size: 812 B

View File

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 910 B

View File

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

View File

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 916 B

View File

Before

Width:  |  Height:  |  Size: 530 B

After

Width:  |  Height:  |  Size: 530 B

View File

Before

Width:  |  Height:  |  Size: 732 B

After

Width:  |  Height:  |  Size: 732 B

View File

Before

Width:  |  Height:  |  Size: 675 B

After

Width:  |  Height:  |  Size: 675 B

View File

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 772 B

View File

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

View File

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

View File

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 908 B

View File

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 804 B

View File

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

View File

Before

Width:  |  Height:  |  Size: 808 B

After

Width:  |  Height:  |  Size: 808 B

View File

Before

Width:  |  Height:  |  Size: 972 B

After

Width:  |  Height:  |  Size: 972 B

View File

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 920 B

View File

Before

Width:  |  Height:  |  Size: 927 B

After

Width:  |  Height:  |  Size: 927 B

View File

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

View File

Before

Width:  |  Height:  |  Size: 799 B

After

Width:  |  Height:  |  Size: 799 B

Some files were not shown because too many files have changed in this diff Show More