YaST2 Developers Documentation: Unknown YCP Module

Unknown YCP Module

This module has an unstable interface.

Imports

  • Popup
  • Printerlib
  • Progress
  • Summary

Structures

Global Variables

Global Functions

Local Functions

Info:

File: modules/Printer.ycp Package: Configuration of printer Summary: Printer settings, input and output functions Authors: Johannes Meixner

$Id: Printer.ycp 27914 2006-02-13 14:32:08Z locilka $

global Modified () -> boolean

Prototypes

global modified -> boolean

Data was modified?

global proposal_valid -> boolean

global write_only -> boolean

Write only, used during autoinstallation. Don't run services and SuSEconfig, it's all done at one place.

Info:

Abort function return boolean return true if abort

global Abort () -> boolean

Abort function

Return value:
return true if abort
global Modified () -> boolean

Data was modified?

Return value:
true if modified
global number_chars -> string

Explicite listing of all alphanumeric ASCII characters. The reason is that in certain special locales for example [a-z] is not equivalent to "abcdefghijklmnopqrstuvwxyz" because in certain special languages the 'z' is not the last character in the alphabet, e.g. the Estonian alphabet ends with ... s ... z ... t u v w ... x y (non-ASCII characters omitted here) so that [a-z] would exclude t u v w x y in an Estonian locale. Therefore uppercase and lowercase characters are both explicitely listed to avoid any unexpected result e.g. of "tolower(uppercase_characters)".

global known_manufacturers -> list< string >

Explicite listing of all known manufacturers in a standard installation which one gets as output from the command lpinfo -l -m | grep make-and-model | cut -s -d '=' -f 2 | cut -s -d ' ' -f 2 | sort -f -u and then a bit changing it (in particular removing duplicates and nonsense entries). The current list was made on openSUSE 11.0.

global ppds -> list< map< string, string > >

PPD database: the database is created anew in Printer::CreateDatabase() which calls the bash script "/usr/lib/YaST2/bin/create_ppd_database" which outputs on stdout a YCP list of printer_ppd_map where the last list entry is an emtpy map. Printer::CreateDatabase() leaves manufacturer and modelname empty because it would take several minutes (instead of a few seconds) to fill them up (see the comments in create_ppd_database). Both fields can be filled up during runtime for particular PPDs (e.g. for a more detailed PPD selection among several PPDs which match to a particular model or manufacturer but not for all the thousands of PPDs which are installed in the system).

Structure printer_ppd_map

 $[ "ppd":"the PPD file name with path below /usr/share/cups/model/ (required)",
    "nickname":"the NickName entry in the PPD (required)",
    "deviceID":"the 1284DeviceID entry in the PPD (may be the empty string)",
    "language":"the language of the PPD, usually "en" (may be the empty string)",
    "manufacturer":"the Manufacturer entry in the PPD (initially the empty string)",
    "modelname":"the ModelName entry in the PPD (initially the empty string)"
  ]
global selected_ppds_index -> integer

Selected PPD database index: The index in the PPD database list (of PPD maps) for the PPD which was selected by the user. Preset to -1 which indicates that no PPD is selected.

global connections -> list< map< string, string > >

Autodetected printers: Determined at runtime via Printer::AutodetectPrinters() which calls the bash script "/usr/lib/YaST2/bin/autodetect_printers" which outputs on stdout a YCP list of autodetected_printer_map where the last list entry is an emtpy map.

Structure autodetected_printer_map

 $[ "uri":"the full CUPS DeviceURI (required)",
    "model":"the manufacturer and model, often "Unknown" (may be the empty string)",
    "deviceID":"what the printer reported as its device ID (often the empty string)",
    "info":"arbitrary info regarding this connection (may be the empty string)",
    "class":"the kind of connection, e.g. "direct","network","file" (may be the empty string)"
  ]
global selected_connections_index -> integer

Selected autodetected printer index: The index in the autodetected printers list (of connection maps) for the connection which was selected by the user. Preset to -1 which indicates that no connection is selected.

global queues -> list< map< string, string > >

Autodetected queues: Determined at runtime via Printer::AutodetectQueues() which calls the bash script "/usr/lib/YaST2/bin/autodetect_print_queues" which outputs on stdout a YCP list of autodetected_queue_map where the last list entry is an emtpy map.

Structure autodetected_queue_map

 $[ "name":"the queue name (required)",
    "uri":"the full CUPS DeviceURI (required)",
    "description":"(may be the empty string)",
    "location":"(may be the empty string)",
    "ppd":"/etc/cups/ppd/<queue-name>.ppd (may be the empty string)",
    "default":"'yes' if it is a DefaultPrinter in /etc/cups/printers.conf, otherwise the empty string",
    "disabled":"'yes' if printing is disabled, otherwise 'no'",
    "rejecting":"'yes' if print job are rejected, otherwise 'no'",
    "config":"either 'local' if the queue exists in /etc/cups/printers.conf, otherwise 'remote' (required)"
  ]
global selected_queues_index -> integer

Selected queue index: The index in the queues list (of queue maps) for the queue which was selected by the user. Preset to -1 which indicates that no queue is selected.

global queue_filter_show_local -> boolean

Queue filter string: Can be either "all" or "local" or "remote" depending on which kind of queues from the queues list (of queue maps) the user wants to see in the overview dialog. Preset to "all" which indicates that all queues are shown.

global driver_options -> list< map< string, any > >

Driver options (options in the PPD for one specific existing queue): Determined at runtime via Printer::DetermineDriverOptions( "queue_name") which calls the bash script "/usr/lib/YaST2/bin/determine_printer_driver_options" which outputs on stdout a YCP list of driver_option_map where the last list entry is an emtpy map.

Structure driver_option_map

 $[ "keyword":"the main keyword of the option in the PPD (required)",
    "translation":"the translation string of the main keyword (may be the empty string)",
    "values":["a list of the option keywords in the PPD (at least one non-empty entry is required)
               i.e. the values for the main keyword (i.e. the values for this option)
               where the currently set option value of the queue is marked by a leading '*'
               and where the last list entry is an emtpy string"],
    "selected":"the curently selected value in the DriverOptionsDialog (may be the empty string)"
  ]
local CreateDatabase () -> boolean

Create the PPD database by calling a bash script which calls "lpinfo -l -m" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of printer_ppd_map

Return value:
true on success
local AutodetectPrinters () -> boolean

Try to autodetect printers by calling a bash script which calls "lpinfo -l -v" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of autodetected_printer_map

Return value:
true on success
global AutodetectQueues () -> boolean

Autodetect queues by calling a bash script which calls "lpstat -v" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of autodetected_queue_map

Return value:
true on success
global DetermineDriverOptions (string queue_name) -> boolean

Determine driver options by calling a bash script which calls "lpoptions -l" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of autodetected_queue_map

Parameters:
queue_name
Return value:
true on success
global Read () -> boolean

Initialize printer configuration (checks only the installed packages) see http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementation_Principles: for background information

Return value:
true on success
global Write () -> boolean

Finish printer configuration (does actually nothing except to exit verbosely) see http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementation_Principles: for background information

Return value:
true in any case (because it only exits)
global NewQueueName (string proposal) -> string

Create a valid new queue name.

Parameters:
proposal string from which a valid new queue name is derived.
global QueueItems (boolean local, boolean remote) -> list

Create the list of queues for the Table in the OverviewDialog

Parameters:
local
remote
Return value:
table items
global ConnectionItems (string connection_filter_string) -> list

Create a list of items from the autodetected connections which is used for the SelectionBox in the BasicAddDialog and SelectConnectionDialog

Parameters:
connection_filter_string string of a search string to return only matching connections (return all connections if connection_filter_string is the empty string)
Return value:
of connections (i.e. DeviceURI, model, and info of the "lpinfo -l -v" output)
global DriverItems (string driver_filter_string, boolean preselection) -> list

Create a list of items from the PPD database entries which is used for the SelectionBox in the BasicAddDialog and SelectDriverDialog

Parameters:
driver_filter_string string of a search string to return only matching PPDs (return all PPDs if driver_filter_string is the empty string)
preselection
Return value:
of drivers (i.e. the NickName entries of the PPDs)
global AddQueue (string queue_name, string default_paper_size) -> boolean

Add new queue or overwrite existing queue

Parameters:
queue_name
default_paper_size
Return value:
true on success
global DeleteQueue (string queue_name) -> boolean

Delete queue

Parameters:
queue_name
Return value:
true on success
global DriverOptionItems (string selected_keyword, string selected_value) -> list

Create a list of tree widget items from the driver_options which is used for the tree widget in the DriverOptionsDialog

Parameters:
selected_keyword string of an already selected keyword to have the matching values list opened by default in the tree
selected_value string of a selected value which matches to the selected_keyword string to show this value in the tree (which might be different than the value of the queue)
Return value:
of driver options items for a tree widget
global Import (map settings) -> boolean

Get all printer settings from the first parameter (For use by autoinstallation.)

Parameters:
settings The YCP structure to be imported.
Return value:
True on success
global Export () -> map

Dump the printer settings to a single map (For use by autoinstallation.)

Return value:
Dumped settings (later acceptable by Import ())
global AutoPackages () -> map

Return packages needed to be installed and removed during Autoinstallation to insure module has all needed software installed.

Return value:
with 2 lists.