Mon, 16 Dec 2019 20:20:20 -0600
Update the ChangeLog and COPYRIGHT for the GNUTLS SNI patch.
|
24140
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
1 | #!/usr/bin/env ruby |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
2 | |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
3 | require "rexml/document" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
4 | require "ftools" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
5 | include REXML |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
6 | INKSCAPE = '/usr/bin/inkscape' |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
7 | SRC = "./svg" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
8 | |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
9 | def renderit(file) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
10 | svg = Document.new(File.new("#{SRC}/#{file}", 'r')) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
11 | svg.root.each_element("//g[contains(@inkscape:label,'plate')]") do |icon| |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
12 | filename = icon.attributes["label"] |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
13 | filename = `echo -n #{filename} | sed -e 's/plate\-//g'` |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
14 | puts "#{file} #{filename}.png" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
15 | icon.each_element("rect") do |box| |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
16 | if box.attributes['inkscape:label'] == '22x22' |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
17 | dir = "#{box.attributes['width']}x#{box.attributes['height']}/" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
18 | cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{filename}.png #{SRC}/#{file} > /dev/null 2>&1" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
19 | File.makedirs(dir) unless File.exists?(dir) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
20 | system(cmd) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
21 | print "." |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
22 | elsif box.attributes['inkscape:label'] == '24x24' |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
23 | dir = "#{box.attributes['width']}x#{box.attributes['height']}/" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
24 | cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{filename}.png #{SRC}/#{file} > /dev/null 2>&1" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
25 | File.makedirs(dir) unless File.exists?(dir) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
26 | system(cmd) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
27 | print "." |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
28 | end |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
29 | end |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
30 | puts '' |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
31 | end |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
32 | end |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
33 | |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
34 | if (ARGV[0].nil?) #render all SVGs |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
35 | puts "Rendering from SVGs in #{SRC}" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
36 | Dir.foreach(SRC) do |file| |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
37 | renderit(file) if file.match(/svg$/) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
38 | end |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
39 | puts "\nrendered all SVGs" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
40 | else #only render the SVG passed |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
41 | file = "#{ARGV[0]}.svg" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
42 | if (File.exists?("#{SRC}/#{file}")) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
43 | renderit(file) |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
44 | puts "\nrendered #{file}" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
45 | else |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
46 | puts "[E] No such file (#{file})" |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
47 | end |
|
6ae3775aa398
First steps to one-canvas workflow.
Hylke Bons <hbons@pidgin.im>
parents:
diff
changeset
|
48 | end |