Skip to content

Commit

Permalink
no border
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvlaminck committed Dec 9, 2024
1 parent e3b8ecb commit 4cc6a84
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions otlmow_visuals/PyVisWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ def modify_html(cls, file_path: Path) -> None:
index_of_function = -1
index_of_nodes = -1
index_of_edges = -1
index_of_screen_height = -1
index_of_border = -1
index_of_card_class = -1
for index, line in enumerate(file_data):
if index_of_function == -1 and ('// This method is responsible for drawing the graph, '
'returns the drawn network') in line:
Expand All @@ -289,6 +292,12 @@ def modify_html(cls, file_path: Path) -> None:
index_of_nodes = index
elif index_of_edges == -1 and 'edges = new vis.DataSet' in line:
index_of_edges = index
elif index_of_screen_height == -1 and 'height: 600px;' in line:
index_of_screen_height = index
elif index_of_border == -1 and 'border: 1px solid lightgray;' in line:
index_of_border = index
elif index_of_card_class == -1 and 'class="card"' in line:
index_of_card_class = index

nodes_line = file_data.pop(index_of_nodes)
nodes_line = nodes_line.replace('"\\u003chtmlTitle\\u003e(\\\"', 'htmlTitle("'). \
Expand All @@ -304,6 +313,21 @@ def modify_html(cls, file_path: Path) -> None:
file_data.insert(index_of_function + 2, ' return container;' + '\n')
file_data.insert(index_of_function + 3, ' }' + '\n')

if index_of_screen_height != -1:
screen_height_line = file_data.pop(index_of_screen_height)
screen_height_line = screen_height_line.replace('height: 600px;', 'height: auto;')
file_data.insert(index_of_screen_height, screen_height_line)

if index_of_border != -1:
border_line = file_data.pop(index_of_border)
border_line = border_line.replace('border: 1px solid lightgray;', 'border: 0px solid lightgray;')
file_data.insert(index_of_border, border_line)

if index_of_card_class != -1:
card_class_line = file_data.pop(index_of_card_class)
card_class_line = card_class_line.replace('class="card"', ' ')
file_data.insert(index_of_card_class, card_class_line)

with open(file_path, 'w') as file:
for line in file_data:
file.write(line)
Expand Down

0 comments on commit 4cc6a84

Please sign in to comment.