File tree Expand file tree Collapse file tree 12 files changed +137
-8
lines changed Expand file tree Collapse file tree 12 files changed +137
-8
lines changed Original file line number Diff line number Diff line change
1
+ dist /*
2
+ ltk.egg-info /*
3
+ pyscript_ltk.egg-info /*
Original file line number Diff line number Diff line change @@ -112,3 +112,30 @@ LTK is covered under the Apache License:
112
112
- The license does not require derived works to adopt the Apache license . Though this is encouraged for consistency.
113
113
114
114
115
+
116
+ # # Upload new version to PyPi
117
+
118
+ First build the package into a source distribution and a Python wheel:
119
+ ```console
120
+ python3 - m pip install -- user -- upgrade setuptools wheel twine build
121
+ python3 - m build
122
+ ```
123
+
124
+ Then verify whether the build works for pypi:
125
+ ```console
126
+ twine check dist/*
127
+ ```
128
+
129
+ Then upload to the pypi test environment:
130
+ ```console
131
+ twine upload -- repository pypitest dist/*
132
+ ```
133
+
134
+ Finally, if the pypi test upload appears to work fine, run:
135
+ ```console
136
+ twine upload dist/*
137
+ ```
138
+
139
+ # License
140
+
141
+ _Microlog_ is released under version 1 of the [Server Side Public License (SSPL )](LICENSE ).
Original file line number Diff line number Diff line change
1
+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2
+
1
3
from examples import custom
2
4
from examples import table
3
5
from examples import tictactoe
Original file line number Diff line number Diff line change
1
+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2
+
1
3
import ltk
2
4
3
5
# Create a new widget, based on VBox
Original file line number Diff line number Diff line change
1
+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2
+
1
3
import ltk
2
4
3
5
# Create an HTML table to display country temperature data
Original file line number Diff line number Diff line change
1
+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2
+
1
3
import ltk
2
4
3
5
# Tic Tac Toe Game
@@ -55,4 +57,6 @@ def create():
55
57
for row in range (3 )
56
58
),
57
59
ltk .H4 ("Tip: Click inside the squares." ),
58
- ).attr ("name" , "Tic Tac Toe" )
60
+ ).attr ("name" , "Tic Tac Toe" )
61
+
62
+ ltk .inject (__file__ , "tictactoe.css" )
Original file line number Diff line number Diff line change
1
+ <!-- LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE -->
2
+
1
3
<!DOCTYPE html>
2
4
< html lang ="en ">
3
5
< head >
4
6
< title > LTK</ title >
5
7
< meta charset ="UTF-8 ">
6
8
< meta name ="viewport " content ="width=device-width,initial-scale=1 ">
7
9
8
- <!-- Import PyScript CSS and JS -->
10
+ <!-- Import PyScript -->
9
11
< link rel ="stylesheet " href ="https://pyscript.net/releases/2023.11.1/core.css " />
10
12
< script defer type ="module " src ="https://pyscript.net/releases/2023.11.1/core.js "> </ script >
11
13
12
- <!-- Import LTK and jQuery -->
13
- < link rel ="stylesheet " href ="ltk/ltk.css " />
14
+ <!-- Import jQuery -->
14
15
< script src ="https://code.jquery.com/jquery-3.6.0.js "> </ script >
15
16
< script src ="https://code.jquery.com/ui/1.13.2/jquery-ui.js "> </ script >
16
17
< link rel ="stylesheet " href ="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css ">
17
-
18
- <!-- Import custom CSS for our examples -->
19
- < link rel ="stylesheet " href ="examples/tictactoe.css " />
20
18
</ head >
21
19
< body >
22
20
< h1 > The PyScript LTK Kitchen Sink</ h1 >
@@ -28,8 +26,11 @@ <h1>The PyScript LTK Kitchen Sink</h1>
28
26
"ltk/__init__.py",
29
27
"ltk/jquery.py",
30
28
"ltk/widgets.py",
29
+ "ltk/ltk.js",
30
+ "ltk/ltk.css",
31
31
"examples/__init__.py",
32
32
"examples/tictactoe.py",
33
+ "examples/tictactoe.css",
33
34
"examples/custom.py",
34
35
"examples/table.py",
35
36
]
Original file line number Diff line number Diff line change
1
+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2
+
1
3
from ltk .jquery import find
2
4
from ltk .jquery import create
3
5
from ltk .jquery import find_list
14
16
from ltk .jquery import set_url_parameter
15
17
from ltk .jquery import push_state
16
18
from ltk .jquery import to_js
19
+ from ltk .jquery import inject
17
20
18
21
19
22
from ltk .jquery import jQuery
20
23
from ltk .jquery import console
21
24
from ltk .jquery import window
22
25
from ltk .jquery import document
23
26
from ltk .jquery import body
27
+ from ltk .jquery import head
24
28
from ltk .jquery import parse_int
25
29
from ltk .jquery import parse_float
26
30
from ltk .jquery import local_storage
52
56
from ltk .widgets import H2
53
57
from ltk .widgets import H3
54
58
from ltk .widgets import H4
59
+
60
+ inject (__file__ , "ltk.js" , "ltk.css" )
Original file line number Diff line number Diff line change
1
+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2
+
1
3
import js # type: ignore
2
4
import json
5
+ import os
3
6
import pyodide # type: ignore
4
7
import traceback
5
8
9
+
6
10
timers = {}
7
11
8
12
jQuery = js .jQuery
9
13
console = js .console
10
14
window = jQuery (js .window )
11
15
document = jQuery (js .document )
16
+ head = jQuery ("head" )
12
17
body = jQuery ("body" )
13
18
parse_int = js .parseInt
14
19
parse_float = js .parseFloat
@@ -81,3 +86,15 @@ def set_url_parameter(key, value):
81
86
82
87
def push_state (url ):
83
88
js .history .pushState (None , "" , url )
89
+
90
+ def inject (modulepath , * files ):
91
+ types = {
92
+ ".js" : "<script>" ,
93
+ ".css" : "<style>" ,
94
+ }
95
+ for file in files :
96
+ _ , extension = os .path .splitext (file )
97
+ tag = types [extension ]
98
+ path = os .path .join (os .path .dirname (modulepath ), file )
99
+ create (tag ).text (open (path ).read ()).appendTo (head )
100
+ print ("injected" , tag , path )
Original file line number Diff line number Diff line change
1
+ /* LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE */
2
+
1
3
.ltk-vbox {
2
4
display : flex;
3
5
flex-direction : column;
You can’t perform that action at this time.
0 commit comments