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?

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 printer_auto_summary -> string

Used by AutoYaST by calling in printer_auto.ycp the "Summary" function.

global printer_auto_modified -> boolean

Set to 'true' by AutoYaST by calling in printer_auto.ycp the "SetModified" function. Read by AutoYaST by calling in printer_auto.ycp the "GetModified" function. Preset to false which is the right default for AutoYast.

global autoyast_printer_settings -> map

Filled in by AutoYaST by calling in printer_auto.ycp the "Import" function. Reset to the empty map by AutoYaST by calling in printer_auto.ycp the "Reset" function. Preset to the empty map.

global printer_auto_dialogs -> boolean

Set to 'true' by AutoYaST by calling in printer_auto.ycp the "Change" function. Lets the Overview dialog disable the checkbox to show local queues which disables as a consequence in particular the [Delete] button. Lets the Printing via Network dialog disable the button to run the Connection Wizard (to set up a local queue for a network printer). Preset to false which is the right default for all dialogs.

global printer_auto_requires_cupsd_restart -> boolean

Set to 'true' by AutoYaST when in printer_auto.ycp the "Reset" function resets /etc/cups/cupsd.conf and /etc/cups/client.conf to system defaults. When it is 'true', the "Change" function in printer_auto.ycp does a cupsd restart. Preset to false.

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 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. 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 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":"one of 'direct','network','file','serial' or 'ConnectionWizardDialog' (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 current_device_uri -> string

Current device uri: The device uri (i.e. the connection) which is currently in use so that the BasicAddDialog and BasicModifyDialog could preselect it. Note that selected_connections_index cannot be used for this because the ConnectionItems function which generates the list of connections for BasicAddDialog and BasicModifyDialog invalidates selected_connections_index because it autodetects the currently available connections in the system anew because those would change e.g. after a printer was connected or disconnected Preset to "" which indicates that no device uri is currently in use.

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

Autodetected queues: Determined at runtime via 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":"'local' if the queue exists in /etc/cups/printers.conf, 'class' if the class exists in /etc/cups/classes.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: Both boolean variables queue_filter_show_local and queue_filter_show_remote can be either 'true' or 'false' depending on which kind of queues from the queues list (of queue maps) the user wants to see in the overview dialog. Both are preset to 'true' which indicates that all queues are shown.

global current_queue_name -> string

Current queue name: The name of the queue which is currently in use so that the Overview dialog could preselect it. Note that selected_queues_index cannot be used for this because the QueueItems function which generates the list of queues for the Overview dialog invalidates selected_queues_index because it autodetects the current actual queues in the system anew because the list of queues in the system would have changed e.g. after a new queue was added or after a queue was removed. Preset to "" which indicates that no queue is currently in use.

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

Driver options (options in the PPD for one specific existing queue): Determined at runtime via 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 DeriveModelName (string description, integer max_words) -> string

Derive a reasonable model info from an arbitrary description string.

Parameters:
description
max_words
Return value:
(possibly the empty string)
global DeriveDriverFilterString (string driver_filter_input_text) -> string

Derive a reasonable driver_filter_string from an arbitrary driver_filter_input_text.

Parameters:
driver_filter_input_text
Return value:
(possibly the empty string)
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 BasicModifyDialog. This function is also called in connectionwizard.ycp and in printer_proposal.ycp.

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 TestClientOnlyServer (string server_name, boolean fail_if_executable_is_missing) -> boolean

Test whether or not a "client-only" server is accessible.

Parameters:
server_name string of the "client-only" server name
fail_if_executable_is_missing boolean which lets this function fail if netcat, ping, or host are not executable (e.g. because of not installed packages)
Return value:
false if the "client-only" server is not accessible.
global RunHpsetup () -> boolean

Run hp-setup:

Return value:
false if hp-setup cannot be run and return true in any other case because there is no usable exit code of hp-setup (always zero even in case of error).