summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsumit2020-05-19 20:26:26 +0530
committersumit2020-05-19 20:26:26 +0530
commit238cedcd7e834d859fb948d3d3e289c64133596e (patch)
tree2f9590a2ea95768393ee3639f14a4b1c6f4d0037
parentc2cbe91cb77b00e728fa9d5b53cb4c608005a25a (diff)
parentb2332467ca0d261644373b6578349bfcddc240ab (diff)
downloadChemical-PFD-238cedcd7e834d859fb948d3d3e289c64133596e.tar.gz
Chemical-PFD-238cedcd7e834d859fb948d3d3e289c64133596e.tar.bz2
Chemical-PFD-238cedcd7e834d859fb948d3d3e289c64133596e.zip
Merge branch 'master' of https://github.com/Sumit-Sahu/Chemical-PFD
-rw-r--r--src/main/python/shapes/svghandler.py44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/main/python/shapes/svghandler.py b/src/main/python/shapes/svghandler.py
deleted file mode 100644
index fa976cf..0000000
--- a/src/main/python/shapes/svghandler.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import re
-
-from PyQt5.QtCore import QFile, QIODevice
-from PyQt5.QtXml import QDomDocument
-
-
-class SvgHandler():
- def __init__(self, file):
- self.doc = QDomDocument("doc")
- self.file = file
- if not self.doc.setContent(self.file):
- print("Cannot parse the content")
- self.file.close()
- exit(-1)
- self.file.close()
- self.docElem = self.doc.documentElement()
-
- def checkViewBox(self):
- viewbox = self.docElem.attributes().namedItem("viewBox").nodeValue().split(" ")
- width = self.docElem.attributes().namedItem("width").nodeValue()
- height = self.docElem.attributes().namedItem("height").nodeValue()
- if viewbox[2] == width and viewbox[3] == height:
- return True
- else:
- return False
-
- def setColor(self, value):
- paths = self.docElem.elementsByTagName("path")
- for index in range(paths.size()):
- path = paths.at(index)
- style = path.attributes().namedItem("style")
- output = re.sub("stroke:[^;]*;", f"stroke:{value};", style.nodeValue())
- style.setNodeValue(output)
-
- def setStrokeWidth(self,value):
- paths = self.docElem.elementsByTagName("path")
- for index in range(paths.size()):
- path = paths.at(index)
- style = path.attributes().namedItem("style")
- output = re.sub("stroke-width:[^;]*;", f"stroke-width:{value};", style.nodeValue())
- style.setNodeValue(output)
- print(self.doc.toString())
- # output = re.sub('="stroke-width:[\d.]*;', f'="stroke-width:{target};', self.svg)
- # output = re.sub('stroke-width:[\d.]*;', f'stroke-width:{target};', self.svg)