[Scribus] KDE icons for Scribus

Henning Schröder scribus
Sun Aug 3 22:18:32 CEST 2003


Hi!
If you would like to see KDE icons inside Scribus you should try out the attached
Python script. Call it from command line with
 python scribus_icons.py /your/path/to/scribus/icons
 
Enjoy the new fresh look :-)


Henning
-------------- next part --------------
#!/usr/bin/python
import os, sys, shutil
from ConfigParser import ConfigParser

SCRIBUS_ICONS = '/usr/local/stow/scribus/lib/scribus/icons/'
THEME = 'default.kde'
PATHS = ['/usr/', '/usr/local/', '/opt/kde/']

replace = {
  'DateiNeu.xpm': '22x22/actions/filenew.png',
  'DateiNeu16.png': '16x16/actions/filenew.png',
  'DateiOpen.xpm': '22x22/actions/fileopen.png',
  'DateiOpen16.png': '16x16/actions/fileopen.png',
  'DateiPrint.xpm': '22x22/actions/fileprint.png',
  'DateiPrint16.png': '16x16/actions/fileprint.png',
  'DateiSave.xpm': '22x22/actions/filesave.png',
  'DateiSave16.png': '16x16/actions/filesave.png',
  'DateiClos.xpm': '22x22/actions/fileclose.png',
  'DateiClos16.png': '16x16/actions/fileclose.png',
  'editcopy.png': '22x22/actions/editcopy.png',
  'editcut.png': '22x22/actions/editcut.png',
  'editdelete.png': '22x22/actions/editdelete.png',
  'editpaste.png': '22x22/actions/editpaste.png',
  'exit.png': '22x22/actions/exit.png',
  'Lupe.xpm': '22x22/actions/viewmag.png',
  'back.png': '22x22/actions/back.png',
  'gohome.png': '22x22/actions/gohome.png',
  'forward.png': '22x22/actions/forward.png',
  'top.png': '22x22/actions/top.png',  
  'bottom.png': '22x22/actions/bottom.png',
  'start.png': '22x22/actions/start.png',
  'finish.png': '22x22/actions/finish.png'
}



def init():
    global THEME
    KDEDIR = os.environ.get('KDEDIR', '')
    if KDEDIR:
	PATHS.insert(0, KDEDIR)
    PATHS.insert(0, os.path.expanduser('~/.kde'))
    try:
	cfg = ConfigParser()
	cfg.read(os.path.expanduser('~/.kde/share/config/kdeglobals'))
	THEME = cfg.get('Icons', 'Theme')
    except: pass
    
def findIcon(name):
    for theme in [THEME, 'default.kde', 'hicolor']:
	for p in PATHS:
	    filename = os.path.join(p, 'share/icons/%s/%s' % (theme, name))
	    if os.path.exists(filename):
		return filename
    return None


init()
if len(sys.argv) not in [2,3]:
    print 'Usage: %s <PATH-TO-SCIBUS-ICONS> [<THEME-NAME>]' % sys.argv[0]
    sys.exit(1)
    
SCRIBUS_ICONS=sys.argv[1]
if len(sys.argv) == 3:
    THEME = sys.argv[2]
    
for old, new in replace.items():
    filename = findIcon(new)
    if not filename:
	print >> sys.stderr, 'Could not find', icon
    else:
	target = os.path.join(SCRIBUS_ICONS, old)
	if not os.path.exists(target):
	    print >> sys.stderr, 'Could not find scribus icon', target
	else:
	    print '"%s" -> "%s"' % (filename, target)
	    try:
		shutil.copy(filename, target)
	    except Exception, msg:
		print >> sys.stderr, 'Error while copying', msg



More information about the scribus mailing list