From f57497f2da38dae588566832d72df415e76a964d Mon Sep 17 00:00:00 2001 From: Kai Bublitz Date: Wed, 20 Mar 2019 13:41:20 +0100 Subject: [PATCH] Fix class imports that lead to crash --- src/database/database.py | 27 ++++++++++++++------------- src/gui/kickerapp.py | 3 ++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/database/database.py b/src/database/database.py index b09a7af..0c380b6 100644 --- a/src/database/database.py +++ b/src/database/database.py @@ -1,7 +1,8 @@ import sqlite3 from kicker import player -from kicker import Game +from kicker.game import Game +from kicker.player import Player import trueskill import os.path @@ -99,7 +100,7 @@ def get_all_players(self): cur = self.database.cursor() cur.execute("SELECT * FROM players ORDER BY skill_mu DESC, skill_sigma ASC") return [self.create_player(p) for p in cur.fetchall()] - + def get_active_players(self): cur = self.database.cursor() cur.execute("SELECT * FROM players WHERE is_hidden=0 ORDER BY skill_mu DESC, skill_sigma ASC") @@ -125,7 +126,7 @@ def update_player_skill(self, p): self.database.commit() def create_player(self, db_result): - p = player.Player() + p = Player() p.id = db_result[0] p.name = db_result[1] p.tokenID = db_result[2] @@ -174,27 +175,27 @@ def get_games(self, number=None): games = [] for entry in cur: - game = Game.Game() + game = Game() game.time = entry[0] try: game.player1 = self.get_player(entry[1]) except: - game.player1 = player.Player() + game.player1 = Player() game.player1.name = "Unregistered Player" try: game.player2 = self.get_player(entry[2]) except: - game.player2 = player.Player() + game.player2 = Player() game.player2.name = "Unregistered Player" try: game.player3 = self.get_player(entry[3]) except: - game.player3 = player.Player() + game.player3 = Player() game.player3.name = "Unregistered Player" try: game.player4 = self.get_player(entry[4]) except: - game.player4 = player.Player() + game.player4 = Player() game.player4.name = "Unregistered Player" game.scoreTeam1 = entry[5] game.scoreTeam2 = entry[6] @@ -221,27 +222,27 @@ def get_game(self, game_id): if result is None: return None - game = Game.Game() + game = Game() game.time = result[0] try: game.player1 = self.get_player(result[1]) except: - game.player1 = player.Player() + game.player1 = Player() game.player1.name = "Unregistered Player" try: game.player2 = self.get_player(result[2]) except: - game.player2 = player.Player() + game.player2 = Player() game.player2.name = "Unregistered Player" try: game.player3 = self.get_player(result[3]) except: - game.player3 = player.Player() + game.player3 = Player() game.player3.name = "Unregistered Player" try: game.player4 = self.get_player(result[4]) except: - game.player4 = player.Player() + game.player4 = Player() game.player4.name = "Unregistered Player" game.scoreTeam1 = result[5] game.scoreTeam2 = result[6] diff --git a/src/gui/kickerapp.py b/src/gui/kickerapp.py index d73f62a..80f74a5 100644 --- a/src/gui/kickerapp.py +++ b/src/gui/kickerapp.py @@ -2,6 +2,7 @@ import config from config import db, rfidReader +from kicker.game import Game import kivy kivy.require('1.10.0') @@ -226,7 +227,7 @@ def on_confirm(self, sender): winner_team = 1 else: winner_team = 2 - game = Game.Game() + game = Game() game.player1 = self.players[0] game.player2 = self.players[1] game.player3 = self.players[2]