Exemplo n.º 1
0
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.topMenuBar()
        self.cardName = "Let's play a game"
        self.gameColor = "white"
        try:
            self.master.config(menu=self.menubar)
        except AttributeError:
            self.master.tk.call(master, "config", "-menu", self.menubar)

#        fontText = tk.Font("Arial", 14,"bold")
#        self.Label(master, text="Color")
        self.frameCanvas = tk.Frame(self, borderwidth=1)

        self.canvas = tk.Canvas(self.frameCanvas,
                                bg="white",
                                width=400,
                                height=400,
                                bd=0,
                                highlightthickness=0)

        self.canvas.pack()
        self.canvas.create_rectangle(25, 25, 375, 375, fill=self.gameColor)
        self.canvas.create_text(200, 200, text=self.cardName)

        self.frameCanvas.pack()

        self.frameGameControl = tk.Frame(self, borderwidth=1)
        self.frameGameControl.pack()

        controller.GameController().registerMainGui(self)
Exemplo n.º 2
0
 def save(self):
     ''' save button to save configuration to Card Manager '''
     entryIDContent = self.entryID.get()
     entryDescContent = self.entryDesc.get()
     entryTypeContent = self.typeVar.get()
     
     controller.GameController().updateCard(self.activeCard, entryIDContent, entryDescContent, entryTypeContent)
     # aus edit felder texte holen
     # über self.curINdex passende card suchen
     # card mit neuen texten aktualisieren
     # listbox eintrag aktualisieren
     # card manager configuration speichern
     
     self.top.destroy()
Exemplo n.º 3
0
 def configSerialConnection(self):
     ''' create dialog elements ''' 
            
     self.top.wm_title("Configure Serial Connection") 
     
     self.frame1 = tk.Frame(self.top)
     tk.Label(self.frame1, text="Current configured Serial Connection:")
     self.serial = tk.Entry(self.frame1)
     self.serial.insert(0, controller.GameController().getSerialInterface())
     self.serial.pack()
     self.frame1.pack(expand=True, padx=70, pady=20)
     closeButton = tk.Button(self.top, text="Save", command=self.save)
     closeButton.pack(side="right", padx=5, pady=5)
     cancelButton = tk.Button(self.top, text="Cancel", command=self.cancel)
     cancelButton.pack(side="right", padx=5, pady=5)
Exemplo n.º 4
0
 def configGamePlayMode(self):     
     ''' create dialg elements '''          
     self.top.wm_title("Configure Game Play Mode") 
     
     self.frame1 = tk.Frame(self.top)
     tk.Label(self.frame1, text="Active Game Play Mode").pack(side="top")        
     self.mode = tk.IntVar()
     self.mode.set(controller.GameController().getCurrentGameStrategy())
     tk.Radiobutton(self.frame1, text="Easy Mode", variable=self.mode, value=0, command=self.selectGameMode()).pack(anchor="w")
     tk.Radiobutton(self.frame1, text="Advanced Mode", variable=self.mode, value=1, command=self.selectGameMode()).pack(anchor="w")        
     self.frame1.pack(expand=True, padx=50, pady=20)
     
     closeButton = tk.Button(self.top, text="Save", command=self.save)
     closeButton.pack(side="right", padx=5, pady=5)
     cancelButton = tk.Button(self.top, text="Cancel", command=self.cancel)
     cancelButton.pack(side="right", padx=5, pady=5)
Exemplo n.º 5
0
def main():

        
        
        # Initialize all singeltons
        gameController.GameController()                             # initialize Game Controller
        rFIDReader.RFIDReader()                                     # open serial interface manager
        cardFactory.CardFactory()                                   # initialize card factory manager
        cardManager.CardManager()                                   # initialize card manager

        
        gamePlayModes.GamePlayManager().setGamePlayMode(0)          # activate game play mode "simple"
        cardManager.CardManager().loadConfiguration()               # load config from pickle to card manager
        
        app = mainGUI.MainGui()                                     # start gui
        app.pack()
        app.master.title("ReaFID")
        app.mainloop()
Exemplo n.º 6
0
    def initializeWidgets(self):
        ''' get cards from Card Manager to display '''
#        self.myCardManager.loadConfiguration()
#        cardManager.CardManager.loadConfiguration(self)
        
        # numberCards = cardManager.CardManager.getSizeCardArray(self)
        self.myCardManager = controller.GameController().getCardManager()
        numberCards = self.myCardManager.getSizeCardArray()
        cardIndex = 0
        while (cardIndex < numberCards):
            currentCard = self.myCardManager.getCardByNumber(cardIndex)
#            currentIDString = currentCard.getID().decode("utf-8")
            if (isinstance(currentCard, cardFactory.ColorCard)):
                entry = str(currentCard.getID()) + "   " + currentCard.getColor() + "   Color"
                self.listboxCards.insert("end", entry)
            elif (isinstance(currentCard, cardFactory.StudentCard)):
                entry = str(currentCard.getID()) + "   " + currentCard.getName() + "   Student ID"
                self.listboxCards.insert("end", entry)
            else:
                print("Unknown card type")
            cardIndex += 1
        
        self.listboxCards.pack() 
Exemplo n.º 7
0
 def selectGameMode(self):
     ''' select active game mode '''
     controller.GameController().setCurrentGameStrategy(self.mode.get())     
Exemplo n.º 8
0
 def updateSerialConnection(self):
     ''' update serial configuration over controller '''
     controller.GameController().setSerialInterface(self.serial.get())
Exemplo n.º 9
0
    def setUp(self):

        self.myController = controller.GameController()
Exemplo n.º 10
0
 def play(self):
     controller.GameController().startGame()