test list files

workspace
km0 2 years ago
parent 96c4d9544f
commit c994ccfe6c

@ -1,104 +1,82 @@
<!DOCTYPE html>
<html lang=eng>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>Ingredients</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;
}
<html lang="eng">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="UTF-8" />
<title>Ingredients</title>
<style>
.header {
padding: 10px 16px;
color: black;
}
.column {
float: left;
padding: 45px;
height: 200px;
}
h1 {
font-family: "Coconat";
font-size: 80px;
}
.left {
width: 60%;
}
h2 {
font-family: "Coconat";
}
.right {
width: 40%;
}
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";
}
.row:after {
content: "";
display: table;
clear: both;
}
.barcode {
width= 120px;
height= 50px;
}
* {
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="header" id="myHeader">
<h1 align="center">THE INGREDIENTS<h1>
</div>
.column {
float: left;
padding: 45px;
height: 200px;
}
<div class="row">
<div class="column left">
<h2>
☾ POTATO [ <img src="" alt="barcode_weaver" width="120" height="50"> ]
</h2>
<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]
.left {
width: 60%;
}
</p>
<p>
⚪ *My dear lovely dad that I love with all my heart
</p>
</div>
</div>
</body>
</html>
.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 INGREDIENTS</h1>
</div>
% for content in contents
<div class="row">
<div class="column left">
<h2>${content.title} ${content.barcode}</h2>
</div>
<div class="column right">
<p>☾ {content.content[:200]}...</p>
</div>
</div>
%endfor
</body>
</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 yaml
from random import choice
import kode256
import b64encode
from PIL import Image
@ -20,6 +22,7 @@ class Soup(Bureau):
name = "Canteen of the Screenless Office"
prefix = "SB"
version = 0
input_queue = []
def __init__(self):
Bureau.__init__(self)
@ -48,14 +51,28 @@ class Soup(Bureau):
@add_command('list', 'Return a list of contents')
def list_contents(self):
files = glob.glob(os.path.join(self.mdir, 'contents', '*.txt'))
prn = self._get_small_printer()
contents = []
files = glob.glob(os.path.join(self.mdir, 'contents', '*.txt'))
for file in files:
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')
def print_preview(self, data):
@ -66,6 +83,19 @@ class Soup(Bureau):
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():
sb = Soup()

Loading…
Cancel
Save