示例#1
0
import pyssed


def size(width=None, height=None):
    result = {}
    if width:
        result.update({'width': width})
    if height:
        result.update({'height': height})
    return result


css = {
    'div.square': size(100, 100),
    'div.rect': size(40, 30),
    'div.wide': size(1024),
    'div.tall': size(height=800),
}

print '\n'.join(pyssed.generate(css))
示例#2
0
import pyssed

background = pyssed.style('background: #123456')
italic = pyssed.style('font-style: italic')
bold = pyssed.style('font-weight: bold')
blue = pyssed.style('color: blue')

blue_ul = pyssed.style({'ul': {'background': 'blue'}})

css = {
    'a:hover': background + italic,
    'a:visited': background + bold + blue,
    '.someclass': blue_ul + {
        'a:visited': italic,
    },
    '.anotherclass': blue_ul + {
        'a:visited': bold,
    },
}

print "\n".join(pyssed.generate(css))
                                       defaultColorForNation)  # land,color

                #Set other colors
                i = 0
                for c in colorrow:
                    i += 1
                    if c is not defaultColorForNation:
                        if c is not False:
                            addFillColor(headers[i], row[0],
                                         c)  # year,land,color
                        else:
                            # We need to unset default colors again for years without values.
                            addFillColorToLand(headers[i], row[0], "lightgray")

except IOError:
    print("Could not open input file")

for color in fillColors:
    classes = ",".join(fillColors[color])
    css[classes] = {'fill': color}

# Write to file
try:
    f = open(outputFile, "w")
    try:
        f.write('\n'.join(pyssed.generate(css)))  # Write a string to a file
    finally:
        f.close()
except IOError:
    print "Could not write to css file (%s)" % outputFile
示例#4
0
bold = pyssed.style('font-weight: bold;')
red_bold = red + bold


def rounded(radius):
    return pyssed.style({
        'border-radius': radius,
        '-moz-border-radius': int(round(radius * 1.5)),
        '-webkit-border-radius': int(round(radius * 2.0)),
        })

css = {
    '.blue': blue,
    '.green': green,
    'ul li': rounded(3) + blue + {
        'font-style': 'italic',
        'background': site_background,
    },
    'div.ground': rounded(7) + red_bold + {
        'p': {
            'text-align': 'left',
            'em': {
                'font-size': '14pt',
                'background': site_background,
            }
        },
    }
}

print '\n'.join(pyssed.generate(css))
                if defaultColorForNation is not False:
                    addFillColorNoYear(row[0], defaultColorForNation)  # land,color

                    # Set other colors
                i = 0
                for c in colorrow:
                    i += 1
                    if c is not defaultColorForNation:
                        if c is not False:
                            addFillColor(headers[i], row[0], c)  # year,land,color
                        else:
                            # We need to unset default colors again for years without values.
                            addFillColorToLand(headers[i], row[0], "lightgray")

except IOError:
    print ("Could not open input file")

for color in fillColors:
    classes = ",".join(fillColors[color])
    css[classes] = {"fill": color}

# Write to file
try:
    f = open(outputFile, "w")
    try:
        f.write("\n".join(pyssed.generate(css)))  # Write a string to a file
    finally:
        f.close()
except IOError:
    print "Could not write to css file (%s)" % outputFile