Convert MenuItem, working styledtexteditor in grampletpane
svn: r19859
This commit is contained in:
parent
faed8a9f5f
commit
35ccf01827
@ -1437,13 +1437,13 @@ class MultiTreeView(Gtk.TreeView):
|
||||
objclass, handle = None, None
|
||||
if objclass in ['Person', 'Event', 'Media', 'Source',
|
||||
'Repository', 'Family', 'Note', 'Place']:
|
||||
menu_item = Gtk.MenuItem(_("the object|See %s details") % trans_objclass(objclass))
|
||||
menu_item = Gtk.MenuItem(label=_("the object|See %s details") % trans_objclass(objclass))
|
||||
menu_item.connect("activate",
|
||||
lambda widget: self.edit_obj(objclass, handle))
|
||||
popup.append(menu_item)
|
||||
menu_item.show()
|
||||
# ---------------------------
|
||||
menu_item = Gtk.MenuItem(_("the object|Make %s active") % trans_objclass(objclass))
|
||||
menu_item = Gtk.MenuItem(label=_("the object|Make %s active") % trans_objclass(objclass))
|
||||
menu_item.connect("activate",
|
||||
lambda widget: self.uistate.set_active(handle, objclass))
|
||||
popup.append(menu_item)
|
||||
@ -1459,7 +1459,7 @@ class MultiTreeView(Gtk.TreeView):
|
||||
obj = self.dbstate.db.get_table_metadata(objclass)["handle_func"](my_handle)
|
||||
if obj:
|
||||
gids.add(obj.gramps_id)
|
||||
menu_item = Gtk.MenuItem(_("the object|Create Filter from %s selected...") % trans_objclass(objclass))
|
||||
menu_item = Gtk.MenuItem(label=_("the object|Create Filter from %s selected...") % trans_objclass(objclass))
|
||||
menu_item.connect("activate",
|
||||
lambda widget: make_filter(self.dbstate, self.uistate,
|
||||
objclass, gids, title=self.title))
|
||||
|
@ -72,7 +72,7 @@ class DataEmbedList(EmbeddedList):
|
||||
# Need to add attributes to renderers
|
||||
# and connect renderers to the 'edited' signal
|
||||
for colno in range(len(self.columns)):
|
||||
for renderer in self.columns[colno].get_cell_renderers():
|
||||
for renderer in self.columns[colno].get_cells():
|
||||
renderer.set_property('editable', not self.dbstate.db.readonly)
|
||||
renderer.connect('edited',self.edit_inline,colno)
|
||||
|
||||
|
@ -35,6 +35,7 @@ import cPickle as pickle
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
|
||||
@ -153,7 +154,7 @@ class EmbeddedList(ButtonTab):
|
||||
else:
|
||||
item = Gtk.ImageMenuItem(stock_id=title)
|
||||
else:
|
||||
item = Gtk.MenuItem(title)
|
||||
item = Gtk.MenuItem(label=title)
|
||||
item.connect('activate', func)
|
||||
if needs_write_access and self.dbstate.db.readonly:
|
||||
item.set_sensitive(False)
|
||||
@ -368,7 +369,7 @@ class EmbeddedList(ButtonTab):
|
||||
scroll.set_shadow_type(Gtk.ShadowType.IN)
|
||||
scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
scroll.add(self.tree)
|
||||
self.pack_end(scroll, True)
|
||||
self.pack_end(scroll, True, True,0)
|
||||
|
||||
def get_selected(self):
|
||||
"""
|
||||
|
@ -141,7 +141,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
item.show()
|
||||
menu.append(item)
|
||||
mfolder, mfile = os.path.split(media_path)
|
||||
item = Gtk.MenuItem(_('Open Containing _Folder'))
|
||||
item = Gtk.MenuItem(label=_('Open Containing _Folder'))
|
||||
item.connect('activate', make_launcher(mfolder))
|
||||
item.show()
|
||||
menu.append(item)
|
||||
@ -153,7 +153,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
if image:
|
||||
item = Gtk.ImageMenuItem(stock_id=title)
|
||||
else:
|
||||
item = Gtk.MenuItem(title)
|
||||
item = Gtk.MenuItem(label=title)
|
||||
item.connect('activate', func)
|
||||
if needs_write_access and self.dbstate.db.readonly:
|
||||
item.set_sensitive(False)
|
||||
|
@ -98,7 +98,7 @@ class SurnameTab(EmbeddedList):
|
||||
# Need to add attributes to renderers
|
||||
# and connect renderers to the 'edited' signal
|
||||
for colno in range(len(self.columns)):
|
||||
for renderer in self.columns[colno].get_cell_renderers():
|
||||
for renderer in self.columns[colno].get_cells():
|
||||
renderer.set_property('editable', not self.dbstate.db.readonly)
|
||||
renderer.connect('editing_started', self.on_edit_start, colno)
|
||||
renderer.connect('edited', self.on_edit_inline, self.column_order()[colno][1])
|
||||
|
@ -3,8 +3,9 @@ in glade.
|
||||
|
||||
Assuming you are in the root svn directory do:
|
||||
|
||||
GLADE_CATALOG_PATH=src/gui/glade/catalog glade
|
||||
GLADE_CATALOG_SEARCH_PATH=src/gui/glade/catalog GLADE_MODULE_SEARCH_PATH=src/gui/glade/catalog/ glade
|
||||
|
||||
However, this does no longer work for python modules (since 3.8), so the gramps widgets are not in the catalog at this moment.
|
||||
As project settings:
|
||||
|
||||
*format: gtkbuilder
|
||||
|
@ -419,7 +419,7 @@ class GrampsBar(Gtk.Notebook):
|
||||
if gui.utils.is_right_click(event):
|
||||
menu = Gtk.Menu()
|
||||
|
||||
ag_menu = Gtk.MenuItem(_('Add a gramplet'))
|
||||
ag_menu = Gtk.MenuItem(label=_('Add a gramplet'))
|
||||
nav_type = self.pageview.navigation_type()
|
||||
skip = self.all_gramplets()
|
||||
gramplet_list = GET_GRAMPLET_LIST(nav_type, skip)
|
||||
@ -429,7 +429,7 @@ class GrampsBar(Gtk.Notebook):
|
||||
menu.append(ag_menu)
|
||||
|
||||
if not self.empty:
|
||||
rg_menu = Gtk.MenuItem(_('Remove a gramplet'))
|
||||
rg_menu = Gtk.MenuItem(label=_('Remove a gramplet'))
|
||||
gramplet_list = [(gramplet.title, gramplet.gname)
|
||||
for gramplet in self.get_children() +
|
||||
self.detached_gramplets]
|
||||
@ -439,7 +439,7 @@ class GrampsBar(Gtk.Notebook):
|
||||
rg_menu.show()
|
||||
menu.append(rg_menu)
|
||||
|
||||
rd_menu = Gtk.MenuItem(_('Restore default gramplets'))
|
||||
rd_menu = Gtk.MenuItem(label=_('Restore default gramplets'))
|
||||
rd_menu.connect("activate", self.__restore_clicked)
|
||||
rd_menu.show()
|
||||
menu.append(rd_menu)
|
||||
@ -457,7 +457,7 @@ class GrampsBar(Gtk.Notebook):
|
||||
submenu = main_menu.get_submenu()
|
||||
submenu = Gtk.Menu()
|
||||
for entry in gramplet_list:
|
||||
item = Gtk.MenuItem(entry[0])
|
||||
item = Gtk.MenuItem(label=entry[0])
|
||||
item.connect("activate", callback_func, entry[1])
|
||||
item.show()
|
||||
submenu.append(item)
|
||||
|
@ -105,7 +105,7 @@ class Navigator(object):
|
||||
self.pages.append((title, sidebar))
|
||||
index = self.notebook.append_page(sidebar.get_top(), Gtk.Label(label=title))
|
||||
|
||||
menu_item = Gtk.MenuItem(title)
|
||||
menu_item = Gtk.MenuItem(label=title)
|
||||
if order == START:
|
||||
self.menu.prepend(menu_item)
|
||||
self.notebook.set_current_page(index)
|
||||
|
@ -121,7 +121,7 @@ class QuickTable(SimpleTable):
|
||||
if (index is not None and self._link[index]):
|
||||
# See details (edit, etc):
|
||||
objclass, handle = self._link[index]
|
||||
menu_item = Gtk.MenuItem(_("the object|See %s details") % trans_objclass(objclass))
|
||||
menu_item = Gtk.MenuItem(label=_("the object|See %s details") % trans_objclass(objclass))
|
||||
menu_item.connect("activate",
|
||||
lambda widget: self.on_table_doubleclick(treeview))
|
||||
popup.append(menu_item)
|
||||
@ -131,7 +131,7 @@ class QuickTable(SimpleTable):
|
||||
(index is not None and self._link[index])):
|
||||
objclass, handle = self._link[index]
|
||||
if objclass == 'Person':
|
||||
menu_item = Gtk.MenuItem(_("the object|Make %s active") % trans_objclass('Person'))
|
||||
menu_item = Gtk.MenuItem(label=_("the object|Make %s active") % trans_objclass('Person'))
|
||||
menu_item.connect("activate",
|
||||
lambda widget: self.on_table_click(treeview))
|
||||
popup.append(menu_item)
|
||||
@ -144,7 +144,7 @@ class QuickTable(SimpleTable):
|
||||
handle[0] in ['Person', 'Family', 'Place', 'Event',
|
||||
'Repository', 'Note', 'MediaObject',
|
||||
'Citation', 'Source']):
|
||||
menu_item = Gtk.MenuItem(_("See data not in Filter"))
|
||||
menu_item = Gtk.MenuItem(label=_("See data not in Filter"))
|
||||
menu_item.connect("activate",
|
||||
lambda widget: self.show_not_in_filter(handle[0]))
|
||||
popup.append(menu_item)
|
||||
|
@ -104,7 +104,7 @@ class TextBufDoc(BaseDoc, TextDoc):
|
||||
sheet = self.get_style_sheet()
|
||||
|
||||
for name in sheet.get_paragraph_style_names():
|
||||
tag = Gtk.TextTag(name)
|
||||
tag = Gtk.TextTag(name=name)
|
||||
|
||||
style = sheet.get_paragraph_style(name)
|
||||
font = style.get_font()
|
||||
@ -142,7 +142,8 @@ class TextBufDoc(BaseDoc, TextDoc):
|
||||
|
||||
new_tabs = style.get_tabs()
|
||||
|
||||
tab_array = Pango.TabArray(len(new_tabs)+1,True)
|
||||
tab_array = Pango.TabArray.new(initial_size=len(new_tabs)+1,
|
||||
positions_in_pixels=True)
|
||||
index = 0
|
||||
for tab in map(pixels, new_tabs):
|
||||
tab_array.set_tab(index, Pango.TabAlign.LEFT, tab)
|
||||
@ -150,7 +151,7 @@ class TextBufDoc(BaseDoc, TextDoc):
|
||||
tag.set_property("tabs", tab_array)
|
||||
|
||||
self.tag_table.add(tag)
|
||||
self.buffer = Gtk.TextBuffer(self.tag_table)
|
||||
self.buffer = Gtk.TextBuffer.new(self.tag_table)
|
||||
if container:
|
||||
return DocumentManager(_('Quick View'), self, container)
|
||||
else:
|
||||
|
@ -61,7 +61,7 @@ def add_menuitem(menu, msg, obj, func):
|
||||
obj
|
||||
"""
|
||||
from gi.repository import Gtk
|
||||
item = Gtk.MenuItem(msg)
|
||||
item = Gtk.MenuItem(label=msg)
|
||||
item.set_data('o', obj)
|
||||
item.connect("activate", func)
|
||||
item.show()
|
||||
|
@ -187,7 +187,7 @@ class LinkTag(Gtk.TextTag):
|
||||
lid = 0
|
||||
def __init__(self, buffer):
|
||||
LinkTag.lid += 1
|
||||
GObject.GObject.__init__(self, str(LinkTag.lid))
|
||||
GObject.GObject.__init__(self, name=str(LinkTag.lid))
|
||||
tag_table = buffer.get_tag_table()
|
||||
self.set_property('foreground', "blue")
|
||||
#self.set_property('underline', Pango.Underline.SINGLE)
|
||||
|
@ -304,7 +304,8 @@ class StyledTextEditor(Gtk.TextView):
|
||||
|
||||
self.last_match = self.match
|
||||
self.get_root_window().get_pointer()
|
||||
self.set_tooltip_text(tooltip)
|
||||
if tooltip:
|
||||
self.set_tooltip_text(tooltip)
|
||||
return False
|
||||
|
||||
def make_tooltip_from_link(self, link_tag):
|
||||
@ -330,9 +331,10 @@ class StyledTextEditor(Gtk.TextView):
|
||||
event.button == 1):
|
||||
bounds = self.textbuffer.get_selection_bounds()
|
||||
if bounds:
|
||||
clip = Gtk.Clipboard(selection="PRIMARY")
|
||||
clip = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_PRIMARY)
|
||||
clip.set_text(str(self.textbuffer.get_text(bounds[0],
|
||||
bounds[1])))
|
||||
bounds[1], True)), -1)
|
||||
return False
|
||||
|
||||
def on_button_press_event(self, widget, event):
|
||||
@ -365,12 +367,12 @@ class StyledTextEditor(Gtk.TextView):
|
||||
|
||||
"""
|
||||
# spell checker submenu
|
||||
spell_menu = Gtk.MenuItem(_('Spellcheck'))
|
||||
spell_menu = Gtk.MenuItem(label=_('Spellcheck'))
|
||||
spell_menu.set_submenu(self._create_spell_menu())
|
||||
spell_menu.show_all()
|
||||
menu.prepend(spell_menu)
|
||||
|
||||
search_menu = Gtk.MenuItem(_("Search selection on web"))
|
||||
search_menu = Gtk.MenuItem(label=_("Search selection on web"))
|
||||
search_menu.connect('activate', self.search_web)
|
||||
search_menu.show_all()
|
||||
menu.append(search_menu)
|
||||
@ -381,14 +383,14 @@ class StyledTextEditor(Gtk.TextView):
|
||||
url = self.url_match[MATCH_STRING]
|
||||
|
||||
if flavor == MAIL:
|
||||
open_menu = Gtk.MenuItem(_('_Send Mail To...'))
|
||||
copy_menu = Gtk.MenuItem(_('Copy _E-mail Address'))
|
||||
open_menu = Gtk.MenuItem(label=_('_Send Mail To...'))
|
||||
copy_menu = Gtk.MenuItem(label=_('Copy _E-mail Address'))
|
||||
else:
|
||||
open_menu = Gtk.MenuItem(_('_Open Link'))
|
||||
copy_menu = Gtk.MenuItem(_('Copy _Link Address'))
|
||||
open_menu = Gtk.MenuItem(label=_('_Open Link'))
|
||||
copy_menu = Gtk.MenuItem(label=_('Copy _Link Address'))
|
||||
|
||||
if flavor == LINK:
|
||||
edit_menu = Gtk.MenuItem(_('_Edit Link'))
|
||||
edit_menu = Gtk.MenuItem(label=_('_Edit Link'))
|
||||
edit_menu.connect('activate', self._edit_url_cb,
|
||||
self.url_match[-1], # tag
|
||||
)
|
||||
@ -413,7 +415,7 @@ class StyledTextEditor(Gtk.TextView):
|
||||
display_url(config.get("behavior.web-search-url") %
|
||||
{'text':
|
||||
self.textbuffer.get_text(selection[0],
|
||||
selection[1])})
|
||||
selection[1], True)})
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
@ -563,7 +565,7 @@ class StyledTextEditor(Gtk.TextView):
|
||||
menu = Gtk.Menu()
|
||||
group = None
|
||||
for lang in self.spellcheck.get_all_spellchecks():
|
||||
menuitem = Gtk.RadioMenuItem(group, lang)
|
||||
menuitem = Gtk.RadioMenuItem(label=lang)
|
||||
menuitem.set_active(lang == active_spellcheck)
|
||||
menuitem.connect('activate', self._spell_change_cb, lang)
|
||||
menu.append(menuitem)
|
||||
@ -598,11 +600,14 @@ class StyledTextEditor(Gtk.TextView):
|
||||
if selection_bounds:
|
||||
# Paste text to clipboards
|
||||
text = str(self.textbuffer.get_text(selection_bounds[0],
|
||||
selection_bounds[1]))
|
||||
clipboard = Gtk.Clipboard(selection="CLIPBOARD")
|
||||
clipboard.set_text(text)
|
||||
clipboard = Gtk.Clipboard(selection="PRIMARY")
|
||||
clipboard.set_text(text)
|
||||
selection_bounds[1], True))
|
||||
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_CLIPBOARD)
|
||||
|
||||
clipboard.set_text(text, -1)
|
||||
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_PRIMARY)
|
||||
clipboard.set_text(text, -1)
|
||||
uri_dialog(self, None, self.setlink_callback)
|
||||
|
||||
def setlink_callback(self, uri, tag=None):
|
||||
@ -752,11 +757,13 @@ class StyledTextEditor(Gtk.TextView):
|
||||
|
||||
def _copy_url_cb(self, menuitem, url, flavor):
|
||||
"""Copy url to both useful selections."""
|
||||
clipboard = Gtk.Clipboard(selection="CLIPBOARD")
|
||||
clipboard.set_text(url)
|
||||
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_CLIPBOARD)
|
||||
clipboard.set_text(url, -1)
|
||||
|
||||
clipboard = Gtk.Clipboard(selection="PRIMARY")
|
||||
clipboard.set_text(url)
|
||||
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_PRIMARY)
|
||||
clipboard.set_text(url, -1)
|
||||
|
||||
|
||||
def _edit_url_cb(self, menuitem, link_tag):
|
||||
@ -766,11 +773,13 @@ class StyledTextEditor(Gtk.TextView):
|
||||
# Paste text to clipboards
|
||||
bounds = self.textbuffer.get_selection_bounds()
|
||||
if bounds:
|
||||
text = str(self.textbuffer.get_text(bounds[0], bounds[1]))
|
||||
clipboard = Gtk.Clipboard(selection="CLIPBOARD")
|
||||
clipboard.set_text(text)
|
||||
clipboard = Gtk.Clipboard(selection="PRIMARY")
|
||||
clipboard.set_text(text)
|
||||
text = str(self.textbuffer.get_text(bounds[0], bounds[1], True))
|
||||
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_CLIPBOARD)
|
||||
clipboard.set_text(text, -1)
|
||||
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_PRIMARY)
|
||||
clipboard.set_text(text, -1)
|
||||
uri_dialog(self, link_tag.data,
|
||||
lambda uri: self.setlink_callback(uri, link_tag))
|
||||
|
||||
@ -793,7 +802,8 @@ class StyledTextEditor(Gtk.TextView):
|
||||
@returntype: L{StyledText}
|
||||
|
||||
"""
|
||||
return self.textbuffer.get_text()
|
||||
start, end = self.textbuffer.get_bounds()
|
||||
return self.textbuffer.get_text(start, end, True)
|
||||
|
||||
def get_toolbar(self):
|
||||
"""Get the formatting toolbar of the editor.
|
||||
|
@ -678,7 +678,8 @@ class FanChartGramplet(Gramplet):
|
||||
"""Renders the person data into some lines of text and puts that into the clipboard"""
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
cb = Gtk.clipboard_get(Gdk.SELECTION_CLIPBOARD)
|
||||
cb = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_CLIPBOARD)
|
||||
cb.set_text( self.format_helper.format_person(person,11))
|
||||
return True
|
||||
return False
|
||||
@ -718,7 +719,7 @@ class FanChartGramplet(Gramplet):
|
||||
linked_persons = []
|
||||
|
||||
# Go over spouses and build their menu
|
||||
item = Gtk.MenuItem(_("Spouses"))
|
||||
item = Gtk.MenuItem(label=_("Spouses"))
|
||||
fam_list = person.get_family_handle_list()
|
||||
no_spouses = 1
|
||||
for fam_id in fam_list:
|
||||
@ -752,7 +753,7 @@ class FanChartGramplet(Gramplet):
|
||||
menu.append(item)
|
||||
|
||||
# Go over siblings and build their menu
|
||||
item = Gtk.MenuItem(_("Siblings"))
|
||||
item = Gtk.MenuItem(label=_("Siblings"))
|
||||
pfam_list = person.get_parent_family_handle_list()
|
||||
no_siblings = 1
|
||||
for f in pfam_list:
|
||||
@ -795,7 +796,7 @@ class FanChartGramplet(Gramplet):
|
||||
menu.append(item)
|
||||
|
||||
# Go over children and build their menu
|
||||
item = Gtk.MenuItem(_("Children"))
|
||||
item = Gtk.MenuItem(label=_("Children"))
|
||||
no_children = 1
|
||||
childlist = find_children(self.dbstate.db,person)
|
||||
for child_handle in childlist:
|
||||
@ -832,7 +833,7 @@ class FanChartGramplet(Gramplet):
|
||||
menu.append(item)
|
||||
|
||||
# Go over parents and build their menu
|
||||
item = Gtk.MenuItem(_("Parents"))
|
||||
item = Gtk.MenuItem(label=_("Parents"))
|
||||
no_parents = 1
|
||||
par_list = find_parents(self.dbstate.db,person)
|
||||
for par_id in par_list:
|
||||
@ -869,7 +870,7 @@ class FanChartGramplet(Gramplet):
|
||||
menu.append(item)
|
||||
|
||||
# Go over parents and build their menu
|
||||
item = Gtk.MenuItem(_("Related"))
|
||||
item = Gtk.MenuItem(label=_("Related"))
|
||||
no_related = 1
|
||||
for p_id in find_witnessed_people(self.dbstate.db,person):
|
||||
#if p_id in linked_persons:
|
||||
|
@ -165,7 +165,8 @@ def fontstyle_to_fontdescription(font_style):
|
||||
def tabstops_to_tabarray(tab_stops, dpi):
|
||||
"""Convert a list of tabs given in cm to a Pango.TabArray.
|
||||
"""
|
||||
tab_array = Pango.TabArray(len(tab_stops), False)
|
||||
tab_array = Pango.TabArray.new(initial_size=len(tab_stops),
|
||||
positions_in_pixels=False)
|
||||
|
||||
for index in range(len(tab_stops)):
|
||||
location = tab_stops[index] * dpi * Pango.SCALE / 2.54
|
||||
|
@ -240,7 +240,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
title = _('Remove cross hair')
|
||||
else:
|
||||
title = _('Add cross hair')
|
||||
add_item = Gtk.MenuItem(title)
|
||||
add_item = Gtk.MenuItem(label=title)
|
||||
add_item.connect("activate", self.config_crosshair, event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
@ -249,23 +249,23 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
title = _('Unlock zoom and position')
|
||||
else:
|
||||
title = _('Lock zoom and position')
|
||||
add_item = Gtk.MenuItem(title)
|
||||
add_item = Gtk.MenuItem(label=title)
|
||||
add_item.connect("activate", self.config_zoom_and_position,
|
||||
event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
||||
add_item = Gtk.MenuItem(_("Add place"))
|
||||
add_item = Gtk.MenuItem(label=_("Add place"))
|
||||
add_item.connect("activate", self.add_place, event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
||||
add_item = Gtk.MenuItem(_("Link place"))
|
||||
add_item = Gtk.MenuItem(label=_("Link place"))
|
||||
add_item.connect("activate", self.link_place, event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
||||
add_item = Gtk.MenuItem(_("Center here"))
|
||||
add_item = Gtk.MenuItem(label=_("Center here"))
|
||||
add_item.connect("activate", self.set_center, event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
@ -273,7 +273,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
# Add specific module menu
|
||||
self.add_specific_menu(menu, event, lat, lon)
|
||||
# Add a separator line
|
||||
add_item = Gtk.MenuItem(None)
|
||||
add_item = Gtk.MenuItem(label=None)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
||||
@ -281,7 +281,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
title = _("Replace '%(map)s' by =>") % {
|
||||
'map' : map_name
|
||||
}
|
||||
add_item = Gtk.MenuItem(title)
|
||||
add_item = Gtk.MenuItem(label=title)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
||||
@ -291,7 +291,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
add_item.set_submenu(changemap)
|
||||
# show in the map menu all available providers
|
||||
for map in constants.map_type:
|
||||
changemapitem = Gtk.MenuItem(constants.map_title[map])
|
||||
changemapitem = Gtk.MenuItem(label=constants.map_title[map])
|
||||
changemapitem.show()
|
||||
changemapitem.connect("activate", self.change_map, map)
|
||||
changemap.append(changemapitem)
|
||||
@ -698,18 +698,18 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
add_item = Gtk.MenuItem()
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Place"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Place"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_place, event, lat, lon, mark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here, event, lat, lon, mark)
|
||||
itemoption.append(center)
|
||||
|
@ -750,7 +750,8 @@ class FanChartView(NavigationView):
|
||||
"""Renders the person data into some lines of text and puts that into the clipboard"""
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
cb = Gtk.clipboard_get(Gdk.SELECTION_CLIPBOARD)
|
||||
cb = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
|
||||
Gdk.SELECTION_CLIPBOARD)
|
||||
cb.set_text( self.format_helper.format_person(person,11))
|
||||
return True
|
||||
return False
|
||||
@ -790,7 +791,7 @@ class FanChartView(NavigationView):
|
||||
linked_persons = []
|
||||
|
||||
# Go over spouses and build their menu
|
||||
item = Gtk.MenuItem(_("Spouses"))
|
||||
item = Gtk.MenuItem(label=_("Spouses"))
|
||||
fam_list = person.get_family_handle_list()
|
||||
no_spouses = 1
|
||||
for fam_id in fam_list:
|
||||
@ -824,7 +825,7 @@ class FanChartView(NavigationView):
|
||||
menu.append(item)
|
||||
|
||||
# Go over siblings and build their menu
|
||||
item = Gtk.MenuItem(_("Siblings"))
|
||||
item = Gtk.MenuItem(label=_("Siblings"))
|
||||
pfam_list = person.get_parent_family_handle_list()
|
||||
no_siblings = 1
|
||||
for f in pfam_list:
|
||||
@ -867,7 +868,7 @@ class FanChartView(NavigationView):
|
||||
menu.append(item)
|
||||
|
||||
# Go over children and build their menu
|
||||
item = Gtk.MenuItem(_("Children"))
|
||||
item = Gtk.MenuItem(label=_("Children"))
|
||||
no_children = 1
|
||||
childlist = find_children(self.dbstate.db,person)
|
||||
for child_handle in childlist:
|
||||
@ -904,7 +905,7 @@ class FanChartView(NavigationView):
|
||||
menu.append(item)
|
||||
|
||||
# Go over parents and build their menu
|
||||
item = Gtk.MenuItem(_("Parents"))
|
||||
item = Gtk.MenuItem(label=_("Parents"))
|
||||
no_parents = 1
|
||||
par_list = find_parents(self.dbstate.db,person)
|
||||
for par_id in par_list:
|
||||
@ -941,7 +942,7 @@ class FanChartView(NavigationView):
|
||||
menu.append(item)
|
||||
|
||||
# Go over parents and build their menu
|
||||
item = Gtk.MenuItem(_("Related"))
|
||||
item = Gtk.MenuItem(label=_("Related"))
|
||||
no_related = 1
|
||||
for p_id in find_witnessed_people(self.dbstate.db,person):
|
||||
#if p_id in linked_persons:
|
||||
|
@ -458,19 +458,19 @@ class GeoClose(GeoGraphyView):
|
||||
descr = _('No description')
|
||||
message = "(%s) %s => %s" % ( date, plce[11], descr)
|
||||
prevmark = plce
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, prevmark)
|
||||
@ -486,7 +486,7 @@ class GeoClose(GeoGraphyView):
|
||||
add_item = Gtk.MenuItem()
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Choose the reference person"))
|
||||
add_item = Gtk.MenuItem(label=_("Choose the reference person"))
|
||||
add_item.connect("activate", self.selectPerson)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
@ -312,19 +312,19 @@ class GeoEvents(GeoGraphyView):
|
||||
prevmark = None
|
||||
for mark in marks:
|
||||
if message != "":
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, prevmark)
|
||||
@ -339,18 +339,18 @@ class GeoEvents(GeoGraphyView):
|
||||
date = gen.datehandler.displayer.display(evt.get_date_object())
|
||||
message = "(%s) %s : %s" % (date, gen.lib.EventType( mark[7] ), mark[5] )
|
||||
prevmark = mark
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event, event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here, event, lat, lon, prevmark)
|
||||
itemoption.append(center)
|
||||
@ -364,11 +364,11 @@ class GeoEvents(GeoGraphyView):
|
||||
add_item = Gtk.MenuItem()
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Show all events"))
|
||||
add_item = Gtk.MenuItem(label=_("Show all events"))
|
||||
add_item.connect("activate", self.show_all_events, event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Centering on Place"))
|
||||
add_item = Gtk.MenuItem(label=_("Centering on Place"))
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
@ -379,7 +379,7 @@ class GeoEvents(GeoGraphyView):
|
||||
for mark in self.sort:
|
||||
if mark[0] != oldplace:
|
||||
oldplace = mark[0]
|
||||
modify = Gtk.MenuItem(mark[0])
|
||||
modify = Gtk.MenuItem(label=mark[0])
|
||||
modify.show()
|
||||
modify.connect("activate", self.goto_place, float(mark[3]), float(mark[4]))
|
||||
itemoption.append(modify)
|
||||
|
@ -647,19 +647,19 @@ class GeoFamClose(GeoGraphyView):
|
||||
descr = _('No description')
|
||||
message = "(%s) %s => %s" % ( date, plce[11], descr)
|
||||
prevmark = plce
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, prevmark)
|
||||
@ -675,7 +675,7 @@ class GeoFamClose(GeoGraphyView):
|
||||
add_item = Gtk.MenuItem()
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Choose the reference family"))
|
||||
add_item = Gtk.MenuItem(label=_("Choose the reference family"))
|
||||
add_item.connect("activate", self.selectFamily)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
@ -390,19 +390,19 @@ class GeoFamily(GeoGraphyView):
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.show()
|
||||
menu.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Family"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Family"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_family, event, lat, lon, mark)
|
||||
itemoption.append(modify)
|
||||
modify = Gtk.MenuItem(_("Edit Person"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Person"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_person, event, lat, lon, mark)
|
||||
itemoption.append(modify)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event, event, lat, lon, mark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here, event, lat, lon, mark)
|
||||
itemoption.append(center)
|
||||
@ -415,7 +415,7 @@ class GeoFamily(GeoGraphyView):
|
||||
prevmark = None
|
||||
for mark in marks:
|
||||
if message != "":
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
self.add_event_bubble_message(event, lat, lon,
|
||||
@ -443,7 +443,7 @@ class GeoFamily(GeoGraphyView):
|
||||
descr = _('No description')
|
||||
message = "(%s) %s => %s" % ( date, mark[5], descr)
|
||||
prevmark = mark
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
self.add_event_bubble_message(event, lat, lon, prevmark, add_item)
|
||||
|
@ -589,19 +589,19 @@ class GeoMoves(GeoGraphyView):
|
||||
descr = _('No description')
|
||||
message = "(%s) %s => %s" % ( date, mark[11], descr)
|
||||
prevmark = mark
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, prevmark)
|
||||
|
@ -407,7 +407,7 @@ class GeoPerson(GeoGraphyView):
|
||||
prevmark = None
|
||||
for mark in marks:
|
||||
if oldplace != "":
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
@ -415,12 +415,12 @@ class GeoPerson(GeoGraphyView):
|
||||
itemoption.show()
|
||||
message = ""
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, prevmark)
|
||||
@ -435,12 +435,12 @@ class GeoPerson(GeoGraphyView):
|
||||
itemoption.show()
|
||||
message = ""
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event,
|
||||
event, lat, lon, mark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, mark)
|
||||
@ -466,18 +466,18 @@ class GeoPerson(GeoGraphyView):
|
||||
descr = _('No description')
|
||||
message = "(%s) %s => %s" % ( date, mark[11], descr)
|
||||
prevmark = mark
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Event"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_event, event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here, event, lat, lon, prevmark)
|
||||
itemoption.append(center)
|
||||
@ -492,7 +492,7 @@ class GeoPerson(GeoGraphyView):
|
||||
add_item = Gtk.MenuItem()
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Animate"))
|
||||
add_item = Gtk.MenuItem(label=_("Animate"))
|
||||
add_item.connect("activate", self.animate, self.sort, 0, 0)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
|
@ -311,37 +311,37 @@ class GeoPlaces(GeoGraphyView):
|
||||
prevmark = None
|
||||
for mark in marks:
|
||||
if message != "":
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Place"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Place"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_place,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here,
|
||||
event, lat, lon, prevmark)
|
||||
itemoption.append(center)
|
||||
message = "%s" % mark[0]
|
||||
prevmark = mark
|
||||
add_item = Gtk.MenuItem(message)
|
||||
add_item = Gtk.MenuItem(label=message)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(_("Edit Place"))
|
||||
modify = Gtk.MenuItem(label=_("Edit Place"))
|
||||
modify.show()
|
||||
modify.connect("activate", self.edit_place, event, lat, lon, prevmark)
|
||||
itemoption.append(modify)
|
||||
center = Gtk.MenuItem(_("Center on this place"))
|
||||
center = Gtk.MenuItem(label=_("Center on this place"))
|
||||
center.show()
|
||||
center.connect("activate", self.center_here, event, lat, lon, prevmark)
|
||||
itemoption.append(center)
|
||||
@ -355,11 +355,11 @@ class GeoPlaces(GeoGraphyView):
|
||||
add_item = Gtk.MenuItem()
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Show all places"))
|
||||
add_item = Gtk.MenuItem(label=_("Show all places"))
|
||||
add_item.connect("activate", self.show_all_places, event, lat , lon)
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
add_item = Gtk.MenuItem(_("Centering on Place"))
|
||||
add_item = Gtk.MenuItem(label=_("Centering on Place"))
|
||||
add_item.show()
|
||||
menu.append(add_item)
|
||||
itemoption = Gtk.Menu()
|
||||
@ -370,7 +370,7 @@ class GeoPlaces(GeoGraphyView):
|
||||
for mark in self.sort:
|
||||
if mark[0] != oldplace:
|
||||
oldplace = mark[0]
|
||||
modify = Gtk.MenuItem(mark[0])
|
||||
modify = Gtk.MenuItem(label=mark[0])
|
||||
modify.show()
|
||||
modify.connect("activate", self.goto_place,
|
||||
float(mark[3]), float(mark[4]))
|
||||
|
Loading…
Reference in New Issue
Block a user