Example #1
0
 def on_read(self, data):
     hasCallback, data = self.__splitData(data)
     data = self.__unwrapData(data)
     if hasCallback == 'True' and not self.callbacks.isEmpty():
         callback = self.callbacks.dequeue()
         if callback is not None:
             callback(data)
     return FrontEnd.on_read(self, data)
Example #2
0
 def on_read(self, data):
     hasCallback, data = self.__splitData(data)
     data = self.__unwrapData(data)
     if hasCallback == 'True' and not self.callbacks.isEmpty():
         callback = self.callbacks.dequeue()
         if callback is not None:
             callback(data)
     return FrontEnd.on_read(self, data)
    def __init__(self):
        print("Initialising game")
        self.View = UIView()
        self.FrontEnd = FrontEnd()
        self.FrontEnd.main()
        self.User = User()
        self.Time = TimeContainer()

        parser = argparse.ArgumentParser(description='Schwarzchild Radius')
        parser.add_argument('-g',
                            action='store_false',
                            help='Disables graphical user interface')
        args = parser.parse_args()

        print(args.g)

        if args.g:
            self.Controller = Controller(self.FrontEnd, self.User, self.Time)
        else:
            self.Controller = Controller(self.View, self.User, self.Time)
Example #4
0
def main():
    """The main function. Establishes a database connection, then initiates the GUI
    """

    # Creating main connection
    mydb = mysql.connector.connect(
        converter_class=Converter.MyConverter,
        host="altium.cyyn3lqbjhax.us-east-2.rds.amazonaws.com",
        user="******",
        passwd="formulasae",
        database="Altium")
    app = QApplication(sys.argv)
    ex = FrontEnd(mydb)
    sys.exit(app.exec_())
Example #5
0
    def fetch_config(self):
        json_string = FrontEnd().input_receiver('go.config')
        python_obj = json.loads(json_string)
        return python_obj["IP"], python_obj["port"], python_obj[
            "default-player"]

    # def connect(self,data):
    #     self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    #     self.s.connect((self.HOST, self.HOST))
    # s.sendall(json.dumps(data).encode())
    # data = s.recv(6000)
    # return data.decode()

    # def receive_and_send(self):
    #     data = self.s.recv(6000)
    #     json_data = json.loads(data.decode('utf-8'))
    #     if len(json_data) == 1 and json_data[0] == "register":
    #         name = self.player.register()
    #         self.s.sendall(json.dumps(name).encode())
    #     elif len(json_data) == 2 and json_data[0] == "receive-stones":
    #         stone = json_data[1]
    #         self.player.receive_stones(stone)
    #     elif len(json_data) == 2 and json_data[0]== "make-move":
    #         history = json_data[1]
    #         move = self.player.make_move(history)
    #         self.s.sendall(json.dumps(move).encode())
    #     else:
    #         return "GO has gone crazy!"


# if __name__ == '__main__':
#     remote_player = Remote(Player())
#     # remote_player.verify_protocol(remote_player._wrapped.register())
#     remote_player.connect()
#     while True:
#         remote_player.receive_and_send()

#     PlayerProxy(Remote()).connect()
Example #6
0
 def write(self, data, callback=None):
     self.callbacks.enqueue(callback)
     data = self.__wrapData(data)
     return FrontEnd.write(self, data)
Example #7
0
 def fetch_config(self):
     json_string = FrontEnd().input_receiver('go.config')
     python_obj = json.loads(json_string)
     return python_obj["IP"], python_obj["port"], python_obj[
         "default-player"]
Example #8
0
 def write(self, data, callback=None):
     self.callbacks.enqueue(callback)
     data = self.__wrapData(data)
     return FrontEnd.write(self, data)
Example #9
0
        exit(1)
    if args.nms < 0 or args.nms >= 1:
        eprint("the nms must be within [0, 1[")
        exit(1)
    if args.mask_threshold < 0 or args.mask_threshold >= 1:
        eprint("the mask_threshold must be within [0, 1[")
        exit(1)
    if args.input_size < 224 or args.input_size > 720:
        eprint("As input image is 960*720 and 224 is quite small, input size must be within [224, 720]")
        exit(1)

    if args.model == "None":
        frame_processor = FrameProcessor()
    elif args.model.startswith("yolo") or args.model.startswith("ssd"):
        frame_processor = ObjectDetector(args.model, args.input_size, args.threshold, args.nms, args.use_gpu)
    elif args.model == "posenet":
        frame_processor = PoseDetector(args.model, args.threshold)
    elif args.model == "maskrcnn":
        frame_processor = ObjectSegmentor(args.input_size, args.threshold, args.mask_threshold, args.use_gpu)
    elif args.model == "midas":
        if args.input_size % 32 != 0:
            eprint("Input size must be a multiple of 32 for Midas")
            exit(1)
        frame_processor = DepthEstimator(args.input_size, args.use_gpu)
    else:
        raise ValueError("Not implemented")

    frontend = FrontEnd(args.drone_speed, args.azerty and os.name != "nt", frame_processor)  # azerty keyboard
    # automatically handled on windows
    frontend.run()