Browse Source

Remove explicit open() calls on .css and .svg map files

... and therefore allow py2exe to do a better job in packaging.
pull/217/head
never-eat-yellow-snow 10 years ago
parent
commit
f78f88d7a3
  1. 6
      pygal/config.py
  2. 0
      pygal/css/__init__.py
  3. 2
      pygal/css/base_css.py
  4. 2
      pygal/css/graph_css.py
  5. 2
      pygal/css/style_css.py
  6. 14
      pygal/graph/frenchmap.py
  7. 0
      pygal/graph/maps/__init__.py
  8. 3
      pygal/graph/maps/ch_cantons_svg.py
  9. 2
      pygal/graph/maps/fr_departments_svg.py
  10. 2
      pygal/graph/maps/fr_regions_svg.py
  11. 2
      pygal/graph/maps/worldmap_svg.py
  12. 7
      pygal/graph/swissmap.py
  13. 7
      pygal/graph/worldmap.py
  14. 48
      pygal/svg.py
  15. 2
      setup.py

6
pygal/config.py

@ -23,7 +23,7 @@ Config module with all options
from copy import deepcopy from copy import deepcopy
from pygal.style import Style, DefaultStyle from pygal.style import Style, DefaultStyle
from pygal.interpolate import INTERPOLATIONS from pygal.interpolate import INTERPOLATIONS
from pygal.css import style_css, graph_css
CONFIG_ITEMS = [] CONFIG_ITEMS = []
@ -170,9 +170,9 @@ class Config(CommonConfig):
DefaultStyle, Style, "Style", "Style holding values injected in css") DefaultStyle, Style, "Style", "Style holding values injected in css")
css = Key( css = Key(
('style.css', 'graph.css'), list, "Style", (style_css, graph_css), list, "Style",
"List of css file", "List of css file",
"It can be an absolute file path or an external link", "It can be an absolute file path, an external link or a python module exporting the string variable data containing the .css style",
str) str)
# Look # # Look #

0
pygal/css/__init__.py

2
pygal/css/base.css → pygal/css/base_css.py

@ -1,3 +1,4 @@
data = """\
/* /*
* This file is part of pygal * This file is part of pygal
* *
@ -55,3 +56,4 @@
{{ id }}text.no_data { {{ id }}text.no_data {
font-size: {{ font_sizes.no_data }}; font-size: {{ font_sizes.no_data }};
} }
"""

2
pygal/css/graph.css → pygal/css/graph_css.py

@ -1,3 +1,4 @@
data="""\
/* /*
* This file is part of pygal * This file is part of pygal
* *
@ -126,3 +127,4 @@
{{ id }}.tooltip text tspan.label { {{ id }}.tooltip text tspan.label {
fill-opacity: .8; fill-opacity: .8;
} }
"""

2
pygal/css/style.css → pygal/css/style_css.py

@ -1,3 +1,4 @@
data="""\
/* /*
* This file is part of pygal * This file is part of pygal
* *
@ -139,3 +140,4 @@
{{ colors }} {{ colors }}
"""

14
pygal/graph/frenchmap.py

@ -169,12 +169,7 @@ REGIONS = {
'06': u("Mayotte") '06': u("Mayotte")
} }
from .maps.fr_departments_svg import data as DPT_MAP
with open(os.path.join(
os.path.dirname(__file__), 'maps',
'fr.departments.svg')) as file:
DPT_MAP = file.read()
class IntCodeMixin(object): class IntCodeMixin(object):
def adapt_code(self, area_code): def adapt_code(self, area_code):
@ -194,12 +189,7 @@ class FrenchMapDepartments(IntCodeMixin, BaseMap):
kind = 'departement' kind = 'departement'
svg_map = DPT_MAP svg_map = DPT_MAP
from .maps.fr_regions_svg import data as REG_MAP
with open(os.path.join(
os.path.dirname(__file__), 'maps',
'fr.regions.svg')) as file:
REG_MAP = file.read()
class FrenchMapRegions(IntCodeMixin, BaseMap): class FrenchMapRegions(IntCodeMixin, BaseMap):
"""French regions map""" """French regions map"""

0
pygal/graph/maps/__init__.py

3
pygal/graph/maps/ch.cantons.svg → pygal/graph/maps/ch_cantons_svg.py

@ -1,3 +1,4 @@
data = """\
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g id="cantons" transform="translate(-265.0,-825.0) matrix(0.53050535,0,0,0.53379421,130.8741,392.31231)"> <g id="cantons" transform="translate(-265.0,-825.0) matrix(0.53050535,0,0,0.53379421,130.8741,392.31231)">
<g class="zkt-zh canton map-element"><path d="m 950.10063,1055.077 0,-1.8258 c 0,0 -0.75,-2.1909 -0.75,-3.4081 0,-1.2172 -1,-3.1647 -1,-3.1647 l -0.5,-5.1122 -3.75,-3.6516 4,0.7303 1.75,-1.9475 2.75,0.2434 1.5,-2.4344 2.25,-0.7303 0.25,-3.4081 c 0,0 1.25,-2.191 2.25,-2.9213 1,-0.7303 2.5,-2.1909 3.25,-3.1647 0.75,-0.9737 0.75,-3.895 0.75,-3.895 0,0 -2,2.1909 -4,2.4344 -2,0.2434 -4.5,0.9737 -5.5,1.2172 -1,0.2434 -3,0 -2,-1.9475 1,-1.9475 1.5,-2.6779 0,-4.1385 -1.5,-1.4606 -2.25,-1.7041 -1.75,-3.6516 0.5,-1.9475 0.75,-3.895 0.75,-3.895 l -0.5,-3.6516 -3.25,-3.895 -0.25,-6.32941 -2.75,-0.4869 -1,-1.704 -3.75,0 0,-2.191 3.5,-0.4869 0.75,-3.6515 1,-1.7041 1.25,-2.4344 -4.25,-1.4606 2.25,-3.1647 -0.75,-3.1647 1.5,-2.191 -1,-3.4081 -3,-0.4869 -1.25,-3.895 2.25,-1.2172 -0.5,-3.6516 -2.75,0.2435 -0.75,-5.5991 1,-1.9475 -1.25,-2.6779 1.5,-2.6778 4,0 0.5,-3.1647 1.25,-2.9212 2.75,1.704 0.75,-3.1647 1.75,-0.4869 0,-3.1647 2.25,-1.9475 1.75,-0.7303 -0.75,-2.9212 0.75,-2.9213 1.25,-2.6778 1.6133,-3.1761 3e-4,0 0.252,0.078 0.7519,-0.061 2.0806,-1.0752 3.0454,-0.2813 4.8438,-1.2058 3.2661,-0.9595 0.7309,-0.2106 1.9268,-0.5694 -0.9463,-1.2212 -4.9253,1.3701 -2.7231,-4.3646 3.4267,-2.0552 2.1109,-4.0217 7.2964,-1.7131 2.1108,-3.083 1.4068,-2.6516 4.8339,0.2539 0.7041,2.3977 3.4263,0.3426 4.5737,4.1107 -3.3062,5.6322 -1.8985,2.8917 -3.4268,1.3703 -0.7036,3.4255 1.7588,2.0552 3.0752,6.0774 1.416,-1.1268 0.25,-2.9213 0.5,-1.7041 2.5,-2.9212 1.75,-3.4082 0.75,-1.9475 0.2795,0.2051 1.2251,-1.3959 0.1621,-1.8634 2.18997,-3.9616 0.3882,-1.6926 -2.32037,-9.1263 1.05767,-4.1742 4.7417,-3.6815 -1.4062,-3.4141 -0.049,-0.6238 -0.082,-0.9671 -10e-5,-10e-5 1.0928,-1.4768 1,-2.5561 2,-1.9475 0.875,-4.1385 2.125,-1.8258 4.375,0.1218 2.875,0.852 3.75,3.895 1.625,-0.4868 -1.375,6.0859 3,1.9476 0.5,4.8687 2,3.6516 3.75,0.9738 1.25,1.704 3.5,0.4869 2.75,-0.4869 4.5,0.9738 3.25,-0.9738 2.5,-2.6778 3.25,0 2.25,-2.4344 1,-3.895 4,0 0.5,5.3557 4.5,1.4606 1.25,3.1647 -0.5,1.7041 -3,2.9212 c 0,0 -0.5,0.4869 -0.5,2.9213 0,2.4344 -2.75,3.1647 -2.75,3.1647 l -0.25,5.1122 -3.5,-0.9738 -0.25,-2.4343 -7.25,-3.6516 -3.75,-0.9738 -2,6.086 2.75,1.9475 -0.75,3.4081 4,0 11.25,4.6254 1.25,4.1384 7.5,-0.7303 3.75,4.3819 -2.5,1.7041 -2.75,0.7303 1.75,4.6253 2.25,4.8688 7,0 2.25,1.7041 5.5,0.4868 0,9.2507 -1.75,4.1385 1.25,4.1384 -3.25,0.9738 -0.25,2.9212 2.75,2.191 1.75,4.8687 2,1.2172 0.25,1.9475 -1,1.9476 1.5,2.4343 5,0.4869 0,1.9475 -5.25,0.2435 2,3.6515 -0.75,3.4082 -2,3.1647 0.25,2.1909 3.75,0.7303 2.25,2.4344 4,2.4344 -0.25,2.92131 3,2.1909 2,7.3032 2.5,0 1.75,2.9213 -1,3.1647 2.25,0.7303 -0.75,4.1384 2.5,2.9213 -3.75,5.5991 -4,0.4869 -1.5,2.1909 -0.75,2.9213 -3.75,1.4606 1,3.4081 2.5,0.4869 -3.5,7.79 -5.75,1.7041 -7.25,0.9738 -3.25,0.2434 -1.25,2.6778 -4.75,0.9738 -1.5,-3.1647 -2.25,1.9475 -4.5,-2.191 -4.75,1.4607 -4.084,2.4508 -1.166,6.313 -4e-4,0 -14.75,0.9737 -5.251,6.3099 -4.499,4.6449 -3.75,2.6778 -1.25,2.6778 0.5,3.895 2.25,1.4607 0.5,2.1909 4e-4,0 -3.5,0.7303 -2.5,1.7041 -3.5,-1.2172 0.25,-2.9213 -3,-0.9737 -2,1.2172 -1.75,-1.2172 -3.75,-0.7303 1.5,-2.4344 -2.5,-3.895 -1.5,-5.5991 -3.5,0 0.25,-1.7041 -1.25,-1.7041 -3.75007,0.7303 0,-2.9212 -7.5,-1.9475 -5.5,-0.2435 -1.25,1.9475 -2.5,-1.2171 -2.75,0.2434 -0.75,1.9475 -2.25,1.2172 -2.75,0 -2.75,1.2172 -1.75,-0.2435 -3.5,-2.6778 -3.75,-1.2172 -1.75,-2.4344 -5.5,0.4869 -1.25,-3.895 -0.5,-2.4344 -2.25,-3.5298 z" id="kt-zh"/></g> <g class="zkt-zh canton map-element"><path d="m 950.10063,1055.077 0,-1.8258 c 0,0 -0.75,-2.1909 -0.75,-3.4081 0,-1.2172 -1,-3.1647 -1,-3.1647 l -0.5,-5.1122 -3.75,-3.6516 4,0.7303 1.75,-1.9475 2.75,0.2434 1.5,-2.4344 2.25,-0.7303 0.25,-3.4081 c 0,0 1.25,-2.191 2.25,-2.9213 1,-0.7303 2.5,-2.1909 3.25,-3.1647 0.75,-0.9737 0.75,-3.895 0.75,-3.895 0,0 -2,2.1909 -4,2.4344 -2,0.2434 -4.5,0.9737 -5.5,1.2172 -1,0.2434 -3,0 -2,-1.9475 1,-1.9475 1.5,-2.6779 0,-4.1385 -1.5,-1.4606 -2.25,-1.7041 -1.75,-3.6516 0.5,-1.9475 0.75,-3.895 0.75,-3.895 l -0.5,-3.6516 -3.25,-3.895 -0.25,-6.32941 -2.75,-0.4869 -1,-1.704 -3.75,0 0,-2.191 3.5,-0.4869 0.75,-3.6515 1,-1.7041 1.25,-2.4344 -4.25,-1.4606 2.25,-3.1647 -0.75,-3.1647 1.5,-2.191 -1,-3.4081 -3,-0.4869 -1.25,-3.895 2.25,-1.2172 -0.5,-3.6516 -2.75,0.2435 -0.75,-5.5991 1,-1.9475 -1.25,-2.6779 1.5,-2.6778 4,0 0.5,-3.1647 1.25,-2.9212 2.75,1.704 0.75,-3.1647 1.75,-0.4869 0,-3.1647 2.25,-1.9475 1.75,-0.7303 -0.75,-2.9212 0.75,-2.9213 1.25,-2.6778 1.6133,-3.1761 3e-4,0 0.252,0.078 0.7519,-0.061 2.0806,-1.0752 3.0454,-0.2813 4.8438,-1.2058 3.2661,-0.9595 0.7309,-0.2106 1.9268,-0.5694 -0.9463,-1.2212 -4.9253,1.3701 -2.7231,-4.3646 3.4267,-2.0552 2.1109,-4.0217 7.2964,-1.7131 2.1108,-3.083 1.4068,-2.6516 4.8339,0.2539 0.7041,2.3977 3.4263,0.3426 4.5737,4.1107 -3.3062,5.6322 -1.8985,2.8917 -3.4268,1.3703 -0.7036,3.4255 1.7588,2.0552 3.0752,6.0774 1.416,-1.1268 0.25,-2.9213 0.5,-1.7041 2.5,-2.9212 1.75,-3.4082 0.75,-1.9475 0.2795,0.2051 1.2251,-1.3959 0.1621,-1.8634 2.18997,-3.9616 0.3882,-1.6926 -2.32037,-9.1263 1.05767,-4.1742 4.7417,-3.6815 -1.4062,-3.4141 -0.049,-0.6238 -0.082,-0.9671 -10e-5,-10e-5 1.0928,-1.4768 1,-2.5561 2,-1.9475 0.875,-4.1385 2.125,-1.8258 4.375,0.1218 2.875,0.852 3.75,3.895 1.625,-0.4868 -1.375,6.0859 3,1.9476 0.5,4.8687 2,3.6516 3.75,0.9738 1.25,1.704 3.5,0.4869 2.75,-0.4869 4.5,0.9738 3.25,-0.9738 2.5,-2.6778 3.25,0 2.25,-2.4344 1,-3.895 4,0 0.5,5.3557 4.5,1.4606 1.25,3.1647 -0.5,1.7041 -3,2.9212 c 0,0 -0.5,0.4869 -0.5,2.9213 0,2.4344 -2.75,3.1647 -2.75,3.1647 l -0.25,5.1122 -3.5,-0.9738 -0.25,-2.4343 -7.25,-3.6516 -3.75,-0.9738 -2,6.086 2.75,1.9475 -0.75,3.4081 4,0 11.25,4.6254 1.25,4.1384 7.5,-0.7303 3.75,4.3819 -2.5,1.7041 -2.75,0.7303 1.75,4.6253 2.25,4.8688 7,0 2.25,1.7041 5.5,0.4868 0,9.2507 -1.75,4.1385 1.25,4.1384 -3.25,0.9738 -0.25,2.9212 2.75,2.191 1.75,4.8687 2,1.2172 0.25,1.9475 -1,1.9476 1.5,2.4343 5,0.4869 0,1.9475 -5.25,0.2435 2,3.6515 -0.75,3.4082 -2,3.1647 0.25,2.1909 3.75,0.7303 2.25,2.4344 4,2.4344 -0.25,2.92131 3,2.1909 2,7.3032 2.5,0 1.75,2.9213 -1,3.1647 2.25,0.7303 -0.75,4.1384 2.5,2.9213 -3.75,5.5991 -4,0.4869 -1.5,2.1909 -0.75,2.9213 -3.75,1.4606 1,3.4081 2.5,0.4869 -3.5,7.79 -5.75,1.7041 -7.25,0.9738 -3.25,0.2434 -1.25,2.6778 -4.75,0.9738 -1.5,-3.1647 -2.25,1.9475 -4.5,-2.191 -4.75,1.4607 -4.084,2.4508 -1.166,6.313 -4e-4,0 -14.75,0.9737 -5.251,6.3099 -4.499,4.6449 -3.75,2.6778 -1.25,2.6778 0.5,3.895 2.25,1.4607 0.5,2.1909 4e-4,0 -3.5,0.7303 -2.5,1.7041 -3.5,-1.2172 0.25,-2.9213 -3,-0.9737 -2,1.2172 -1.75,-1.2172 -3.75,-0.7303 1.5,-2.4344 -2.5,-3.895 -1.5,-5.5991 -3.5,0 0.25,-1.7041 -1.25,-1.7041 -3.75007,0.7303 0,-2.9212 -7.5,-1.9475 -5.5,-0.2435 -1.25,1.9475 -2.5,-1.2171 -2.75,0.2434 -0.75,1.9475 -2.25,1.2172 -2.75,0 -2.75,1.2172 -1.75,-0.2435 -3.5,-2.6778 -3.75,-1.2172 -1.75,-2.4344 -5.5,0.4869 -1.25,-3.895 -0.5,-2.4344 -2.25,-3.5298 z" id="kt-zh"/></g>
@ -88,4 +89,4 @@
<polygon id="polygon151-6" style="fill:#0978ab;stroke:#0978ab;stroke-width:1.01338696;" points="361.27954,499.90723 359.76001,500.64014 356.82764,504.27197 357.33179,507.26074 356.56812,508.5332 356.32373,511.18994 356.56812,514.47705 358.73657,523.90381 358.41602,526.93799 359.19482,528.03906 358.69849,530.98193 357.00317,529.83691 355.73584,529.99756 356.04126,526.7666 354.94922,510.97266 355.30811,506.89404 353.94116,506.99805 352.76538,508.60059 352.6355,507.66162 355.34644,499.90723 357.36206,498.01807 357.7439,496.48291 355.98755,496.00146 355.29297,494.71924 355.28516,492.64648 354.50635,491.54688 356.03345,489.11816 357.57593,487.98389 359.74463,486.39209 359.74463,486.39209 359.88965,487.60645 359.06494,489.53027 357.37744,490.56201 357.18652,492.26904 360.27905,497.97217 361.72998,497.28516 362.95923,496.7124 361.59253,499.3125 " transform="matrix(1,0,0,0.9737543,234.60453,792.53506)"/> <polygon id="polygon151-6" style="fill:#0978ab;stroke:#0978ab;stroke-width:1.01338696;" points="361.27954,499.90723 359.76001,500.64014 356.82764,504.27197 357.33179,507.26074 356.56812,508.5332 356.32373,511.18994 356.56812,514.47705 358.73657,523.90381 358.41602,526.93799 359.19482,528.03906 358.69849,530.98193 357.00317,529.83691 355.73584,529.99756 356.04126,526.7666 354.94922,510.97266 355.30811,506.89404 353.94116,506.99805 352.76538,508.60059 352.6355,507.66162 355.34644,499.90723 357.36206,498.01807 357.7439,496.48291 355.98755,496.00146 355.29297,494.71924 355.28516,492.64648 354.50635,491.54688 356.03345,489.11816 357.57593,487.98389 359.74463,486.39209 359.74463,486.39209 359.88965,487.60645 359.06494,489.53027 357.37744,490.56201 357.18652,492.26904 360.27905,497.97217 361.72998,497.28516 362.95923,496.7124 361.59253,499.3125 " transform="matrix(1,0,0,0.9737543,234.60453,792.53506)"/>
</g> </g>
</svg> </svg>
"""

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

2
pygal/graph/maps/fr.departments.svg → pygal/graph/maps/fr_departments_svg.py

@ -1,3 +1,4 @@
data="""\
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1898"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1898">
<g id="departements" transform="translate(-42.932808,96.039162)"> <g id="departements" transform="translate(-42.932808,96.039162)">
<g class="z95 departement map-element"> <g class="z95 departement map-element">
@ -326,3 +327,4 @@
</g> </g>
</g> </g>
</svg> </svg>
"""

Before

Width:  |  Height:  |  Size: 583 KiB

After

Width:  |  Height:  |  Size: 583 KiB

2
pygal/graph/maps/fr.regions.svg → pygal/graph/maps/fr_regions_svg.py

@ -1,3 +1,4 @@
data="""\
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2000 1898"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2000 1898">
<g id="regions" transform="translate(-42.932808,96.039162)"> <g id="regions" transform="translate(-42.932808,96.039162)">
<g class="a94 region map-element"> <g class="a94 region map-element">
@ -89,3 +90,4 @@
</g> </g>
</g> </g>
</svg> </svg>
"""

Before

Width:  |  Height:  |  Size: 370 KiB

After

Width:  |  Height:  |  Size: 370 KiB

2
pygal/graph/maps/worldmap.svg → pygal/graph/maps/worldmap_svg.py

@ -1,3 +1,4 @@
data="""\
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2475 1388"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2475 1388">
<g id="countries"> <g id="countries">
<g class="ad country map-element"> <g class="ad country map-element">
@ -2408,3 +2409,4 @@
</g> </g>
</g> </g>
</svg> </svg>
"""

Before

Width:  |  Height:  |  Size: 760 KiB

After

Width:  |  Height:  |  Size: 760 KiB

7
pygal/graph/swissmap.py

@ -56,12 +56,7 @@ CANTONS = {
'kt-ge': u("Genf"), 'kt-ge': u("Genf"),
} }
from .maps.ch_cantons_svg import data as CNT_MAP
with open(os.path.join(
os.path.dirname(__file__), 'maps',
'ch.cantons.svg')) as file:
CNT_MAP = file.read()
class SwissMapCantons(BaseMap): class SwissMapCantons(BaseMap):
"""Swiss Cantons map""" """Swiss Cantons map"""

7
pygal/graph/worldmap.py

@ -27,12 +27,7 @@ from pygal.graph.map import BaseMap
from pygal.i18n import COUNTRIES, SUPRANATIONAL from pygal.i18n import COUNTRIES, SUPRANATIONAL
import os import os
from .maps.worldmap_svg import data as WORLD_MAP
with open(os.path.join(
os.path.dirname(__file__), 'maps',
'worldmap.svg')) as file:
WORLD_MAP = file.read()
class Worldmap(BaseMap): class Worldmap(BaseMap):
"""Worldmap graph""" """Worldmap graph"""

48
pygal/svg.py

@ -32,6 +32,7 @@ from numbers import Number
from math import cos, sin, pi from math import cos, sin, pi
from pygal.util import template, coord_format, minify_css from pygal.util import template, coord_format, minify_css
from pygal import __version__ from pygal import __version__
from pygal.css import base_css
class Svg(object): class Svg(object):
@ -83,36 +84,39 @@ class Svg(object):
"""Add the css to the svg""" """Add the css to the svg"""
colors = self.graph.style.get_colors(self.id) colors = self.graph.style.get_colors(self.id)
all_css = [] all_css = []
for css in ['base.css'] + list(self.graph.css): for css in [base_css] + list(self.graph.css):
if '://' in css: if type(css) == str and '://' in css:
self.processing_instructions.append( self.processing_instructions.append(
etree.PI( etree.PI(
u('xml-stylesheet'), u('href="%s"' % css))) u('xml-stylesheet'), u('href="%s"' % css)))
else: else:
if css.startswith('inline:'): if type(css) == str and css.startswith('inline:'):
css_text = css[len('inline:'):] css_text = css[len('inline:'):]
else: else:
if not os.path.exists(css): if type(css) == str:
css = os.path.join( if not os.path.exists(css):
os.path.dirname(__file__), 'css', css) css = os.path.join(
os.path.dirname(__file__), 'css', css)
class FontSizes(object): class FontSizes(object):
"""Container for font sizes""" """Container for font sizes"""
fs = FontSizes() fs = FontSizes()
for name in dir(self.graph.state): for name in dir(self.graph.state):
if name.endswith('_font_size'): if name.endswith('_font_size'):
setattr( setattr(
fs, fs,
name.replace('_font_size', ''), name.replace('_font_size', ''),
('%dpx' % getattr(self.graph, name))) ('%dpx' % getattr(self.graph, name)))
with io.open(css, encoding='utf-8') as f: with io.open(css, encoding='utf-8') as f:
css_text = template( css_text = template(
f.read(), f.read(),
style=self.graph.style, style=self.graph.style,
colors=colors, colors=colors,
font_sizes=fs, font_sizes=fs,
id=self.id) id=self.id)
else:
css_text = css.data
if not self.graph.pretty_print: if not self.graph.pretty_print:
css_text = minify_css(css_text) css_text = minify_css(css_text)
all_css.append(css_text) all_css.append(css_text)

2
setup.py

@ -64,7 +64,7 @@ setup(
"svg", "chart", "graph", "diagram", "plot", "histogram", "kiviat"], "svg", "chart", "graph", "diagram", "plot", "histogram", "kiviat"],
tests_require=["pytest", "pyquery", "flask", "cairosvg"], tests_require=["pytest", "pyquery", "flask", "cairosvg"],
cmdclass={'test': PyTest}, cmdclass={'test': PyTest},
package_data={'pygal': ['css/*', 'graph/maps/*.svg']}, #package_data={'pygal': ['css/*', 'graph/maps/*.svg']},
extras_require={ extras_require={
'lxml': ['lxml'], 'lxml': ['lxml'],
'png': ['cairosvg'] 'png': ['cairosvg']

Loading…
Cancel
Save