Unknown YCP Module |
This module has an unstable interface. |
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 $
Prototypes
Data was modified?
Abort function return boolean return true if abort
Abort function
- Return value:
-
return true if abort
Data was modified?
- Return value:
-
true if modified
Used by AutoYaST by calling in printer_auto.ycp the "Summary" function.
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.
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.
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.
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.
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 explicitly listed to avoid any unexpected result e.g. of "tolower(uppercase_characters)".
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.
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)" ]
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.
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)" ]
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.
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.
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)" ]
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.
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.
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.
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)" ]
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
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
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
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
Initialize printer configuration (checks only the installed packages) see http://en.opensuse.org/Archive:YaST_Printer_redesign#Basic_Implementation_Principles: for background information
- Return value:
-
true on success
Finish printer configuration (does actually nothing except to exit verbosely) see http://en.opensuse.org/Archive:YaST_Printer_redesign#Basic_Implementation_Principles: for background information
- Return value:
-
true in any case (because it only exits)
Derive a reasonable model info from an arbitrary description string.
- Parameters:
-
description max_words
- Return value:
-
(possibly the empty 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)
Create a valid new queue name.
- Parameters:
-
proposal string from which a valid new queue name is derived.
Create the list of queues for the Table in the OverviewDialog
- Parameters:
-
local remote
- Return value:
-
table items
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)
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)
Add new queue or overwrite existing queue
- Parameters:
-
queue_name is_default_queue default_paper_size
- Return value:
-
true on success
Delete queue
- Parameters:
-
queue_name
- Return value:
-
true on success
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
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.
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).