From deaf21737024a7709d8710127c6bc65a02024584 Mon Sep 17 00:00:00 2001 From: Untriex Programming Date: Wed, 17 Mar 2021 08:12:52 +0100 Subject: [PATCH] moved server to own folder --- app/WikiSpot/.idea/vcs.xml | 6 +++ engine.py => server/engine.py | 0 {files => server/files}/test.jpg | Bin {files => server/files}/test.txt | 0 {files => server/files}/test2.txt | 0 filesystem.json => server/filesystem.json | 2 +- log.txt => server/log.txt | 0 main.py => server/main.py | 0 settings.json => server/settings.json | 0 server/setup.py | 12 +++++ server/test.json | 47 +++++++++++++++++ server/test.py | 60 ++++++++++++++++++++++ version.json => server/version.json | 0 13 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 app/WikiSpot/.idea/vcs.xml rename engine.py => server/engine.py (100%) rename {files => server/files}/test.jpg (100%) rename {files => server/files}/test.txt (100%) rename {files => server/files}/test2.txt (100%) rename filesystem.json => server/filesystem.json (99%) rename log.txt => server/log.txt (100%) rename main.py => server/main.py (100%) rename settings.json => server/settings.json (100%) create mode 100644 server/setup.py create mode 100644 server/test.json create mode 100644 server/test.py rename version.json => server/version.json (100%) diff --git a/app/WikiSpot/.idea/vcs.xml b/app/WikiSpot/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/app/WikiSpot/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/engine.py b/server/engine.py similarity index 100% rename from engine.py rename to server/engine.py diff --git a/files/test.jpg b/server/files/test.jpg similarity index 100% rename from files/test.jpg rename to server/files/test.jpg diff --git a/files/test.txt b/server/files/test.txt similarity index 100% rename from files/test.txt rename to server/files/test.txt diff --git a/files/test2.txt b/server/files/test2.txt similarity index 100% rename from files/test2.txt rename to server/files/test2.txt diff --git a/filesystem.json b/server/filesystem.json similarity index 99% rename from filesystem.json rename to server/filesystem.json index bfb59b2..2031326 100644 --- a/filesystem.json +++ b/server/filesystem.json @@ -19,4 +19,4 @@ "description": "toto je txt test file" } ] -} \ No newline at end of file +} diff --git a/log.txt b/server/log.txt similarity index 100% rename from log.txt rename to server/log.txt diff --git a/main.py b/server/main.py similarity index 100% rename from main.py rename to server/main.py diff --git a/settings.json b/server/settings.json similarity index 100% rename from settings.json rename to server/settings.json diff --git a/server/setup.py b/server/setup.py new file mode 100644 index 0000000..88d6fa2 --- /dev/null +++ b/server/setup.py @@ -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() \ No newline at end of file diff --git a/server/test.json b/server/test.json new file mode 100644 index 0000000..ea7f657 --- /dev/null +++ b/server/test.json @@ -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" + } + ] + } +} \ No newline at end of file diff --git a/server/test.py b/server/test.py new file mode 100644 index 0000000..81785ff --- /dev/null +++ b/server/test.py @@ -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) \ No newline at end of file diff --git a/version.json b/server/version.json similarity index 100% rename from version.json rename to server/version.json