Skip to content

Commit 0fdf086

Browse files
committed
Remove css from inspector
1 parent 29136f4 commit 0fdf086

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

ltk/ltk.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,7 @@
153153
window.getWidget = function(id) {
154154
return undefined;
155155
};
156-
157-
window.getStyle = function(node) {
158-
const result = {};
159-
const div = $(`<${node[0].tagName}>`).appendTo("body");
160-
const default_styles = window.getComputedStyle(div[0])
161-
const widget_styles = window.getComputedStyle(node[0])
162-
for (let prop in widget_styles) {
163-
if (widget_styles[prop] !== default_styles[prop]) {
164-
result[prop] = widget_styles[prop];
165-
}
166-
}
167-
return result;
168-
}
156+
169157

170158
$.fn.widget = function() {
171159
return window.getWidget($(this))

ltk/widgets.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def show(self, widget):
6565
<li>{widget.__class__.__doc__.replace("<", "&lt;")}
6666
{self.get_attrs(widget)}
6767
{self.get_classes(widget)}
68+
<li>id = {widget.attr("id")}
6869
<li>{self.get_creation_link(widget)}
6970
<li>{widget.children().length} children
70-
{self.get_css(widget)}
7171
""")
7272
details_left = max(0, left - self.details.outerWidth() + 2) \
7373
if left + width > find("body").width() * 3 / 4 else left + width - 2
@@ -81,19 +81,9 @@ def hide(self):
8181
self.right.css("display", "none")
8282
self.details.css("display", "none")
8383

84-
def get_css(self, widget):
85-
""" Show the CSS of a widget """
86-
js_styles = window.getStyle(widget.element)
87-
return "<li> css:<pre style='font-size: 12px;'>" + window.JSON.stringify(js_styles, None, 4) + "</pre>"
88-
8984
def get_classes(self, widget):
9085
""" Show the classes of a widget """
91-
result = []
92-
for name, value in widget.__class__.__dict__.items():
93-
if name.startswith("_") or name in INSPECT_IGNORE_ATTRIBUTES:
94-
continue
95-
result.append(f"{name} = {value}")
96-
return ("<li>" if result else "") + "<li>".join(result)
86+
return f"<li>classes = [{', '.join(widget.element[0].classList.toString().split())}]<//li>"
9787

9888
def get_attrs(self, widget):
9989
""" Show the attributes of a widget """

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "pyscript-ltk"
9-
version = "0.2.22"
9+
version = "0.2.23"
1010
description = "A little toolkit for writing UIs in PyScript"
1111
readme = "README.md"
1212
authors = [{ name = "Chris Laffra", email = "[email protected]" }]

0 commit comments

Comments
 (0)