from helper.CsvReadWriter import CsvReadWriter from helper.NavigationDisplay import NavigationDisplay from helper.TableDisplay import TableDisplay from helper.Utility import clearScreen from InventoryItem import InventoryItem #################### csvRW = CsvReadWriter("data/inventory.csv") data = csvRW.loadAsDictionary() DATA_FIELDS = list(data[0].keys()) navDisplay = NavigationDisplay() tableDisplay = TableDisplay(DATA_FIELDS) #################### def showMessage(message): print(message) input("Press enter to continue: ") def generateDataID(): listOfIDs = [int(item["ID"]) for item in data] maxId = max(listOfIDs) return maxId + 1 def printFields():
# do not delete the code in here ############################## from helper.CsvReadWriter import CsvReadWriter from helper.TableDisplay import TableDisplay from helper.NavigationDisplay import NavigationDisplay # do not delete the code in here ############################## DATA_PATH_CSV = "data/contactList.csv" # load data csvRW = CsvReadWriter(DATA_PATH_CSV) data = csvRW.loadAsDictionary() # create display instance tableDisplay = TableDisplay(data[0].keys()) navDisplay = NavigationDisplay() # do not delete the code in here ############################## def showInvalidOrSuccess(message): print(message) input("Press any key to continue: ") while(True): tableDisplay.display(data) navDisplay.printMainMenu() userAction = input("What would you like to do? : ") userAction = int(userAction) if(userAction == 1): tableDisplay.display(data)
from helper.JsonReadWriter import JsonReadWriter from helper.NavigationDisplay import NavigationDisplay from helper.TableDisplay import TableDisplay from helper.Utility import clearScreen import random import time ################################### SYMBOLS = ["'", "/", "\\", "?", "."] DATA_PATH_CSV_QUESTIONS = "data/questions.csv" DATA_PATH_JSON_SCOREBOARD = "data/scoreBoard.json" jsonRW = JsonReadWriter(DATA_PATH_JSON_SCOREBOARD) scoreBoardData = jsonRW.load() csvRW = CsvReadWriter(DATA_PATH_CSV_QUESTIONS) questionsData = csvRW.loadAsDictionary() SCOREBOARD_FIELDS = scoreBoardData[0].keys() tableDisplay = TableDisplay(SCOREBOARD_FIELDS) scoreBoardData.sort(key=lambda x: x["score"], reverse=True) highestScore = scoreBoardData[0]["score"] navDisplay = NavigationDisplay() #################################### def showMessage(message): print(message) input("Press enter to continue: ")