8000 Merge pull request #37 from anaconda/quickfix/move_code_out_pylist · robinboot/pyscript@8c8b641 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c8b641

Browse files
authored
Merge pull request pyscript#37 from anaconda/quickfix/move_code_out_pylist
move code from pylist.py to the example directly
2 parents 0b5004f + 08aadbe commit 8c8b641

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

pyscriptjs/examples/pylist.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,3 @@ def on_click(self, evt=None):
99

1010
class PyList(PyListTemplate):
1111
item_class = PyItem
12-
13-
def add_task(*ags, **kws):
14-
# create a new dictionary representing the new task
15-
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
16-
17-
# add a new task to the list and tell it to use the `content` key to show in the UI
18-
# and to use the key `done` to sync the task status with a checkbox element in the UI
19-
myList.add(task, labels=['content'], state_key="done")
20-
21-
# clear the inputbox element used to create the new task
22-
new_task_content.clear()

pyscriptjs/examples/todo-pylist.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
- /utils.py
1515
</py-env>
1616
<py-register-widget src="/pylist.py" name="py-list" klass="PyList"></py-register-widget>
17+
18+
<py-script>
19+
def add_task(*ags, **kws):
20+
# create a new dictionary representing the new task
21+
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
22+
23+
# add a new task to the list and tell it to use the `content` key to show in the UI
24+
# and to use the key `done` to sync the task status with a checkbox element in the UI
25+
myList.add(task, labels=['content'], state_key="done")
26+
27+
# clear the inputbox element used to create the new task
28+
new_task_content.clear()
29+
30+
</py-script>
1731
</head>
1832

1933
<body>

0 commit comments

Comments
 (0)
0