The interprocess messaging class for the Commotion Client. This class extends the single application to allow for instantiations of the Commotion Client to pass messages to the existing client if it is already running. When a second instance of a Commotion Client is run without a message specified it will reaise the earler clients main window to the front and then close itself.
e.g:
python3.3 CommotionClient.py --message "COMMAND"
def commotion_client.utils.single_application.SingleApplicationWithMessaging.handle_message |
( |
|
self | ) |
|
Server side implementation of the messaging functions. This function waits for signals it receives and then emits a SIGNAL "messageAvailable" with the decoded message.
(Emits a signal instead of just calling a function in case we decide we would like to allow other components or extensions to listen for messages from new instances.)
References commotion_client.utils.single_application.SingleApplicationWithMessaging._timeout, commotion_client.GUI.menu_bar.MenuBar.translate, commotion_client.extensions.config_editor.main.ViewPort.translate, commotion_client.GUI.main_window.MainWindow.translate, commotion_client.GUI.toolbar_builder.ToolBar.translate, commotion_client.GUI.extension_toolbar.ExtensionToolBar.translate, commotion_client.GUI.toolbar.ToolBar.translate, commotion_client.utils.validate.ClientConfig.translate, commotion_client.utils.extension_manager.ExtensionManager.translate, commotion_client.GUI.extension_toolbar.MenuItem.translate, commotion_client.commotion_client.CommotionClientApplication.translate, commotion_client.utils.validate.Networking.translate, and commotion_client.utils.extension_manager.ConfigManager.translate.
79 Server side implementation of the messaging functions. This function waits for signals it receives and then emits a SIGNAL "messageAvailable" with the decoded message.
81 (Emits a signal instead of just calling a function in case we decide we would like to allow other components or extensions to listen for messages from new instances.)
83 socket = self._server.nextPendingConnection()
84 if socket.waitForReadyRead(self.
_timeout):
85 self.emit(QtCore.SIGNAL(
"messageAvailable"), bytes(socket.readAll().data()).decode(
'utf-8'))
86 socket.disconnectFromServer()
87 self.log.debug(self.translate(
"logs",
"message received and emitted in a messageAvailable signal"))
89 self.log.error(socket.errorString())
def handle_message
Definition: single_application.py:76
_timeout
Definition: single_application.py:65