@@ -297,7 +297,7 @@ def load_svg_template(self, filename_field=None):
297
297
title_text .append (text )
298
298
299
299
# Set font size (for possible font dialog)
300
- s = node .attributes [ "style" ]. value
300
+ s = node .getAttribute ( "style" )
301
301
ard = style_to_dict (s )
302
302
fs = ard .get ("font-size" )
303
303
if fs and fs .endswith ("px" ):
@@ -459,7 +459,7 @@ def update_font_color_button(self):
459
459
for node in self .text_nodes + self .tspan_nodes :
460
460
461
461
# Get the value in the style attribute and turn into a dict
462
- s = node .attributes [ "style" ]. value
462
+ s = node .getAttribute ( "style" )
463
463
ard = style_to_dict (s )
464
464
# Get fill color or default to white
465
465
color = ard .get ("fill" , "#FFF" )
@@ -503,7 +503,7 @@ def get_ref_color(self, id):
503
503
for stop_node in ref_node .childNodes :
504
504
if stop_node .nodeName == "stop" :
505
505
# get color from stop
506
- ard = style_to_dict (stop_node .attributes [ "style" ]. value )
506
+ ard = style_to_dict (stop_node .getAttribute ( "style" ) )
507
507
if "stop-color" in ard :
508
508
return ard .get ("stop-color" )
509
509
return ""
@@ -513,7 +513,7 @@ def update_background_color_button(self):
513
513
514
514
if self .rect_node :
515
515
# All backgrounds should be the first (index 0) rect tag in the svg
516
- s = self .rect_node [0 ].attributes [ "style" ]. value
516
+ s = self .rect_node [0 ].getAttribute ( "style" )
517
517
ard = style_to_dict (s )
518
518
519
519
# Get fill color or default to black + full opacity
@@ -538,7 +538,7 @@ def set_font_style(self):
538
538
# Loop through each TEXT element
539
539
for text_child in self .text_nodes + self .tspan_nodes :
540
540
# set the style elements for the main text node
541
- s = text_child .attributes [ "style" ]. value
541
+ s = text_child .getAttribute ( "style" )
542
542
ard = style_to_dict (s )
543
543
set_if_existing (ard , "font-style" , self .font_style )
544
544
set_if_existing (ard , "font-family" , f"'{ self .font_family } '" )
@@ -557,7 +557,7 @@ def set_bg_style(self, color, alpha):
557
557
558
558
if self .rect_node :
559
559
# Turn the style attribute into a dict for modification
560
- s = self .rect_node [0 ].attributes [ "style" ]. value
560
+ s = self .rect_node [0 ].getAttribute ( "style" )
561
561
ard = style_to_dict (s )
562
562
ard .update ({
563
563
"fill" : color ,
@@ -572,7 +572,7 @@ def set_font_color_elements(self, color, alpha):
572
572
# Loop through each TEXT element
573
573
for text_child in self .text_nodes + self .tspan_nodes :
574
574
# SET TEXT PROPERTIES
575
- s = text_child .attributes [ "style" ]. value
575
+ s = text_child .getAttribute ( "style" )
576
576
ard = style_to_dict (s )
577
577
ard .update ({
578
578
"fill" : color ,
0 commit comments