def __init__(self): """ """ super().__init__() self.setTitle('Select Scenario') self.layout = QtWidgets.QVBoxLayout(self) # add a channel for us local_network_client.connect_to_channel(constants.C.LOBBY, self.received_titles) # send message and ask for scenario titles local_network_client.send(constants.C.LOBBY, constants.M.LOBBY_SCENARIO_CORE_LIST)
def __init__(self, scenario_file): """ Given a scenario file name, get the preview from the server. """ # TODO move the network communication outside this class. super().__init__() # add a channel for us local_network_client.connect_to_channel(constants.C.LOBBY, self.received_preview) # send a message and ask for preview local_network_client.send(constants.C.LOBBY, constants.M.LOBBY_SCENARIO_PREVIEW, scenario_file) self.selected_nation = None
def __init__(self): """ """ super().__init__() self.setTitle('Select Scenario') self.layout = QtWidgets.QVBoxLayout(self) # add a channel for us local_network_client.connect_to_channel(constants.C.LOBBY, self.received_titles) # send message and ask for scenario titles local_network_client.send(constants.C.LOBBY, constants.M.LOBBY_SCENARIO_CORE_LIST)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) layout = QtWidgets.QHBoxLayout(self) self.client_list_widget = QtWidgets.QListWidget() # list.itemSelectionChanged.connect(self.selection_changed) # list.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.client_list_widget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.client_list_widget.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarAsNeeded) self.client_list_widget.setFixedWidth(200) layout.addWidget( qt.wrap_in_groupbox(self.client_list_widget, 'Players')) self.chat_log_text_edit = QtWidgets.QTextEdit() self.chat_log_text_edit.setEnabled(False) chat_log_group = qt.wrap_in_groupbox(self.chat_log_text_edit, 'Chat log') self.chat_input_edit = QtWidgets.QLineEdit() self.chat_input_edit.returnPressed.connect(self.send_chat_message) chat_input_group = qt.wrap_in_groupbox(self.chat_input_edit, 'Chat input') layout.addLayout(qt.wrap_in_boxlayout( (chat_log_group, chat_input_group), horizontal=False, add_stretch=False), stretch=1) # connection to server # chat messages local_network_client.connect_to_channel(constants.C.CHAT, self.receive_chat_messages) local_network_client.send(constants.C.CHAT, constants.M.CHAT_SUBSCRIBE) # LOBBY local_network_client.connect_to_channel(constants.C.LOBBY, self.receive_lobby_messages) self.request_updated_client_list() # set timer for connected client updates self.timer = QtCore.QTimer() self.timer.timeout.connect(self.request_updated_client_list) self.timer.setInterval(5000) self.timer.start()
def __init__(self, scenario_file): """ Given a scenario file name, get the preview from the server. """ # TODO move the network communication outside this class. super().__init__() # add a channel for us local_network_client.connect_to_channel(constants.C.LOBBY, self.received_preview) # send a message and ask for preview local_network_client.send(constants.C.LOBBY, constants.M.LOBBY_SCENARIO_PREVIEW, scenario_file) self.selected_nation = None
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.layout = QtWidgets.QVBoxLayout(self) self.status = QtWidgets.QLabel('No information yet.') self.layout.addWidget(self.status) self.layout.addStretch() local_network_client.connect_to_channel(constants.C.SYSTEM, self.update_monitor) # one initial update self.request_monitor_update() # set timer for following updates self.timer = QtCore.QTimer() self.timer.timeout.connect(self.request_monitor_update) self.timer.setInterval(10000) self.timer.start()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.layout = QtWidgets.QVBoxLayout(self) self.status = QtWidgets.QLabel('No information yet.') self.layout.addWidget(self.status) self.layout.addStretch() local_network_client.connect_to_channel(constants.C.SYSTEM, self.update_monitor) # one initial update self.request_monitor_update() # set timer for following updates self.timer = QtCore.QTimer() self.timer.timeout.connect(self.request_monitor_update) self.timer.setInterval(10000) self.timer.start()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) layout = QtWidgets.QHBoxLayout(self) self.client_list_widget = QtWidgets.QListWidget() # list.itemSelectionChanged.connect(self.selection_changed) # list.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.client_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.client_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.client_list_widget.setFixedWidth(200) layout.addWidget(qt.wrap_in_groupbox(self.client_list_widget, 'Players')) self.chat_log_text_edit = QtWidgets.QTextEdit() self.chat_log_text_edit.setEnabled(False) chat_log_group = qt.wrap_in_groupbox(self.chat_log_text_edit, 'Chat log') self.chat_input_edit = QtWidgets.QLineEdit() self.chat_input_edit.returnPressed.connect(self.send_chat_message) chat_input_group = qt.wrap_in_groupbox(self.chat_input_edit, 'Chat input') layout.addLayout(qt.wrap_in_boxlayout((chat_log_group, chat_input_group), horizontal=False, add_stretch=False), stretch=1) # connection to server # chat messages local_network_client.connect_to_channel(constants.C.CHAT, self.receive_chat_messages) local_network_client.send(constants.C.CHAT, constants.M.CHAT_SUBSCRIBE) # LOBBY local_network_client.connect_to_channel(constants.C.LOBBY, self.receive_lobby_messages) self.request_updated_client_list() # set timer for connected client updates self.timer = QtCore.QTimer() self.timer.timeout.connect(self.request_updated_client_list) self.timer.setInterval(5000) self.timer.start()