Skip to content

Commit b14458d

Browse files
committed
fix: add missing py file
1 parent 4a2f9c5 commit b14458d

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ build
2828
dist
2929
*egg-info
3030
*pyc
31+
.ipynb_checkpoints

examples/demo.ipynb

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "51f43547-eb09-4690-9418-a7b9855fd87d",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from demo import ExampleApp\n",
11+
"\n",
12+
"app = ExampleApp()"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"id": "aca1b17b-adad-49da-b3ee-a4aa5b58401e",
19+
"metadata": {},
20+
"outputs": [
21+
{
22+
"data": {
23+
"text/html": [
24+
"<iframe id=\"trame_trame__template_main\" src=\"http://localhost:62063/index.html?ui=main&reconnect=auto\" style=\"border: none; width: 100%; height: 600px;\"></iframe>"
25+
]
26+
},
27+
"metadata": {},
28+
"output_type": "display_data"
29+
}
30+
],
31+
"source": [
32+
"app"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": null,
38+
"id": "ac89e148-00ae-4156-b4be-8f2982ce3edc",
39+
"metadata": {},
40+
"outputs": [],
41+
"source": []
42+
}
43+
],
44+
"metadata": {
45+
"kernelspec": {
46+
"display_name": "Python 3 (ipykernel)",
47+
"language": "python",
48+
"name": "python3"
49+
},
50+
"language_info": {
51+
"codemirror_mode": {
52+
"name": "ipython",
53+
"version": 3
54+
},
55+
"file_extension": ".py",
56+
"mimetype": "text/x-python",
57+
"name": "python",
58+
"nbconvert_exporter": "python",
59+
"pygments_lexer": "ipython3",
60+
"version": "3.10.15"
61+
}
62+
},
63+
"nbformat": 4,
64+
"nbformat_minor": 5
65+
}

examples/demo.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from trame.app import TrameApp
2+
3+
from trame.widgets import html, image_tools
4+
from trame.ui.html import DivLayout
5+
6+
7+
class ExampleApp(TrameApp):
8+
def __init__(self, server=None):
9+
super().__init__(server)
10+
self._build_ui()
11+
12+
def _build_ui(self):
13+
with DivLayout(self.server) as self.ui:
14+
self.ui.root.style = "position: absolute; top:0;left:0;width: 100vw; height: 100vh; background-color: gray;"
15+
16+
image_tools.TrameImage(
17+
src="https://www.kitware.com/main/wp-content/uploads/2023/10/logo-trame.png",
18+
size=("[800, 210]",),
19+
v_model_scale=("scale", 0.2),
20+
v_model_center=("center", [0.5, 0.5]),
21+
)
22+
23+
html.Button(
24+
"Reset Camera",
25+
style="position: absolute; left: 1rem; top: 1rem;color: white",
26+
click="scale = 0.9; center = [0.5, 0.5];",
27+
)
28+
29+
30+
def main():
31+
app = ExampleApp()
32+
app.server.start()
33+
34+
35+
if __name__ == "__main__":
36+
main()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ include = ["trame.modules", "trame.widgets", "trame_image_tools"]
4444

4545
[tool.setuptools.package-data]
4646
trame_image_tools = [
47+
"**/*.py",
4748
"**/*.js",
4849
"**/*.css",
4950
]

trame_image_tools/widgets.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
from trame_image_tools import module
44

5-
__all__ = ["TrameImage", "TrameImageRoi"]
5+
__all__ = [
6+
"TrameImage",
7+
"TrameImageRoi",
8+
"TrameImageLine",
9+
"TrameImageCircle",
10+
"TrameImagePolygon",
11+
"TrameImageGrid",
12+
]
613

714

815
class HtmlElement(AbstractElement):
@@ -60,7 +67,7 @@ def __init__(
6067
"center",
6168
"scale",
6269
]
63-
self._attributes["slot"] = f'v-slot="{{ { ", ".join(slot_props) } }}"'
70+
self._attributes["slot"] = f'v-slot="{{ {", ".join(slot_props)} }}"'
6471

6572

6673
class TrameImageInnerWidget(HtmlElement):

0 commit comments

Comments
 (0)