1 # -*- coding: utf-8 -*-
3 # (c) Copyright 2001-2011 Hewlett-Packard Development Company, L.P.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # Authors: Amarnath Chitumalla
25 from base import device, utils, pkit
27 from base.codes import *
28 from ui_utils import *
29 from installer.core_install import CoreInstall
30 from installer.core_install import PLUGIN_INSTALL_ERROR_NONE, \
31 PLUGIN_INSTALL_ERROR_PLUGIN_FILE_NOT_FOUND, \
32 PLUGIN_INSTALL_ERROR_DIGITAL_SIG_NOT_FOUND, \
33 PLUGIN_INSTALL_ERROR_DIGITAL_SIG_BAD, \
34 PLUGIN_INSTALL_ERROR_PLUGIN_FILE_CHECKSUM_ERROR, \
35 PLUGIN_INSTALL_ERROR_NO_NETWORK, \
36 PLUGIN_INSTALL_ERROR_DIRECTORY_ERROR, \
37 PLUGIN_INSTALL_ERROR_UNABLE_TO_RECV_KEYS
40 from PyQt4.QtCore import *
41 from PyQt4.QtGui import *
44 from plugindiagnose_base import Ui_Dialog
48 class PluginDiagnose(QDialog, Ui_Dialog):
49 def __init__(self, parent, install_mode=PLUGIN_NONE, plugin_reason=PLUGIN_REASON_NONE, upgrade=False):
50 QDialog.__init__(self, parent)
51 self.install_mode = install_mode
52 self.plugin_reason = plugin_reason
53 self.plugin_path = None
55 self.core = CoreInstall()
56 self.core.set_plugin_version()
57 self.setupUi(self, upgrade)
59 self.user_settings = UserSettings()
60 self.user_settings.load()
61 self.user_settings.debug()
69 # connect signals/slots
70 self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
71 self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
74 self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
77 def PathLineEdit_textChanged(self, t):
78 self.plugin_path = unicode(t)
79 self.setPathIndicators()
86 def displayPage(self, page):
87 self.updateStepText(page)
88 self.StackedWidget.setCurrentIndex(page)
90 def CancelButton_clicked(self):
94 def NextButton_clicked(self):
95 self.NextButton.setEnabled(False)
96 self.CancelButton.setEnabled(False)
98 plugin = PLUGIN_REQUIRED
99 plugin_reason = PLUGIN_REASON_NONE
100 ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
102 if not ok or self.core.check_for_plugin() != PLUGIN_INSTALLED:
103 FailureUI(self, self.__tr("Failed to install Plug-in.\nEither you have chosen to skip the Plug-in installation or entered incorrect Password."))
111 def __tr(self,s,c = None):
112 return qApp.translate("PluginDialog",s,c)