Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Chris
Pixelframe
Commits
9bdc9105
Commit
9bdc9105
authored
Dec 22, 2020
by
Christian Wander
Browse files
adding a web frontend
parent
a219b691
Changes
4
Hide whitespace changes
Inline
Side-by-side
pixelframe/controllers.py
View file @
9bdc9105
...
...
@@ -5,6 +5,7 @@ import pixelframe.pixel_service as pixel_service
@
app
.
route
(
'/'
)
def
main_page
():
return
render_template
(
'main.html'
)
return
"This is the main page"
...
...
@@ -12,12 +13,12 @@ def main_page():
def
hello_method
():
return
render_template
(
'hello.html'
,
name
=
"foo"
)
@
app
.
route
(
'/start'
)
@
app
.
route
(
'/start'
,
methods
=
[
"POST"
]
)
def
start_pixels
():
pixel_service
.
doit
()
return
"Started work."
@
app
.
route
(
'/stop'
)
@
app
.
route
(
'/stop'
,
methods
=
[
"POST"
]
)
def
stop_pixels
():
pixel_service
.
stopit
()
return
"Stopped work"
pixelframe/static/main.css
0 → 100644
View file @
9bdc9105
body
{
background-color
:
black
;
color
:
coral
;
font-family
:
'Courier New'
,
Courier
,
monospace
;
}
h1
{
color
:
pink
;
}
\ No newline at end of file
pixelframe/static/main.js
0 → 100644
View file @
9bdc9105
console
.
log
(
"
hello
"
)
document
.
getElementById
(
"
buttonOne
"
).
onclick
=
function
()
{
console
.
log
(
"
button one clicked
"
)
fetch
(
'
start
'
,
{
method
:
'
POST
'
})
.
then
(
r
=>
{
console
.
log
(
`Status:
${
r
.
status
}
, text:
${
r
.
statusText
}
`
)
})
}
document
.
getElementById
(
"
buttonTwo
"
).
onclick
=
function
()
{
console
.
log
(
"
button two clicked
"
)
fetch
(
'
stop
'
,
{
method
:
'
POST
'
})
.
then
(
r
=>
{
console
.
log
(
`Status:
${
r
.
status
}
, text:
${
r
.
statusText
}
`
)
})
}
\ No newline at end of file
pixelframe/templates/main.html
0 → 100644
View file @
9bdc9105
<!doctype html>
<html>
<head>
<link
rel=
"stylesheet"
href=
"static/main.css"
/>
</head>
<body>
<title>
Pixelframe
</title>
<h1>
Pixelframe
</h1>
<p>
This is some text and even more text
</p>
{% if name %}
<p>
Hello {{ name }}!
</p>
{% else %}
<p>
Hello, World!
</p>
{% endif %}
<button
type=
"button"
id=
"buttonOne"
>
Start
</button>
<button
type=
"button"
id=
"buttonTwo"
>
Stop
</button>
<script
src=
"static/main.js"
></script>
</body>
</html>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment