SVG画图工具,整套源码


SVG画图工具是一个基于网络的免费和开源矢量图形编辑器。 它可用于从Web浏览器内创建和编辑可缩放矢量图形(SVG)图像,而不需要额外的软件安装。
资源截图
代码片段和文件信息
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# ship.py
#
# Licensed under the Apache 2 License as is the rest of the project
# Copyright (c) 2011 Jeff Schiller
#
# This script has very little real-world application.  It is only used in our pure-client web app
# served on GoogleCode so we can have one HTML file run a build script and generate a ‘release‘
# version without having to maintain two separate HTML files.  It does this by evaluating
# ‘processing comments‘ that are suspicously similar to IE conditional comments and then outputting
# a new HTML file after evaluating particular variables.
#
# This script takes the following inputs:
#
# * a HTML file (--i=in.html)
# * a series of flag names (--on=Foo --on=Bar)
#
# Example:
#
# in.html:
#   
#     BAR!
#   
#
# $ ship.py --i in.html --on foo
#
# out.html:
#   
#     FOO!
#   
#
# It has the following limitations:
#
# 1) Only if-else-endif are currently supported.
# 2) All processing comments must be on one line with no other non-whitespace characters.
# 3) Comments cannot be nested.

import optparse
import os

inside_if = False
last_if_true = False

_options_parser = optparse.OptionParser(
usage=‘%prog --i input.html [--on flag1]‘
description=(‘Rewrites an HTML file based on conditional comments and flags‘))
_options_parser.add_option(‘--i‘
action=‘store‘ dest=‘input_html_file‘ help=‘Input HTML filename‘)
_options_parser.add_option(‘--on‘
action=‘append‘ type=‘string‘ dest=‘enabled_flags‘
help=‘name of flag to enable‘)

def parse_args(args=None):
  options rargs = _options_parser.parse_args(args)
  return options (None None)

def parseComment(line line_num enabled_flags):
  global inside_if
  global last_if_true

  start = line.find(‘{‘)
  end = line.find(‘}‘)
  statement = line[start+1:end].strip()
  if statement.startswith(‘if ‘):
    if inside_if == True:
      print ‘Fatal Error: Nested {if} found on line ‘ + str(line_num)
      print line
      quit()

    # Evaluate whether the expression is true/false.
    # only one variable name allowed for now
    variable_name = statement[3:].strip()
    if variable_name in enabled_flags:
      last_if_true = True
      line = ‘
    else:
      last_if_true = False
      line = ‘

    # invert the logic so the endif clause is closed properly
    last_if_true = not last_if_true

    # ensure we don‘t have two else statements in the same i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-02-27 15:04  svgedit-master
     文件         114  2018-02-27 15:04  svgedit-master.gitignore
     文件         987  2018-02-27 15:04  svgedit-masterAUTHORS
     文件       11859  2018-02-27 15:04  svgedit-masterCHANGES.md
     文件        1087  2018-02-27 15:04  svgedit-masterLICENSE
     文件        3029  2018-02-27 15:04  svgedit-masterMakefile
     文件        2029  2018-02-27 15:04  svgedit-masterREADME.md
     目录           0  2018-02-27 15:04  svgedit-masteruild
     目录           0  2018-02-27 15:04  svgedit-masteruild ools
     文件       11358  2018-02-27 15:04  svgedit-masteruild oolsCOPYING
     文件        7143  2018-02-27 15:04  svgedit-masteruild oolsREADME
     文件     3939454  2018-02-27 15:04  svgedit-masteruild oolsclosure-compiler.jar
     文件        4264  2018-02-27 15:04  svgedit-masteruild oolsship.py
     文件      851359  2018-02-27 15:04  svgedit-masteruild oolsyuicompressor.jar
     目录           0  2018-02-27 15:04  svgedit-masterchrome-app
     文件        7756  2018-02-27 15:04  svgedit-masterchrome-appicon_128.png
     文件         459  2018-02-27 15:04  svgedit-masterchrome-appmanifest.json
     目录           0  2018-02-27 15:04  svgedit-masterclipart
     文件        1835  2018-02-27 15:04  svgedit-masterclipartmoon.svg
     文件         500  2018-02-27 15:04  svgedit-masterclipartstar.svg
     文件        9448  2018-02-27 15:04  svgedit-masterclipartsun.svg
     文件         959  2018-02-27 15:04  svgedit-mastercomposer.json
     目录           0  2018-02-27 15:04  svgedit-masterdocs
     文件        2427  2018-02-27 15:04  svgedit-masterdocsAcknowledgements.md
     文件        1769  2018-02-27 15:04  svgedit-masterdocsReleaseInstructions.md
     文件       61763  2018-02-27 15:04  svgedit-masterdocsSvgCanvas.md
     目录           0  2018-02-27 15:04  svgedit-mastereditor
     文件        1535  2018-02-27 15:04  svgedit-mastereditorrowser-not-supported.html
     文件        6600  2018-02-27 15:04  svgedit-mastereditorrowser.js
     目录           0  2018-02-27 15:04  svgedit-mastereditorcanvg
     文件      100625  2018-02-27 15:04  svgedit-mastereditorcanvgcanvg.js
............此处省略325个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)