Skip to content

Commit 26e1631

Browse files
committed
Add leader-line so that Tutorial works by default
1 parent 418eb4b commit 26e1631

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/python/python.min.js"></script>
5555
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css" >
5656

57+
<!-- Import for drawing arrows -->
58+
<script defer src="leader-line.min.js"></script>
59+
5760
<!-- Import Styles for the kitchensink demo -->
5861
<link rel="stylesheet" href="kitchensink.css">
5962
</head>

kitchensink.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ def activate_tab(event, ui=None):
6161

6262
def load():
6363
logger.info("Kitchensink Ready")
64+

leader-line.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ltk/ltk.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,22 @@
124124
}
125125
};
126126

127+
window.addArrow = (from, to, label) => {
128+
try {
129+
const start = from[0];
130+
const end = to[0];
131+
if (start && end) {
132+
return $(new LeaderLine(start, end, {
133+
dash: { },
134+
size: 3,
135+
middleLabel: LeaderLine.pathLabel(label || "")
136+
})).appendTo($("body"));
137+
}
138+
} catch(e) {
139+
// ignore
140+
}
141+
}
142+
127143
$.fn.isInViewport = function() {
128144
const offset = $(this).offset();
129145
if (!offset) return true

ltk/widgets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,7 @@ def show(self):
14671467
self.appendTo(find("body"))
14681468
self.css(to_js({
14691469
"visibility": "visible",
1470+
"position": "absolute",
14701471
"opacity": 1,
14711472
"left": self.widget.offset().left + self.widget.outerWidth() + 100,
14721473
"top": self.widget.offset().top,

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.18"
9+
version = "0.2.19"
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)