def add_media(self, infile, pos, x, y, alt='', style_name=None, crop=None): """Add photo to report""" outfile = os.path.splitext(infile)[0] pictname = latexescape(os.path.split(outfile)[1]) outfile = ''.join((outfile, '.jpg')) outfile2 = ''.join((outfile, '.jpeg')) outfile3 = ''.join((outfile, '.png')) if HAVE_PIL and infile not in [outfile, outfile2, outfile3]: try: curr_img = Image.open(infile) curr_img.save(outfile) width, height = curr_img.size if height > width: y = y * height / width except IOError: self.emit(''.join( ('%\n *** Error: cannot convert ', infile, '\n *** to ', outfile, '%\n'))) elif not HAVE_PIL: from gramps.gen.config import config if not config.get('interface.ignore-pil'): from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog title = _("PIL (Python Imaging Library) not loaded.") message = _("Production of jpg images from non-jpg images " "in LaTeX documents will not be available. " "Use your package manager to install " "python-imaging or python-pillow or " "python3-pillow") MessageHideDialog( title, message, # TODO no-parent 'interface.ignore-pil') self.emit(''.join(('%\n *** Error: cannot convert ', infile, '\n *** to ', outfile, '\n *** PIL not installed %\n'))) if self.in_table: self.pict_in_table = True self.emit(''.join(('\\grmkpicture{', outfile, '}{', repr(x), '}{', repr(y), '}{', pictname, '}%\n'))) self.pict_width = x self.pict_height = y
from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog from gramps.gen.const import URL_WIKISTRING gexiv2_dict = { 'gramps_wiki_build_gexiv2_url': URL_WIKISTRING + "GEPS_029:_GTK3-GObject_introspection" "_Conversion#GExiv2_for_Image_metadata" } title = _("GExiv2 module not loaded.") message = _("Image metadata functionality will not be available.\n" "To build it for Gramps see " "%(gramps_wiki_build_gexiv2_url)s" % gexiv2_dict) if uistate: MessageHideDialog(title, message, 'interface.ignore-gexiv2', parent=uistate.window) else: MessageHideDialog(title, message, 'interface.ignore-gexiv2') register( GRAMPLET, id="Person Residence", name=_("Person Residence"), description=_("Gramplet showing residence events for a person"), version="1.0.0", gramps_target_version=MODULE_VERSION, status=STABLE, fname="personresidence.py", height=200, gramplet='PersonResidence',
from gramps.gen.config import config if not config.get('interface.ignore-gexiv2'): from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog from gramps.gen.const import URL_WIKISTRING gexiv2_dict = { 'gramps_wiki_build_gexiv2_url': URL_WIKISTRING + "GEPS_029:_GTK3-GObject_introspection" "_Conversion#GExiv2_for_Image_metadata" } title = _("GExiv2 module not loaded.") message = _("Image metadata functionality will not be available.\n" "To build it for Gramps see " "%(gramps_wiki_build_gexiv2_url)s" % gexiv2_dict) MessageHideDialog(title, message, 'interface.ignore-gexiv2') register( GRAMPLET, id="Person Residence", name=_("Person Residence"), description=_("Gramplet showing residence events for a person"), version="1.0.0", gramps_target_version=MODULE_VERSION, status=STABLE, fname="personresidence.py", height=200, gramplet='PersonResidence', gramplet_title=_("Residence"), navtypes=["Person"], )
except: pass if not GOOCANVAS: from gramps.gen.config import config if not config.get('interface.ignore-goocanvas'): from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog from gramps.gen.const import URL_WIKISTRING TITLE = _("goocanvas module not loaded.") MESSAGE = _("Graphview functionality will not be available.\n" "You must install goocanvas.") if uistate: MessageHideDialog(TITLE, MESSAGE, 'interface.ignore-goocanvas', parent=uistate.window) else: MessageHideDialog(TITLE, MESSAGE, 'interface.ignore-goocanvas') else: # Load the view only if goocanvas library is present. register( VIEW, id='graphview', name=_("Graph View"), category=("Ancestry", _("Charts")), description=_("Dynamic graph of relations"), version='1.0.70', gramps_target_version="5.0", status=STABLE, fname='graphview.py',
from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog from gramps.gen.const import URL_WIKISTRING TITLE = _("OsmGpsMap module not loaded.") MESSAGE = _("Geography functionality will not be available.\n" "Try to install:\n" " gir1.2-osmgpsmap-1.0 (debian, ubuntu, ...)\n" " osm-gps-map-gobject-1.0.1 for fedora, ...\n" " typelib-1_0-OsmGpsMap-1_0 for openSuse\n" " ...\n" "To build it for Gramps see the Wiki (<F1>)\n" " and search for 'build from source'") if uistate: MessageHideDialog(TITLE, MESSAGE, 'interface.ignore-osmgpsmap', parent=uistate.window) else: MessageHideDialog(TITLE, MESSAGE, 'interface.ignore-osmgpsmap') else: # Load the view only if osmgpsmap library is present. register(VIEW, id = 'geo1', name = _("All known places for one Person"), description = _("A view showing the places visited by " "one person during his life."), version = '1.0', gramps_target_version = MODULE_VERSION, status = STABLE, fname = 'geoperson.py',
TOOLKIT = WEBKIT except: pass from gramps.gen.config import config if TOOLKIT == NOWEB and not config.get('interface.ignore-webkit'): from gramps.gen.constfunc import has_display, mac, win if win() or mac(): # WebKit is not put into either Windows or Mac bundles config.set('interface.ignore-webkit', True) if has_display() and not config.get('interface.ignore-webkit'): from gramps.gui.dialog import MessageHideDialog title = _("Webkit module not loaded.") msg = _("Webkit module not loaded. " "Embedded web page viewing will not be available. " "Use your package manager to install gir1.2-webkit-3.0") MessageHideDialog(title, msg, 'interface.ignore-webkit') #no interfaces present, we do not register these plugins if not (TOOLKIT == NOWEB): register( VIEW, id='htmlview', name=_("Html View"), description=_("A view showing html pages embedded in Gramps"), version='1.0', gramps_target_version=MODULE_VERSION, status=STABLE, fname='htmlrenderer.py', authors=["The Gramps project"], authors_email=["http://gramps-project.org"], category=("Web", _("Web")),
from gramps.gen.config import config if not config.get('interface.ignore-osmgpsmap'): from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog from gramps.gen.const import URL_WIKISTRING OSMGPS_DICT = { 'gramps_wiki_build_osmgps_url': URL_WIKISTRING + "GEPS_029:_GTK3-GObject_introspection" "_Conversion#OsmGpsMap_for_Geography" } TITLE = _("OsmGpsMap module not loaded.") MESSAGE = _("Geography functionality will not be available.\n" "To build it for Gramps see " "%(gramps_wiki_build_osmgps_url)s") % OSMGPS_DICT MessageHideDialog(TITLE, MESSAGE, 'interface.ignore-osmgpsmap') else: # Load the view only if osmgpsmap library is present. register( VIEW, id='geo1', name=_("All known places for one Person"), description=_("A view showing the places visited by " "one person during his life."), version='1.0', gramps_target_version=MODULE_VERSION, status=STABLE, fname='geoperson.py', authors=["Serge Noiraud"], authors_email=[""], category=("Geography", _("Geography")),
from gramps.gen.config import config if not config.get('interface.ignore-osmgpsmap'): from gramps.gen.constfunc import has_display if has_display(): from gramps.gui.dialog import MessageHideDialog from gramps.gen.const import URL_WIKISTRING osmgps_dict = { 'gramps_wiki_build_osmgps_url': URL_WIKISTRING + "GEPS_029:_GTK3-GObject_introspection" "_Conversion#OsmGpsMap_for_Geography" } title = _("OsmGpsMap module not loaded.") message = _("Geography functionality will not be available.\n" "To build it for Gramps see " "%(gramps_wiki_build_osmgps_url)s") % osmgps_dict MessageHideDialog(title, message, 'interface.ignore-osmgpsmap') else: # Load the view only if osmgpsmap library is present. register( VIEW, id='geo1', name=_("All known places for one Person"), description=_("A view showing the places visited by " "one person during his life."), version='1.0', gramps_target_version=MODULE_VERSION, status=STABLE, fname='geoperson.py', authors=["Serge Noiraud"], authors_email=[""], category=("Geography", _("Geography")),