seopardy/seopardy.py

44 lines
1.3 KiB
Python
Executable File

#!/usr/bin/python
from __future__ import print_function
import argparse
import os
import sys
#from PySide import QtCore, QtGui
from PySide import QtGui
from question import Questions
from gamestate import GameState
from game import SeopardyGame
def _parser():
parser = argparse.ArgumentParser(description="Sebas jeopardy/beopardy clone")
parser.add_argument("--fifo", action="store", default="/tmp/seopardy-fifo", help="Name of the fifo to create")
parser.add_argument("--gamestate", action="store", default=None, help="Gamestate to load to recover a crashed game")
parser.add_argument("--savedir", action="store", default="/tmp/seopardy/", help="Directory where to save the temporary gamestates to, in case of game-crash")
parser.add_argument("questions", action="store", help="Path to questionfile")
return parser
if __name__ == '__main__':
parser = _parser()
args = parser.parse_args()
fifo = None
try:
if os.path.exists(args.fifo):
os.unlink(args.fifo)
os.mkfifo(args.fifo)
except OSError as e:
print("Error: Could not create fifo: %s" % (str(e),), file=sys.stderr)
questions = Questions(args.questions)
gamestate = GameState(args.savedir)
# start gui
app = QtGui.QApplication([])
board = SeopardyGame(questions, gamestate)
board.show()
app.exec_()
sys.exit()