From 35ccf018273db9e93c13b3ff12246a1a521c2f43 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sun, 17 Jun 2012 23:04:42 +0000 Subject: [PATCH] Convert MenuItem, working styledtexteditor in grampletpane svn: r19859 --- src/gui/clipboard.py | 6 +- src/gui/editors/displaytabs/dataembedlist.py | 2 +- src/gui/editors/displaytabs/embeddedlist.py | 5 +- src/gui/editors/displaytabs/gallerytab.py | 4 +- src/gui/editors/displaytabs/surnametab.py | 2 +- src/gui/glade/catalog/README | 3 +- src/gui/grampsbar.py | 8 +-- src/gui/navigator.py | 2 +- src/gui/plug/quick/_quicktable.py | 6 +- src/gui/plug/quick/_textbufdoc.py | 7 ++- src/gui/utils.py | 2 +- src/gui/widgets/grampletpane.py | 2 +- src/gui/widgets/styledtexteditor.py | 64 +++++++++++--------- src/plugins/gramplet/FanChartGramplet.py | 13 ++-- src/plugins/lib/libcairodoc.py | 3 +- src/plugins/lib/maps/geography.py | 22 +++---- src/plugins/view/fanchartview.py | 13 ++-- src/plugins/view/geoclose.py | 8 +-- src/plugins/view/geoevents.py | 18 +++--- src/plugins/view/geofamclose.py | 8 +-- src/plugins/view/geofamily.py | 12 ++-- src/plugins/view/geomoves.py | 6 +- src/plugins/view/geoperson.py | 18 +++--- src/plugins/view/geoplaces.py | 18 +++--- 24 files changed, 134 insertions(+), 118 deletions(-) diff --git a/src/gui/clipboard.py b/src/gui/clipboard.py index fd4fa0325..f7b47404c 100644 --- a/src/gui/clipboard.py +++ b/src/gui/clipboard.py @@ -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)) diff --git a/src/gui/editors/displaytabs/dataembedlist.py b/src/gui/editors/displaytabs/dataembedlist.py index b47f6fbeb..7bb2201e0 100644 --- a/src/gui/editors/displaytabs/dataembedlist.py +++ b/src/gui/editors/displaytabs/dataembedlist.py @@ -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) diff --git a/src/gui/editors/displaytabs/embeddedlist.py b/src/gui/editors/displaytabs/embeddedlist.py index 1769f0971..83e81c079 100644 --- a/src/gui/editors/displaytabs/embeddedlist.py +++ b/src/gui/editors/displaytabs/embeddedlist.py @@ -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): """ diff --git a/src/gui/editors/displaytabs/gallerytab.py b/src/gui/editors/displaytabs/gallerytab.py index 8f3554600..ea4cd2a03 100644 --- a/src/gui/editors/displaytabs/gallerytab.py +++ b/src/gui/editors/displaytabs/gallerytab.py @@ -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) diff --git a/src/gui/editors/displaytabs/surnametab.py b/src/gui/editors/displaytabs/surnametab.py index 18bdf9c21..d58dc5a34 100644 --- a/src/gui/editors/displaytabs/surnametab.py +++ b/src/gui/editors/displaytabs/surnametab.py @@ -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]) diff --git a/src/gui/glade/catalog/README b/src/gui/glade/catalog/README index 63012c593..f99e7db27 100644 --- a/src/gui/glade/catalog/README +++ b/src/gui/glade/catalog/README @@ -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 diff --git a/src/gui/grampsbar.py b/src/gui/grampsbar.py index 05c96150f..7336491bc 100644 --- a/src/gui/grampsbar.py +++ b/src/gui/grampsbar.py @@ -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) diff --git a/src/gui/navigator.py b/src/gui/navigator.py index b4f14e324..fc7a8a477 100644 --- a/src/gui/navigator.py +++ b/src/gui/navigator.py @@ -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) diff --git a/src/gui/plug/quick/_quicktable.py b/src/gui/plug/quick/_quicktable.py index e149626fd..6cee8f02b 100644 --- a/src/gui/plug/quick/_quicktable.py +++ b/src/gui/plug/quick/_quicktable.py @@ -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) diff --git a/src/gui/plug/quick/_textbufdoc.py b/src/gui/plug/quick/_textbufdoc.py index c0ebb2dc6..9a6415d26 100644 --- a/src/gui/plug/quick/_textbufdoc.py +++ b/src/gui/plug/quick/_textbufdoc.py @@ -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: diff --git a/src/gui/utils.py b/src/gui/utils.py index d9898170b..ae9bcdc72 100644 --- a/src/gui/utils.py +++ b/src/gui/utils.py @@ -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() diff --git a/src/gui/widgets/grampletpane.py b/src/gui/widgets/grampletpane.py index 65a8838cc..508b686f8 100644 --- a/src/gui/widgets/grampletpane.py +++ b/src/gui/widgets/grampletpane.py @@ -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) diff --git a/src/gui/widgets/styledtexteditor.py b/src/gui/widgets/styledtexteditor.py index 814d496e5..ace313e85 100644 --- a/src/gui/widgets/styledtexteditor.py +++ b/src/gui/widgets/styledtexteditor.py @@ -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. diff --git a/src/plugins/gramplet/FanChartGramplet.py b/src/plugins/gramplet/FanChartGramplet.py index e0a712aaf..54f333f57 100644 --- a/src/plugins/gramplet/FanChartGramplet.py +++ b/src/plugins/gramplet/FanChartGramplet.py @@ -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: diff --git a/src/plugins/lib/libcairodoc.py b/src/plugins/lib/libcairodoc.py index 55242945d..818d2ba4c 100644 --- a/src/plugins/lib/libcairodoc.py +++ b/src/plugins/lib/libcairodoc.py @@ -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 diff --git a/src/plugins/lib/maps/geography.py b/src/plugins/lib/maps/geography.py index 46c061e05..c2cff9bb2 100644 --- a/src/plugins/lib/maps/geography.py +++ b/src/plugins/lib/maps/geography.py @@ -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) diff --git a/src/plugins/view/fanchartview.py b/src/plugins/view/fanchartview.py index cac3e9de5..b24a33c85 100644 --- a/src/plugins/view/fanchartview.py +++ b/src/plugins/view/fanchartview.py @@ -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: diff --git a/src/plugins/view/geoclose.py b/src/plugins/view/geoclose.py index 3f662547a..9131ec0dc 100644 --- a/src/plugins/view/geoclose.py +++ b/src/plugins/view/geoclose.py @@ -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) diff --git a/src/plugins/view/geoevents.py b/src/plugins/view/geoevents.py index 4499b118a..cf8215fbc 100644 --- a/src/plugins/view/geoevents.py +++ b/src/plugins/view/geoevents.py @@ -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) diff --git a/src/plugins/view/geofamclose.py b/src/plugins/view/geofamclose.py index fe13edf4d..d55f1864d 100644 --- a/src/plugins/view/geofamclose.py +++ b/src/plugins/view/geofamclose.py @@ -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) diff --git a/src/plugins/view/geofamily.py b/src/plugins/view/geofamily.py index a60e72c44..f9f2742bc 100644 --- a/src/plugins/view/geofamily.py +++ b/src/plugins/view/geofamily.py @@ -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) diff --git a/src/plugins/view/geomoves.py b/src/plugins/view/geomoves.py index ce68e31ff..51ec4cfc5 100644 --- a/src/plugins/view/geomoves.py +++ b/src/plugins/view/geomoves.py @@ -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) diff --git a/src/plugins/view/geoperson.py b/src/plugins/view/geoperson.py index ca631af6c..590024620 100644 --- a/src/plugins/view/geoperson.py +++ b/src/plugins/view/geoperson.py @@ -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) diff --git a/src/plugins/view/geoplaces.py b/src/plugins/view/geoplaces.py index 23a7c3c1c..2c6faafc0 100644 --- a/src/plugins/view/geoplaces.py +++ b/src/plugins/view/geoplaces.py @@ -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]))