Package x2go :: Package backends :: Package printing :: Module _file :: Class X2GoClientPrintingFILE

[frames] | no frames]

# Class X2GoClientPrintingFILE

source code

              object --+
                       |
    inifiles.X2GoIniFile --+
                           |
                          X2GoClientPrintingFILE

X2GoClientPrintingFILE provides access to the X2Go ini-like file »printing« as stored in `~/.x2goclient/printing` resp. globally `/etc/x2goclient/printing`.

An instance of X2GoClientPrintingFILE is created on each incoming print job. This facilitates that on every print job the print action for this job is derived from the »printing« configuration file.

Thus, changes on the file are active for the next incoming print job.

Instance Methods

__init__(self, config_files=`[``'``/home/buildd/.x2goclient/printing``'``,` `'``/etc/x2goclient/printing``'``]`, defaults=None, client_instance=None, logger=None, loglevel=56) x.__init__(...) initializes x; see help(type(x)) for signature | source code

`obj` or `str`

get_print_action(self, reload=False, reinit=False, return_name=False) Return the print action described by the »printing« configuration file. | source code

`str`

get_property(self, print_property) Retrieve a printing property as mapped by the _print_property_map dictionary. | source code

`str`

set_property(self, print_property, value) Set a printing property as mapped by the _print_property_map dictionary. | source code

store_print_action(self, print_action, **print_properties) Accept a new print action configuration. | source code

Inherited from `inifiles.X2GoIniFile`: `__call__`, `__repr__`, `get`, `get_type`, `get_value`, `load`, `update_value`, `write` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| config_files = ``[``]``
| defaultValues = ``{``'``CUPS``'``:` `{``'``defaultprinter``'``:` `'``PDF``'``}``,` `'``General``'``:``...``
Inherited from `inifiles.X2GoIniFile`: `user_config_file`, `write_user_config`

Properties
| print_action Return the print action described by the »printing« configuration file.
Inherited from `inifiles.X2GoIniFile`: `printable_config_file` Inherited from `object`: `__class__`

Method Details

### __init__(self, config_files=`[``'``/home/buildd/.x2goclient/printing``'``,` `'``/etc/x2goclient/printing``'``]`, defaults=None, client_instance=None, logger=None, loglevel=56)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `config_files` (`list`) - a list of configuration files names (e.g. a global filename and a user's home directory filename)
  - `defaults` (`dict`) - a cascaded Python dicitionary structure with ini file defaults (to override Python X2Go's hard coded defaults in defaults
  - `logger` (`obj`) - you can pass an X2GoLogger object to the X2GoPrintAction constructor
  - `loglevel` (`int`) - if no X2GoLogger object has been supplied a new one will be constructed with the given loglevel
Overrides: object.__init__

### get_print_action(self, reload=False, reinit=False, return_name=False)

source code

Return the print action described by the »printing« configuration file.

Parameters:
  - `reload` (`bool`) - reload the configuration file before retrieving the print action?
  - `reinit` (`bool`) - re-detect the print action from what is stored in cache?
  - `return_name` (`bool`) - return the print action name, not the class
Returns: `obj` or `str`
  the configured print action

### get_property(self, print_property)

source code

Retrieve a printing property as mapped by the _print_property_map dictionary.

Parameters:
  - `print_property` (`str`) - a printing property
Returns: `str`
  the stored value for `<print_property>`
Raises:
  - `X2GoClientPrintingException` - if the printing property does not exist

### set_property(self, print_property, value)

source code

Set a printing property as mapped by the _print_property_map dictionary.

Parameters:
  - `print_property` (`str`) - a printing property
  - `value` - the value to be stored as `<print_property>`
Returns: `str`
Raises:
  - `X2GoClientPrintingException` - if the printing property does not exist or if there is a type mismatch

### store_print_action(self, print_action, **print_properties)

source code

Accept a new print action configuration. This includes the print action itself (DIALOG, PDFVIEW, PDFSAVE, PRINT or PRINTCMD) and related printing properties as mapped by the _print_property_map dictionary.

Parameters:
  - `print_action` (`str`) - the print action name
  - `print_properties` (`dict`) - the printing properties to set for the given print action

Class Variable Details

### defaultValues

Value:

      {'CUPS': {'defaultprinter': 'PDF'},
       'General': {'pdfview': True, 'showdialog': False},
       'print': {'command': 'lpr',
                 'ps': False,
                 'startcmd': False,
                 'stdin': False},
       'save': {'folder': 'PDF'},
       'view': {'command': 'xpdf', 'open': True}}

Property Details

### print_action

Return the print action described by the »printing« configuration file.

This method has property status and wraps around the get_print_action method.

Get Method:
  unreachable.print_action(self) - Return the print action described by the »printing« configuration file.