/usr/lib/python2.7/dist-packages/sagenb/notebook/css.py is in python-sagenb 0.13+ds1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # -*- coding: utf-8 -*
"""nodoctest
Notebook Stylesheets (CSS)
"""
#############################################################################
# Copyright (C) 2007 William Stein <wstein@gmail.com>
# Distributed under the terms of the GNU General Public License (GPL)
# The full text of the GPL is available at:
# http://www.gnu.org/licenses/
#############################################################################
import os
from sagenb.misc.misc import DOT_SAGENB
from sagenb.notebook.template import template
from hashlib import sha1
_css_cache = None
def css(color='default'):
r"""
Return the CSS header used by the Sage Notebook.
INPUT:
- ``color`` - string or pair of html colors, e.g.,
'gmail' 'grey' ``('#ff0000', '#0000ff')``
EXAMPLES::
sage: import sagenb.notebook.css as c
sage: type(c.css()[0])
<type 'str'>
"""
# TODO: the color argument does nothing right now, since
# the main.css file does not use it at all
global _css_cache
if _css_cache is None:
# TODO: Implement a theming system, with a register.
if color in ('default', 'grey', 'gmail', None):
color1 = None
color2 = None
elif isinstance(color, (tuple,list)):
color1, color2 = color
else:
raise ValueError, "unknown color scheme %s"%color
main_css = template(os.path.join('css', 'main.css'),
color1 = color1, color2 = color2,
color_theme = color)
user_css_path = os.path.join(DOT_SAGENB, 'notebook.css')
user_css = ''
if os.path.exists(user_css_path):
user_css = '\n' + open(user_css_path).read()
data = main_css + user_css
_css_cache = (data, sha1(data).hexdigest())
return _css_cache
|