def __init__(self, master):
        # Init frame
        tk.Frame.__init__(self, master)
        #[temp,hum] = grovepi.dht(4,0)
        self.temp = 21
        self.room = ConfigFileParser.ConfigFileParser()
        self.dagList = [
            "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag"
        ]
        self.lesList = [
            "Les uur / Tijd ", "1 ", "2 ", "3", "4", "5", "6", "7", "8", "9",
            "10", "11", "12", "13", "14", "15"
        ]
        self.startList = [
            "Start", " 8:30", " 9:20", "10:30", "11:20", "12:10", "13:00",
            "13:50", "15:00", "15:50", "17:00", "17:50", "18:40", "19:30",
            "20:20", "21:10"
        ]
        self.master = master

        self.init_buttons()
        # Init table view
        self.Fill_outer()

        self.Fill_inner()
Beispiel #2
0
    def setUp(self):
        self.xmlParser = SimpleXMLParser()
        self.configFileParser = ConfigFileParser.ConfigFileParser()

        self.xmlParser.link((self.xmlParser, 'outbox'),
                            (self.configFileParser, 'inbox'))
        self.xmlParser.link((self.xmlParser, 'signal'),
                            (self.configFileParser, 'control'))

        self.initializeSystem(self.xmlParser, self.configFileParser)
Beispiel #3
0
    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
Beispiel #4
0
 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
Beispiel #5
0
def client_authenticator(sock):
    channel = rpyc.Channel(rpyc.SocketStream(sock))
    data = channel.recv()

    data = rpyc.core.brine.load(data)

    login = data[0]
    password = data[1]

    config_parser = ConfigFileParser.ConfigFileParser()
    expected_login = config_parser.login()
    expected_password = config_parser.password()

    if login != expected_login or password != expected_password:
        channel.send('AUTH_ERROR')
        raise rpyc.utils.authenticators.AuthenticationError(
            'Invalid password from client.')

    channel.send('AUTH_SUCCESS')
    return sock, None
Beispiel #6
0
    def RetrieveData(day, booking, endPoint):
        try:

            #requests for data  : May take time
            request = requests
            endPointString = "http://acceptancetimetable2api.azurewebsites.net/api/" + endPoint
            room = ConfigFileParser.ConfigFileParser()
            url = endPointString + str(room) + "/" + str(
                date.today().isocalendar()[1])
            authString = str(base64.b64encode(bytes("Pi:" + str(room),
                                                    "utf8")))
            response = request.get(url,
                                   headers={
                                       'Authorization':
                                       'Basic ' + authString[1:].strip("'")
                                   })
            jsonData = simplejson.loads(response.content)
            if (endPoint == "Schedule/Classroom/"):
                return DataFormer.DataFormer.FormData(jsonData, day,
                                                      "jsonRoom.txt", booking)
            else:
                return DataFormer.DataFormer.FormData(jsonData, day,
                                                      "jsonBooking.txt",
                                                      booking)
        except:
            if (endPoint == "Schedule/Classroom/"):
                try:
                    return DataFormer.DataFormer.FormData(
                        TextFileReader.TextFileReader.ReadFromFile(
                            "jsonRoom.txt"), day, "jsonRoom.txt", booking)
                except:
                    return ["Lost"]
            else:
                try:
                    return DataFormer.DataFormer.FormData(
                        TextFileReader.TextFileReader.ReadFromFile(
                            "jsonBooking.txt"), day, "jsonBooking.txt",
                        booking)
                except:
                    return ["Lost"]
    def __init__(self, master):
        # Init frame
        tk.Frame.__init__(self, master)
        #[temp,hum] = grovepi.dht(4,0)
        self.temp = 21
        self.room = ConfigFileParser.ConfigFileParser()
        self.startList = [
            "Start", " 8:30", " 9:20", "10:30", "11:20", "12:10", "13:00",
            "13:50", "15:00", "15:50", "17:00", "17:50", "18:40", "19:30",
            "20:20", "21:10"
        ]
        # Sets selected item to none
        self.selected_item = None

        # Creates variable for the master class FrameController
        self.master = master

        # Inits the buttons and pictures
        self.init_buttons()

        # Builds foundation of the treeview
        self.Build_Treeview(self.master)
Beispiel #8
0
 def test_configFileReader(self):
     config = ConfigFileParser.ConfigFileParser()
     self.assertNotEqual(None, str(config))
Beispiel #9
0
        # code that runs when a connection is created
        # (to init the serivce, if needed)
        pass

    def on_disconnect(self):
        # code that runs when the connection has already closed
        # (to finalize the service, if needed)
        pass

    def exposed_get(self, key):  # this is an exposed method
        #print key
        return self.mysql.select(key)

    def exposed_put(self, key, val):  # this is an exposed method
        return self.mysql.insert(key, val)

    def exposed_update(self, key, val):  # this is an exposed method
        return self.mysql.update(key, val)


if __name__ == "__main__":
    from rpyc.utils.server import ThreadedServer

    config_parser = ConfigFileParser.ConfigFileParser()
    port = int(config_parser.port())
    t = ThreadedServer(RPCService,
                       port=port,
                       authenticator=client_authenticator)

    t.start()