def send_shutdown(): """ Send shutdown message. """ client.send(constants.C.SYSTEM, constants.M.SYSTEM_SHUTDOWN) client.socket.flush() if __name__ == '__main__': start.fix_pyqt5_exception_eating() start.set_start_directory() # create server process and start it server_process = server.ServerProcess() server_process.start() # create app in this process app = QtCore.QCoreApplication([]) client = base_network.NetworkClient() # actions QtCore.QTimer.singleShot(100, client_connect) QtCore.QTimer.singleShot(200, send_shutdown) QtCore.QTimer.singleShot(300, app.quit) app.exec_() # wait for server server_process.join()
if __name__ == '__main__': # add source directory to path if needed source_directory = os.path.realpath( os.path.join(os.path.abspath(os.path.dirname(__file__)), os.path.pardir, os.path.pardir, 'source')) if source_directory not in sys.path: sys.path.insert(0, source_directory) from imperialism_remake.base import constants, network as base_network from imperialism_remake.server import server_process app = QtCore.QCoreApplication([]) server_manager = imperialism_remake.server.server_manager.ServerManager() clientA = base_network.NetworkClient() clientB = base_network.NetworkClient() # actions QtCore.QTimer.singleShot(0, server_manager.start) QtCore.QTimer.singleShot(100, clients_connect) QtCore.QTimer.singleShot(500, clients_send_names) QtCore.QTimer.singleShot(800, clientA_subscribes) QtCore.QTimer.singleShot(1000, clientB_chats) QtCore.QTimer.singleShot(1200, clientB_subscribes) QtCore.QTimer.singleShot(1400, clientA_chats) QtCore.QTimer.singleShot(3000, app.quit) app.exec_()
""" # TODO automatic placement of help dialog depending on if another dialog is open from functools import partial from PyQt5 import QtCore, QtGui, QtWidgets from imperialism_remake.base import constants, tools import imperialism_remake.base.network as base_network from imperialism_remake.client import audio import imperialism_remake.client.graphics as graphics from imperialism_remake.lib import qt, utils import imperialism_remake.version as version # TODO like in audio, set the network client singleton somewhere else local_network_client = base_network.NetworkClient() from imperialism_remake.client.editor import EditorScreen from imperialism_remake.client.lobby import GameLobbyWidget from imperialism_remake.client.game import GameMainScreen from imperialism_remake.client.preferences import PreferencesWidget from imperialism_remake.client.server_monitor import ServerMonitorWidget class MapItem(QtCore.QObject): """ Holds together a clickable QPixmapItem, a description text and a reference to a label that shows the text TODO use signals to show the text instead """ description_change = QtCore.pyqtSignal(str)
def send_shutdown(): """ Send shutdown message. """ client.send(constants.C.SYSTEM, constants.M.SYSTEM_SHUTDOWN) client.socket.flush() if __name__ == '__main__': start.fix_pyqt5_exception_eating() start.set_start_directory() # create server process and start it server_process = server.ServerProcess() server_process.start() # create app in this process app = QtCore.QCoreApplication([]) client = network.NetworkClient() # actions QtCore.QTimer.singleShot(100, client_connect) QtCore.QTimer.singleShot(200, send_shutdown) QtCore.QTimer.singleShot(300, app.quit) app.exec_() # wait for server server_process.join()