Browse Source

sorting the xdex

master
manetta 4 years ago
parent
commit
160a9dae95
  1. 31
      start.py
  2. 157
      static/css/curves.css
  3. 44
      static/css/text-scan.css
  4. 16
      templates/test.html
  5. 2
      templates/x-dex.html

31
start.py

@ -3,23 +3,11 @@
import sys, os
import flask
from flask import request, redirect, url_for
from werkzeug.utils import secure_filename
from functions import *
from flaskext.markdown import Markdown
# Upload settings
UPLOAD_FOLDER_TRACES = 'static/traces/'
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
# Create the application.
APP = flask.Flask(__name__)
APP.config['UPLOAD_FOLDER_TRACES'] = UPLOAD_FOLDER_TRACES
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
@APP.route('/', methods=['GET', 'POST'])
def index():
@ -33,12 +21,12 @@ def index():
x = request.args.get('x', '').strip()
xdex, lastx = load_db('xdex.json')
entries = [x for x in xdex.keys()]
xs = sorted(xdex)
submit = request.args.get('submit', '').strip()
if submit:
if submit == 'add':
# if x not in xdex:
if x:
# new entry
xdex[x] = {}
@ -50,6 +38,7 @@ def index():
xdex[x]['comment'] = comment
xdex[x]['status'] = '-'
write_db('xdex.json', xdex)
xs.append(x)
else:
# editing entry
x = submit
@ -62,19 +51,7 @@ def index():
write_db('xdex.json', xdex)
return redirect(url_for('index'))
return flask.render_template('x-dex.html', xdex=xdex)
# @APP.route('/test', methods=['GET', 'POST'])
# def test():
# if request.args.get('submit', ''):
# form = request.args.get('submit', '').strip()
# text = request.args.get('text', '').strip()
# else:
# form = 'none'
# text = 'none'
# return flask.render_template('test.html', form=form, text=text)
return flask.render_template('x-dex.html', xdex=xdex, xs=xs)
if __name__ == '__main__':
APP.debug=True

157
static/css/curves.css

@ -1,157 +0,0 @@
svg {
touch-action: none;
display: block;
clear: both;
/*border:1px dotted magenta;*/
/*margin-top:-1px;*/
}
.handle {
fill: none;
pointer-events: all;
}
/* including #handles is a hack to increase specificity */
#handles .handle:hover {
/*fill: #f00;*/
fill: black;
}
svg:hover .handle {
/*fill: #800;*/
fill: black;
}
svg:hover .selected .handle {
/*fill: #fcb;*/
fill: black;
stroke: black;
}
#handles line.target {
stroke: black;
}
#handles circle.target {
fill: none;
stroke: black;
stroke-opacity: 0.15;
stroke-width: 10;
}
svg:hover #handles line.tan {
/*stroke: #00f;*/
fill: black;
stroke-width: 1;
}
svg:hover #handles .tanhandle {
/*fill: white;*/
fill: black;
/*stroke: #00f;*/
}
svg:hover #handles .tanhandle.computed {
/*fill: rgba(255, 255, 255, 0.3);*/
fill: black;
/*stroke: rgba(0, 0, 255, 0.3);*/
}
svg:hover #handles .tanhandle:hover {
/*fill: #fcb;*/
fill: black;
}
#grid line {
stroke: #ddf;
}
#nav {
position: relative;
font-size: 12px;
/* float: left; */
height: 25px;
z-index: 10;
top: 0px;
left: 0;
padding: 0;
margin: 0;
width: 100%;
user-select: none;
}
#nav li {
float: left;
position: relative;
list-style: none;
}
#nav li a {
display: block;
padding: 5px 10px;
color: #000;
text-decoration: none;
cursor: default;
}
#nav a:hover:not(.inactive) {
background: #cdf;
}
#nav li ul {
position: absolute;
display: none;
background: #fff;
box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.3);
/*float: none;*/
}
#nav li ul a {
width: 10em;
width: -moz-max-content;
width: max-content;
padding: 4px 10px;
cursor: default;
}
#nav li ul a.inactive {
color: #888;
}
#nav li:hover ul {
display: block;
left: 0;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
border-color: #000;
}
#nav li:hover ul.off {
display: none;
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(255, 255, 255, 0.3);
}
.modal-content {
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 60%;
background-color: rgba(255, 255, 255, 0.8);
}
.modal-content pre {
white-space: pre-wrap;
}
.modal-content textarea {
width: 100%;
}
.modal-content button {
font-size: 14px;
}
.close {
float: right;
font-size: 28px;
user-select: none;
}
.close:hover, .close.focus {
cursor: pointer;
}
.invisible {
opacity: 0;
}

44
static/css/text-scan.css

@ -1,44 +0,0 @@
/* --------- */
/* text-scan */
#wrapper{
width: calc(100% - 0em);
}
div#crossings, div#sentences, div#ADJ, div#PRE{
position: relative;
display: inline-block;
width: calc(50% - 1.5em);
top:0;
left: 0;
margin:0 1em 2em 0;
padding:0;
vertical-align: top;
font-size: 90%;
}
div#crossings{
float: right;
}
div#txtfiles{
position: absolute;
width:200px;
top:0;
right: 40px;
}
div.sentence{
margin:-0.5em 0 0;
}
strong.query{
display: inline;
width: 100%;
height: 12em;
margin:10em -6em -10.5em -6em;
padding: 10em 6em;
text-align: center;
}
small, sup{
font-family: monospace;
font-size: 10pt;
}
div.sentence small{
display: block;
margin-bottom: 5em;
}

16
templates/test.html

@ -1,16 +0,0 @@
{% extends "base.html" %}
{% block page %}
<h1>test</h1>
<form>
<textarea name="text"></textarea><br>
<input type="submit" name="submit" value="add">
</form>
<br>
<form>
<textarea name="text"></textarea><br>
<input type="submit" name="submit" value="update">
</form>
<hr>
<strong>{{ form }}</strong>: {{ text }}
{% endblock %}

2
templates/x-dex.html

@ -22,7 +22,7 @@
<th>update</th>
</thead>
<tbody>
{% for x in xdex.keys() %}
{% for x in xs %}
<form>
<tr>
<td><input class="code" type="text" name="code" value="{{ xdex[x]['code'] }}"></td>

Loading…
Cancel
Save