From dfce4d49dc5411d9f90c5c348eeda65c9d770b27 Mon Sep 17 00:00:00 2001 From: Sam Hewitt Date: Thu, 21 Apr 2016 10:24:05 -0400 Subject: [PATCH] tweaked src --- .../actions/action-unavailable-symbolic.svg | 60 ++++-- src/extract-panel-icons.rb | 19 +- src/extract-symbolic-app-icons.rb | 2 +- src/extract-symbolic-icons.rb | 2 +- src/extract-vector-icons.rb | 192 +++++++++--------- src/panel/source-panel-16.svg | 6 +- src/vector/source-16x16.svg | 27 +-- 7 files changed, 172 insertions(+), 136 deletions(-) diff --git a/Paper/symbolic/actions/action-unavailable-symbolic.svg b/Paper/symbolic/actions/action-unavailable-symbolic.svg index f21a232f..d24a5c5c 100644 --- a/Paper/symbolic/actions/action-unavailable-symbolic.svg +++ b/Paper/symbolic/actions/action-unavailable-symbolic.svg @@ -1,15 +1,49 @@ - - - - - - - - - - - - - + + + + + + + + + + image/svg+xml + + Paper Symbolic Icon Theme + + + + + + + + + + + + + Paper Symbolic Icon Theme + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/extract-panel-icons.rb b/src/extract-panel-icons.rb index cf498e31..bb6374e5 100755 --- a/src/extract-panel-icons.rb +++ b/src/extract-panel-icons.rb @@ -22,6 +22,7 @@ require "fileutils" include REXML INKSCAPE = '/usr/bin/inkscape' +#INKSCAPE = '/usr/bin/inkscape' # like this works for me, while using `which` inkscape hangs # Render 24x24 pixel panel icons SRC24 = "panel/source-panel-24.svg" @@ -33,12 +34,12 @@ def chopSVG(icon) unless (File.exists?(icon[:file]) && !icon[:forcerender]) FileUtils.cp(SRC24,icon[:file]) puts " >> #{icon[:name]}" - cmd = "#{INKSCAPE} -f -z #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " + cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " - cmd += "--verb=FileSave --verb=FileClose > /dev/null 2>&1" + cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" system(cmd) #saving as plain SVG gets rid of the classes :/ - #cmd = "#{INKSCAPE} -f -z #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" + #cmd = "#{INKSCAPE} -f #{icon[:file]} -z --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" #system(cmd) svgcrop = Document.new(File.new(icon[:file], 'r')) svgcrop.root.each_element("//rect") do |rect| @@ -111,12 +112,12 @@ def chopSVG(icon) unless (File.exists?(icon[:file]) && !icon[:forcerender]) FileUtils.cp(SRC22,icon[:file]) puts " >> #{icon[:name]}" - cmd = "#{INKSCAPE} -f -z #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " + cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " - cmd += "--verb=FileSave --verb=FileClose > /dev/null 2>&1" + cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" system(cmd) #saving as plain SVG gets rid of the classes :/ - #cmd = "#{INKSCAPE} -f -z #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" + #cmd = "#{INKSCAPE} -f #{icon[:file]} -z --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" #system(cmd) svgcrop = Document.new(File.new(icon[:file], 'r')) svgcrop.root.each_element("//rect") do |rect| @@ -188,12 +189,12 @@ def chopSVG(icon) unless (File.exists?(icon[:file]) && !icon[:forcerender]) FileUtils.cp(SRC16,icon[:file]) puts " >> #{icon[:name]}" - cmd = "#{INKSCAPE} -f -z #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " + cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " - cmd += "--verb=FileSave --verb=FileClose > /dev/null 2>&1" + cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" system(cmd) #saving as plain SVG gets rid of the classes :/ - #cmd = "#{INKSCAPE} -f -z #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" + #cmd = "#{INKSCAPE} -f #{icon[:file]} -z --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" #system(cmd) svgcrop = Document.new(File.new(icon[:file], 'r')) svgcrop.root.each_element("//rect") do |rect| diff --git a/src/extract-symbolic-app-icons.rb b/src/extract-symbolic-app-icons.rb index 48809c2c..130c17ac 100755 --- a/src/extract-symbolic-app-icons.rb +++ b/src/extract-symbolic-app-icons.rb @@ -33,7 +33,7 @@ def chopSVG(icon) puts " >> #{icon[:name]}" cmd = "#{INKSCAPE} -f -z #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " - cmd += "--verb=FileSave --verb=FileClose > /dev/null 2>&1" + cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" system(cmd) #saving as plain SVG gets rid of the classes :/ #cmd = "#{INKSCAPE} -f #{icon[:file]} -z --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" diff --git a/src/extract-symbolic-icons.rb b/src/extract-symbolic-icons.rb index 086a75bf..cae96821 100755 --- a/src/extract-symbolic-icons.rb +++ b/src/extract-symbolic-icons.rb @@ -31,7 +31,7 @@ def chopSVG(icon) unless (File.exists?(icon[:file]) && !icon[:forcerender]) FileUtils.cp(SRC,icon[:file]) puts " >> #{icon[:name]}" - cmd = "#{INKSCAPE} -f -z #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " + cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" system(cmd) diff --git a/src/extract-vector-icons.rb b/src/extract-vector-icons.rb index 03cac536..8de4242a 100755 --- a/src/extract-vector-icons.rb +++ b/src/extract-vector-icons.rb @@ -26,38 +26,38 @@ SRC16 = "vector/source-16x16.svg" PREFIX16 = "../Paper/16x16" def chopSVG(icon) - FileUtils.mkdir_p(icon[:dir]) unless File.exists?(icon[:dir]) - unless (File.exists?(icon[:file]) && !icon[:forcerender]) - FileUtils.cp(SRC16,icon[:file]) - puts " >> #{icon[:name]}" - cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " - cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " - cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" - system(cmd) - #saving as plain SVG gets rid of the classes :/ - #cmd = "#{INKSCAPE} -f -z #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" - #system(cmd) - svgcrop = Document.new(File.new(icon[:file], 'r')) - svgcrop.root.each_element("//rect") do |rect| - w = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #get rid of 16 vs 15.99999 - h = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #Inkscape bugs - if w == 16 && h == 16 - rect.remove - end - end + FileUtils.mkdir_p(icon[:dir]) unless File.exists?(icon[:dir]) + unless (File.exists?(icon[:file]) && !icon[:forcerender]) + FileUtils.cp(SRC16,icon[:file]) + puts " >> #{icon[:name]}" + cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " + cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " + cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1" + system(cmd) + #saving as plain SVG gets rid of the classes :/ + #cmd = "#{INKSCAPE} -f #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" + #system(cmd) + svgcrop = Document.new(File.new(icon[:file], 'r')) + svgcrop.root.each_element("//rect") do |rect| + w = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #get rid of 16 vs 15.99999 + h = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #Inkscape bugs + if w == 16 && h == 16 + rect.remove + end + end icon_f = File.new(icon[:file],'w+') icon_f.puts svgcrop icon_f.close - else - puts " -- #{icon[:name]} already exists" - end + else + puts " -- #{icon[:name]} already exists" + end end #end of function def get_output_filename(d,n) - if (/rtl$/.match(n)) - outfile = "#{d}/#{n.chomp('-rtl')}-rtl.svg" - else - outfile = "#{d}/#{n}.svg" + if (/rtl$/.match(n)) + outfile = "#{d}/#{n.chomp('-rtl')}-rtl.svg" + else + outfile = "#{d}/#{n}.svg" end return outfile end @@ -68,32 +68,32 @@ svg = Document.new(File.new(SRC16, 'r')) if (ARGV[0].nil?) #render all SVGs puts "Rendering from icons in #{SRC16}" - # Go through every layer. - svg.root.each_element("/svg/g[@inkscape:groupmode='layer']") do |context| - context_name = context.attributes.get_attribute("inkscape:label").value - puts "Going through layer '" + context_name + "'" - context.each_element("g") do |icon| - #puts "DEBUG #{icon.attributes.get_attribute('id')}" - dir = "#{PREFIX16}/#{context_name}" - icon_name = icon.attributes.get_attribute("inkscape:label").value - chopSVG({ :name => icon_name, - :id => icon.attributes.get_attribute("id"), - :dir => dir, - :file => get_output_filename(dir, icon_name)}) - end - end + # Go through every layer. + svg.root.each_element("/svg/g[@inkscape:groupmode='layer']") do |context| + context_name = context.attributes.get_attribute("inkscape:label").value + puts "Going through layer '" + context_name + "'" + context.each_element("g") do |icon| + #puts "DEBUG #{icon.attributes.get_attribute('id')}" + dir = "#{PREFIX16}/#{context_name}" + icon_name = icon.attributes.get_attribute("inkscape:label").value + chopSVG({ :name => icon_name, + :id => icon.attributes.get_attribute("id"), + :dir => dir, + :file => get_output_filename(dir, icon_name)}) + end + end puts "\nrendered all SVGs" else #only render the icons passed icons = ARGV ARGV.each do |icon_name| - icon = svg.root.elements["//g[@inkscape:label='#{icon_name}']"] - dir = "#{PREFIX16}/#{icon.parent.attributes['inkscape:label']}" - chopSVG({ :name => icon_name, - :id => icon.attributes["id"], - :dir => dir, - :file => get_output_filename(dir, icon_name), - :forcerender => true}) - end + icon = svg.root.elements["//g[@inkscape:label='#{icon_name}']"] + dir = "#{PREFIX16}/#{icon.parent.attributes['inkscape:label']}" + chopSVG({ :name => icon_name, + :id => icon.attributes["id"], + :dir => dir, + :file => get_output_filename(dir, icon_name), + :forcerender => true}) + end puts "\nrendered #{ARGV.length} icons" end @@ -101,38 +101,38 @@ SRC48 = "vector/source-48x48.svg" PREFIX48 = "../Paper/48x48" def chopSVG(icon) - FileUtils.mkdir_p(icon[:dir]) unless File.exists?(icon[:dir]) - unless (File.exists?(icon[:file]) && !icon[:forcerender]) - FileUtils.cp(SRC48,icon[:file]) - puts " >> #{icon[:name]}" - cmd = "#{INKSCAPE} -f -z #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " - cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " - cmd += "--verb=FileSave --verb=FileClose > /dev/null 2>&1" - system(cmd) - #saving as plain SVG gets rid of the classes :/ - #cmd = "#{INKSCAPE} -f -z #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" - #system(cmd) - svgcrop = Document.new(File.new(icon[:file], 'r')) - svgcrop.root.each_element("//rect") do |rect| - w = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #get rid of 16 vs 15.99999 - h = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #Inkscape bugs - if w == 16 && h == 16 - rect.remove - end - end + FileUtils.mkdir_p(icon[:dir]) unless File.exists?(icon[:dir]) + unless (File.exists?(icon[:file]) && !icon[:forcerender]) + FileUtils.cp(SRC48,icon[:file]) + puts " >> #{icon[:name]}" + cmd = "#{INKSCAPE} -f #{icon[:file]} --select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers " + cmd += "--verb=EditDelete --verb=EditSelectAll --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileVacuum " + cmd += "--verb=FileSave --verb=FileClose > /dev/null 2>&1" + system(cmd) + #saving as plain SVG gets rid of the classes :/ + #cmd = "#{INKSCAPE} -f #{icon[:file]} --vacuum-defs -l #{icon[:file]} > /dev/null 2>&1" + #system(cmd) + svgcrop = Document.new(File.new(icon[:file], 'r')) + svgcrop.root.each_element("//rect") do |rect| + w = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #get rid of 16 vs 15.99999 + h = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #Inkscape bugs + if w == 16 && h == 16 + rect.remove + end + end icon_f = File.new(icon[:file],'w+') icon_f.puts svgcrop icon_f.close - else - puts " -- #{icon[:name]} already exists" - end + else + puts " -- #{icon[:name]} already exists" + end end #end of function def get_output_filename(d,n) - if (/rtl$/.match(n)) - outfile = "#{d}/#{n.chomp('-rtl')}-rtl.svg" - else - outfile = "#{d}/#{n}.svg" + if (/rtl$/.match(n)) + outfile = "#{d}/#{n.chomp('-rtl')}-rtl.svg" + else + outfile = "#{d}/#{n}.svg" end return outfile end @@ -143,32 +143,32 @@ svg = Document.new(File.new(SRC48, 'r')) if (ARGV[0].nil?) #render all SVGs puts "Rendering from icons in #{SRC48}" - # Go through every layer. - svg.root.each_element("/svg/g[@inkscape:groupmode='layer']") do |context| - context_name = context.attributes.get_attribute("inkscape:label").value - puts "Going through layer '" + context_name + "'" - context.each_element("g") do |icon| - #puts "DEBUG #{icon.attributes.get_attribute('id')}" - dir = "#{PREFIX48}/#{context_name}" - icon_name = icon.attributes.get_attribute("inkscape:label").value - chopSVG({ :name => icon_name, - :id => icon.attributes.get_attribute("id"), - :dir => dir, - :file => get_output_filename(dir, icon_name)}) - end - end + # Go through every layer. + svg.root.each_element("/svg/g[@inkscape:groupmode='layer']") do |context| + context_name = context.attributes.get_attribute("inkscape:label").value + puts "Going through layer '" + context_name + "'" + context.each_element("g") do |icon| + #puts "DEBUG #{icon.attributes.get_attribute('id')}" + dir = "#{PREFIX48}/#{context_name}" + icon_name = icon.attributes.get_attribute("inkscape:label").value + chopSVG({ :name => icon_name, + :id => icon.attributes.get_attribute("id"), + :dir => dir, + :file => get_output_filename(dir, icon_name)}) + end + end puts "\nrendered all SVGs" else #only render the icons passed icons = ARGV ARGV.each do |icon_name| - icon = svg.root.elements["//g[@inkscape:label='#{icon_name}']"] - dir = "#{PREFIX48}/#{icon.parent.attributes['inkscape:label']}" - chopSVG({ :name => icon_name, - :id => icon.attributes["id"], - :dir => dir, - :file => get_output_filename(dir, icon_name), - :forcerender => true}) - end + icon = svg.root.elements["//g[@inkscape:label='#{icon_name}']"] + dir = "#{PREFIX48}/#{icon.parent.attributes['inkscape:label']}" + chopSVG({ :name => icon_name, + :id => icon.attributes["id"], + :dir => dir, + :file => get_output_filename(dir, icon_name), + :forcerender => true}) + end puts "\nrendered #{ARGV.length} icons" end diff --git a/src/panel/source-panel-16.svg b/src/panel/source-panel-16.svg index bb83df54..32f41561 100644 --- a/src/panel/source-panel-16.svg +++ b/src/panel/source-panel-16.svg @@ -14,7 +14,7 @@ viewBox="0 0 720 600.00001" id="svg6530" version="1.1" - inkscape:version="0.91 r" + inkscape:version="0.91 r13725" sodipodi:docname="source-panel-16.svg"> @@ -87,8 +87,8 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:zoom="1" - inkscape:cx="147.88999" - inkscape:cy="446.81469" + inkscape:cx="152.88999" + inkscape:cy="444.81469" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" diff --git a/src/vector/source-16x16.svg b/src/vector/source-16x16.svg index 3d3e7c52..b887b979 100644 --- a/src/vector/source-16x16.svg +++ b/src/vector/source-16x16.svg @@ -35,8 +35,8 @@ id="namedview88" showgrid="false" inkscape:zoom="1" - inkscape:cx="457.42382" - inkscape:cy="198.06954" + inkscape:cx="309.42382" + inkscape:cy="196.06954" inkscape:window-x="0" inkscape:window-y="32" inkscape:window-maximized="1" @@ -2232,6 +2232,18 @@ inkscape:label="actions" transform="translate(-241.0002,103)" style="display:inline"> + actions - actions