moved server to own folder

This commit is contained in:
Untriex Programming 2021-03-17 08:12:52 +01:00
parent f53ed7653f
commit deaf217370
13 changed files with 126 additions and 1 deletions

@ -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

@ -19,4 +19,4 @@
"description": "toto je txt test file" "description": "toto je txt test file"
} }
] ]
} }

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)