Skip to content

Commit ef10b3c

Browse files
authored
Add files via upload
1 parent c7e710d commit ef10b3c

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

ProfilAnalyser.py

+27-13
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111
from UM.Application import Application
1212
from UM.Settings.ContainerRegistry import ContainerRegistry
1313

14+
from UM.Logger import Logger
15+
from UM.Message import Message
16+
1417
from PyQt5.QtCore import QObject, QUrl
1518
from PyQt5.QtGui import QDesktopServices
1619

1720
import os.path
1821
import tempfile
1922
import html
2023
import json
24+
import re
2125

2226
encode = html.escape
2327

@@ -270,12 +274,6 @@ def formatContainerStackMenu(stack):
270274
html += "</ul>\n"
271275
return html
272276

273-
def formatContainerMetaDataOnly(container):
274-
html = tableHeader("Container: " + safeCall(container.getId))
275-
html += formatContainerMetaDataRows(container)
276-
html += tableFooter()
277-
return html
278-
279277
def formatContainer(container, name="Container", short_value_properties=False, show_keys=True):
280278
html = ""
281279
html += "<a id='" + str(id(container)) + "' ></a>"
@@ -302,11 +300,11 @@ def formatContainerMetaDataRows(def_container):
302300
# html += formatKeyValueTableRow("<id>", def_container, extra_class="metadata")
303301
html += formatKeyValueTableRow("id", safeCall(def_container.getId), extra_class="metadata")
304302
html += formatKeyValueTableRow("name", safeCall(def_container.getName), extra_class="metadata")
305-
if hasattr(def_container, "_getDefinition"):
306-
html += formatKeyValueTableRow("definition", safeCall(def_container._getDefinition), extra_class="metadata")
303+
# if hasattr(def_container, "_getDefinition"):
304+
# html += formatKeyValueTableRow("definition", safeCall(def_container._getDefinition), extra_class="metadata")
307305
html += formatKeyValueTableRow("read only", safeCall(def_container.isReadOnly), extra_class="metadata")
308306
html += formatKeyValueTableRow("path", safeCall(def_container.getPath), extra_class="metadata")
309-
html += formatKeyValueTableRow("metadata", safeCall(def_container.getMetaData), extra_class="metadata")
307+
# html += formatKeyValueTableRow("metadata", safeCall(def_container.getMetaData), extra_class="metadata")
310308
except:
311309
pass
312310

@@ -323,9 +321,20 @@ def formatSettingValue(container, key, properties=None):
323321
for prop_name in properties:
324322
prop_value = container.getProperty(key, prop_name)
325323
if prop_value is not None:
326-
value += " <li>\n"
327-
value += " <span class='prop_name'>" + encode(prop_name) + ":</span> " + encode(repr(prop_value))
328-
value += " </li>\n"
324+
if prop_name=="default_value" or prop_name=="value" :
325+
# repr() function returns a printable representation of the given object
326+
print_value = repr(prop_value)
327+
if print_value.find("UM.Settings.SettingFunction") > 0 :
328+
# Logger.log('d', 'print_value : ' + print_value)
329+
strtok_value = print_value.split("=",1)
330+
# Logger.log('d', 'print_value : ' + str(strtok_value[1]))
331+
final_value = "=" + strtok_value[1].replace(" >","")
332+
else :
333+
final_value = print_value
334+
335+
value += " <li>\n"
336+
value += " <span class='prop_name'>" + encode(prop_name) + ":</span> " + encode(final_value)
337+
value += " </li>\n"
329338
value += "</ul>\n"
330339

331340
return RawHtml(value)
@@ -370,16 +379,21 @@ def formatKeyValueTableRow(key, value, extra_class=""):
370379

371380
def formatSettingsKeyTableRow(key, value):
372381
clazz = ""
382+
# Test if type Exception
373383
if isinstance(value, Exception):
374384
clazz = "exception"
375385

386+
# Test if type RawHtml
376387
if isinstance(value, RawHtml):
377388
formatted_value = value.value
389+
Display_Key = "&#x1f511; "
378390
else:
379391
formatted_value = encode(str(value))
392+
Display_Key = "&#x1F527; "
380393

381394
formatted_key = encode(str(key))
382-
return "<tr class='" + clazz + "' --data-key='" + formatted_key + "'><td class='key'>&#x1f511; " + formatted_key + "</td><td class='value'>" + formatted_value + "</td></tr>\n"
395+
# &#x1f511; => Key symbole
396+
return "<tr class='" + clazz + "' --data-key='" + formatted_key + "'><td class='key'>" + Display_Key + formatted_key + "</td><td class='value'>" + formatted_value + "</td></tr>\n"
383397

384398
def keyFilterJS():
385399
return """

0 commit comments

Comments
 (0)