2013-11-06 20:42:00 +01:00
#!/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 " )
2013-11-13 21:16:50 +01:00
parser . add_argument ( " --savedir " , action = " store " , default = " /tmp/seopardy/ " , help = " Directory where to save the temporary gamestates to, in case of game-crash " )
2013-11-06 20:42:00 +01:00
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 )
2013-11-13 21:16:50 +01:00
gamestate = GameState ( args . savedir )
2013-11-06 20:42:00 +01:00
# start gui
app = QtGui . QApplication ( [ ] )
board = SeopardyGame ( questions , gamestate )
board . show ( )
app . exec_ ( )
sys . exit ( )