Difference between revisions of "Overrule Gramps Icons"

From Gramps
Jump to: navigation, search
(Overrule GTK icons)
(mark page as outdated - believe came up in recent conversation on mailing list.)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Making custom icons for use in GRAMPS
+
{{man warn|Instructions are for Gramps version 2.4}}
 +
{{stub}}
 +
Making custom icons for use in Gramps
  
[[Category:Documentation]][[Category:Developers/Artwork]]
+
==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.
  
==Why do this==
+
==Overruling Gramps icons, with fallback==
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.
+
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:
  
==Overruling GRAMPS icons, with fallback==
 
The following is for upcoming version 2.4. Suppose you use the ''Buuf'' icon theme, and want to make your own custom gramps icons. Then do the following:
 
 
===Preparation===
 
===Preparation===
 
*In directories <code>Buuf/16x16</code>, <code>Buuf/22x22</code>, <code>and Buuf/scalable</code>, add the directory <code>gramps</code>.
 
*In directories <code>Buuf/16x16</code>, <code>Buuf/22x22</code>, <code>and Buuf/scalable</code>, add the directory <code>gramps</code>.
*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]].
+
*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===
 
===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:
+
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 = [
 
  iconpaths = [
 
                     (os.path.join(const.image_dir,'scalable'),'.svg'),
 
                     (os.path.join(const.image_dir,'scalable'),'.svg'),
Line 48: Line 50:
 
                     ]
 
                     ]
  
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.
+
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==
 
==Overrule GTK icons==
Line 65: Line 67:
 
{ "22x22/actions/text_bold.png" }
 
{ "22x22/actions/text_bold.png" }
 
  }</nowiki>
 
  }</nowiki>
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).
+
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 ==
 +
*[[Using icons]]
 +
 
 +
[[Category:Developers/Artwork]]

Latest revision as of 00:43, 13 January 2019

Gnome-important.png
Instructions are for Gramps version 2.4

Gramps-notes.png

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