Merge branch 'Development' of https://github.com/Tucan444/Mabasej_Team into Development

This commit is contained in:
JustSteel 2021-03-17 08:32:00 +01:00
commit 219d3e250b
14 changed files with 137 additions and 4 deletions

@ -5,8 +5,16 @@ We are working on system, that will help tourists in cities to get information a
- work in progress (but probabbly we will use rpi with external antena for wifi)
# Software
- python 3.9 based server with basic web interface
- python 3.9.2 compatible server with basic web interface
- python 3.x based mobile app with help of android studio
# Known issues
- no code writen (needs to be fixed app does not work because of it)
# Server
To run server you need to install
- hypercorn - "pip install hypercorn"
- fastapi - "pip install fastapi"
- requests - "pip install requests"
then run by command - "hypercorn main:app --bind <IP:port>"
To connect to another rpi you need to edit settings.json with different ID and fill heartbeat table.
This is not finished product

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

Before

Width:  |  Height:  |  Size: 354 KiB

After

Width:  |  Height:  |  Size: 354 KiB

12
server/setup.py Normal file

@ -0,0 +1,12 @@
import tkinter
import json
height = 750
width = 1200
with open("settings.json", "r") as file:
settings = json.load(file)
with open("settings.json", "r") as file:
filesystem = json.load(file)
canvas = tkinter.Canvas(height=height, width=width)
canvas.pack()
canvas.mainloop()

47
server/test.json Normal file

@ -0,0 +1,47 @@
{
"connected_id": 1,
"1": {
"ID": 1,
"location": "GPS",
"descrpition": {
"title": "nazov rpi ako nazov",
"description_s": "krátky popis, ktorý bude zobrazený iba v náhladovom okne",
"description_l": "dlhší popis zariadenia, ktorý bude zobrazený po otvorení",
"photo_s": "mala_fotka.png",
"photo_b": "velka_fotka.png"
},
"files": [
{
"name": "prehliadky",
"format": ".pdf",
"description": "tento súbor obsahuje prehliadky"
}, {
"name": "prehliadky",
"format": ".pdf",
"description": "tento súbor obsahuje prehliadky"
}
]
},
"2": {
"ID": 2,
"location": "GPS",
"descrpition": {
"title": "nazov rpi ako nazov",
"description_s": "krátky popis, ktorý bude zobrazený iba v náhladovom okne",
"description_l": "dlhší popis zariadenia, ktorý bude zobrazený po otvorení",
"photo_s": "mala_fotka.png",
"photo_b": "velka fotka.png"
},
"files": [
{
"name": "prehliadky",
"format": ".pdf",
"description": "tento súbor obsahuje prehliadky"
}, {
"name": "prehliadky",
"format": ".pdf",
"description": "tento súbor obsahuje prehliadky"
}
]
}
}

60
server/test.py Normal file

@ -0,0 +1,60 @@
import curses
menu = ['Home', 'Play', 'Scoreboard', 'Exit']
def print_menu(stdscr, selected_row_idx):
stdscr.clear()
h, w = stdscr.getmaxyx()
for idx, row in enumerate(menu):
x = w//2 - len(row)//2
y = h//2 - len(menu)//2 + idx
if idx == selected_row_idx:
stdscr.attron(curses.color_pair(1))
stdscr.addstr(y, x, row)
stdscr.attroff(curses.color_pair(1))
else:
stdscr.addstr(y, x, row)
stdscr.refresh()
def print_center(stdscr, text):
stdscr.clear()
h, w = stdscr.getmaxyx()
x = w//2 - len(text)//2
y = h//2
stdscr.addstr(y, x, text)
stdscr.refresh()
def main(stdscr):
# turn off cursor blinking
curses.curs_set(0)
# color scheme for selected row
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
# specify the current selected row
current_row = 0
# print the menu
print_menu(stdscr, current_row)
while 1:
key = stdscr.getch()
if key == curses.KEY_UP and current_row > 0:
current_row -= 1
elif key == curses.KEY_DOWN and current_row < len(menu)-1:
current_row += 1
elif key == curses.KEY_ENTER or key in [10, 13]:
print_center(stdscr, "You selected '{}'".format(menu[current_row]))
stdscr.getch()
# if user selected last row, exit the program
if current_row == len(menu)-1:
break
print_menu(stdscr, current_row)
curses.wrapper(main)