def __init__(self, width, height): self.stream = audioPlayerCkass.playSound("Audio\\Violet.wav") self.mouseX = 0 self.mouseY = 0 subThread = threading.Thread(target=audioPlayerCkass.record, args=("audiorecordtest.txt", )) subThread.daemon = True subThread.start() self.width = width self.height = height self.room = RoomClass.RoomClass(width, height, "bedroom") PlayerClass.player.init() self.player = PlayerClass.player(width, height, 400, 400, self.room) self.num = 0 self.playerGroup = pygame.sprite.GroupSingle(self.player) self.background = SubGameClass.background self.dot = SubGameClass.dot self.textStream = [["Hello?", 3], ["Is anyone there?", 6], ["I'll be good I promise!", 2], ["Don't leave me!", 2], ["Please", 10], ["In the end I guess I'm always alone.", 4], ["What did I do so wrong to deserve this?", 3], ["I'm sorry", 15]] self.timer = 0 self.text = self.textStream[self.num][0]
def __init__(self, width, height, screen): PlayerClass.player.init() self.width = width self.height = height self.initTime() self.tasks = [] self.room = RoomClass.RoomClass(width, height, self.roomName) self.player = PlayerClass.player(self.width, self.height, int(self.playerX), int(self.playerY), self.room) self.playerGroup = pygame.sprite.GroupSingle(self.player) self.screen = screen self.roomsurface = pygame.Surface((width, height)) self.drawRoom() self.font = pygame.font.SysFont("Calibri", 20) self.timer = 0 self.initNPC() self.tag = None self.optionButton = Button((62, 38, 12), 1050, 25, 130, 100, None, None, 150) self.name = "Player" self.introText = [ "Architect", "Planner", "Designer", "Creator", "With destruction: beginning", "A new society emerges", "And so the architect's job begins" ]
def test_ConvertJsonStringToRoomClass(self): Json = { "Id": "59ca7e3f-68bb-11e8-8697-525400c8e11c", "Week": 24, "WeekDay": 2, "StartBlock": 1, "EndBlock": 4, "Teacher": "AMMMQ", "Description": "SKC gesprekken", "CourseCode": None, "Classes": [], "Rooms": [{ "RoomId": "H.1.114", "Capacity": 99, "Maintenance": 0 }, { "RoomId": "H.1.306", "Capacity": 99, "Maintenance": 0 }, { "RoomId": "H.1.312", "Capacity": 99, "Maintenance": 0 }, { "RoomId": "H.1.315", "Capacity": 99, "Maintenance": 0 }, { "RoomId": "H.1.110", "Capacity": 99, "Maintenance": 0 }, { "RoomId": "H.1.112", "Capacity": 99, "Maintenance": 0 }] } room = RoomClass.Rooms(Json) self.assertEqual(room.Classes, [{"Name": "None"}]) self.assertEqual(room.CourseCode, Json["CourseCode"]) self.assertEqual(room.Description, Json["Description"]) self.assertEqual(room.EndBlock, Json["EndBlock"]) self.assertEqual(room.Rooms[0], Json["Rooms"][0]) self.assertEqual(room.StartBlock, Json["StartBlock"]) self.assertEqual(room.Teacher, Json["Teacher"]) self.assertEqual(room.Week, Json["Week"]) self.assertEqual(room.WeekDay, Json["WeekDay"])
def setRoom(self): self.roomName = GameClass.room self.room = RoomClass.RoomClass(self.width, self.height, GameClass.room) self.drawRoom() self.player.changePlayerRoom(self.room) self.objects = self.room.objects self.objectGroup = pygame.sprite.Group() for objects in self.objects: self.objectGroup.add(objects) GameClass.displayText = None
def ConvertWeekJson(jsonData,booking): room = ConfigFileParser.ConfigFileParser() roomNumber = str(room) # New array of data for json newJsonData = [] # Filters json for the day of the week. if(booking): for data in jsonData: if(data['Classroom'] == roomNumber): newJsonData.append(BookingClass.BookingClass(data)) return newJsonData else: for data in jsonData: newJsonData.append(RoomClass.Rooms(data)) return newJsonData
def ConvertDayJson(day,jsonData,booking): room = ConfigFileParser.ConfigFileParser() roomNumber = str(room) # New array of data for json newJsonData = [] if(booking): for data in jsonData: if (data['WeekDay'] == date.today().isocalendar()[2]): newJsonData.append(BookingClass.BookingClass(data)) return newJsonData # Filters json for the day of the week. else: for data in jsonData: if (data['WeekDay'] == date.today().isocalendar()[2]): newJsonData.append(RoomClass.Rooms(data)) return newJsonData
def APIGetRooms(self, json_req): streaming_in_progress = False for proc in psutil.process_iter(): if proc.name() == 'ffmpeg': streaming_in_progress = True break if streaming_in_progress == False: command = ['/HomeControlCenter/play.sh'] proc = Popen( command, shell=True, stdin=None, stdout=None, stderr=None, close_fds=True, ) obj = RoomClass.RoomClass() response = obj.getRoomsData() return json.dumps(response)
import CryptClass import json import ConfigClass import RoomClass import APIClass api = APIClass.APIClass() c = RoomClass.RoomClass() req = {} #req['ip'] = "192.168.1.49" #req['ip'] = "192.168.1.26" #req['ip'] = "192.168.1.14" #api.APItoggleLight(req) print api.APIGetRooms("")