test list files

workspace
km0 3 years ago
parent 96c4d9544f
commit c994ccfe6c

@ -1,104 +1,82 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang=eng> <html lang="eng">
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title>Ingredients</title> <title>Ingredients</title>
<style> <style>
.header {
.header { padding: 10px 16px;
padding: 10px 16px; color: black;
color: black; }
}
h1 {
h1 { font-family: "Coconat";
font-family: "Coconat"; font-size: 80px;
font-size: 80px; }
}
h2 {
h2 { font-family: "Coconat";
font-family: "Coconat"; }
}
body {
body { height: 100%;
height: 100%; margin: 0;
margin: 0; background-repeat: no-repeat;
background-repeat: no-repeat; background-attachment: fixed;
background-attachment: fixed; background-color: black;
background-color: black; background-image: linear-gradient(0deg, black, white);
background-image: linear-gradient(0deg, black, white); }
}
p {
p { font-family: "Montserrat Alternates";
font-family: "Montserrat Alternates"; }
}
* {
* { box-sizing: border-box;
box-sizing: border-box; }
}
.column {
.column { float: left;
float: left; padding: 45px;
padding: 45px; height: 200px;
height: 200px; }
}
.left {
.left { width: 60%;
width: 60%; }
}
.right {
.right { width: 40%;
width: 40%; }
}
.row:after {
content: "";
.row:after { display: table;
content: ""; clear: both;
display: table; }
clear: both;
} .barcode {
width: 120px;
.barcode { height: 50px;
width= 120px; }
height= 50px; </style>
} </head>
</style> <body>
</head> <div class="header" id="myHeader">
<h1 align="center">THE INGREDIENTS</h1>
<body> </div>
<div class="header" id="myHeader"> % for content in contents
<h1 align="center">THE INGREDIENTS<h1> <div class="row">
</div> <div class="column left">
<h2>${content.title} ${content.barcode}</h2>
<div class="row"> </div>
<div class="column right">
<div class="column left"> <p>☾ {content.content[:200]}...</p>
</div>
<h2> </div>
☾ POTATO [ <img src="" alt="barcode_weaver" width="120" height="50"> ] %endfor
</h2> </body>
<h2>
⚪ SWEET POTATO [ <img src="" alt="barcode_weaver" width="120" height="50"> ]
</h2>
</div>
<div class="column right">
<p>
☾ etcetera = ['et cetera', ' etc ', ' etc.', '...', '[...]', '[. ...]', 'and-so-on', 'and-so-forth', 'and others', 'et al.', 'and all the rest', 'and on and on', 'along with others, blablabla, blabla, and much more]
</p>
<p>
⚪ *My dear lovely dad that I love with all my heart
</p>
</div>
</div>
</body>
</html> </html>

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="eng">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="UTF-8" />
<title>The CookBook</title>
<style>
.header {
padding: 10px 16px;
color: black;
}
h1 {
text-align: center;
font-family: "Coconat";
font-size: 80px;
}
h2 {
font-family: "Coconat";
}
body {
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
background-color: black;
background-image: linear-gradient(0deg, black, white);
}
p {
font-family: "Montserrat Alternates";
}
* {
box-sizing: border-box;
}
.column {
float: left;
padding: 45px;
height: 200px;
}
.left {
width: 60%;
}
.right {
width: 40%;
}
.row:after {
content: "";
display: table;
clear: both;
}
.barcode {
width: 120px;
height: 50px;
}
</style>
</head>
<body>
<div class="header" id="myHeader">
<h1>THE COOKBOOK</h1>
</div>
% for function in functions
<div class="row">
<div class="column left">
<h2>
${function.title}
<img src="${function.barcode}" class="barcode" />
</h2>
</div>
<div class="column right">
<p>☻ ${function.description}</p>
</div>
</div>
% endfor
</body>
</html>

@ -1,95 +0,0 @@
<!DOCTYPE html>
<html lang=eng>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>The CookBook</title>
<style>
.header {
padding: 10px 16px;
color: black;
}
h1 {
font-family: "Coconat";
font-size: 80px;
}
h2 {
font-family: "Coconat";
}
body {
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
background-color: black;
background-image: linear-gradient(0deg, black, white);
}
p {
font-family: "Montserrat Alternates";
}
* {
box-sizing: border-box;
}
.column {
float: left;
padding: 45px;
height: 200px;
}
.left {
width: 60%;
}
.right {
width: 40%;
}
.row:after {
content: "";
display: table;
clear: both;
}
.barcode {
width= 120px;
height= 50px;
}
</style>
</head>
<body>
<div class="header" id="myHeader">
<h1 align="center">THE COOKBOOK<h1>
</div>
<div class="row">
<div class="column left">
<h2>
☻ DOUGH WEAVER [ <img src="barcode.png" alt="barcode_weaver" width="120" height="50"> ]
</h2>
</div>
<div class="column right">
<p>☻ Create a unique textual recipe with the Dough Weaver. Spice up your kitchen daydreaming with a custom recipe-mix of already existing dishes!<br>
<br>
Spice up your kitchen experience by plugging the six black and yellow cables, to A or B, in whatever order you see fit. Then once you are happy with your selection, press the button to submit your custom pattern.</p>
</div>
</div>
</div>
</body>
</html>

@ -6,6 +6,8 @@ import subprocess
import urllib import urllib
import yaml import yaml
from random import choice from random import choice
import kode256
import b64encode
from PIL import Image from PIL import Image
@ -20,6 +22,7 @@ class Soup(Bureau):
name = "Canteen of the Screenless Office" name = "Canteen of the Screenless Office"
prefix = "SB" prefix = "SB"
version = 0 version = 0
input_queue = []
def __init__(self): def __init__(self):
Bureau.__init__(self) Bureau.__init__(self)
@ -48,14 +51,28 @@ class Soup(Bureau):
@add_command('list', 'Return a list of contents') @add_command('list', 'Return a list of contents')
def list_contents(self): def list_contents(self):
files = glob.glob(os.path.join(self.mdir, 'contents', '*.txt'))
prn = self._get_small_printer() prn = self._get_small_printer()
contents = []
files = glob.glob(os.path.join(self.mdir, 'contents', '*.txt'))
for file in files: for file in files:
filename, ext = os.path.basename(file).split('.') filename, ext = os.path.basename(file).split('.')
self.print_small(filename)
prn.soft_barcode("code128", "SBtp." + filename) svg = kode256.svg("SBaq." + filename)
encoded_svg = b64encode(svg.encode()).decode()
encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg
with open(os.path.join(self.mdir, 'contents', filename + '.txt'), 'r') as f:
text = f.read()
contents.append({
"title": filename,
"barcode": encoded_data,
"content": text
})
self.print_full('files.html', contents=contents)
@add_command('tp', 'Print a short excerpt of a text') @add_command('tp', 'Print a short excerpt of a text')
def print_preview(self, data): def print_preview(self, data):
@ -66,6 +83,19 @@ class Soup(Bureau):
self.print_small(filename + '\n' + text[:200] + '...') self.print_small(filename + '\n' + text[:200] + '...')
@add_command('aq', 'Add a text to the queue')
def add_to_queue(self, data):
filename, _ = data.split(".")
self.input_queue.append(filename)
@add_command('cq', 'clear inputs in the queue')
def clear_q(self):
self.input_queue = []
self.print_small("queue cleared!")
# @add_command('fx', 'execute the chosen function')
# def ex_function
def main(): def main():
sb = Soup() sb = Soup()

Loading…
Cancel
Save