Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eel sometimes takes infinitely long to render a webpage #702

Open
padfoot9445 opened this issue Sep 23, 2023 · 0 comments
Open

Eel sometimes takes infinitely long to render a webpage #702

padfoot9445 opened this issue Sep 23, 2023 · 0 comments
Labels

Comments

@padfoot9445
Copy link

Eel version
0.16.0

Describe the bug
At seemingly random, eel never exits the loading page
To Reproduce
Steps to reproduce the behavior:

  1. create simple application using eel
  2. run it multiple times until the page fails to load

Expected behavior
The page should have loaded properly every time
System Information

  • OS: Microsoft Windows 11 Home System Type x64-based PC
  • Browser: chrome 116
  • Python Distribution: Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] on win32

Additional context
as reccomended by #393, i added the print statement. Every file parses even when it doesnt load properly.

import chess
import eel

board = chess.Board()
print("Initialised")
@eel.expose
def _validate_move(source, destination, piece) -> bool:
    if not (board.turn == chess.WHITE and piece[0] == "w" or board.turn == chess.BLACK and piece[0] == "b") or source == destination:
        return False
    if chess.Move.from_uci(f"{source}{destination}") in board.legal_moves:
        board.push(chess.Move.from_uci(f"{source}{destination}"))
        print(board.fen())
        return True
    else:
        return False
                                       
    print("F")
eel.init(r"D:\coding\Python\chess\opening_trainer\eel_app\web")
eel.start("main.html",disable_cache=True)
print("G")
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="css/chessboard-1.0.0.min.css">
        <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
        <script src="js/chessboard-1.0.0.min.js"></script>
        <script src="mainjs.js" defer></script>
        <script type="text/javascript" src="/eel.js"></script>
        <link rel="stylesheet" href="main.css"></linkt>
        
        
        
    </head>
    <body>
        <div id="main-container" class="main-horizongal-flex">
            <div id="board-and-pgn-container">
                <div id="board" style="width: 400px"></div>
                <div id="pgn">PGN HERE</div>
            </div>
            <div id="moves-container">
                <ul id="moves" class="moves-options">
                    <li>Move 1</li>
                    <li>Move 2</li>
                </ul>
            </div>
        </div>
    </body>
</html>
let config = {
    draggable: true,
    position: 'start',
    onDrop: onDrop
  }
  


let board = ChessBoard("board", config);
function move(source, target, piece, newPos){
    board.position(newPos,false);
    if(piece=="wK"&&source=="e1"&&(target=="g1"||target=="c1")){
        if(target=="g1"){
            board.move("h1-f1");
        } else{
            board.move("a1-d1");
        }
    } else if(piece=="bK"&&source=="e8"&&(target=="g8"||target=="c8")){
        if(target=="g8"){
            board.move("h8-f8");
        } else{
            board.move("a8-d8");
        }
    }
}
async function moveIfValid(source, target, piece, newPos){
    await eel._validate_move(source, target, piece)(function(result){
                if(result==true){
                    move(source, target, piece,newPos);
                }
            })
}
function onDrop(source, target, piece, newPos, oldPos, orientation){
    moveIfValid(source, target,piece, newPos);
    return "snapback";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant