Compare commits

..

10 Commits

Author SHA1 Message Date
dttric
609c21245f + примерная реализация "получения рецепта" через POST
+ реформат таблицы для демо потому что удобно (я копировать буду👿👿)
2024-04-30 21:56:33 +07:00
dttric
d7296528b2 Просто сделай 2 вкладки под это. 2024-04-30 20:52:52 +07:00
dttric
398796e892 justuser — Сегодня, в 20:45
Рецепт составляющего не нужен, много мороки будет.
2024-04-30 20:49:03 +07:00
dttric
21a77c1372 Совмещение изменений. 2024-04-30 20:44:53 +07:00
dttric
ad8819dbd7 + demo.html
# показывает примерный вид сайта
2024-04-30 20:44:31 +07:00
justuser31
0afa599408 Пробелы на табы, мелкие поправки. 2024-04-30 16:09:46 +03:00
dttric
ed661f01f1 - дропдауны
+ радиальные кнопки для количества
+ <select /> для реакций
2024-04-30 20:01:03 +07:00
wadehusky
bdc90b42d0 Добавление функции load_recipe() в parse.py
Добавление функции get_all() для класса reag__
2024-04-30 15:34:26 +03:00
wadehusky
fb9254844e Merge remote-tracking branch 'origin/main' 2024-04-30 15:31:13 +03:00
wadehusky
e5c7c65816 Добавление функции load_recipe() в parse.py
Добавление функции get_all() для класса reag__
2024-04-30 15:29:00 +03:00
6 changed files with 140 additions and 26 deletions

BIN
reworked/assets/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

88
reworked/demo.html Normal file
View File

@ -0,0 +1,88 @@
<!doctype html>
<html lang="ru" data-bs-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SS14Tools</title>
<link rel="icon" type="image/x-icon" href="./assets/favicon.ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head>
<body>
<style>
.mx-10 {
margin-left: 10rem;
margin-right: 10rem;
}
.gxr-- {
margin-right: 18rem;
}
.gxl-- {
margin-left: 18rem;
}
</style>
<nav class="navbar bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="#"><i class="bi bi-tools"></i> SS14Tools</a>
<div class="btn-group" role="group" aria-label="Простой пример">
<button type="button" class="btn btn-primary"><i class="bi bi-discord"></i></button>
<button type="button" class="btn btn-primary"><i class="bi bi-telegram"></i></button>
<button type="button" class="btn btn-primary"><i class="bi bi-github"></i></button>
</div>
</div>
</nav>
<center>
<div class="container">
<div class="row py-5">
<div class="col-xl-9">
<select class="form-select" aria-label="Реакция">
<option selected><p class="gx-5">💊 Дермалин</p></option>
</select>
</div>
<div class="container-fluid col">
<div class="btn-group" role="group" aria-label="Базовая группа переключателей радио">
<input type="radio" class="btn-check" name="btnradio" id="30" autocomplete="off">
<label class="btn btn-outline-primary" for="30">30</label>
<input type="radio" class="btn-check" name="btnradio" id="50" autocomplete="off">
<label class="btn btn-outline-primary" for="50">50</label>
<input type="radio" class="btn-check" name="btnradio" id="100" autocomplete="off" checked>
<label class="btn btn-outline-primary" for="100">100</label>
<input type="radio" class="btn-check" name="btnradio" id="300" autocomplete="off">
<label class="btn btn-outline-primary" for="300">300</label>
<input type="radio" class="btn-check" name="btnradio" id="1000" autocomplete="off">
<label class="btn btn-outline-primary" for="1000">1000</label>
</div>
</div>
</div>
<div class="row">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Рецепт</a>
</li>
<li class="nav-item">
<a class="nav-link disabled">Эффекты и дебафы</a>
</li>
</ul>
<table class="table">
<thead>
<tr>
<th scope="col">Составляющее</th>
<th scope="col">Количество</th>
</tr>
</thead>
<tbody>
<tr><td>Кислород</td><td>100</td></tr>
<tr><td>Фосфор</td><td>100</td></tr>
<tr><td>Келотан</td><td>100</td></tr>
</tbody>
</table>
</div>
</div>
</center>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
</body>
</html>

View File

@ -1,5 +1,6 @@
from requests import get from requests import get
from yaml import load, SafeLoader from yaml import load, SafeLoader
from reag__ import reag__
def parse_yml(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions/medicine.yml'): def parse_yml(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions/medicine.yml'):
yml = load(get(url).content.decode('utf-8'), Loader=SafeLoader) yml = load(get(url).content.decode('utf-8'), Loader=SafeLoader)
@ -15,3 +16,16 @@ def parse_ftl(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-st
locale = splitted[2] locale = splitted[2]
locales[name] = locale locales[name] = locale
return locales return locales
def load_recipes(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions/medicine.yml', category = '-'):
yml = parse_yml(url)
recipes = {}
for element in yml:
product = element["id"]
comps = {}
for elem in element["reactants"]:
comps[elem] = element["reactants"][elem]["amount"]
for id, value in element["products"].items():
out = value
recipes[product] = reag__(category=category, comps=comps, out=out)
return recipes

View File

@ -1,8 +1,11 @@
class reag__: class reag__:
def __init__(category = '-', comps, out): def __init__(self, category: str = '-', comps = {}, out: int = 0):
# medicine # medicine
self.category = category self.category = category
# {'инапровалин': 1, 'углерод': 1} # {'инапровалин': 1, 'углерод': 1}
self.comps = comps self.comps = comps
# 2 # 2
self.out = out self.out = out
def get_all(self):
return [self.category, self.comps, self.out]

View File

@ -1,4 +1,4 @@
from flask import Flask, render_template from flask import Flask, render_template, request
app = Flask(__name__) app = Flask(__name__)
@app.route("/") @app.route("/")
@ -7,3 +7,8 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=False, port = 5001) app.run(debug=False, port = 5001)
@app.route("/submit", methods=['POST'])
def calculate():
selectedval = request.form["getrecept"]
return f"{selectedval}"

View File

@ -4,6 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>SS14Tools</title> <title>SS14Tools</title>
<link rel="icon" type="image/x-icon" href="../assets/favicon.ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head> </head>
@ -32,31 +33,34 @@
</nav> </nav>
<center> <center>
<div class="container"> <div class="container">
<div class="row"> <div class="row py-5">
<div class="col p-5 gxl--"> <div class="col-xl-9">
<div class="dropdown"> <form action="/submit" method="post">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" py-5> <select class="form-select" name="getrecept" aria-label="Реакция">
<span class="mx-10">Реакция</span> <option selected><p class="gx-5">Выберите (бля а что мы конкретно выбираем)</p></option>
</button> <option value="1">Пример 1</option>
<ul class="dropdown-menu"> <option value="2">Пример 2</option>
<li><a class="dropdown-item" href="#">Пример 1</a></li> <option value="3">Пример 3</option>
<li><a class="dropdown-item" href="#">Пример 2</a></li> </select>
<li><a class="dropdown-item" href="#">Пример 3</a></li> <input type="submit" value="Submit">
</ul> </form>
</div> </div>
</div> <div class="container-fluid col">
<div class="col p-5 gxr--"> <div class="btn-group" role="group" aria-label="Базовая группа переключателей радио">
<div class="dropdown"> <input type="radio" class="btn-check" name="btnradio" id="30" autocomplete="off">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <label class="btn btn-outline-primary" for="30">30</label>
Сколько?
</button> <input type="radio" class="btn-check" name="btnradio" id="50" autocomplete="off">
<ul class="dropdown-menu"> <label class="btn btn-outline-primary" for="50">50</label>
<li><a class="dropdown-item" href="#">30</a></li>
<li><a class="dropdown-item" href="#">50</a></li> <input type="radio" class="btn-check" name="btnradio" id="100" autocomplete="off" checked>
<li><a class="dropdown-item" href="#">100</a></li> <label class="btn btn-outline-primary" for="100">100</label>
<li><a class="dropdown-item" href="#">300</a></li>
<li><a class="dropdown-item" href="#">1000</a></li> <input type="radio" class="btn-check" name="btnradio" id="300" autocomplete="off">
</ul> <label class="btn btn-outline-primary" for="300">300</label>
<input type="radio" class="btn-check" name="btnradio" id="1000" autocomplete="off">
<label class="btn btn-outline-primary" for="1000">1000</label>
</div> </div>
</div> </div>
</div> </div>