Difference between revisions of "Overrule Gramps Icons"

From Gramps
Jump to: navigation, search
(mark page as outdated - believe came up in recent conversation on mailing list.)
 
Line 1: Line 1:
 +
{{man warn|Instructions are for Gramps version 2.4}}
 +
{{stub}}
 
Making custom icons for use in Gramps
 
Making custom icons for use in Gramps
  

Latest revision as of 00:43, 13 January 2019

Gnome-important.png
Instructions are for Gramps version 2.4

Gramps-notes.png

This article's content is incomplete or a placeholder stub.
Please update or expand this section.


Making custom icons for use in Gramps

Why do this

The Gramps icon style is based on the Tango guidelines. If you use a different icon set, this might not fit in well. Normally the GTK stock icons should be taken from the theme you use, so paste, edit, add, ... should be conform. You can overrule those too however.

Overruling Gramps icons, with fallback

In Gramps version 2.4. Suppose you use the Buuf icon theme, and want to make your own custom gramps icons. Then do the following:

Preparation

  • In directories Buuf/16x16, Buuf/22x22, and Buuf/scalable, add the directory gramps.
  • In these created gramps directories, make the icons with the corresponding sizes (scalable is for svg icons of size 48x48px), for the Gramps icons you want to overrule. Give the icons the correct gramps name, see Gramps icon set.

Overruling

To make Gramps use these icons, save a backup of gramps_main.py and then open gramps_main.py. Change the following codelines, using the correct path names on your system:

iconpaths = [
                   (os.path.join(const.image_dir,'scalable'),'.svg'),
                   (const.image_dir,'.svg'), (const.image_dir,'.png'),
                   ]

must be changed into:

iconpaths = [
                    ('/path_to_buuf/Buuf/scalable/gramps','.svg'),
                   (os.path.join(const.image_dir,'scalable'),'.svg'),
                   (const.image_dir,'.svg'), (const.image_dir,'.png'),
                   ]

and

extraiconsize = [
                   (os.path.join(const.image_dir, '22x22'),
                           gtk.ICON_SIZE_LARGE_TOOLBAR),
                   (os.path.join(const.image_dir, '16x16'),
                           gtk.ICON_SIZE_MENU),
                   (os.path.join(const.image_dir, '22x22'),
                           gtk.ICON_SIZE_BUTTON),
                   ] 

into

extraiconsize = [
                   (os.path.join(const.image_dir, '22x22'),
                           gtk.ICON_SIZE_LARGE_TOOLBAR),
                   (os.path.join(const.image_dir, '16x16'),
                           gtk.ICON_SIZE_MENU),
                   (os.path.join(const.image_dir, '22x22'),
                           gtk.ICON_SIZE_BUTTON),
                   ('/path_to_buuf/Buuf/22x22/gramps',
                           gtk.ICON_SIZE_LARGE_TOOLBAR),
                   ('/path_to_buuf/Buuf/22x22/gramps', 
                           gtk.ICON_SIZE_BUTTON),
                   ('//path_to_buuf/Buuf/16x16/gramps', 
                           gtk.ICON_SIZE_MENU),
                   ]

Your own icons are now visible in Gramps. You could off course replace the Gramps icons in the images directory too, but the above method has less risk of deleting icons by error.

Overrule GTK icons

To overrule GTK icons, your theme must be correctly configured. The theme will normally map a set of gtk icons to theme icons. In eg the Tango icon set, a actions/gtk-copy.png icon is available. By replacing it you see it everywhere different.

In KDE, if you use the GTK-QT-engine to make GTK apps look like QT apps, you will note that this does not work 100%. Patches have been accepted in GTK-QT to make it work, version > 0.7.
If you have version <= 0.7 you can hack the .gtk_qt_engine_rc file in your home directory to make it work. The variable pixmap_path sets the absolute path where icons can be found, and eg

stock["gtk-bold"]={
	{ "22x22/actions/text_bold.png", *, *, "gtk-large-toolbar" },
	{ "32x32/actions/text_bold.png", *, *, "gtk-dnd" },
	{ "32x32/actions/text_bold.png", *, *, "gtk-dialog" },
	{ "16x16/actions/text_bold.png", *, *, "gtk-button" },
	{ "16x16/actions/text_bold.png", *, *, "gtk-menu" },
	{ "16x16/actions/text_bold.png", *, *, "gtk-small-toolbar" },
	{ "22x22/actions/text_bold.png" }
 }

shows how to find the gtk icon gtk-bold, and with which sizes. This can be easily changed to your liking. If you make an error, delete the file and restart Gramps. The gtk-qt-engine will recreate it (on font/icon set change the file is also regenerated, so keep a backup of your changes to the file).

See also