Skip to content

Commit c2e53cf

Browse files
committed
Improve rendering of Inspector
1 parent d41dce0 commit c2e53cf

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

ltk/ltk.css

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,32 @@
1818
position: absolute;
1919
z-index: 100000000;
2020
background-color: red;
21-
width: 2px;
22-
height: 2px;
21+
width: 3px;
22+
height: 3px;
2323
}
2424

2525
.ltk-highlight-details {
2626
display: none;
2727
position: absolute;
2828
z-index: 100000000;
29-
background-color: red;
30-
border: 1px solid white;
31-
color: white;
29+
background-color: pink;
30+
border: 3px solid red;
31+
color: black;
3232
padding: 0 8px;
3333
height: fit-content;
3434
width: fit-content;
3535
min-height: 24px;
3636
}
3737

38+
.ltk-highlight-details tt {
39+
color: black;
40+
font-weight: bold;
41+
border: 1px solid white;
42+
padding: 0 4px;
43+
}
44+
3845
.ltk-highlight-details a {
39-
color: white;
46+
color: rgb(76, 112, 255)
4047
}
4148

4249
.ltk-highlight-details ul {

ltk/widgets.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ def show(self, widget):
5959
.width(width)
6060
self.right.css("display", "block").css("left", left + width - 2).css("top", top) \
6161
.height(height)
62-
self.details.css("display", "block").css("left", left + width).css("top", top) \
62+
self.details.css("display", "block") \
6363
.html(f"""
64-
A widget of type {widget.__class__.__name__}<ul>
64+
An LTK Python widget of class <tt>{widget.__class__.__name__}</tt><ul>
6565
<li>{widget.__class__.__doc__.replace("<", "&lt;")}
6666
{self.get_attrs(widget)}
6767
<li>{self.get_creation_link(widget)}
6868
<li>{widget.children().length} children
6969
""")
70+
details_left = max(0, left - self.details.outerWidth() + 2) \
71+
if left + width > find("body").width() * 3 / 4 else left + width - 2
72+
self.details.css("left", details_left).css("top", top)
7073

7174
def hide(self):
7275
""" Hide the highlight """
@@ -98,7 +101,7 @@ def get_creation_link(self, widget):
98101
lineno = caller.f_lineno
99102
abspath = f"{home}/{filename}"
100103
url = f"vscode://file:/{abspath}:{lineno}"
101-
return f"<a href={url}>{filename}:{lineno}</a>"
104+
return f"Created at: <a href={url}>{filename}:{lineno}</a>"
102105

103106
@classmethod
104107
def get_caller(cls):

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.14"
9+
version = "0.2.15"
1010
description = "A little toolkit for writing UIs in PyScript"
1111
readme = "README.md"
1212
authors = [{ name = "Chris Laffra", email = "chris@chrislaffra.com" }]

0 commit comments

Comments
 (0)