2
# -*- coding: utf-8 -*-
4
# (c) Copyright 2011 Hewlett-Packard Development Company, L.P.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
# Author: Amarnath Chitumalla, Suma Byrappa
24
__mod__ = 'hp-diagnose_plugin'
25
__title__ = 'Plugin Download and Install Utility'
38
from base import utils, module
40
USAGE = [ (__doc__, "", "name", True),
41
("Usage: %s [OPTIONS]" % __mod__, "", "summary", True),
43
utils.USAGE_LOGGING1, utils.USAGE_LOGGING2, utils.USAGE_LOGGING3,
47
("hp-plugin", "", "seealso", False),
48
("hp-setup", "", "seealso", False),
49
("hp-firmware", "", "seealso", False),
53
mod = module.Module(__mod__, __title__, __version__, __doc__, USAGE,
54
(INTERACTIVE_MODE, GUI_MODE),
55
(UI_TOOLKIT_QT3, UI_TOOLKIT_QT4), True)
57
opts, device_uri, printer_name, mode, ui_toolkit, loc = \
58
mod.parseStdOpts( handle_device_printer=False)
61
install_mode = PLUGIN_REQUIRED
62
plugin_reason = PLUGIN_REASON_NONE
65
if ui_toolkit == 'qt3':
66
log.error("Unable to load Qt3. Please use Qt4")
69
if not utils.canEnterGUIMode4():
70
log.error("%s requires GUI support . Is Qt4 installed?" % __mod__)
74
from PyQt4.QtGui import QApplication, QMessageBox
75
from ui4.plugindiagnose import PluginDiagnose
76
from installer import core_install
78
log.error("Unable to load Qt4 support. Is it installed?")
81
app = QApplication(sys.argv)
82
core = core_install.CoreInstall(core_install.MODE_CHECK)
83
plugin_sts = core.check_for_plugin()
84
if plugin_sts == PLUGIN_INSTALLED:
85
log.info("Device Plugin is already installed")
87
elif plugin_sts == PLUGIN_VERSION_MISMATCH:
88
dialog = PluginDiagnose(None, install_mode, plugin_reason, True)
90
dialog = PluginDiagnose(None, install_mode, plugin_reason)
94
log.debug("Starting GUI loop...")
96
except KeyboardInterrupt:
97
log.error("User exit")
99
else: #Interaction mode
100
log.error("Only Qt4 GUI mode is supported \n")