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:
112112 - The license does not require derived works to adopt the Apache license . Though this is encouraged for consistency.
113113
114114
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+
13from examples import custom
24from examples import table
35from examples import tictactoe
Original file line number Diff line number Diff line change 1+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13import ltk
24
35# 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+
13import ltk
24
35# 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+
13import ltk
24
35# Tic Tac Toe Game
@@ -55,4 +57,6 @@ def create():
5557 for row in range (3 )
5658 ),
5759 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+
13<!DOCTYPE html>
24< html lang ="en ">
35< head >
46 < title > LTK</ title >
57 < meta charset ="UTF-8 ">
68 < meta name ="viewport " content ="width=device-width,initial-scale=1 ">
79
8- <!-- Import PyScript CSS and JS -->
10+ <!-- Import PyScript -->
911 < link rel ="stylesheet " href ="https://pyscript.net/releases/2023.11.1/core.css " />
1012 < script defer type ="module " src ="https://pyscript.net/releases/2023.11.1/core.js "> </ script >
1113
12- <!-- Import LTK and jQuery -->
13- < link rel ="stylesheet " href ="ltk/ltk.css " />
14+ <!-- Import jQuery -->
1415 < script src ="https://code.jquery.com/jquery-3.6.0.js "> </ script >
1516 < script src ="https://code.jquery.com/ui/1.13.2/jquery-ui.js "> </ script >
1617 < 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 " />
2018</ head >
2119< body >
2220 < h1 > The PyScript LTK Kitchen Sink</ h1 >
@@ -28,8 +26,11 @@ <h1>The PyScript LTK Kitchen Sink</h1>
2826 "ltk/__init__.py",
2927 "ltk/jquery.py",
3028 "ltk/widgets.py",
29+ "ltk/ltk.js",
30+ "ltk/ltk.css",
3131 "examples/__init__.py",
3232 "examples/tictactoe.py",
33+ "examples/tictactoe.css",
3334 "examples/custom.py",
3435 "examples/table.py",
3536 ]
Original file line number Diff line number Diff line change 1+ # LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13from ltk .jquery import find
24from ltk .jquery import create
35from ltk .jquery import find_list
1416from ltk .jquery import set_url_parameter
1517from ltk .jquery import push_state
1618from ltk .jquery import to_js
19+ from ltk .jquery import inject
1720
1821
1922from ltk .jquery import jQuery
2023from ltk .jquery import console
2124from ltk .jquery import window
2225from ltk .jquery import document
2326from ltk .jquery import body
27+ from ltk .jquery import head
2428from ltk .jquery import parse_int
2529from ltk .jquery import parse_float
2630from ltk .jquery import local_storage
5256from ltk .widgets import H2
5357from ltk .widgets import H3
5458from 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+
13import js # type: ignore
24import json
5+ import os
36import pyodide # type: ignore
47import traceback
58
9+
610timers = {}
711
812jQuery = js .jQuery
913console = js .console
1014window = jQuery (js .window )
1115document = jQuery (js .document )
16+ head = jQuery ("head" )
1217body = jQuery ("body" )
1318parse_int = js .parseInt
1419parse_float = js .parseFloat
@@ -81,3 +86,15 @@ def set_url_parameter(key, value):
8186
8287def push_state (url ):
8388 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+
13.ltk-vbox {
24 display : flex;
35 flex-direction : column;
You can’t perform that action at this time.
0 commit comments