X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=qchess%2Fsrc%2Fmain.py;h=7e862a9cf54cea4ea98b50c93640dbdbde990d3f;hp=748a4592688d48ee0a85165a2e784242282ae39f;hb=c0c346f95a6d19d8967928aeeeb4937e1a99f2f4;hpb=5287b4f869be70ddae4b59a44c448be33f95ccda diff --git a/qchess/src/main.py b/qchess/src/main.py index 748a459..7e862a9 100644 --- a/qchess/src/main.py +++ b/qchess/src/main.py @@ -16,6 +16,7 @@ import os import time turn_delay = 0.5 +sleep_timeout = None [game, graphics] = [None, None] def make_player(name, colour): @@ -68,6 +69,7 @@ def main(argv): global src_file global graphics_enabled global always_reveal_states + global sleep_timeout max_moves = None src_file = None @@ -149,6 +151,12 @@ def main(argv): agent_timeout = -1 else: agent_timeout = float(arg[2:].split("=")[1]) + elif (arg[1] == '-' and arg[2:].split("=")[0] == "blackout"): + # Screen saver delay + if len(arg[2:].split("=")) == 1: + sleep_timeout = -1 + else: + sleep_timeout = float(arg[2:].split("=")[1]) elif (arg[1] == '-' and arg[2:] == "help"): # Help @@ -188,6 +196,8 @@ def main(argv): if graphics_enabled == True: try: graphics = GraphicsThread(game.board, grid_sz = [64,64]) # Construct a GraphicsThread! + + graphics.sleep_timeout = sleep_timeout except Exception,e: graphics = None