109 |
109 |
110 @param name name of the attribute (string) |
110 @param name name of the attribute (string) |
111 @param default default value (string) |
111 @param default default value (string) |
112 @return value of the requested tag attribute (string) |
112 @return value of the requested tag attribute (string) |
113 """ |
113 """ |
114 attributes = self.attributes() |
114 try: |
115 for attribute in attributes: |
115 att = self.attributes().value(name) |
116 if attribute.name() == name: |
116 if att == "": |
117 value = attribute.value() |
117 att = default |
118 if not value: |
118 return att |
119 value = default |
119 except AttributeError: |
120 break |
120 # Work around for PyQt6 < 6.1.1 |
121 else: |
121 attributes = self.attributes() |
122 value = default |
122 for attribute in attributes: |
123 return value |
123 if attribute.name() == name: |
124 # TODO: re-enable this code once PyQt6 is fixed and released |
124 value = attribute.value() |
125 ## att = self.attributes().value(name) |
125 if not value: |
126 ## if att == "": |
126 value = default |
127 ## att = default |
127 break |
128 ## return att |
128 else: |
|
129 value = default |
|
130 return value |
129 |
131 |
130 def _skipUnknownElement(self): |
132 def _skipUnknownElement(self): |
131 """ |
133 """ |
132 Protected method to skip over all unknown elements. |
134 Protected method to skip over all unknown elements. |
133 """ |
135 """ |