Merge lp:~mhall119/quickly-community-templates/add-unity-lens into lp:quickly-community-templates

Proposed by Michael Hall
Status: Merged
Merged at revision: 11
Proposed branch: lp:~mhall119/quickly-community-templates/add-unity-lens
Merge into: lp:quickly-community-templates
Diff against target: 681 lines (+613/-0)
13 files modified
unity-lens/commandsconfig (+11/-0)
unity-lens/create.py (+120/-0)
unity-lens/install.py (+72/-0)
unity-lens/project_root/AUTHORS (+1/-0)
unity-lens/project_root/bin/project_name (+31/-0)
unity-lens/project_root/lens_name.lens (+11/-0)
unity-lens/project_root/python/__init__.py (+33/-0)
unity-lens/project_root/python/python_nameconfig.py (+59/-0)
unity-lens/project_root/setup.py (+75/-0)
unity-lens/project_root/unity-lens-lens_name.service (+3/-0)
unity-lens/project_root/unity-lens-lens_name.svg (+52/-0)
unity-lens/run.py (+75/-0)
unity-lens/uninstall.py (+70/-0)
To merge this branch: bzr merge lp:~mhall119/quickly-community-templates/add-unity-lens
Reviewer Review Type Date Requested Status
David Planella Approve
Review via email: mp+109896@code.launchpad.net

Commit message

Adds the unity-lens template from lp:unity-quickly-templates

Description of the change

Adds the unity-lens template from lp:unity-quickly-templates

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

Thanks Mike, looks good to me as the second addition to the Quickly community templates. As part of quickly-template-hackers you should have permissions to push the branch already, so feel free to do so.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'unity-lens'
2=== added file 'unity-lens/commandsconfig'
3--- unity-lens/commandsconfig 1970-01-01 00:00:00 +0000
4+++ unity-lens/commandsconfig 2012-06-12 18:05:22 +0000
5@@ -0,0 +1,11 @@
6+# define parameters for commands, putting them in a list seperated
7+# by ';'
8+# if nothing specified, default is to launch command inside a project
9+# only and not be followed by a template
10+#COMMANDS_LAUNCHED_IN_OR_OUTSIDE_PROJECT =
11+COMMANDS_LAUNCHED_OUTSIDE_PROJECT_ONLY = create
12+#COMMANDS_FOLLOWED_BY_COMMAND =
13+COMMANDS_EXPOSED_IN_BAR = create;edit;install;package;release;save;share;test
14+
15+[ubuntu-application]
16+IMPORT=configure;edit;debug;license;package;release;run;save;share;test
17
18=== added file 'unity-lens/create.py'
19--- unity-lens/create.py 1970-01-01 00:00:00 +0000
20+++ unity-lens/create.py 2012-06-12 18:05:22 +0000
21@@ -0,0 +1,120 @@
22+#!/usr/bin/python
23+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
24+# Copyright 2009 Didier Roche
25+#
26+# This file is part of Quickly ubuntu-application template
27+#
28+#This program is free software: you can redistribute it and/or modify it
29+#under the terms of the GNU General Public License version 3, as published
30+#by the Free Software Foundation.
31+
32+#This program is distributed in the hope that it will be useful, but
33+#WITHOUT ANY WARRANTY; without even the implied warranties of
34+#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
35+#PURPOSE. See the GNU General Public License for more details.
36+
37+#You should have received a copy of the GNU General Public License along
38+#with this program. If not, see <http://www.gnu.org/licenses/>.
39+
40+import sys
41+import os
42+import shutil
43+import subprocess
44+
45+from quickly import templatetools
46+
47+import gettext
48+from gettext import gettext as _
49+# set domain text
50+gettext.textdomain('quickly')
51+
52+
53+
54+def usage():
55+ templatetools.print_usage(_('quickly create <template> <project-name>'))
56+def help():
57+ print _("""This will create and run a new Unity Lens, including Python
58+code, DBus files, and packaging files to make the project work. After
59+creating the project, get started by:
60+
61+1. Changing your working directory to the new project:
62+$ cd path/to/project-name
63+
64+2. Edit the Python code:
65+$ quickly edit
66+""")
67+templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
68+
69+
70+path_and_project = sys.argv[1].split('/')
71+project_name = path_and_project[-1]
72+
73+# String trailing -lens from project name, we'll add it back in as necessary
74+lens_name = project_name
75+if lens_name[:6] == 'unity-':
76+ lens_name = lens_name[6:]
77+if lens_name[-5:] == '-lens':
78+ lens_name = lens_name[:-5]
79+elif lens_name[:5] == 'lens-':
80+ lens_name = lens_name[5:]
81+
82+try:
83+ project_name = templatetools.quickly_name(project_name)
84+except:
85+ # user friendly message already caught in pre_create
86+ sys.exit(1)
87+
88+if len(path_and_project) > 1:
89+ os.chdir(str(os.path.sep).join(path_and_project[0:-1]))
90+
91+os.chdir(project_name)
92+
93+# get origin path
94+pathname = templatetools.get_template_path_from_project()
95+abs_path_project_root = os.path.join(pathname, 'project_root')
96+
97+python_name = templatetools.python_name(project_name)
98+sentence_name, camel_case_name = templatetools.conventional_names(lens_name)
99+pythonic_lens_name = templatetools.python_name(lens_name)
100+substitutions = (("project_name",project_name),
101+ ("camel_case_name",camel_case_name),
102+ ("python_name",python_name),
103+ ("lens_name",pythonic_lens_name),
104+ ("sentence_name",sentence_name),)
105+
106+
107+for root, dirs, files in os.walk(abs_path_project_root):
108+ try:
109+ relative_dir = root.split('project_root/')[1]
110+ except:
111+ relative_dir = ""
112+ # python dir should be replace by python_name (project "pythonified" name)
113+ if relative_dir.startswith('python'):
114+ relative_dir = relative_dir.replace('python', python_name)
115+
116+ for directory in dirs:
117+ if directory.startswith('python'):
118+ directory = directory.replace('python', python_name)
119+ os.mkdir(os.path.join(relative_dir, directory))
120+ for filename in files:
121+ templatetools.file_from_template(root, filename, relative_dir, substitutions)
122+
123+# set the mode to executable for executable file
124+exec_file = os.path.join('bin', project_name)
125+try:
126+ os.chmod(exec_file, 0755)
127+except:
128+ pass
129+
130+# add it to revision control
131+print _("Creating bzr repository and committing")
132+bzr_instance = subprocess.Popen(["bzr", "init"], stdout=subprocess.PIPE)
133+bzr_instance.wait()
134+bzr_instance = subprocess.Popen(["bzr", "add"], stdout=subprocess.PIPE)
135+bzr_instance.wait()
136+bzr_instance = subprocess.Popen(["bzr", "commit", "-m", "Initial project creation with Quickly!"], stderr=subprocess.PIPE)
137+bzr_instance.wait()
138+
139+print _("Congrats, your new project is setup! cd %s/ to start hacking.") % os.getcwd()
140+
141+sys.exit(0)
142
143=== added file 'unity-lens/install.py'
144--- unity-lens/install.py 1970-01-01 00:00:00 +0000
145+++ unity-lens/install.py 2012-06-12 18:05:22 +0000
146@@ -0,0 +1,72 @@
147+#!/usr/bin/python
148+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
149+# Copyright 2009 Didier Roche
150+#
151+# This file is part of Quickly ubuntu-application template
152+#
153+#This program is free software: you can redistribute it and/or modify it
154+#under the terms of the GNU General Public License version 3, as published
155+#by the Free Software Foundation.
156+
157+#This program is distributed in the hope that it will be useful, but
158+#WITHOUT ANY WARRANTY; without even the implied warranties of
159+#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
160+#PURPOSE. See the GNU General Public License for more details.
161+
162+#You should have received a copy of the GNU General Public License along
163+#with this program. If not, see <http://www.gnu.org/licenses/>.
164+
165+import sys
166+import os
167+import shutil
168+import subprocess
169+
170+from quickly import configurationhandler
171+from quickly import templatetools
172+
173+import gettext
174+from gettext import gettext as _
175+# set domain text
176+gettext.textdomain('quickly')
177+
178+
179+
180+def usage():
181+ templatetools.print_usage(_('sudo quickly install'))
182+def help():
183+ print _("""This will install your lens description file into
184+ /usr/share/unity/leneses/ and restart Unity so that your lens will be available
185+ for testing""")
186+templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
187+
188+if os.getuid() > 0:
189+ print _("Only root can install lens files")
190+ sys.exit(1)
191+
192+# if config not already loaded
193+if not configurationhandler.project_config:
194+ configurationhandler.loadConfig()
195+
196+project_name = configurationhandler.project_config['project']
197+# String trailing -lens from project name, we'll add it back in as necessary
198+lens_name = project_name
199+if lens_name[:6] == 'unity-':
200+ lens_name = lens_name[6:]
201+if lens_name[-5:] == '-lens':
202+ lens_name = lens_name[:-5]
203+elif lens_name[:5] == 'lens-':
204+ lens_name = lens_name[5:]
205+
206+# install lens config file
207+if not os.path.exists('/usr/share/unity/lenses/%s' % lens_name):
208+ os.mkdir('/usr/share/unity/lenses/%s' % lens_name)
209+shutil.copy('./%s.lens' % lens_name, '/usr/share/unity/lenses/%s' % lens_name)
210+shutil.copy('./unity-lens-%s.svg' % lens_name, '/usr/share/unity/lenses/%s' % lens_name)
211+
212+# restart unity
213+os.system('sudo -u %s unity --replace &' % os.environ.get('SUDO_USER', 'root'))
214+
215+print _("Congrats, your new lens has been installed.")
216+
217+
218+sys.exit(0)
219
220=== added directory 'unity-lens/project_root'
221=== added file 'unity-lens/project_root/AUTHORS'
222--- unity-lens/project_root/AUTHORS 1970-01-01 00:00:00 +0000
223+++ unity-lens/project_root/AUTHORS 2012-06-12 18:05:22 +0000
224@@ -0,0 +1,1 @@
225+Copyright (C) YYYY <Your Name> <Your E-mail>
226
227=== added directory 'unity-lens/project_root/bin'
228=== added file 'unity-lens/project_root/bin/project_name'
229--- unity-lens/project_root/bin/project_name 1970-01-01 00:00:00 +0000
230+++ unity-lens/project_root/bin/project_name 2012-06-12 18:05:22 +0000
231@@ -0,0 +1,31 @@
232+#!/usr/bin/python
233+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
234+### BEGIN LICENSE
235+# This file is in the public domain
236+### END LICENSE
237+
238+import os
239+import sys
240+
241+from singlet.utils import run_lens
242+
243+# Add project root directory (enable symlink, and trunk execution).
244+PROJECT_ROOT_DIRECTORY = os.path.abspath(
245+ os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
246+
247+python_path = []
248+if os.path.abspath(__file__).startswith('/opt'):
249+ syspath = sys.path[:] # copy to avoid infinite loop in pending objects
250+ for path in syspath:
251+ opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/project_name')
252+ python_path.insert(0, opt_path)
253+ sys.path.insert(0, opt_path)
254+if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'python_name'))
255+ and PROJECT_ROOT_DIRECTORY not in sys.path):
256+ python_path.insert(0, PROJECT_ROOT_DIRECTORY)
257+ sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
258+if python_path:
259+ os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
260+
261+from python_name import camel_case_nameLens
262+run_lens(camel_case_nameLens, sys.argv)
263
264=== added file 'unity-lens/project_root/lens_name.lens'
265--- unity-lens/project_root/lens_name.lens 1970-01-01 00:00:00 +0000
266+++ unity-lens/project_root/lens_name.lens 2012-06-12 18:05:22 +0000
267@@ -0,0 +1,11 @@
268+[Lens]
269+DBusName=unity.singlet.lens.lens_name
270+DBusPath=/unity/singlet/lens/lens_name
271+Name=sentence_name
272+Icon=/usr/share/unity/lenses/lens_name/unity-lens-lens_name.svg
273+Description=sentence_name Lens
274+SearchHint=Search sentence_name
275+#Shortcut=c
276+
277+[Desktop Entry]
278+X-Ubuntu-Gettext-Domain=project_name
279
280=== added directory 'unity-lens/project_root/python'
281=== added file 'unity-lens/project_root/python/__init__.py'
282--- unity-lens/project_root/python/__init__.py 1970-01-01 00:00:00 +0000
283+++ unity-lens/project_root/python/__init__.py 2012-06-12 18:05:22 +0000
284@@ -0,0 +1,33 @@
285+import logging
286+import optparse
287+
288+import gettext
289+from gettext import gettext as _
290+gettext.textdomain('project_name')
291+
292+from singlet.lens import SingleScopeLens, IconViewCategory, ListViewCategory
293+
294+from python_name import python_nameconfig
295+
296+class camel_case_nameLens(SingleScopeLens):
297+
298+ class Meta:
299+ name = 'lens_name'
300+ description = 'sentence_name Lens'
301+ search_hint = 'Search sentence_name'
302+ icon = 'lens_name.svg'
303+ search_on_blank=True
304+
305+ # TODO: Add your categories
306+ example_category = ListViewCategory("Examples", 'help')
307+
308+ def search(self, search, results):
309+ # TODO: Add your search results
310+ results.append('https://wiki.ubuntu.com/Unity/Lenses/Singlet',
311+ 'ubuntu-logo',
312+ self.example_category,
313+ "text/html",
314+ 'Learn More',
315+ 'Find out how to write your Unity Lens',
316+ 'https://wiki.ubuntu.com/Unity/Lenses/Singlet')
317+ pass
318
319=== added file 'unity-lens/project_root/python/python_nameconfig.py'
320--- unity-lens/project_root/python/python_nameconfig.py 1970-01-01 00:00:00 +0000
321+++ unity-lens/project_root/python/python_nameconfig.py 2012-06-12 18:05:22 +0000
322@@ -0,0 +1,59 @@
323+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
324+### BEGIN LICENSE
325+# This file is in the public domain
326+### END LICENSE
327+
328+# THIS IS camel_case_name CONFIGURATION FILE
329+# YOU CAN PUT THERE SOME GLOBAL VALUE
330+# Do not touch unless you know what you're doing.
331+# you're warned :)
332+
333+__all__ = [
334+ 'project_path_not_found',
335+ 'get_data_file',
336+ 'get_data_path',
337+ ]
338+
339+# Where your project will look for your data (for instance, images and ui
340+# files). By default, this is ../data, relative your trunk layout
341+__python_name_data_directory__ = '../data/'
342+__license__ = ''
343+__version__ = 'VERSION'
344+
345+import os
346+
347+import gettext
348+from gettext import gettext as _
349+gettext.textdomain('project_name')
350+
351+class project_path_not_found(Exception):
352+ """Raised when we can't find the project directory."""
353+
354+
355+def get_data_file(*path_segments):
356+ """Get the full path to a data file.
357+
358+ Returns the path to a file underneath the data directory (as defined by
359+ `get_data_path`). Equivalent to os.path.join(get_data_path(),
360+ *path_segments).
361+ """
362+ return os.path.join(get_data_path(), *path_segments)
363+
364+
365+def get_data_path():
366+ """Retrieve project_name data path
367+
368+ This path is by default <python_name_lib_path>/../data/ in trunk
369+ and /usr/share/project_name in an installed version but this path
370+ is specified at installation time.
371+ """
372+
373+ # Get pathname absolute or relative.
374+ path = os.path.join(
375+ os.path.dirname(__file__), __python_name_data_directory__)
376+
377+ abs_data_path = os.path.abspath(path)
378+ if not os.path.exists(abs_data_path):
379+ raise project_path_not_found
380+
381+ return abs_data_path
382
383=== added file 'unity-lens/project_root/setup.py'
384--- unity-lens/project_root/setup.py 1970-01-01 00:00:00 +0000
385+++ unity-lens/project_root/setup.py 2012-06-12 18:05:22 +0000
386@@ -0,0 +1,75 @@
387+#!/usr/bin/env python
388+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
389+### BEGIN LICENSE
390+# This file is in the public domain
391+### END LICENSE
392+
393+###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
394+
395+import os
396+import sys
397+
398+try:
399+ import DistUtilsExtra.auto
400+ from DistUtilsExtra.command import build_extra
401+except ImportError:
402+ print >> sys.stderr, 'To build project_name you need https://launchpad.net/python-distutils-extra'
403+ sys.exit(1)
404+assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
405+
406+def update_config(values = {}):
407+
408+ oldvalues = {}
409+ try:
410+ fin = file('python_name/python_nameconfig.py', 'r')
411+ fout = file(fin.name + '.new', 'w')
412+
413+ for line in fin:
414+ fields = line.split(' = ') # Separate variable from value
415+ if fields[0] in values:
416+ oldvalues[fields[0]] = fields[1].strip()
417+ line = "%s = %s\n" % (fields[0], values[fields[0]])
418+ fout.write(line)
419+
420+ fout.flush()
421+ fout.close()
422+ fin.close()
423+ os.rename(fout.name, fin.name)
424+ except (OSError, IOError), e:
425+ print ("ERROR: Can't find python_name/python_nameconfig.py")
426+ sys.exit(1)
427+ return oldvalues
428+
429+
430+class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
431+ def run(self):
432+ values = {'__python_name_data_directory__': "'%s'" % (self.prefix + '/share/project_name/'),
433+ '__version__': "'%s'" % (self.distribution.get_version())}
434+ previous_values = update_config(values)
435+ DistUtilsExtra.auto.install_auto.run(self)
436+ update_config(previous_values)
437+
438+
439+
440+##################################################################################
441+###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
442+##################################################################################
443+
444+DistUtilsExtra.auto.setup(
445+ name='project_name',
446+ version='0.1',
447+ #license='GPL-3',
448+ #author='Your Name',
449+ #author_email='email@ubuntu.com',
450+ #description='UI for managing …',
451+ #long_description='Here a longer description',
452+ #url='https://launchpad.net/project_name',
453+ data_files=[
454+ ('share/unity/lenses/lens_name', ['lens_name.lens']),
455+ ('share/dbus-1/services', ['unity-lens-lens_name.service']),
456+ ('share/unity/lenses/lens_name', ['unity-lens-lens_name.svg']),
457+ ('bin', ['bin/project_name']),
458+ ],
459+ cmdclass={"build": build_extra.build_extra, 'install': InstallAndUpdateDataDirectory}
460+ )
461+
462
463=== added file 'unity-lens/project_root/unity-lens-lens_name.service'
464--- unity-lens/project_root/unity-lens-lens_name.service 1970-01-01 00:00:00 +0000
465+++ unity-lens/project_root/unity-lens-lens_name.service 2012-06-12 18:05:22 +0000
466@@ -0,0 +1,3 @@
467+[D-BUS Service]
468+Name=unity.singlet.lens.lens_name
469+Exec=/usr/bin/project_name
470
471=== added file 'unity-lens/project_root/unity-lens-lens_name.svg'
472--- unity-lens/project_root/unity-lens-lens_name.svg 1970-01-01 00:00:00 +0000
473+++ unity-lens/project_root/unity-lens-lens_name.svg 2012-06-12 18:05:22 +0000
474@@ -0,0 +1,52 @@
475+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
476+<!-- Created with Inkscape (http://www.inkscape.org/) -->
477+<svg id="svg3386" xmlns="http://www.w3.org/2000/svg" height="24" width="24" version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
478+ <defs id="defs3388">
479+ <linearGradient id="linearGradient5060">
480+ <stop id="stop5062" offset="0"/>
481+ <stop id="stop5064" style="stop-opacity:0" offset="1"/>
482+ </linearGradient>
483+ <linearGradient id="linearGradient2425" y2="5.4565" gradientUnits="userSpaceOnUse" x2="36.358" gradientTransform="matrix(.47785 0 0 .55248 .37225 -.076128)" y1="8.059" x1="32.892">
484+ <stop id="stop8591" style="stop-color:#fefefe" offset="0"/>
485+ <stop id="stop8593" style="stop-color:#cbcbcb" offset="1"/>
486+ </linearGradient>
487+ <linearGradient id="linearGradient2429" y2="46.017" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.45454 0 0 .46512 1.0909 .33723)" y1="2" x1="24">
488+ <stop id="stop3213" style="stop-color:#fff" offset="0"/>
489+ <stop id="stop3215" style="stop-color:#fff;stop-opacity:0" offset="1"/>
490+ </linearGradient>
491+ <radialGradient id="radialGradient2432" gradientUnits="userSpaceOnUse" cy="102.7" cx="92.09" gradientTransform="matrix(.17021 0 0 -.19072 1.1064 23.717)" r="139.56">
492+ <stop id="stop41" style="stop-color:#b7b8b9" offset="0"/>
493+ <stop id="stop47" style="stop-color:#ececec" offset=".17403"/>
494+ <stop id="stop49" style="stop-color:#fafafa;stop-opacity:0" offset=".23908"/>
495+ <stop id="stop51" style="stop-color:#fff;stop-opacity:0" offset=".30111"/>
496+ <stop id="stop53" style="stop-color:#fafafa;stop-opacity:0" offset=".53130"/>
497+ <stop id="stop55" style="stop-color:#ebecec;stop-opacity:0" offset=".84490"/>
498+ <stop id="stop57" style="stop-color:#e1e2e3;stop-opacity:0" offset="1"/>
499+ </radialGradient>
500+ <linearGradient id="linearGradient2435" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.48572 0 0 .47803 .34283 -.70595)" y1=".98521" x1="25.132">
501+ <stop id="stop3602" style="stop-color:#f4f4f4" offset="0"/>
502+ <stop id="stop3604" style="stop-color:#dbdbdb" offset="1"/>
503+ </linearGradient>
504+ <linearGradient id="linearGradient2438" y2="2.9062" gradientUnits="userSpaceOnUse" x2="-51.786" gradientTransform="matrix(.39221 0 0 .44736 29.199 -1.2387)" y1="50.786" x1="-51.786">
505+ <stop id="stop3106" style="stop-color:#aaa" offset="0"/>
506+ <stop id="stop3108" style="stop-color:#c8c8c8" offset="1"/>
507+ </linearGradient>
508+ <radialGradient id="radialGradient2441" xlink:href="#linearGradient5060" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.012049 0 0 .0082353 13.239 18.981)" r="117.14"/>
509+ <radialGradient id="radialGradient2444" xlink:href="#linearGradient5060" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.012049 0 0 .0082353 10.761 18.981)" r="117.14"/>
510+ <linearGradient id="linearGradient2447" y2="609.51" gradientUnits="userSpaceOnUse" x2="302.86" gradientTransform="matrix(.035207 0 0 .0082353 -.72485 18.981)" y1="366.65" x1="302.86">
511+ <stop id="stop5050" style="stop-opacity:0" offset="0"/>
512+ <stop id="stop5056" offset=".5"/>
513+ <stop id="stop5052" style="stop-opacity:0" offset="1"/>
514+ </linearGradient>
515+ </defs>
516+ <rect id="rect2879" style="opacity:.15;fill:url(#linearGradient2447)" height="2" width="17" y="22" x="3.5"/>
517+ <path id="path2881" style="opacity:.15;fill:url(#radialGradient2444)" d="m3.5 22v1.9999c-0.6205 0.004-1.5-0.448-1.5-1s0.6924-1 1.5-1z"/>
518+ <path id="path2883" style="opacity:.15;fill:url(#radialGradient2441)" d="m20.5 22v1.9999c0.62047 0.0038 1.5-0.44807 1.5-1.0001 0-0.552-0.6924-0.99982-1.5-0.99982z"/>
519+ <path id="path4160" style="stroke-linejoin:round;stroke:url(#linearGradient2438);stroke-width:.99992;fill:url(#linearGradient2435)" d="m3.5 0.49996h11.5c0.683 0.2373 4.541 3.1281 5.5 5 0 5.7292 0.000039 11.271 0.000039 17h-17v-22z"/>
520+ <path id="path4191" style="fill:url(#radialGradient2432)" d="m4.1702 22c-0.0938 0-0.1702-0.086-0.1702-0.191v-20.598c0-0.105 0.0764-0.1905 0.1702-0.1905 3.5215 0.0527 7.4238-0.07883 10.941 0.0131l4.839 4.3272 0.05 16.448c0 0.105-0.076 0.191-0.17 0.191h-15.66z"/>
521+ <path id="path2435" style="opacity:.6;stroke:url(#linearGradient2429);fill:none" d="m19.5 5.677v15.823h-15v-20h10.394"/>
522+ <path id="path3370" style="opacity:.2;fill-rule:evenodd" d="m14.075 1c1.1563 0.32877 0.33906 4.6144 0.33906 4.6144s4.5154-0.42774 5.6077 1.195c1.489 2.2122-0.068-0.6352-0.173-0.8217-0.756-1.3401-3.867-4.5471-5.046-4.9412-0.088-0.0295-0.283-0.0465-0.728-0.0465z"/>
523+ <path id="path4474" style="fill:url(#linearGradient2425);fill-rule:evenodd" d="m14 1c1.5262 0 1 4 1 4s4.9921-0.45326 4.9921 2c0-0.59774 0.05575-1.4784-0.06407-1.6559-0.839-1.243-3.744-3.8619-4.798-4.2976-0.086-0.0356-0.686-0.0465-1.13-0.0465z"/>
524+ <path id="path9053" style="opacity:.6" d="m12.455 15.982c-0.03304-1.1794 0.23119-2.3243 1.3454-3.1353 1.1769-0.91718 2.3104-2.0647 2.1906-3.4174-0.026-1.3047-1.546-2.327-3.183-2.474-1.843-0.2551-4.0715 0.3759-4.6888 1.8145-0.3131 0.6997-0.0227 1.9552 1.0279 1.9552 0.61453 0 0.89678-0.39697 0.94315-0.7601 0.03508-0.27476-0.07772-0.52011-0.14433-0.74706-0.075905-0.2586 0.24813-0.75978 0.60104-0.96399 0.2949-0.17064 0.60344-0.22785 0.64892-0.23878 1.0591-0.25452 2.1148 0.30768 2.5553 0.99196 0.44048 0.68427-0.04435 1.7222-0.74143 2.7315-0.69707 1.0093-1.4452 2.1557-1.4422 3.3734 0 0.46356-0.0413 0.62104-0.01196 0.80859 0.02345 0.14984 0.51961 0.13174 0.89958 0.06145zm-0.48333 1.5874c-1.0126-0.05497-1.7135 1.093-1.1052 1.8244 0.54328 0.80755 2.0665 0.6082 2.3276-0.30627 0.27143-0.71112-0.38177-1.53-1.2224-1.5181v0.000001z"/>
525+ <path id="path3298" style="opacity:.4;fill:#fff" d="m12.455 16.482c-0.03304-1.1794 0.23119-2.3243 1.3454-3.1353 1.1769-0.91718 2.3104-2.0647 2.1906-3.4174-0.026-1.3047-1.546-2.327-3.183-2.474-1.843-0.2551-4.0715 0.3759-4.6888 1.8145-0.3131 0.6997-0.0227 1.9552 1.0279 1.9552 0.61453 0 0.89678-0.39697 0.94315-0.7601 0.03508-0.27476-0.07772-0.52011-0.14433-0.74706-0.075905-0.2586 0.24813-0.75978 0.60104-0.96398 0.2949-0.17064 0.60344-0.22785 0.64892-0.23878 1.0591-0.25452 2.1148 0.30768 2.5553 0.99196 0.44048 0.68427-0.04435 1.7222-0.74143 2.7315-0.69707 1.0093-1.4452 2.1557-1.4422 3.3734 0 0.46356-0.0413 0.62104-0.01196 0.80859 0.02345 0.14984 0.51961 0.13174 0.89958 0.06145zm-0.48333 1.5874c-1.0126-0.05497-1.7135 1.093-1.1052 1.8244 0.54328 0.80755 2.0665 0.6082 2.3276-0.30627 0.27143-0.71112-0.38177-1.53-1.2224-1.5181z"/>
526+</svg>
527
528=== added file 'unity-lens/run.py'
529--- unity-lens/run.py 1970-01-01 00:00:00 +0000
530+++ unity-lens/run.py 2012-06-12 18:05:22 +0000
531@@ -0,0 +1,75 @@
532+#!/usr/bin/python
533+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
534+# Copyright 2009 Didier Roche
535+#
536+# This file is part of Quickly ubuntu-application template
537+#
538+#This program is free software: you can redistribute it and/or modify it
539+#under the terms of the GNU General Public License version 3, as published
540+#by the Free Software Foundation.
541+
542+#This program is distributed in the hope that it will be useful, but
543+#WITHOUT ANY WARRANTY; without even the implied warranties of
544+#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
545+#PURPOSE. See the GNU General Public License for more details.
546+
547+#You should have received a copy of the GNU General Public License along
548+#with this program. If not, see <http://www.gnu.org/licenses/>.
549+
550+
551+import os
552+import stat
553+import sys
554+import subprocess
555+
556+import gettext
557+from gettext import gettext as _
558+gettext.textdomain('quickly')
559+
560+from quickly import configurationhandler
561+from quickly import templatetools
562+
563+def usage():
564+ templatetools.print_usage(_('quickly run -- [program arguments]'))
565+def help():
566+ print _("""Runs your lens. This is the best way to try test it out
567+while you are developing it. It starts up the main project window.
568+
569+You will need to have installed your lens using 'sudo quickly install' before
570+you can run it.
571+
572+$ quickly run""")
573+templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
574+
575+# if config not already loaded
576+if not configurationhandler.project_config:
577+ configurationhandler.loadConfig()
578+
579+project_name = configurationhandler.project_config['project']
580+# String trailing -lens from project name, we'll add it back in as necessary
581+lens_name = project_name
582+if lens_name[:6] == 'unity-':
583+ lens_name = lens_name[6:]
584+if lens_name[-5:] == '-lens':
585+ lens_name = lens_name[:-5]
586+elif lens_name[:5] == 'lens-':
587+ lens_name = lens_name[5:]
588+if not os.path.exists('/usr/share/unity/lenses/%s/%s.lens' % (lens_name, lens_name)):
589+ print _("You need to install your lens by running 'sudo quickly install' before it can be run")
590+ sys.exit(1)
591+
592+env = os.environ.copy()
593+
594+project_bin = 'bin/' + configurationhandler.project_config['project']
595+command_line = [project_bin]
596+command_line.extend([arg for arg in sys.argv[1:] if arg != "--"])
597+
598+# run with args if bin/project exist
599+st = os.stat(project_bin)
600+mode = st[stat.ST_MODE]
601+if mode & stat.S_IEXEC:
602+ subprocess.call(command_line, env=env)
603+else:
604+ print _("Can't execute %s") % project_bin
605+ sys.exit(1)
606+
607
608=== added file 'unity-lens/uninstall.py'
609--- unity-lens/uninstall.py 1970-01-01 00:00:00 +0000
610+++ unity-lens/uninstall.py 2012-06-12 18:05:22 +0000
611@@ -0,0 +1,70 @@
612+#!/usr/bin/python
613+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
614+# Copyright 2009 Didier Roche
615+#
616+# This file is part of Quickly ubuntu-application template
617+#
618+#This program is free software: you can redistribute it and/or modify it
619+#under the terms of the GNU General Public License version 3, as published
620+#by the Free Software Foundation.
621+
622+#This program is distributed in the hope that it will be useful, but
623+#WITHOUT ANY WARRANTY; without even the implied warranties of
624+#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
625+#PURPOSE. See the GNU General Public License for more details.
626+
627+#You should have received a copy of the GNU General Public License along
628+#with this program. If not, see <http://www.gnu.org/licenses/>.
629+
630+import sys
631+import os
632+import shutil
633+import subprocess
634+
635+from quickly import configurationhandler
636+from quickly import templatetools
637+
638+import gettext
639+from gettext import gettext as _
640+# set domain text
641+gettext.textdomain('quickly')
642+
643+
644+
645+def usage():
646+ templatetools.print_usage(_('sudo quickly uninstall'))
647+def help():
648+ print _("""This will remove your lens description file from
649+ /usr/share/unity/leneses/ and restart Unity""")
650+templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
651+
652+if os.getuid() > 0:
653+ print _("Only root can uninstall lens files")
654+ sys.exit(1)
655+
656+# if config not already loaded
657+if not configurationhandler.project_config:
658+ configurationhandler.loadConfig()
659+
660+project_name = configurationhandler.project_config['project']
661+# String trailing -lens from project name, we'll add it back in as necessary
662+lens_name = project_name
663+if lens_name[:6] == 'unity-':
664+ lens_name = lens_name[6:]
665+if lens_name[-5:] == '-lens':
666+ lens_name = lens_name[:-5]
667+elif lens_name[:5] == 'lens-':
668+ lens_name = lens_name[5:]
669+
670+# uninstall lens config file
671+os.remove(os.path.join('/usr/share/unity/lenses/%s' % lens_name, '%s.lens' % lens_name))
672+os.remove(os.path.join('/usr/share/unity/lenses/%s' % lens_name, 'unity-lens-%s.svg' % lens_name))
673+os.rmdir('/usr/share/unity/lenses/%s' % lens_name)
674+
675+# restart unity
676+os.system('sudo -u %s unity --replace &' % os.environ.get('SUDO_USER', 'root'))
677+
678+print _("Congrats, your new lens has been removed.")
679+
680+
681+sys.exit(0)

Subscribers

People subscribed via source and target branches