-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete_object.py
More file actions
32 lines (24 loc) · 928 Bytes
/
delete_object.py
File metadata and controls
32 lines (24 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import os
from lxml import etree
from subprocess import call
dir_update = 'C:/Projects/globocan2018_graph/map_by_site/cumrisk_abs'
bool_change = False
for file_sites in os.listdir(dir_update):
bool_change = False
if '.svg' in file_sites:
path_file = os.path.join(dir_update, file_sites)
print(path_file)
path_pdf = path_file.replace(".svg", ".pdf")
base = etree.parse(path_file)
root = base.getroot()
map = root[1]
for child in map:
if 'd' in child.attrib:
if 'M 1329.082031 1337.382813' in child.get("d"):
if 'rgb(50.196078%,50.196078%' in child.get("style"):
map.remove(child)
bool_change = True
if bool_change:
base.write(path_file, pretty_print=False)
call(["inkscape", "--without-gui", "--export-pdf="+path_pdf, path_file])