# Python X2Go (Client) API Documentation (v0.6.1.4)

## x2go.mimebox module

`x2go.mimebox.X2GoMIMEboxQueue` sets up a thread that listens for incoming files that shall be opened locally on the client.

For each file that gets dropped in the MIME box an individual thread is started (`x2go.mimebox.X2GoMIMEboxJob`) that handles the processing of the incoming file.

class x2go.mimebox.X2GoMIMEboxJob(**kwargs)

  Bases: `Thread`

  For each X2Go MIME box job we create a sub-thread that let’s the MIME box job be processed in the background.

  As a handler for this class the function `x2go_mimeboxjob_handler()` is used.

class x2go.mimebox.X2GoMIMEboxQueue(profile_name='UNKNOWN', session_name='UNKNOWN', mimebox_dir=None, mimebox_action=None, mimebox_extensions=[], client_instance=None, logger=None, loglevel=56)

  Bases: `Thread`

  If the X2Go MIME box is supported in a particaluar `x2go.session.X2GoSession` instance this class provides a sub-thread for handling incoming files in the MIME box directory. The actual handling of a dropped file is handled by the classes `x2go.mimeboxactions.X2GoMIMEboxActionOPEN`, `x2go.mimeboxactions.X2GoMIMEboxActionOPENWITH` and `x2go.mimeboxactions.X2GoMIMEboxActionSAVEAS`.

  active_jobs = {}
  mimebox = None
  mimebox_action = None
  mimebox_history = []
  pause()

    Prevent acceptance of new incoming files. The processing of MIME box jobs that are currently still active will be completed, though.

  resume()

    Resume operation of the X2Go MIME box queue and continue accepting new incoming files.

  run()

    This method gets called once the `x2go.mimebox.X2GoMIMEboxQueue` thread is started by the `X2GoMIMEboxQueue.start()` method.

  set_mimebox_action(mimebox_action, **kwargs)

    Modify the MIME box action of this `x2go.mimebox.X2GoMIMEboxQueue` thread during runtime. The change of the MIME box action will be valid for the next incoming file in the MIME box directory.

    Parameters:

      - mimebox_action (`str` or `obj`) – the MIME box action to execute for incoming files

      - kwargs (`dict`) – extra options for the specified MIME box action

  stop_thread()

    Stops this `x2go.mimebox.X2GoMIMEboxQueue` thread completely.

x2go.mimebox.x2go_mimeboxjob_handler(mimebox_file=None, mimebox_extensions=[], mimebox_action=None, parent_thread=None, logger=None)

  This function is called as a handler function for each incoming X2Go MIME box file represented by the class `x2go.mimebox.X2GoMIMEboxJob`.

  Parameters:

    - mimebox_file (`str`) – MIME box file name as placed in to the X2Go MIME box spool directory (Default value = None)

    - mimebox_action (`X2GoMIMEboxActionXXX` nstance) – an instance of either of the possible `X2GoMIMEboxActionXXX` classes (Default value = None)

    - mimebox_extensions (`list`) – filter out files whose file extension is not in this list (Default value = [], means: no filtering)

    - parent_thread (`obj`) – the `x2go.mimebox.X2GoMIMEboxQueue` thread that actually created this handler’s `x2go.mimebox.X2GoMIMEboxJob` instance (Default value = None)

    - logger (`obj`) – the `x2go.mimebox.X2GoMIMEboxQueue`’s logging instance (Default value = None)