def show_requests(cls):
     admins = read_data_from_admins_database()
     r_box = admins['admins_inf']['requests_box']
     while len(r_box) > 0:
         os.system('clear')
         index = RefRequest.get_input_all_reqs_or_get_single_req()
         # print(index)
         try:
             RefRequest.browsing_single_request(index)
             continue
         except TypeError:
             break
     print("No requests!\n")
     inp = input("Press Enter to go back.\n")
     FuncNode.current_node()
示例#2
0
from structures.func_Node import FuncNode
from Games.coin_flip.coin_flipGame.coin_flipGame_script import CoinF
from structures.game_class import Game


def func():
    game = CoinF()

    def inner():
        Game.start_game(game)

    return inner()


coin_flipFuncNode = FuncNode("Play", func)
示例#3
0
from structures.func_Node import FuncNode
from structures.Refill_Requests import RefRequest

func = RefRequest.show_requests

refillRequests_FuncNode = FuncNode("Show requests", func=func)
import json_data_funcs
from structures.func_Node import FuncNode
from structures.game_class import Game


def return_funcTurtle():
    gamename = "Turtle Race"

    def wrapper():
        Game.display_personal_best(gamename)

    return wrapper()


func1 = return_funcTurtle
my_bestCoinFlip = FuncNode("Turtle Race", func=func1)


def return_funcCoinFlip():
    gamename = "Coin Flip"

    def wrapper():
        Game.display_personal_best(gamename)

    return wrapper()


func2 = return_funcCoinFlip
my_bestTurtleRace = FuncNode("Coin Flip", func=func2)
示例#5
0
from structures.func_Node import FuncNode
from Games.turtles_race.turtle_raceGame.turtle_race_script import TurtleRace
from structures.game_class import Game


def func():
    game = TurtleRace()

    def inner():
        Game.start_game(game)

    return inner()


TurtleRace_FuncNode = FuncNode("Play", func)
from structures.func_Node import FuncNode
from structures.game_class import Game


def return_func():
    gamename = "Coin Flip"

    def wrapper():
        Game.display_top_n(gamename)

    wrapper()
    return wrapper()


func = return_func

coinFlipBestScores = FuncNode("Coin Flip Records", func)
示例#7
0
from structures.func_Node import FuncNode
from guestMenu.Register.registerScript import RegisterScript

func = RegisterScript.register_script
RegisterMenu = FuncNode("Register", func)
RegisterMenu.parent_up = FuncNode.default_node
from structures.func_Node import FuncNode
from mainMenuForUsers.myAccount.myWallet.walletRefillRequest_script import wallet_refill


func = wallet_refill

walletRefillRequest = FuncNode("Refill wallet", func)
from structures.func_Node import FuncNode
from mainMenuForUsers.myAccount.myWallet.walletStatus_script import wallet_status

func = wallet_status

walletStatus = FuncNode("Wallet status", func)
示例#10
0
from structures.func_Node import FuncNode
from guestMenu.Login.loginScript import login_script

func = login_script
login_FuncNode = FuncNode("Log In", func)
from structures.func_Node import FuncNode
from adminMenu.list_of_users.list_of_users_Script import list_users

func = list_users

list_of_users_FuncNode = FuncNode("All users", func)
    def get_input_all_reqs_or_get_single_req(cls):
        while True:

            admins = read_data_from_admins_database()
            r_box = admins['admins_inf']['requests_box']
            os.system('clear')
            if len(r_box) > 0:
                RefRequest.print_all_requests()
                inp = input(
                    "\nEnter the positional number to browse a single request.\n\n"
                    "Enter A to mark all requests as accepted.\n"
                    "Enter D to mark all requests as declined.\n"
                    "Enter E to execute all requests.\n"
                    "Enter R to go back.\n")

                try:
                    inp = int(inp)
                    if inp not in range(1, len(r_box) + 1):
                        print("Choose valid option.")
                        time.sleep(2)
                        continue
                    else:
                        index = inp - 1
                        return index

                except ValueError:
                    opts = ["a", "d", "r", "e"]
                    inp = inp.lower()
                    if inp not in opts:
                        print("Choose valid option.")
                        time.sleep(2)
                        continue
                    else:
                        if inp == "a":
                            for req in r_box:
                                req['approved'] = True
                                write_data_to_admins_database(admins)
                                continue
                        if inp == "d":
                            for req in r_box:
                                req['approved'] = False
                                write_data_to_admins_database(admins)
                                continue
                        if inp == "r":
                            return FuncNode.current_node()
                        if inp == "e":
                            users = read_data_from_users_database()
                            for r in r_box:
                                for user in users['users']:
                                    if user['username'] == r['username']:
                                        if r["approved"]:
                                            user["wallet"] += r["amount"]
                                            user["notifications"].append(
                                                f"Your request for {r['amount']} points has been accepted."
                                            )
                                            print("\nRequest executed.\n")
                                        else:
                                            print(
                                                "The request is not approved.")
                                            print("Deleting the request.")
                                            time.sleep(3)
                                            user["notifications"].append(
                                                f"Your request for {r['amount']} points has been rejected."
                                            )
                                        admins = read_data_from_admins_database(
                                        )
                                        del admins['admins_inf'][
                                            'requests_box'][:]
                                        del admins['admins_inf'][
                                            'notifications'][:]
                                        write_data_to_users_database(users)
                                        write_data_to_admins_database(admins)
            else:
                # print("There are no new requests.")
                time.sleep(2)
                return
示例#13
0
from structures.func_Node import FuncNode
from structures.game_class import Game

func = Game.system_wallet
total_system_register = FuncNode("System's register", func)
示例#14
0
from structures.func_Node import FuncNode
from structures.game_class import Game

from structures.func_Node import FuncNode
from structures.game_class import Game


def return_func():
    gamename = "Turtle Race"

    def wrapper():
        Game.display_top_n(gamename)

    return wrapper()


func = return_func

turtle_raceBestScores = FuncNode("Turtle Race Records", func)
from structures.func_Node import FuncNode
from mainMenuForUsers.Logout.logoutScript import logout

func = logout

logOut_FuncNode = FuncNode('Log Out', func)
# logOut_FuncNode()