def setupTestServer(): player = LocalPlayer() player.setHeadless() server = RequestServer(player=player) ip, port = server.server_address thisDevice = Device(type="local", visibleName="rpi-testyamserver", url="{0}:{1}".format(ip,port)) return ServerApp(server, player, thisDevice)
def testServerApp(): player = LocalPlayer() player.setHeadless() requestServer = RequestServer(player=player) ip, port = server.server_address thisDevice = Device(type="local", visibleName="rpi-yamserver", url="{0}:{1}".format(ip,port)) app = ServerApp(requestServer, player, thisDevice) app.start()
def add_player_to_room(self, player_name): if player_name == self.player_name: player = LocalPlayer(player_name, num_of_cards=5) self.local_player = player else: player = Player(player_name, num_of_cards=5) new_item = QListWidgetItem() new_item.setData(Qt.UserRole, player) self.ui.players_list.addItem(new_item) self.update_players_list()
def assembleServer(host, port, broadcast_port): #init player player = LocalPlayer() player.setHeadless() #init the request server server = RequestServer((host,port), player=player) #init device thisDevice = Device(type="local", visibleName="rpi-yamserver", url="{0}:{1}".format(host,port)) thisDevice.setCapabilities([devices.Capability.PlayMusic]) #init presence broadcaster presenceBroadcaster = DevicePresenceBroadcaster(thisDevice, broadcast_port) #init state broadcaster stateBroadcaster = DeviceStateMulticaster(player) #assemble and return the server return ServerApp(server, player, presenceBroadcaster, stateBroadcaster)
def __init__(self, grids: int, size: int, players: Dict[bool, str], rule: Rule) -> None: """Initlize a new local game""" super().__init__(grids, size, players, rule) # Initialize tkUI self._board = Board(self._tkroot, self._size, self._grids) self._board.click = self.click self._board.restart = self.restart self._board.fundo = self._game.undo # Initialize gamer for color, name in players.items(): self._players[color] = LocalPlayer(name, color, self._board)