mailRe: r26996 - /trunk/devel_scripts/oxygen_icon_size_convert.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on December 07, 2014 - 20:38:
Hi Troels,

You should note that the various sizes of the oxygen icons in the
repository (svn://anonsvn.kde.org/home/kde/trunk/kdesupport/oxygen-icons)
are not simply scaled versions of the SVG graphics.  There is quite an
art involved in playing with individual pixels to make the smaller
icons look good.  The SVG graphic is the basis for this, but the
artist does a lot of work improving the small icons.  This is quite a
lot of work.  You can see how poor my self-made icons are in
comparison to the oxygen ones.  Therefore you should always use the
versions from the oxygen icon repository when they exist.  For wizard
graphics it is ok use the SVG to produce a 200x200 version.  Or better
still to overlay a small oxygen icon version over another relax
graphic.

Regards,

Edward


On 7 December 2014 at 17:59,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Sun Dec  7 17:59:10 2014
New Revision: 26996

URL: http://svn.gna.org/viewcvs/relax?rev=26996&view=rev
Log:
Added a devel script which can quickly convert oxygen icons to the desired 
sizes.

Added:
    trunk/devel_scripts/oxygen_icon_size_convert.py   (with props)

Added: trunk/devel_scripts/oxygen_icon_size_convert.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/devel_scripts/oxygen_icon_size_convert.py?rev=26996&view=auto
==============================================================================
--- trunk/devel_scripts/oxygen_icon_size_convert.py     (added)
+++ trunk/devel_scripts/oxygen_icon_size_convert.py     Sun Dec  7 17:59:10 
2014
@@ -0,0 +1,86 @@
+"""Script to convert oxygen icons to different sizes, and copy to path in 
relax"""
+
+# Python module imports.
+from os import F_OK, access, getcwd, makedirs, path, sep
+import shutil
+import subprocess
+from tempfile import mkdtemp
+
+# relax module imports.
+from status import Status; status = Status()
+
+# Set the relax dir
+rdir = status.install_path
+
+# Set the path to the oxygen icon start dir.
+# svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/oxygen-icons
+odir = status.install_path + sep + '..' + sep + 'oxygen-icons'
+
+# Set the category for the icon
+cat = 'actions'
+
+# Set the icon filename
+icon = 'document-preview-archive'
+
+# Define sizes for relax
+sizes = [[16,16], [22,22], [32,32], [48,48], [128,128], [200,'']]
+
+# First make a conversion dir
+cdir = rdir + sep + 'graphics' + sep + 'oxygen_icons' + sep + 
'temp_conversion'
+
+# Make the dir
+if not path.exists(cdir):
+    makedirs(cdir)
+
+# Copy the scalable file.
+filein = odir + sep + 'scalable' + sep + cat + sep + icon + '.svgz'
+shutil.copy(filein, cdir)
+filein = cdir + sep + icon + '.svgz'
+
+# Define Call function.
+def call_prog(list_args):
+    Temp = subprocess.Popen(list_args, stdout=subprocess.PIPE)
+
+    ## Communicate with program, and get outout and exitcode.
+    (output, errput) = Temp.communicate()
+
+    ## Wait for finish and get return code.
+    return_value = Temp.wait()
+
+    return return_value
+
+# Now make the conversion
+if True:
+    for size in sizes:
+        # Extract size.
+        x, y = size
+
+        fileout = cdir + sep + "%s_%sx%s.png" %(icon, x, y)
+        if y != '':
+            list_args = ['inkscape', '-z', '-e', fileout, '-w', str(x), 
'-h', str(y), filein]
+        else:
+            list_args = ['inkscape', '-z', '-e', fileout, '-w', str(x), 
filein]
+
+
+        # Call the conversion
+        return_value = call_prog(list_args)
+        # Print the command
+        str1 = ' '.join(list_args)
+
+        print(return_value, str1)
+
+# Check if the file already exist in
+if True:
+    for size in sizes:
+        # Extract size.
+        x, y = size
+
+        fileor = odir + sep + '%sx%s'%(x, y) + sep + cat + sep + icon + 
'.png'
+        file_ex = path.isfile(fileor)
+
+        print(file_ex, fileor)
+
+        # It the file exists:
+        if file_ex:
+            fileout = cdir + sep + "%s_%sx%s_or.png" %(icon, x, y)
+            shutil.copy(fileor, fileout)

Propchange: trunk/devel_scripts/oxygen_icon_size_convert.py
------------------------------------------------------------------------------
    svn:executable = *


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



Related Messages


Powered by MHonArc, Updated Mon Dec 08 09:20:43 2014