Monochrome Icons for Ubuntu

Merge lp:~mathieu-tl/ubuntu-mono/secure-icons into lp:~ubuntu-art-pkg/ubuntu-mono/trunk

Proposed by Mathieu Trudel-Lapierre on 2011-01-05
Status: Merged
Merged at revision: 78
Proposed branch: lp:~mathieu-tl/ubuntu-mono/secure-icons
Merge into: lp:~ubuntu-art-pkg/ubuntu-mono/trunk
Diff against target: 156 lines (+121/-1) 5 files modified
To merge this branch: bzr merge lp:~mathieu-tl/ubuntu-mono/secure-icons
Reviewer Review Type Date Requested Status
Paul Sladen 2011-01-05 Approve on 2011-01-06
Review via email: mp+45268@code.launchpad.net

Description of the Change

Add a script (written with the big help of Paul Sladen) to composite new icons at install time for nm-applet: those will be the icons used for VPN and secure wireless networks since they cannot be composited dynamically by nm-applet when using libappindicator.

To post a comment you must log in.
Paul Sladen (sladen) wrote :

I thinking was at package build time, rather than package postinst, but lets give it a whirl and see what happens, and need to sanity check what happens at package removal.

It's probably possible to simply down to something like:

  for icon in ubuntu-mono-{dark,light}/{22,24}/nm-signal-{00,25,50,75,100} ; do
      .../scavenge.py -o $(icon)-secure.svg $(icon).svg $(padlock).svg
  done

review: Approve

Ack, very right, this is missing a prerm or postrm script to clean up the additional files.

I had understood from our discussion that you meant package postinst, not build time -- if we want to deal with build time simply it will increase the package's (deb) size slightly, but then we won't need to ship the scavenge script separately from a possible svgtools bundle. It's easy to just add the new files to the bzr branch directly.

In light of trying to avoid increasing size unnecessarily, I'd be for shipping "reusable parts" that can be composited to create the full set of icons, but I'm not sure how much this is scalable, feasible, etc. I think it can probably complicate things or at least the impact of simple changes across the icon set.

Paul Sladen (sladen) wrote :

Yes, I've fixed up debian/copyright, moved the script and added a prerm aswell as postinst handling for abort, but at the moment I'm experimenting with rewriting it as a Makefile so that they files are included in the package (don't worry, compression will nullify the increase) and on the LiveCD the files have already been postinsted anyway.

review: Needs Fixing
Paul Sladen (sladen) wrote :

Merged and sponsored with tweaks:

ubuntu-mono (0.0.24) natty; urgency=low

  * scavenge.py, debian/install: Add and install new scavenge.py script to
    patch multiple svg icons together.
  * ubuntu-mono.postinst: call scavenge.py to generate "secure" icons for
    nm-applet to use for VPNs and to denote wireless security.
  * debian/control: add a python Depends for the compositor script.

  [Paul Sladen]
  * debian/copyright: mention GPL-3+ for debian/scavenge.py
  * Makefile: replace postinst/prerm with Makefile

 -- Mathieu Trudel-Lapierre <email address hidden> Wed, 05 Jan 2011 09:15:31 -0500

review: Approve

Preview Diff

1=== modified file 'debian/changelog'
2--- debian/changelog 2010-11-15 12:37:21 +0000
3+++ debian/changelog 2011-01-05 17:35:11 +0000
4@@ -1,3 +1,13 @@
5+ubuntu-mono (0.0.24) UNRELEASED; urgency=low
6+
7+ * scavenge.py, debian/install: Add and install new scavenge.py script to
8+ patch multiple svg icons together.
9+ * ubuntu-mono.postinst: call scavenge.py to generate "secure" icons for
10+ nm-applet to use for VPNs and to denote wireless security.
11+ * debian/control: add a python Depends for the compositor script.
12+
13+ -- Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com> Wed, 05 Jan 2011 09:15:31 -0500
14+
15 ubuntu-mono (0.0.23) natty; urgency=low
16
17 * debian/control: Add Vcs-Bzr.
18
19=== modified file 'debian/control'
20--- debian/control 2010-11-15 12:37:02 +0000
21+++ debian/control 2011-01-05 17:35:11 +0000
22@@ -13,7 +13,8 @@
23 Depends: ${misc:Depends},
24 humanity-icon-theme,
25 gnome-icon-theme,
26- hicolor-icon-theme
27+ hicolor-icon-theme,
28+ python
29 Description: Ubuntu Mono Icon theme
30 Dark and Light panel icons to make your desktop beautiful
31
32
33=== modified file 'debian/install'
34--- debian/install 2010-03-04 11:27:44 +0000
35+++ debian/install 2011-01-05 17:35:11 +0000
36@@ -1,1 +1,2 @@
37 ubuntu-mono-dark ubuntu-mono-light LoginIcons usr/share/icons
38+scavenge.py usr/share/ubuntu-mono/tools
39
40=== added file 'debian/ubuntu-mono.postinst'
41--- debian/ubuntu-mono.postinst 1970-01-01 00:00:00 +0000
42+++ debian/ubuntu-mono.postinst 2011-01-05 17:35:11 +0000
43@@ -0,0 +1,55 @@
44+#!/bin/sh
45+
46+set -e
47+
48+compositor=/usr/share/ubuntu-mono/tools/scavenge.py
49+
50+case $1 in
51+ configure)
52+ # Post-process additional icons to composite.
53+ for type in light dark; do
54+ for iconsize in \
55+ /usr/share/icons/ubuntu-mono-$type/status/22 \
56+ /usr/share/icons/ubuntu-mono-$type/status/24 \
57+ ;
58+ do
59+ $compositor -o $iconsize/nm-device-wired-secure.svg \
60+ $iconsize/nm-device-wired.svg \
61+ $iconsize/nm-vpn-lock.svg
62+ $compositor -o $iconsize/nm-signal-00-secure.svg \
63+ $iconsize/nm-signal-00.svg \
64+ $iconsize/nm-vpn-lock.svg
65+ $compositor -o $iconsize/nm-signal-25-secure.svg \
66+ $iconsize/nm-signal-25.svg \
67+ $iconsize/nm-vpn-lock.svg
68+ $compositor -o $iconsize/nm-signal-50-secure.svg \
69+ $iconsize/nm-signal-50.svg \
70+ $iconsize/nm-vpn-lock.svg
71+ $compositor -o $iconsize/nm-signal-75-secure.svg \
72+ $iconsize/nm-signal-75.svg \
73+ $iconsize/nm-vpn-lock.svg
74+ $compositor -o $iconsize/nm-signal-100-secure.svg \
75+ $iconsize/nm-signal-100.svg \
76+ $iconsize/nm-vpn-lock.svg
77+ $compositor -o $iconsize/gsm-3g-none-secure.svg \
78+ $iconsize/gsm-3g-none.svg \
79+ $iconsize/nm-vpn-lock.svg
80+ $compositor -o $iconsize/gsm-3g-low-secure.svg \
81+ $iconsize/gsm-3g-low.svg \
82+ $iconsize/nm-vpn-lock.svg
83+ $compositor -o $iconsize/gsm-3g-medium-secure.svg \
84+ $iconsize/gsm-3g-medium.svg \
85+ $iconsize/nm-vpn-lock.svg
86+ $compositor -o $iconsize/gsm-3g-high-secure.svg \
87+ $iconsize/gsm-3g-high.svg \
88+ $iconsize/nm-vpn-lock.svg
89+ $compositor -o $iconsize/gsm-3g-full-secure.svg \
90+ $iconsize/gsm-3g-full.svg \
91+ $iconsize/nm-vpn-lock.svg
92+ done
93+ update-icon-caches /usr/share/icons/ubuntu-mono-$type
94+ done
95+ ;;
96+ *)
97+ ;;
98+esac
99
100=== added file 'scavenge.py'
101--- scavenge.py 1970-01-01 00:00:00 +0000
102+++ scavenge.py 2011-01-05 17:35:11 +0000
103@@ -0,0 +1,53 @@
104+#!/usr/bin/env python
105+# Copyright 2011 Canonical Ltd. Distributed under the terms of the GNU GPLv3 or later.
106+# Combines multiple SVG files into a single SVG in batch mode
107+# 2011-01-04 Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
108+# 2011-01-05 Paul Sladen <sladen@canonica.com>
109+
110+import xml.dom.minidom
111+import sys
112+import optparse
113+
114+def commandline():
115+ # Parse commandline
116+ parser = optparse.OptionParser(usage = '%prog [options] INPUT.svg [MOREINPUT.svg] -o OUTPUT.svg')
117+ parser.add_option("-n", "--dry-run", dest = "do_write",
118+ default = True, action = "store_false",
119+ help = "dry run: do not write output file, just test")
120+ parser.add_option("-o", "--output", dest = "output",
121+ help = "full output path for processed SVG file")
122+ options, args = parser.parse_args()
123+
124+ # Validate
125+ if len(args) < 1:
126+ parser.error("one or more input SVG files required")
127+ if options.do_write and not options.output:
128+ parser.error("SVG output filename required")
129+
130+ return options, args
131+
132+def main():
133+ options, args = commandline()
134+
135+ # Open first SVG and then composite others on top as overlays
136+ base = xml.dom.minidom.parse(args[0])
137+ newline = lambda: base.createTextNode('\n')
138+
139+ for overlay in args[1:]:
140+ comment = base.createComment(" imported from '%s' " % overlay)
141+ dom = xml.dom.minidom.parse(overlay)
142+
143+ # Pull-in '<svg>' tag, clear attributes and rename to '<g>'
144+ g = base.importNode(dom.getElementsByTagName("svg")[0], deep = True)
145+ [g.removeAttribute(k) for k in g.attributes.keys() if k != 'id']
146+ g.tagName = 'g'
147+
148+ # Insert into first SVG with comments and spacing
149+ for node in newline(), comment, newline(), g, newline():
150+ base.documentElement.appendChild(node)
151+
152+ if options.do_write:
153+ base.writexml(open(options.output, "w"))
154+
155+if __name__=='__main__':
156+ main()

Subscribers

People subscribed via source and target branches