Changeset - 69f9170d3c89
[Not reviewed]
default
6 2 0
Laman - 8 years ago 2017-02-14 22:27:34

cleaned redundant whitespace in SVG, cleaned old files
8 files changed with 6 insertions and 3432 deletions:
0 comments (0 inline, 0 general)
example.lyx
Show inline comments
 
deleted file
insertMatrix1.lyx
Show inline comments
 
deleted file
notes.txt
Show inline comments
 
deleted file
src/diana.py
Show inline comments
 
import os
 
import re
 

	
 
from jinja2 import Environment,FileSystemLoader
 

	
 
import config as cfg
 
import go
 
from go import BLACK,WHITE,EMPTY
 
from sgfParser import ParserError
 
from sgfParser.collection import Collection
 
from drawer.svg import Svg
 
from drawer.tikz import Tikz
 

	
 

	
 
curDir=os.path.dirname(__file__)
 
templateDir=os.path.join(curDir,"templ")
 
env=Environment(loader=FileSystemLoader(templateDir))
 
env.trim_blocks=True
 
env.lstrip_blocks=True
 

	
 

	
 
def collectMoves(root):
 
	node=root
 
	while len(node.children)>0:
 
		b=node.getProp("B")
 
		w=node.getProp("W")
 
		if b is not None: yield ("b",b)
 
		elif w is not None: yield ("w",w)
 
		# else: yield None # !! not really robust
 

	
 
		node=node.children[0]
 

	
 

	
 
class SourceFile:
 
	def __init__(self,fileName):
 
		self.fileName=fileName
 
		self._shortName= "".join(re.split(r'[/\\]', fileName)[-1].split('.')[:-1])
 
		self._game=go.Go()
 
		self._moveNumber=0
 
		self._record=None
 
		self._moves=[]
 

	
 
	def process(self):
src/templ/templ.svg
Show inline comments
 
<?xml version="1.0" encoding="utf-8"?>
 
{% set cellSize=boardSize/18 %}
 
{% set stoneRadius=cellSize/2-1 %}
 
{% set stoneRadius=cellSize/2-1 -%}
 

	
 
{% if not labeledPoint %}
 
	{% macro labeledPoint(p) %}
 
	<g class="{{p.color or 'e'}}" transform="translate({{(p.x*cellSize) | round(2)}},{{(p.y*cellSize) | round(2)}})">
 
		<circle cx="0" cy="0" r="{{stoneRadius|round(2)}}"/>
 
		<text y="0.35em" font-size="{{adjustFont(cellSize,p.label)}}">{{p.label}}</text>
 
	</g>
 
	{% endmacro %}
 
{% endif %}
 
{% endif -%}
 

	
 
<svg width="{{boardSize+padding*2}}" height="{{boardSize+padding*2}}" version="1.1" xmlns="http://www.w3.org/2000/svg">
 
	<defs>
 
		<style type="text/css"><![CDATA[
 
		{% block style %}
 
			rect{fill:white;stroke:black;stroke-width:1px}
 
			text{font-family:"DejaVu Sans";text-anchor:middle}
 
			line{stroke:black;stroke-width:0.7px}
 
			circle{stroke:black}
 
			circle.b, .b circle, .w text, .e text{fill:black}
 
			circle.w, .w circle, .b text{fill:white}
 
			.e circle {stroke:none;fill:white}
 
		{% endblock %}
 
		]]></style>
 
	</defs>
 
	<g transform="translate({{padding}},{{padding}})">
 
		<rect x="0" y="0" width="{{boardSize}}" height="{{boardSize}}"/>
 
		{# grid #}
 
		{% for i in range(1,18) %}
 
			<line x1="0" x2="{{boardSize}}" y1="{{(i*cellSize) | round(2)}}" y2="{{(i*cellSize) | round(2)}}"/>
 
			<line x1="{{(i*cellSize) | round(2)}}" x2="{{(i*cellSize) | round(2)}}" y1="0" y2="{{boardSize}}"/>
 
		{% endfor %}
 

	
 
		{# stars #}
 
		{% for y in [3,9,15] %}
 
			{% for x in [3,9,15] %}
 
		  <circle cx="{{(x*cellSize) | round(2)}}" cy="{{(y*cellSize) | round(2)}}" r="2" class="b"/>
 
			{% endfor %}
 
		{% endfor %}
 

	
 
		{# stones #}
 
		{% for p in stones %}
 
			<circle cx="{{(p.x*cellSize) | round(2)}}" cy="{{(p.y*cellSize) | round(2)}}" r="{{stoneRadius|round(2)}}" class="{{p.color}}"/>
 
		{% endfor %}
 

	
 
		{# moves #}
 
		{% for p in moves %}
 
		{% for p in moves -%}
 
			{{labeledPoint(p)}}
 
		{% endfor %}
 

	
 
		{# labels #}
 
		{% for p in labels %}
 
		{% for p in labels -%}
 
			{{labeledPoint(p)}}
 
		{% endfor %}
 
	</g>
 
</svg>
work.lyx
Show inline comments
 
deleted file
work2.lyx
Show inline comments
 
deleted file
work2.tex
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)