11
11
from UM .Application import Application
12
12
from UM .Settings .ContainerRegistry import ContainerRegistry
13
13
14
+ from UM .Logger import Logger
15
+ from UM .Message import Message
16
+
14
17
from PyQt5 .QtCore import QObject , QUrl
15
18
from PyQt5 .QtGui import QDesktopServices
16
19
17
20
import os .path
18
21
import tempfile
19
22
import html
20
23
import json
24
+ import re
21
25
22
26
encode = html .escape
23
27
@@ -270,12 +274,6 @@ def formatContainerStackMenu(stack):
270
274
html += "</ul>\n "
271
275
return html
272
276
273
- def formatContainerMetaDataOnly (container ):
274
- html = tableHeader ("Container: " + safeCall (container .getId ))
275
- html += formatContainerMetaDataRows (container )
276
- html += tableFooter ()
277
- return html
278
-
279
277
def formatContainer (container , name = "Container" , short_value_properties = False , show_keys = True ):
280
278
html = ""
281
279
html += "<a id='" + str (id (container )) + "' ></a>"
@@ -302,11 +300,11 @@ def formatContainerMetaDataRows(def_container):
302
300
# html += formatKeyValueTableRow("<id>", def_container, extra_class="metadata")
303
301
html += formatKeyValueTableRow ("id" , safeCall (def_container .getId ), extra_class = "metadata" )
304
302
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")
307
305
html += formatKeyValueTableRow ("read only" , safeCall (def_container .isReadOnly ), extra_class = "metadata" )
308
306
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")
310
308
except :
311
309
pass
312
310
@@ -323,9 +321,20 @@ def formatSettingValue(container, key, properties=None):
323
321
for prop_name in properties :
324
322
prop_value = container .getProperty (key , prop_name )
325
323
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 "
329
338
value += "</ul>\n "
330
339
331
340
return RawHtml (value )
@@ -370,16 +379,21 @@ def formatKeyValueTableRow(key, value, extra_class=""):
370
379
371
380
def formatSettingsKeyTableRow (key , value ):
372
381
clazz = ""
382
+ # Test if type Exception
373
383
if isinstance (value , Exception ):
374
384
clazz = "exception"
375
385
386
+ # Test if type RawHtml
376
387
if isinstance (value , RawHtml ):
377
388
formatted_value = value .value
389
+ Display_Key = "🔑 "
378
390
else :
379
391
formatted_value = encode (str (value ))
392
+ Display_Key = "🔧 "
380
393
381
394
formatted_key = encode (str (key ))
382
- return "<tr class='" + clazz + "' --data-key='" + formatted_key + "'><td class='key'>🔑 " + formatted_key + "</td><td class='value'>" + formatted_value + "</td></tr>\n "
395
+ # 🔑 => 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 "
383
397
384
398
def keyFilterJS ():
385
399
return """
0 commit comments