208. Printer

Module for printer.

208.1. Summary of Module Globals

List of Global Functions

List of Global Variables

  • autodetected - List of autodetected printers. For documentation see yast2-lib-printer.

  • conf_detected - Configuring printer, which is result of detection?

  • confmode - Current mode of configuration `det for configuring from detected printers dialog `adm for configuring from printer administration dialog

  • connection_subtype_selected - Selected item from 2nd-level connection type dialog

  • connection_type_selected - Selected item from main connection type dialog

  • default_queue - Default queue name

  • deleted - List of printers that were deleted during this configuration session.

  • detect - Shall be printers detected If nil, ask user

  • detection - Type of start, true if autodetection

  • dirty - Were settings changed?

  • hp_driver - Driver (backend) for HP all-in-one devices, one of "ptal" and "hp"

  • index - Index of printer we are working with.

  • inform_about_config - Inform user that using different driver may be possible

  • printcap - List of print queues. See description of map printer for members structure.

  • printcap_backup - Backup list of print queues. See description of map printer for members structure.

  • printer - Print queue we are currently working with.

  • read_done - Were settings read?

  • runAutoprobedListDialog__current - Selected item of the list of detected printers

  • save_all - Has to be saved all?

  • skip_autodetection - True if autodetection should be skipped

  • tested - At least one queue has been tested - because of hw proposal

  • version - Version of YaST2 printer module for updates handling

  • write_only - Don't run SuSEconfig, don't restart services if true and possible

208.2. Global Functions

208.2.1. DeletedNames

get list of names of deleted printers.

Return value

  • list - List of names.

208.2.2. Detect

Autodetect printers.

Return value

  • list<map<string,any> > - autodetected printers

208.2.3. Export

Export module settings to map.

Return value

  • map<string, any> - Map of module settings.

208.2.4. Import

Import module settings.

Function parameters

  • map<string, any> settings

Return value

  • void

208.2.5. Propose

Autoconfigure all printers that haven't been configured yet.

Return value

  • void

208.2.6. Read

Read settings from disk or where.

Return value

  • boolean - success?

208.2.7. Reset

Reset all settings...

Return value

  • void

208.2.8. SaveQueue

Save queue

Function parameters

  • map<string,any> queue

Return value

  • boolean - sucefully save

208.2.9. Summary

Creates summary from autodetected printers and printcap.

Function parameters

  • list style

Return value

  • string - summary string

208.2.10. Write

Write settings.

Return value

  • boolean - success state

208.2.11. addToDeleted

Adds a queue to the deleted list

Function parameters

  • string name

  • string printer_type

Return value

  • void

208.2.12. adjustQueueName

Check if queue name is OK. Otherwise adds number at the end.

Function parameters

  • string name

  • list forbidden_names

Return value

  • string - new queue name.

208.2.13. alreadyConfigured

Has the printer been already configured?

Function parameters

  • string uk

Return value

  • boolean - true or false

208.2.14. assignDefault

Set implicit default queue if no queue is set as default

Return value

  • void

208.2.15. assignState

Assign states to a printer

Function parameters

  • map<string,any> p

  • boolean changed

Return value

  • map<string,any> - a map printer with assigned states

208.2.16. checkGhostscript

Check if GhostScript is installed

Return value

  • boolean - true if is installed

208.2.17. checkSpooler

Detect spooler currently in use

Return value

  • boolean - true on success

208.2.18. cupsRead

Read the CUPS settings.

Return value

  • list<map<string,any> > - a list of printers

208.2.19. deleteDeletedPrinters

Delete printers marked for being deleted

Return value

  • boolean - true on success

208.2.20. deletePrinter

Delete currently selected printer.

Return value

  • void

208.2.21. doPrinterDetection

Check if it is safe, ask user if needed, and detect local printers

Return value

  • boolean - true on success TODO error checking

208.2.22. editDetected

Prepare detected printer to be configured.

Function parameters

  • map det

Return value

  • void

208.2.23. fixPrinter

Add unpresent entries into a map

Function parameters

  • map<string,any> p

Return value

  • map<string,any> - modified map

208.2.24. generateClassName

generate class name

Function parameters

  • list forbidden_names

Return value

  • string - new class name

208.2.25. generateQueueName

TODO: create test case

Function parameters

  • string name

  • string uri

  • string vendor_name

  • string device_name

  • list<string> forbidden_names

Return value

  • string - new queue name

208.2.26. getArgsOfType

separates from config map only values of specified type

Function parameters

  • map config

  • string type

Return value

  • map - of selected values

208.2.27. getForbiddenNames

Return list(set) of names that can not be used as printer name. There can be same name for more printers in /etc/printcap. It was impossible to add printer, because all names were invalid because size (union (forbidden_names, new_names)) != size (forbidden_names) + size (new_names).

Return value

  • list<string> - a list of already used names

208.2.28. getQueueSuffix

Get the suffix for the queue name.

Function parameters

  • list<map<string,any> > queues

Return value

  • string - suffix

208.2.29. queuesRead

Old read function, called from new Read function TODO: better integrate TODO: error handling

Return value

  • boolean - true on success

208.2.30. saveDefaultQueue

Save default queue to appropriate location

Return value

  • boolean - true on success

208.2.31. savePrinters

Save all queues

Return value

  • boolean - true on success

208.2.32. selectPrinter

Select printer to edit or something.

Function parameters

  • integer i

Return value

  • void

208.2.33. selectPrinterByName

Let print queue named name be currently edited. If printer is not found, then queue will be $[] and index -1

Function parameters

  • string name

Return value

  • void

208.2.34. setDefaultPrinter

Set current printer as default printer

Return value

  • void

208.2.35. setUniqueKeys

Set unique keys after configuration reading

Return value

  • void

208.2.36. sortPrinters

Sorts entries of printcap

Return value

  • void

208.2.37. spoolerSpecQueuesRead

Read queues set for spooler

Return value

  • list<map<string,any> > - a list of queues

208.2.38. stateRead

Read the contents of /var/lib/YaST2/printers

Return value

  • boolean - true on success TODO error handling

208.2.39. storePrinter

Save currently edited printer.

Return value

  • void

208.2.40. testAbort

Test for abort.

Return value

  • boolean - true if abort was pressed

208.2.41. updateConfig

Update configuration if cfg. saved by previous version

Function parameters

  • integer read_version

Return value

  • void

208.2.42. wipePrinter

deletes printers

Function parameters

  • map printer

Return value

  • boolean - success state

208.3. Global Variables

208.3.1. autodetected

List of autodetected printers. For documentation see yast2-lib-printer.

208.3.2. conf_detected

Configuring printer, which is result of detection?

208.3.3. confmode

Current mode of configuration `det for configuring from detected printers dialog `adm for configuring from printer administration dialog

208.3.4. connection_subtype_selected

Selected item from 2nd-level connection type dialog

208.3.5. connection_type_selected

Selected item from main connection type dialog

208.3.6. default_queue

Default queue name

208.3.7. deleted

List of printers that were deleted during this configuration session.

208.3.8. detect

Shall be printers detected If nil, ask user

208.3.9. detection

Type of start, true if autodetection

208.3.10. dirty

Were settings changed?

208.3.11. hp_driver

Driver (backend) for HP all-in-one devices, one of "ptal" and "hp"

208.3.12. index

Index of printer we are working with.

208.3.13. inform_about_config

Inform user that using different driver may be possible

208.3.14. printcap

List of print queues. See description of map printer for members structure.

208.3.15. printcap_backup

Backup list of print queues. See description of map printer for members structure.

208.3.16. printer

Print queue we are currently working with.

208.3.17. read_done

Were settings read?

208.3.18. runAutoprobedListDialog__current

Selected item of the list of detected printers

208.3.19. save_all

Has to be saved all?

208.3.20. skip_autodetection

True if autodetection should be skipped

208.3.21. tested

At least one queue has been tested - because of hw proposal

208.3.22. version

Version of YaST2 printer module for updates handling

208.3.23. write_only

Don't run SuSEconfig, don't restart services if true and possible

208.4. Module Requirements

208.4.1. Module Imports

  • Arch
  • CUPS
  • Confirm
  • Crash
  • HTML
  • Inetd
  • Label
  • Message
  • Mode
  • Package
  • PackageSystem
  • Popup
  • Printerdb
  • Printerlib
  • Progress
  • Report
  • Service
  • Spooler
  • Stage
  • String
  • SuSEFirewall
  • Summary
  • URL
  • URL

208.4.2. Module Includes