adeuring at gmx.net
Fri Jun 30 08:13:38 WST 2006
abel deuring wrote:
> Hi all,
> next problem with gnomeprint: Since I am using an obviously too old
> version of Gnome to mix threading and printer dialogs, I thought
> that I could give it a try to show the printer dialog in a separate
> gnomeprint.Config.to_string and gnomeprint.config_from_string can be
> used to pass data between parent and child process -- but this
> results in a new problem:
Some more information.
Firstly, the same problem occurs with
gnome-python-extras-2.9.4/examples/gnomeprint/example_09.py. (read a
printer config file; present a print dialog; write a new config
file). If anything except the two "default" entries, Generic
Postscript or PDF writer is selected, the next run of the script
can't create the the configuration from the XML file.
Playing with gdb and looking aorund in the C sources, I came so far:
On startup, gnomeprint (the C version, not Python) reads "only" two
standard printer descriptions from XML files: GENERIC.xml and
PDF-WRITER.xml (no other descriptions exist). When
gnome_print_config_from_string is called with a description for a
"real" printer, gpa_model_hash_lookup is called to check, if the
printer is already known. Since it is not, the creation of the
configuration fails (more exactly, the default config is returned).
When a print dialog is shown, at least the local Cups server (I
don't have more machines installed here ;) is asked for a list of
printers, and the dialog can present everything installed. This also
means that the list of known printer models (and whatever else)
becomes longer, and a new call of gnome_print_config_from_string /
gnomeprint.config_from_string with a configuration for a "real"
Now, one possible use case of a printer config file is that one does
not need to bother a user every time a program is started to select
his/her preferred printer setup -- my idea is to use the
configuration from the last run. On the other hand, it makes of
course sense to not ask the Cups server during program startup,
because it may take some time.
My current problems/questions are: (1) where and how exactly does
the print dialog extend the list of known printers, and (2) how can
I do that from Python without creating and running this dialog?
Or is this issue fixed in newer versions of gnomeprint?
More information about the pygtk