diff --git a/gramps/plugins/lib/maps/geography.py b/gramps/plugins/lib/maps/geography.py index f43163473..bb3e5980f 100644 --- a/gramps/plugins/lib/maps/geography.py +++ b/gramps/plugins/lib/maps/geography.py @@ -67,6 +67,7 @@ from . import constants from .osmgps import OsmGps from .selectionlayer import SelectionLayer from .placeselection import PlaceSelection +from .cairoprint import CairoPrintSave #------------------------------------------------------------------------ # @@ -238,6 +239,25 @@ class GeoGraphyView(OsmGps, NavigationView): """ return True + def define_actions(self): + """ + Required define_actions function for PageView. Builds the action + group information required. + As this function is overriden in some plugins, we need to call + another method. + """ + NavigationView.define_actions(self) + self.define_print_actions() + + def define_print_actions(self): + """ + Associate the print button to the PrintView action. + """ + self._add_action('PrintView', Gtk.STOCK_PRINT, _("_Print..."), + accel="P", + tip=_("Print or save the Map"), + callback=self.printview) + def config_connect(self): """ Overwriten from :class:`~gui.views.pageview.PageView method @@ -724,6 +744,21 @@ class GeoGraphyView(OsmGps, NavigationView): mnam = _nd.display(mother) if mother else _("Unknown") return ( fnam, mnam ) + #------------------------------------------------------------------------- + # + # Printing functionalities + # + #------------------------------------------------------------------------- + def printview(self, obj): + """ + Print or save the view that is currently shown + """ + req = self.osm.get_allocation() + widthpx = req.width / 0.70 + heightpx = req.height / 0.70 + prt = CairoPrintSave(widthpx, heightpx, self.osm.do_draw, self.osm) + prt.run() + #------------------------------------------------------------------------- # # Specific functionalities diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py index 8fc6ccbdf..32b8c0c9a 100644 --- a/gramps/plugins/view/geoclose.py +++ b/gramps/plugins/view/geoclose.py @@ -80,6 +80,11 @@ _UI_DEF = '''\ + + + + + @@ -94,6 +99,9 @@ _UI_DEF = '''\ + + + ''' @@ -269,6 +277,7 @@ class GeoClose(GeoGraphyView): """ NavigationView.define_actions(self) + self.define_print_actions() self.ref_person = Gtk.ActionGroup(self.title + '/Selection') self.ref_person.add_actions([ ('RefPerson', 'gramps-person', _('reference _Person'), None , diff --git a/gramps/plugins/view/geoevents.py b/gramps/plugins/view/geoevents.py index 3b4af8c29..30a608eee 100644 --- a/gramps/plugins/view/geoevents.py +++ b/gramps/plugins/view/geoevents.py @@ -82,6 +82,11 @@ _UI_DEF = '''\ + + + + + @@ -94,6 +99,9 @@ _UI_DEF = '''\ + + + ''' diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py index b72ccf40e..e36db37b5 100644 --- a/gramps/plugins/view/geofamclose.py +++ b/gramps/plugins/view/geofamclose.py @@ -78,6 +78,11 @@ _UI_DEF = '''\ + + + + + @@ -92,6 +97,9 @@ _UI_DEF = '''\ + + + ''' @@ -259,6 +267,7 @@ class GeoFamClose(GeoGraphyView): """ NavigationView.define_actions(self) + self.define_print_actions() self.ref_family = Gtk.ActionGroup(self.title + '/Selection') self.ref_family.add_actions([ ('RefFamily', 'gramps-family', _('reference _Family'), None , diff --git a/gramps/plugins/view/geofamily.py b/gramps/plugins/view/geofamily.py index 2673e80fc..22dc7a2dc 100644 --- a/gramps/plugins/view/geofamily.py +++ b/gramps/plugins/view/geofamily.py @@ -82,6 +82,11 @@ _UI_DEF = '''\ + + + + + @@ -94,6 +99,9 @@ _UI_DEF = '''\ + + + ''' diff --git a/gramps/plugins/view/geomoves.py b/gramps/plugins/view/geomoves.py index 4d0218e87..696409a22 100644 --- a/gramps/plugins/view/geomoves.py +++ b/gramps/plugins/view/geomoves.py @@ -83,6 +83,11 @@ _UI_DEF = '''\ + + + + + @@ -96,6 +101,9 @@ _UI_DEF = '''\ + + + ''' @@ -211,12 +219,6 @@ class GeoMoves(GeoGraphyView): self._createmap(p1) self.uistate.modify_statusbar(self.dbstate) - def define_actions(self): - """ - Define action for the reference family button. - """ - NavigationView.define_actions(self) - def build_tree(self): """ This is called by the parent class when the view becomes visible. Since diff --git a/gramps/plugins/view/geoperson.py b/gramps/plugins/view/geoperson.py index f18ee9915..e8a3c030e 100644 --- a/gramps/plugins/view/geoperson.py +++ b/gramps/plugins/view/geoperson.py @@ -87,6 +87,11 @@ _UI_DEF = '''\ + + + + + @@ -100,6 +105,9 @@ _UI_DEF = '''\ + + + ''' diff --git a/gramps/plugins/view/geoplaces.py b/gramps/plugins/view/geoplaces.py index 0df1ad722..993ba50eb 100644 --- a/gramps/plugins/view/geoplaces.py +++ b/gramps/plugins/view/geoplaces.py @@ -82,6 +82,11 @@ _UI_DEF = '''\ + + + + + @@ -94,6 +99,9 @@ _UI_DEF = '''\ + + + '''