Merge pull request #1 from brantai/master

Updating for changes in drawsvg 2.0
This commit is contained in:
Flux 2024-03-02 21:08:06 +02:00 committed by GitHub
commit ae7b95396d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="400" height="400" viewBox="-200.0 -200.0 400 400"> width="400" height="400" viewBox="-200.0 -200.0 400.0 400.0">
<defs> <defs>
<marker markerWidth="6.5" markerHeight="5.0" viewBox="-0.8 -0.5 1.3 1.0" orient="auto" id="d0"> <marker markerWidth="6.5" markerHeight="5.0" viewBox="-0.8 -0.5 1.3 1.0" orient="auto" id="d0">
<circle cx="-0.3" cy="-0.0" r="0.3" stroke-width="0.2" stroke="black" fill="none" /> <circle cx="-0.3" cy="-0.0" r="0.3" stroke-width="0.2" stroke="black" fill="none" />

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 767 B

Before After
Before After

View file

@ -24,7 +24,7 @@ SOFTWARE.
import sys import sys
import math import math
import re import re
import drawSvg as svg import drawsvg as svg
def prepareMessage(message): def prepareMessage(message):
message = re.sub("[^a-zA-Z]+", "", message) # get rid of all non-alphabetic characters message = re.sub("[^a-zA-Z]+", "", message) # get rid of all non-alphabetic characters
@ -140,7 +140,7 @@ def createSigil(message, planet, fileName):
planets = ["moon", "mercury", "venus", "sun", "mars", "jupiter", "saturn"] planets = ["moon", "mercury", "venus", "sun", "mars", "jupiter", "saturn"]
planet = planets.index(planet.lower()) planet = planets.index(planet.lower())
# set up SVG canvas # set up SVG canvas
d = svg.Drawing(400, 400, origin='center') # define canvas d = svg.Drawing(400, 400, origin='center', context=svg.Context(invert_y=True)) # define canvas
# draw sigils # draw sigils
message = prepareMessage(message) message = prepareMessage(message)
@ -149,7 +149,7 @@ def createSigil(message, planet, fileName):
drawSigil( coordList, d, "black") drawSigil( coordList, d, "black")
# save sigil to SVG file # save sigil to SVG file
d.saveSvg(fileName) d.save_svg(fileName)
def main(): def main():
argNo = len(sys.argv) - 1 argNo = len(sys.argv) - 1