eric7.Toolbox.SingleApplication

Module implementing the single application server and client.

Global Attributes

None

Classes

SingleApplicationClient Class implementing the single application client base class.
SingleApplicationServer Class implementing the single application server base class.

Functions

None


SingleApplicationClient

Class implementing the single application client base class.

Derived from

None

Class Attributes

None

Class Methods

None

Methods

SingleApplicationClient Constructor
connect Public method to connect the single application client to its server.
disconnect Public method to disconnect from the Single Appliocation server.
errstr Public method to return a meaningful error string for the last error.
processArgs Public method to process the command line arguments passed to the UI.
sendCommand Public method to send the command to the application server.

Static Methods

None

SingleApplicationClient (Constructor)

SingleApplicationClient(name)

Constructor

name (str)
name of the local server to connect to

SingleApplicationClient.connect

connect(timeout=10000)

Public method to connect the single application client to its server.

timeout (int)
connection timeout value in milliseconds
Return:
value indicating success or an error number. Value is one of:
0No application is running
1Application is already running
Return Type:
int

SingleApplicationClient.disconnect

disconnect()

Public method to disconnect from the Single Appliocation server.

SingleApplicationClient.errstr

errstr()

Public method to return a meaningful error string for the last error.

Return:
error string for the last error
Return Type:
str

SingleApplicationClient.processArgs

processArgs(args)

Public method to process the command line arguments passed to the UI.

Note: This method must be overridden by subclasses.

args (argparse.Namespace)
namespace object containing the parsed command line parameters
Raises NotImplementedError:
raised to indicate that this method must be implemented by a subclass

SingleApplicationClient.sendCommand

sendCommand(command, arguments)

Public method to send the command to the application server.

command (str)
command to be sent to the server
arguments (list of str)
list of command arguments
Up


SingleApplicationServer

Class implementing the single application server base class.

Derived from

QLocalServer

Class Attributes

None

Class Methods

None

Methods

SingleApplicationServer Constructor
__disconnected Private method to handle the closure of the socket.
__newConnection Private slot to handle a new connection.
__receiveJson Private method to receive the data from the client.
handleCommand Public slot to handle the command sent by the client.
shutdown Public method used to shut down the server.

Static Methods

None

SingleApplicationServer (Constructor)

SingleApplicationServer(name)

Constructor

name (str)
name this server is listening to

SingleApplicationServer.__disconnected

__disconnected()

Private method to handle the closure of the socket.

SingleApplicationServer.__newConnection

__newConnection()

Private slot to handle a new connection.

SingleApplicationServer.__receiveJson

__receiveJson()

Private method to receive the data from the client.

SingleApplicationServer.handleCommand

handleCommand(command, arguments)

Public slot to handle the command sent by the client.

Note: This method must be overridden by subclasses.

command (str)
command sent by the client
arguments (list of str)
list of command arguments
Raises NotImplementedError:
raised to indicate that this method must be implemented by a subclass

SingleApplicationServer.shutdown

shutdown()

Public method used to shut down the server.

Up