Exemple #1
0
        extra_options=[("Startup even if no hplip CUPS queues are present:", "-x or --force-startup", "option", False)])

    opts, device_uri, printer_name, mode, ui_toolkit, lang = \
        mod.parseStdOpts('x', ['force-startup'], False)

    force_startup = False
    for o, a in opts:
        if o in ('-x', '--force-startup'):
            force_startup = True

    if os.getuid() == 0:
        log.error("hp-systray cannot be run as root. Exiting.")
        sys.exit(1)

    if ui_toolkit == 'qt3':
        if not utils.canEnterGUIMode():
            log.error("%s requires Qt3 GUI and DBus support. Exiting." % __mod__)
            sys.exit(1)
    
    else:
        if not utils.canEnterGUIMode4():
            log.error("%s requires Qt4 GUI and DBus support. Exiting." % __mod__)
            sys.exit(1)

    if not force_startup:
        # Check for any hp: or hpfax: queues. If none, exit
        if not utils.any([p.device_uri for p in cups.getPrinters()], lambda x : x.startswith('hp')):
            log.warn("No hp: or hpfax: devices found in any installed CUPS queue. Exiting.")
            sys.exit(1)

    mod.lockInstance()
Exemple #2
0
except IndexError:
    param = ''

log.debug("param=%s" % param)
if printer_name is not None:
   selected_device_name = printer_name
else:
   if fax_name is not None:
      selected_device_name = fax_name
log.debug("selected_device_name=%s" % selected_device_name)

if mode == GUI_MODE:
    if selected_device_name is not None:
        log.warning("-p or -f option is not supported")
    if ui_toolkit == 'qt3':
        if not utils.canEnterGUIMode():
            log.error("%s requires GUI support (try running with --qt4). Also, try using interactive (-i) mode." % __mod__)
            clean_exit(1)
    else:
        if not utils.canEnterGUIMode4():
            log.error("%s requires GUI support (try running with --qt3). Also, try using interactive (-i) mode." % __mod__)
            clean_exit(1)

if mode == GUI_MODE:
    if ui_toolkit == 'qt3':
        try:
            from qt import *
            from ui import setupform
        except ImportError:
            log.error("Unable to load Qt3 support. Is it installed?")
            clean_exit(1)