OpenPrinting / system-config-printer

Graphical user interface for CUPS administration
GNU General Public License v2.0
160 stars 88 forks source link

Setting personal default printer #133

Closed AHeinlein closed 4 years ago

AHeinlein commented 5 years ago

Until at least the version contained in Debian 8 (1.4.6), it was possible to set a remote shared printer as a personal default. This is different from a system default and requires no admin privileges, it sets the default printer in ~/.cups/lpoptions. It seems that this does not work in Debian 9 (system-config-printer 1.5.7) anymore. The context menu item for this is grayed out - in fact everything is grayed out except for "Show printer queue". If I set the default printer manually with 'lpoptions -d', then system-config-printer reflects that change with a star. I don't know if this has anything to do with the way the printers are shared - all printers are manually configured on a central print server, which is using the legacy cups browsing protocol to share out the printers to the clients.

AHeinlein commented 4 years ago

Unfortunately, I got no answer. I tried to debug the problem myself.

I found this in system-config-printer.py:

userdef = userdefault.UserDefaultPrinter ().get ()

if (n != 1 or
            (userdef is None and self.default_printer == name)):
            set_default_sensitivity = False
        else:
            set_default_sensitivity = True
        self.ui_manager.get_action ("/set-default-printer").set_sensitive (
            set_default_sensitivity)

This is part of the function dests_iconview_selection_changed (self, iconview)

I guess this is intended to enable the context menu item "Set as default" when exactly one printer is selected ("n != 1"). Unfortunately, from my debugging runs, that function is called only once on startup (with n == 0, obviously) and then never again.

If I force that menu item to be enabled by setting self.ui_manager.get_action ("/set-default-printer").set_sensitive ( True)

then that menu item works as expected.

This is no real solution, of course, but if someone could find out why that function is not called when it ought to, this bug could probably be fixed.

zdohnal commented 4 years ago

Hi, it could be connected to https://github.com/apple/cups/issues/5684 and https://github.com/apple/cups/issues/5683