1 # -*- coding: utf-8 -*-
3 # (c) Copyright 2001-2008 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
25 from base import device, utils
26 from ui_utils import *
29 from PyQt4.QtCore import *
30 from PyQt4.QtGui import *
33 from nodevicesdialog_base import Ui_NoDevicesDialog_base
36 class NoDevicesDialog(QDialog, Ui_NoDevicesDialog_base):
37 def __init__(self, parent):
38 QDialog.__init__(self, parent)
44 self.connect(self.SetupButton, SIGNAL("clicked()"), self.SetupButton_clicked)
45 self.connect(self.CUPSButton, SIGNAL("clicked()"), self.CUPSButton_clicked)
46 self.connect(self.CloseButton, SIGNAL("clicked()"), self.CloseButton_clicked)
47 self.Icon.setPixmap(load_pixmap("warning", '32x32'))
50 def SetupButton_clicked(self):
53 if utils.which('hp-setup'):
56 cmd = 'python ./setup.py -u'
59 utils.run(cmd, log_output=True, password_func=None, timeout=1)
62 self.parent().rescanDevices()
64 QMessageBox.critical(self,
66 self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
72 def CUPSButton_clicked(self):
74 utils.openURL("http://localhost:631/admin")
77 def CloseButton_clicked(self):