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
=== added directory 'unity-lens'
=== added file 'unity-lens/commandsconfig'
--- unity-lens/commandsconfig 1970-01-01 00:00:00 +0000
+++ unity-lens/commandsconfig 2012-06-12 18:05:22 +0000
@@ -0,0 +1,11 @@
1# define parameters for commands, putting them in a list seperated
2# by ';'
3# if nothing specified, default is to launch command inside a project
4# only and not be followed by a template
5#COMMANDS_LAUNCHED_IN_OR_OUTSIDE_PROJECT =
6COMMANDS_LAUNCHED_OUTSIDE_PROJECT_ONLY = create
7#COMMANDS_FOLLOWED_BY_COMMAND =
8COMMANDS_EXPOSED_IN_BAR = create;edit;install;package;release;save;share;test
9
10[ubuntu-application]
11IMPORT=configure;edit;debug;license;package;release;run;save;share;test
012
=== added file 'unity-lens/create.py'
--- unity-lens/create.py 1970-01-01 00:00:00 +0000
+++ unity-lens/create.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,120 @@
1#!/usr/bin/python
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3# Copyright 2009 Didier Roche
4#
5# This file is part of Quickly ubuntu-application template
6#
7#This program is free software: you can redistribute it and/or modify it
8#under the terms of the GNU General Public License version 3, as published
9#by the Free Software Foundation.
10
11#This program is distributed in the hope that it will be useful, but
12#WITHOUT ANY WARRANTY; without even the implied warranties of
13#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14#PURPOSE. See the GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License along
17#with this program. If not, see <http://www.gnu.org/licenses/>.
18
19import sys
20import os
21import shutil
22import subprocess
23
24from quickly import templatetools
25
26import gettext
27from gettext import gettext as _
28# set domain text
29gettext.textdomain('quickly')
30
31
32
33def usage():
34 templatetools.print_usage(_('quickly create <template> <project-name>'))
35def help():
36 print _("""This will create and run a new Unity Lens, including Python
37code, DBus files, and packaging files to make the project work. After
38creating the project, get started by:
39
401. Changing your working directory to the new project:
41$ cd path/to/project-name
42
432. Edit the Python code:
44$ quickly edit
45""")
46templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
47
48
49path_and_project = sys.argv[1].split('/')
50project_name = path_and_project[-1]
51
52# String trailing -lens from project name, we'll add it back in as necessary
53lens_name = project_name
54if lens_name[:6] == 'unity-':
55 lens_name = lens_name[6:]
56if lens_name[-5:] == '-lens':
57 lens_name = lens_name[:-5]
58elif lens_name[:5] == 'lens-':
59 lens_name = lens_name[5:]
60
61try:
62 project_name = templatetools.quickly_name(project_name)
63except:
64 # user friendly message already caught in pre_create
65 sys.exit(1)
66
67if len(path_and_project) > 1:
68 os.chdir(str(os.path.sep).join(path_and_project[0:-1]))
69
70os.chdir(project_name)
71
72# get origin path
73pathname = templatetools.get_template_path_from_project()
74abs_path_project_root = os.path.join(pathname, 'project_root')
75
76python_name = templatetools.python_name(project_name)
77sentence_name, camel_case_name = templatetools.conventional_names(lens_name)
78pythonic_lens_name = templatetools.python_name(lens_name)
79substitutions = (("project_name",project_name),
80 ("camel_case_name",camel_case_name),
81 ("python_name",python_name),
82 ("lens_name",pythonic_lens_name),
83 ("sentence_name",sentence_name),)
84
85
86for root, dirs, files in os.walk(abs_path_project_root):
87 try:
88 relative_dir = root.split('project_root/')[1]
89 except:
90 relative_dir = ""
91 # python dir should be replace by python_name (project "pythonified" name)
92 if relative_dir.startswith('python'):
93 relative_dir = relative_dir.replace('python', python_name)
94
95 for directory in dirs:
96 if directory.startswith('python'):
97 directory = directory.replace('python', python_name)
98 os.mkdir(os.path.join(relative_dir, directory))
99 for filename in files:
100 templatetools.file_from_template(root, filename, relative_dir, substitutions)
101
102# set the mode to executable for executable file
103exec_file = os.path.join('bin', project_name)
104try:
105 os.chmod(exec_file, 0755)
106except:
107 pass
108
109# add it to revision control
110print _("Creating bzr repository and committing")
111bzr_instance = subprocess.Popen(["bzr", "init"], stdout=subprocess.PIPE)
112bzr_instance.wait()
113bzr_instance = subprocess.Popen(["bzr", "add"], stdout=subprocess.PIPE)
114bzr_instance.wait()
115bzr_instance = subprocess.Popen(["bzr", "commit", "-m", "Initial project creation with Quickly!"], stderr=subprocess.PIPE)
116bzr_instance.wait()
117
118print _("Congrats, your new project is setup! cd %s/ to start hacking.") % os.getcwd()
119
120sys.exit(0)
0121
=== added file 'unity-lens/install.py'
--- unity-lens/install.py 1970-01-01 00:00:00 +0000
+++ unity-lens/install.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,72 @@
1#!/usr/bin/python
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3# Copyright 2009 Didier Roche
4#
5# This file is part of Quickly ubuntu-application template
6#
7#This program is free software: you can redistribute it and/or modify it
8#under the terms of the GNU General Public License version 3, as published
9#by the Free Software Foundation.
10
11#This program is distributed in the hope that it will be useful, but
12#WITHOUT ANY WARRANTY; without even the implied warranties of
13#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14#PURPOSE. See the GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License along
17#with this program. If not, see <http://www.gnu.org/licenses/>.
18
19import sys
20import os
21import shutil
22import subprocess
23
24from quickly import configurationhandler
25from quickly import templatetools
26
27import gettext
28from gettext import gettext as _
29# set domain text
30gettext.textdomain('quickly')
31
32
33
34def usage():
35 templatetools.print_usage(_('sudo quickly install'))
36def help():
37 print _("""This will install your lens description file into
38 /usr/share/unity/leneses/ and restart Unity so that your lens will be available
39 for testing""")
40templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
41
42if os.getuid() > 0:
43 print _("Only root can install lens files")
44 sys.exit(1)
45
46# if config not already loaded
47if not configurationhandler.project_config:
48 configurationhandler.loadConfig()
49
50project_name = configurationhandler.project_config['project']
51# String trailing -lens from project name, we'll add it back in as necessary
52lens_name = project_name
53if lens_name[:6] == 'unity-':
54 lens_name = lens_name[6:]
55if lens_name[-5:] == '-lens':
56 lens_name = lens_name[:-5]
57elif lens_name[:5] == 'lens-':
58 lens_name = lens_name[5:]
59
60# install lens config file
61if not os.path.exists('/usr/share/unity/lenses/%s' % lens_name):
62 os.mkdir('/usr/share/unity/lenses/%s' % lens_name)
63shutil.copy('./%s.lens' % lens_name, '/usr/share/unity/lenses/%s' % lens_name)
64shutil.copy('./unity-lens-%s.svg' % lens_name, '/usr/share/unity/lenses/%s' % lens_name)
65
66# restart unity
67os.system('sudo -u %s unity --replace &' % os.environ.get('SUDO_USER', 'root'))
68
69print _("Congrats, your new lens has been installed.")
70
71
72sys.exit(0)
073
=== added directory 'unity-lens/project_root'
=== added file 'unity-lens/project_root/AUTHORS'
--- unity-lens/project_root/AUTHORS 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/AUTHORS 2012-06-12 18:05:22 +0000
@@ -0,0 +1,1 @@
1Copyright (C) YYYY <Your Name> <Your E-mail>
02
=== added directory 'unity-lens/project_root/bin'
=== added file 'unity-lens/project_root/bin/project_name'
--- unity-lens/project_root/bin/project_name 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/bin/project_name 2012-06-12 18:05:22 +0000
@@ -0,0 +1,31 @@
1#!/usr/bin/python
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3### BEGIN LICENSE
4# This file is in the public domain
5### END LICENSE
6
7import os
8import sys
9
10from singlet.utils import run_lens
11
12# Add project root directory (enable symlink, and trunk execution).
13PROJECT_ROOT_DIRECTORY = os.path.abspath(
14 os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
15
16python_path = []
17if os.path.abspath(__file__).startswith('/opt'):
18 syspath = sys.path[:] # copy to avoid infinite loop in pending objects
19 for path in syspath:
20 opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/project_name')
21 python_path.insert(0, opt_path)
22 sys.path.insert(0, opt_path)
23if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'python_name'))
24 and PROJECT_ROOT_DIRECTORY not in sys.path):
25 python_path.insert(0, PROJECT_ROOT_DIRECTORY)
26 sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
27if python_path:
28 os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
29
30from python_name import camel_case_nameLens
31run_lens(camel_case_nameLens, sys.argv)
032
=== added file 'unity-lens/project_root/lens_name.lens'
--- unity-lens/project_root/lens_name.lens 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/lens_name.lens 2012-06-12 18:05:22 +0000
@@ -0,0 +1,11 @@
1[Lens]
2DBusName=unity.singlet.lens.lens_name
3DBusPath=/unity/singlet/lens/lens_name
4Name=sentence_name
5Icon=/usr/share/unity/lenses/lens_name/unity-lens-lens_name.svg
6Description=sentence_name Lens
7SearchHint=Search sentence_name
8#Shortcut=c
9
10[Desktop Entry]
11X-Ubuntu-Gettext-Domain=project_name
012
=== added directory 'unity-lens/project_root/python'
=== added file 'unity-lens/project_root/python/__init__.py'
--- unity-lens/project_root/python/__init__.py 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/python/__init__.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,33 @@
1import logging
2import optparse
3
4import gettext
5from gettext import gettext as _
6gettext.textdomain('project_name')
7
8from singlet.lens import SingleScopeLens, IconViewCategory, ListViewCategory
9
10from python_name import python_nameconfig
11
12class camel_case_nameLens(SingleScopeLens):
13
14 class Meta:
15 name = 'lens_name'
16 description = 'sentence_name Lens'
17 search_hint = 'Search sentence_name'
18 icon = 'lens_name.svg'
19 search_on_blank=True
20
21 # TODO: Add your categories
22 example_category = ListViewCategory("Examples", 'help')
23
24 def search(self, search, results):
25 # TODO: Add your search results
26 results.append('https://wiki.ubuntu.com/Unity/Lenses/Singlet',
27 'ubuntu-logo',
28 self.example_category,
29 "text/html",
30 'Learn More',
31 'Find out how to write your Unity Lens',
32 'https://wiki.ubuntu.com/Unity/Lenses/Singlet')
33 pass
034
=== added file 'unity-lens/project_root/python/python_nameconfig.py'
--- unity-lens/project_root/python/python_nameconfig.py 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/python/python_nameconfig.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,59 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2### BEGIN LICENSE
3# This file is in the public domain
4### END LICENSE
5
6# THIS IS camel_case_name CONFIGURATION FILE
7# YOU CAN PUT THERE SOME GLOBAL VALUE
8# Do not touch unless you know what you're doing.
9# you're warned :)
10
11__all__ = [
12 'project_path_not_found',
13 'get_data_file',
14 'get_data_path',
15 ]
16
17# Where your project will look for your data (for instance, images and ui
18# files). By default, this is ../data, relative your trunk layout
19__python_name_data_directory__ = '../data/'
20__license__ = ''
21__version__ = 'VERSION'
22
23import os
24
25import gettext
26from gettext import gettext as _
27gettext.textdomain('project_name')
28
29class project_path_not_found(Exception):
30 """Raised when we can't find the project directory."""
31
32
33def get_data_file(*path_segments):
34 """Get the full path to a data file.
35
36 Returns the path to a file underneath the data directory (as defined by
37 `get_data_path`). Equivalent to os.path.join(get_data_path(),
38 *path_segments).
39 """
40 return os.path.join(get_data_path(), *path_segments)
41
42
43def get_data_path():
44 """Retrieve project_name data path
45
46 This path is by default <python_name_lib_path>/../data/ in trunk
47 and /usr/share/project_name in an installed version but this path
48 is specified at installation time.
49 """
50
51 # Get pathname absolute or relative.
52 path = os.path.join(
53 os.path.dirname(__file__), __python_name_data_directory__)
54
55 abs_data_path = os.path.abspath(path)
56 if not os.path.exists(abs_data_path):
57 raise project_path_not_found
58
59 return abs_data_path
060
=== added file 'unity-lens/project_root/setup.py'
--- unity-lens/project_root/setup.py 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/setup.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,75 @@
1#!/usr/bin/env python
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3### BEGIN LICENSE
4# This file is in the public domain
5### END LICENSE
6
7###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
8
9import os
10import sys
11
12try:
13 import DistUtilsExtra.auto
14 from DistUtilsExtra.command import build_extra
15except ImportError:
16 print >> sys.stderr, 'To build project_name you need https://launchpad.net/python-distutils-extra'
17 sys.exit(1)
18assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
19
20def update_config(values = {}):
21
22 oldvalues = {}
23 try:
24 fin = file('python_name/python_nameconfig.py', 'r')
25 fout = file(fin.name + '.new', 'w')
26
27 for line in fin:
28 fields = line.split(' = ') # Separate variable from value
29 if fields[0] in values:
30 oldvalues[fields[0]] = fields[1].strip()
31 line = "%s = %s\n" % (fields[0], values[fields[0]])
32 fout.write(line)
33
34 fout.flush()
35 fout.close()
36 fin.close()
37 os.rename(fout.name, fin.name)
38 except (OSError, IOError), e:
39 print ("ERROR: Can't find python_name/python_nameconfig.py")
40 sys.exit(1)
41 return oldvalues
42
43
44class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
45 def run(self):
46 values = {'__python_name_data_directory__': "'%s'" % (self.prefix + '/share/project_name/'),
47 '__version__': "'%s'" % (self.distribution.get_version())}
48 previous_values = update_config(values)
49 DistUtilsExtra.auto.install_auto.run(self)
50 update_config(previous_values)
51
52
53
54##################################################################################
55###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
56##################################################################################
57
58DistUtilsExtra.auto.setup(
59 name='project_name',
60 version='0.1',
61 #license='GPL-3',
62 #author='Your Name',
63 #author_email='email@ubuntu.com',
64 #description='UI for managing …',
65 #long_description='Here a longer description',
66 #url='https://launchpad.net/project_name',
67 data_files=[
68 ('share/unity/lenses/lens_name', ['lens_name.lens']),
69 ('share/dbus-1/services', ['unity-lens-lens_name.service']),
70 ('share/unity/lenses/lens_name', ['unity-lens-lens_name.svg']),
71 ('bin', ['bin/project_name']),
72 ],
73 cmdclass={"build": build_extra.build_extra, 'install': InstallAndUpdateDataDirectory}
74 )
75
076
=== added file 'unity-lens/project_root/unity-lens-lens_name.service'
--- unity-lens/project_root/unity-lens-lens_name.service 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/unity-lens-lens_name.service 2012-06-12 18:05:22 +0000
@@ -0,0 +1,3 @@
1[D-BUS Service]
2Name=unity.singlet.lens.lens_name
3Exec=/usr/bin/project_name
04
=== added file 'unity-lens/project_root/unity-lens-lens_name.svg'
--- unity-lens/project_root/unity-lens-lens_name.svg 1970-01-01 00:00:00 +0000
+++ unity-lens/project_root/unity-lens-lens_name.svg 2012-06-12 18:05:22 +0000
@@ -0,0 +1,52 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3<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">
4 <defs id="defs3388">
5 <linearGradient id="linearGradient5060">
6 <stop id="stop5062" offset="0"/>
7 <stop id="stop5064" style="stop-opacity:0" offset="1"/>
8 </linearGradient>
9 <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">
10 <stop id="stop8591" style="stop-color:#fefefe" offset="0"/>
11 <stop id="stop8593" style="stop-color:#cbcbcb" offset="1"/>
12 </linearGradient>
13 <linearGradient id="linearGradient2429" y2="46.017" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.45454 0 0 .46512 1.0909 .33723)" y1="2" x1="24">
14 <stop id="stop3213" style="stop-color:#fff" offset="0"/>
15 <stop id="stop3215" style="stop-color:#fff;stop-opacity:0" offset="1"/>
16 </linearGradient>
17 <radialGradient id="radialGradient2432" gradientUnits="userSpaceOnUse" cy="102.7" cx="92.09" gradientTransform="matrix(.17021 0 0 -.19072 1.1064 23.717)" r="139.56">
18 <stop id="stop41" style="stop-color:#b7b8b9" offset="0"/>
19 <stop id="stop47" style="stop-color:#ececec" offset=".17403"/>
20 <stop id="stop49" style="stop-color:#fafafa;stop-opacity:0" offset=".23908"/>
21 <stop id="stop51" style="stop-color:#fff;stop-opacity:0" offset=".30111"/>
22 <stop id="stop53" style="stop-color:#fafafa;stop-opacity:0" offset=".53130"/>
23 <stop id="stop55" style="stop-color:#ebecec;stop-opacity:0" offset=".84490"/>
24 <stop id="stop57" style="stop-color:#e1e2e3;stop-opacity:0" offset="1"/>
25 </radialGradient>
26 <linearGradient id="linearGradient2435" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.48572 0 0 .47803 .34283 -.70595)" y1=".98521" x1="25.132">
27 <stop id="stop3602" style="stop-color:#f4f4f4" offset="0"/>
28 <stop id="stop3604" style="stop-color:#dbdbdb" offset="1"/>
29 </linearGradient>
30 <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">
31 <stop id="stop3106" style="stop-color:#aaa" offset="0"/>
32 <stop id="stop3108" style="stop-color:#c8c8c8" offset="1"/>
33 </linearGradient>
34 <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"/>
35 <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"/>
36 <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">
37 <stop id="stop5050" style="stop-opacity:0" offset="0"/>
38 <stop id="stop5056" offset=".5"/>
39 <stop id="stop5052" style="stop-opacity:0" offset="1"/>
40 </linearGradient>
41 </defs>
42 <rect id="rect2879" style="opacity:.15;fill:url(#linearGradient2447)" height="2" width="17" y="22" x="3.5"/>
43 <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"/>
44 <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"/>
45 <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"/>
46 <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"/>
47 <path id="path2435" style="opacity:.6;stroke:url(#linearGradient2429);fill:none" d="m19.5 5.677v15.823h-15v-20h10.394"/>
48 <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"/>
49 <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"/>
50 <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"/>
51 <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"/>
52</svg>
053
=== added file 'unity-lens/run.py'
--- unity-lens/run.py 1970-01-01 00:00:00 +0000
+++ unity-lens/run.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,75 @@
1#!/usr/bin/python
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3# Copyright 2009 Didier Roche
4#
5# This file is part of Quickly ubuntu-application template
6#
7#This program is free software: you can redistribute it and/or modify it
8#under the terms of the GNU General Public License version 3, as published
9#by the Free Software Foundation.
10
11#This program is distributed in the hope that it will be useful, but
12#WITHOUT ANY WARRANTY; without even the implied warranties of
13#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14#PURPOSE. See the GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License along
17#with this program. If not, see <http://www.gnu.org/licenses/>.
18
19
20import os
21import stat
22import sys
23import subprocess
24
25import gettext
26from gettext import gettext as _
27gettext.textdomain('quickly')
28
29from quickly import configurationhandler
30from quickly import templatetools
31
32def usage():
33 templatetools.print_usage(_('quickly run -- [program arguments]'))
34def help():
35 print _("""Runs your lens. This is the best way to try test it out
36while you are developing it. It starts up the main project window.
37
38You will need to have installed your lens using 'sudo quickly install' before
39you can run it.
40
41$ quickly run""")
42templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
43
44# if config not already loaded
45if not configurationhandler.project_config:
46 configurationhandler.loadConfig()
47
48project_name = configurationhandler.project_config['project']
49# String trailing -lens from project name, we'll add it back in as necessary
50lens_name = project_name
51if lens_name[:6] == 'unity-':
52 lens_name = lens_name[6:]
53if lens_name[-5:] == '-lens':
54 lens_name = lens_name[:-5]
55elif lens_name[:5] == 'lens-':
56 lens_name = lens_name[5:]
57if not os.path.exists('/usr/share/unity/lenses/%s/%s.lens' % (lens_name, lens_name)):
58 print _("You need to install your lens by running 'sudo quickly install' before it can be run")
59 sys.exit(1)
60
61env = os.environ.copy()
62
63project_bin = 'bin/' + configurationhandler.project_config['project']
64command_line = [project_bin]
65command_line.extend([arg for arg in sys.argv[1:] if arg != "--"])
66
67# run with args if bin/project exist
68st = os.stat(project_bin)
69mode = st[stat.ST_MODE]
70if mode & stat.S_IEXEC:
71 subprocess.call(command_line, env=env)
72else:
73 print _("Can't execute %s") % project_bin
74 sys.exit(1)
75
076
=== added file 'unity-lens/uninstall.py'
--- unity-lens/uninstall.py 1970-01-01 00:00:00 +0000
+++ unity-lens/uninstall.py 2012-06-12 18:05:22 +0000
@@ -0,0 +1,70 @@
1#!/usr/bin/python
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3# Copyright 2009 Didier Roche
4#
5# This file is part of Quickly ubuntu-application template
6#
7#This program is free software: you can redistribute it and/or modify it
8#under the terms of the GNU General Public License version 3, as published
9#by the Free Software Foundation.
10
11#This program is distributed in the hope that it will be useful, but
12#WITHOUT ANY WARRANTY; without even the implied warranties of
13#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14#PURPOSE. See the GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License along
17#with this program. If not, see <http://www.gnu.org/licenses/>.
18
19import sys
20import os
21import shutil
22import subprocess
23
24from quickly import configurationhandler
25from quickly import templatetools
26
27import gettext
28from gettext import gettext as _
29# set domain text
30gettext.textdomain('quickly')
31
32
33
34def usage():
35 templatetools.print_usage(_('sudo quickly uninstall'))
36def help():
37 print _("""This will remove your lens description file from
38 /usr/share/unity/leneses/ and restart Unity""")
39templatetools.handle_additional_parameters(sys.argv, help, usage=usage)
40
41if os.getuid() > 0:
42 print _("Only root can uninstall lens files")
43 sys.exit(1)
44
45# if config not already loaded
46if not configurationhandler.project_config:
47 configurationhandler.loadConfig()
48
49project_name = configurationhandler.project_config['project']
50# String trailing -lens from project name, we'll add it back in as necessary
51lens_name = project_name
52if lens_name[:6] == 'unity-':
53 lens_name = lens_name[6:]
54if lens_name[-5:] == '-lens':
55 lens_name = lens_name[:-5]
56elif lens_name[:5] == 'lens-':
57 lens_name = lens_name[5:]
58
59# uninstall lens config file
60os.remove(os.path.join('/usr/share/unity/lenses/%s' % lens_name, '%s.lens' % lens_name))
61os.remove(os.path.join('/usr/share/unity/lenses/%s' % lens_name, 'unity-lens-%s.svg' % lens_name))
62os.rmdir('/usr/share/unity/lenses/%s' % lens_name)
63
64# restart unity
65os.system('sudo -u %s unity --replace &' % os.environ.get('SUDO_USER', 'root'))
66
67print _("Congrats, your new lens has been removed.")
68
69
70sys.exit(0)

Subscribers

People subscribed via source and target branches