LightningTheme: added support for Trac 1.0
@@ -1,9 +1,24 @@ | ||
1 | -from trac.core import * | |
1 | +# -*- coding: utf-8 -*- | |
2 | 2 | |
3 | +import os | |
4 | +from pkg_resources import parse_version, resource_filename | |
5 | + | |
6 | +from trac import __version__ | |
3 | 7 | from themeengine.api import ThemeBase |
4 | 8 | |
9 | + | |
5 | 10 | class LightningTheme(ThemeBase): |
6 | 11 | """A theme for TracLightning.""" |
7 | 12 | |
8 | 13 | template = htdocs = css = screenshot = True |
9 | - | |
14 | + | |
15 | + def get_theme_info(self, name): | |
16 | + info = super(LightningTheme, self).get_theme_info(name) | |
17 | + template = resource_filename(__name__, 'templates') | |
18 | + if parse_version(__version__) < parse_version('1.0'): | |
19 | + version = '0.12' | |
20 | + else: | |
21 | + version = '1.0' | |
22 | + info['template'] = os.path.join(template, version, | |
23 | + name.lower() + '_theme.html') | |
24 | + return info |
@@ -1,72 +0,0 @@ | ||
1 | -<!DOCTYPE html | |
2 | - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
3 | - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
4 | -<html xmlns="http://www.w3.org/1999/xhtml" | |
5 | - xmlns:xi="http://www.w3.org/2001/XInclude" | |
6 | - xmlns:py="http://genshi.edgewall.org/" | |
7 | - py:strip=""> | |
8 | - <div py:def="navigation(category)" id="${category}" class="nav"> | |
9 | - <ul py:if="chrome.nav[category]"> | |
10 | - <li py:for="idx, item in enumerate(chrome.nav[category])" | |
11 | - class="${classes(first_last(idx, chrome.nav[category]), active=item.active)}">${item.label}</li> | |
12 | - </ul> | |
13 | - </div> | |
14 | - | |
15 | - <py:match path="body" once="true" buffer="false"><body> | |
16 | - <div id="banner"> | |
17 | - <div id="header" py:choose=""> | |
18 | - <a py:when="chrome.logo.src" id="logo" href="${chrome.logo.link or href.wiki('TracIni')+'#header_logo-section'}"><img | |
19 | - src="${chrome.logo.src}" alt="${chrome.logo.alt}" | |
20 | - height="${chrome.logo.height or None}" width="${chrome.logo.width or None}" /></a> | |
21 | - <h1 py:otherwise=""><a href="${chrome.logo.link}">${project.name}</a></h1> | |
22 | - </div> | |
23 | - <form id="search" action="${href.search()}" method="get"> | |
24 | - <div py:if="'SEARCH_VIEW' in perm"> | |
25 | - <label for="proj-search">${_('Search')}:</label> | |
26 | - <input type="text" id="proj-search" name="q" size="18" accesskey="f" value="" /> | |
27 | - <input type="submit" value="${_('Search')}" /> | |
28 | - </div> | |
29 | - </form> | |
30 | - ${navigation('metanav')} | |
31 | - </div> | |
32 | - ${navigation('mainnav')} | |
33 | - | |
34 | - <div id="main"> | |
35 | - <xi:include py:if="value_of('resourcepath_template')" href="${resourcepath_template}" /> | |
36 | - <div id="ctxtnav" class="nav"> | |
37 | - <h2>${_('Context Navigation')}</h2> | |
38 | - <ul py:if="chrome.ctxtnav"> | |
39 | - <li py:for="i, elm in enumerate(chrome.ctxtnav)" | |
40 | - class="${classes(first_last(i, chrome.ctxtnav))}">$elm</li> | |
41 | - </ul> | |
42 | - <hr /> | |
43 | - </div> | |
44 | - <div id="warning" py:if="chrome.warnings" class="system-message"> | |
45 | - <py:choose test="len(chrome.warnings)"> | |
46 | - <strong>${_('Warning')}:</strong> | |
47 | - <py:when test="1">${chrome.warnings[0]}</py:when> | |
48 | - <py:otherwise><ul><li py:for="warning in chrome.warnings">$warning</li></ul></py:otherwise> | |
49 | - </py:choose> | |
50 | - </div> | |
51 | - <div id="notice" py:if="chrome.notices" class="system-message"> | |
52 | - <py:choose test="len(chrome.notices)"> | |
53 | - <py:when test="1">${chrome.notices[0]}</py:when> | |
54 | - <py:otherwise><ul><li py:for="notice in chrome.notices">$notice</li></ul></py:otherwise> | |
55 | - </py:choose> | |
56 | - </div> | |
57 | - | |
58 | - ${select('*|text()')} | |
59 | - </div> | |
60 | - | |
61 | - <div id="footer" xml:lang="en"><hr/> | |
62 | - <a id="tracpowered" href="http://trac.edgewall.org/"><img | |
63 | - src="${chrome.htdocs_location}trac_logo_mini.png" height="30" | |
64 | - width="107" alt="Trac Powered"/></a> | |
65 | - <p class="left"> | |
66 | - Powered by <a href="${href.about()}"><strong>Trac ${trac.version}</strong></a><br /> | |
67 | - By <a href="http://www.edgewall.org/">Edgewall Software</a>. | |
68 | - </p> | |
69 | - <p class="right">${chrome.footer}</p> | |
70 | - </div> | |
71 | - </body></py:match> | |
72 | -</html> |
@@ -0,0 +1,74 @@ | ||
1 | +<!DOCTYPE html | |
2 | + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
3 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
4 | +<html xmlns="http://www.w3.org/1999/xhtml" | |
5 | + xmlns:xi="http://www.w3.org/2001/XInclude" | |
6 | + xmlns:py="http://genshi.edgewall.org/" | |
7 | + py:strip=""> | |
8 | + <div py:def="navigation(category)" id="${category}" class="nav"> | |
9 | + <ul py:if="chrome.nav[category]"> | |
10 | + <li py:for="idx, item in enumerate(chrome.nav[category])" | |
11 | + class="${classes(first_last(idx, chrome.nav[category]), active=item.active)}">${item.label}</li> | |
12 | + </ul> | |
13 | + </div> | |
14 | + | |
15 | + <py:match path="body" once="true" buffer="false"><body> | |
16 | + <div id="banner"> | |
17 | + <div id="header" py:choose=""> | |
18 | + <a py:when="chrome.logo.src" id="logo" href="${chrome.logo.link or href.wiki('TracIni')+'#header_logo-section'}"><img | |
19 | + src="${chrome.logo.src}" alt="${chrome.logo.alt}" | |
20 | + height="${chrome.logo.height or None}" width="${chrome.logo.width or None}" /></a> | |
21 | + <h1 py:otherwise=""><a href="${chrome.logo.link}">${project.name}</a></h1> | |
22 | + </div> | |
23 | + <form id="search" action="${href.search()}" method="get"> | |
24 | + <div py:if="'SEARCH_VIEW' in perm"> | |
25 | + <label for="proj-search">${_('Search')}:</label> | |
26 | + <input type="text" id="proj-search" name="q" size="18" accesskey="f" value="" /> | |
27 | + <input type="submit" value="${_('Search')}" /> | |
28 | + </div> | |
29 | + </form> | |
30 | + ${navigation('metanav')} | |
31 | + </div> | |
32 | + ${navigation('mainnav')} | |
33 | + | |
34 | + <div id="main"> | |
35 | + <xi:include py:if="value_of('resourcepath_template')" href="${resourcepath_template}" /> | |
36 | + <div id="ctxtnav" class="nav"> | |
37 | + <h2>${_('Context Navigation')}</h2> | |
38 | + <ul py:if="chrome.ctxtnav"> | |
39 | + <li py:for="i, elm in enumerate(chrome.ctxtnav)" | |
40 | + class="${classes(first_last(i, chrome.ctxtnav))}">$elm</li> | |
41 | + </ul> | |
42 | + <hr /> | |
43 | + </div> | |
44 | + <div id="warning" py:if="chrome.warnings" class="system-message"> | |
45 | + <a class="trac-close-msg" href="#" title="Hide this warning"><span>close</span></a> | |
46 | + <py:choose test="len(chrome.warnings)"> | |
47 | + <strong>${_('Warning')}:</strong> | |
48 | + <py:when test="1">${chrome.warnings[0]}</py:when> | |
49 | + <py:otherwise><ul><li py:for="warning in chrome.warnings">$warning</li></ul></py:otherwise> | |
50 | + </py:choose> | |
51 | + </div> | |
52 | + <div id="notice" py:if="chrome.notices" class="system-message"> | |
53 | + <a class="trac-close-msg" href="#" title="Hide this warning"><span>close</span></a> | |
54 | + <py:choose test="len(chrome.notices)"> | |
55 | + <py:when test="1">${chrome.notices[0]}</py:when> | |
56 | + <py:otherwise><ul><li py:for="notice in chrome.notices">$notice</li></ul></py:otherwise> | |
57 | + </py:choose> | |
58 | + </div> | |
59 | + | |
60 | + ${select('*|text()')} | |
61 | + </div> | |
62 | + | |
63 | + <div id="footer" xml:lang="en"><hr/> | |
64 | + <a id="tracpowered" href="http://trac.edgewall.org/"><img | |
65 | + src="${chrome.htdocs_location}trac_logo_mini.png" height="30" | |
66 | + width="107" alt="Trac Powered"/></a> | |
67 | + <p class="left"> | |
68 | + Powered by <a href="${href.about()}"><strong>Trac ${trac.version}</strong></a><br /> | |
69 | + By <a href="http://www.edgewall.org/">Edgewall Software</a>. | |
70 | + </p> | |
71 | + <p class="right">${chrome.footer}</p> | |
72 | + </div> | |
73 | + </body></py:match> | |
74 | +</html> |
@@ -0,0 +1,72 @@ | ||
1 | +<!DOCTYPE html | |
2 | + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
3 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
4 | +<html xmlns="http://www.w3.org/1999/xhtml" | |
5 | + xmlns:xi="http://www.w3.org/2001/XInclude" | |
6 | + xmlns:py="http://genshi.edgewall.org/" | |
7 | + py:strip=""> | |
8 | + <div py:def="navigation(category)" id="${category}" class="nav"> | |
9 | + <ul py:if="chrome.nav[category]"> | |
10 | + <li py:for="idx, item in enumerate(chrome.nav[category])" | |
11 | + class="${classes(first_last(idx, chrome.nav[category]), active=item.active)}">${item.label}</li> | |
12 | + </ul> | |
13 | + </div> | |
14 | + | |
15 | + <py:match path="body" once="true" buffer="false"><body> | |
16 | + <div id="banner"> | |
17 | + <div id="header" py:choose=""> | |
18 | + <a py:when="chrome.logo.src" id="logo" href="${chrome.logo.link or href.wiki('TracIni')+'#header_logo-section'}"><img | |
19 | + src="${chrome.logo.src}" alt="${chrome.logo.alt}" | |
20 | + height="${chrome.logo.height or None}" width="${chrome.logo.width or None}" /></a> | |
21 | + <h1 py:otherwise=""><a href="${chrome.logo.link}">${project.name}</a></h1> | |
22 | + </div> | |
23 | + <form id="search" action="${href.search()}" method="get"> | |
24 | + <div py:if="'SEARCH_VIEW' in perm"> | |
25 | + <label for="proj-search">${_('Search')}:</label> | |
26 | + <input type="text" id="proj-search" name="q" size="18" accesskey="f" value="" /> | |
27 | + <input type="submit" value="${_('Search')}" /> | |
28 | + </div> | |
29 | + </form> | |
30 | + ${navigation('metanav')} | |
31 | + </div> | |
32 | + ${navigation('mainnav')} | |
33 | + | |
34 | + <div id="main"> | |
35 | + <xi:include py:if="value_of('resourcepath_template')" href="${resourcepath_template}" /> | |
36 | + <div id="ctxtnav" class="nav"> | |
37 | + <h2>${_('Context Navigation')}</h2> | |
38 | + <ul py:if="chrome.ctxtnav"> | |
39 | + <li py:for="i, elm in enumerate(chrome.ctxtnav)" | |
40 | + class="${classes(first_last(i, chrome.ctxtnav))}">$elm</li> | |
41 | + </ul> | |
42 | + <hr /> | |
43 | + </div> | |
44 | + <div id="warning" py:if="chrome.warnings" class="system-message"> | |
45 | + <py:choose test="len(chrome.warnings)"> | |
46 | + <strong>${_('Warning')}:</strong> | |
47 | + <py:when test="1">${chrome.warnings[0]}</py:when> | |
48 | + <py:otherwise><ul><li py:for="warning in chrome.warnings">$warning</li></ul></py:otherwise> | |
49 | + </py:choose> | |
50 | + </div> | |
51 | + <div id="notice" py:if="chrome.notices" class="system-message"> | |
52 | + <py:choose test="len(chrome.notices)"> | |
53 | + <py:when test="1">${chrome.notices[0]}</py:when> | |
54 | + <py:otherwise><ul><li py:for="notice in chrome.notices">$notice</li></ul></py:otherwise> | |
55 | + </py:choose> | |
56 | + </div> | |
57 | + | |
58 | + ${select('*|text()')} | |
59 | + </div> | |
60 | + | |
61 | + <div id="footer" xml:lang="en"><hr/> | |
62 | + <a id="tracpowered" href="http://trac.edgewall.org/"><img | |
63 | + src="${chrome.htdocs_location}trac_logo_mini.png" height="30" | |
64 | + width="107" alt="Trac Powered"/></a> | |
65 | + <p class="left"> | |
66 | + Powered by <a href="${href.about()}"><strong>Trac ${trac.version}</strong></a><br /> | |
67 | + By <a href="http://www.edgewall.org/">Edgewall Software</a>. | |
68 | + </p> | |
69 | + <p class="right">${chrome.footer}</p> | |
70 | + </div> | |
71 | + </body></py:match> | |
72 | +</html> |
@@ -1,13 +1,18 @@ | ||
1 | 1 | #!/usr/bin/env python |
2 | -# -*- coding: iso-8859-1 -*- | |
2 | +# -*- coding: utf-8 -*- | |
3 | 3 | |
4 | 4 | from setuptools import setup |
5 | 5 | |
6 | 6 | setup( |
7 | 7 | name = 'LightningTheme', |
8 | - version = '1.0', | |
8 | + version = '1.0.1', | |
9 | 9 | packages = ['lightningtheme'], |
10 | - package_data = { 'lightningtheme': ['templates/*.html', 'htdocs/*.png', 'htdocs/*.css', 'htdocs/img/*.png', 'htdocs/img/*.jpg' ] }, | |
10 | + package_data = { | |
11 | + 'lightningtheme': [ | |
12 | + 'htdocs/*.css', 'htdocs/*.png', 'htdocs/img/*.jpg', | |
13 | + 'htdocs/img/*.png', 'templates/*/*.html', | |
14 | + ], | |
15 | + }, | |
11 | 16 | |
12 | 17 | author = 'Takashi Okamoto', |
13 | 18 | author_email = 'okamototk@nospam.sf.jp', |
@@ -18,7 +23,7 @@ | ||
18 | 23 | classifiers = [ |
19 | 24 | 'Framework :: Trac', |
20 | 25 | ], |
21 | - | |
26 | + | |
22 | 27 | install_requires = ['Trac', 'TracThemeEngine>=2.0'], |
23 | 28 | |
24 | 29 | entry_points = { |