Tizen 2.1 base
[platform/upstream/hplip.git] / ui / setupmanualfind.py
1 # -*- coding: utf-8 -*-
2 #
3 # (c) Copyright 2001-2007 Hewlett-Packard Development Company, L.P.
4 #
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.
9 #
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.
14 #
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
18 #
19 # Author: Don Welch
20 #
21
22 from base.g import *
23
24 from qt import *
25 from setupmanualfind_base import SetupManualFind_base
26
27 class SetupManualFind(SetupManualFind_base):
28     def __init__(self, bus, parent=None, name=None, modal=0, fl = 0):
29         SetupManualFind_base.__init__(self, parent, name, modal, fl)
30         self.bus = bus
31         self.param = ''
32
33         if self.bus == 'net':
34             self.findHeadingText.setText(self.__tr("""Please enter the printer's network hostname or IP address."""))
35             self.hintTextLabel.setText(self.__tr("""<i>(IPv4 address "a.b.c.d" or "hostname".)</i>"""))
36             self.findTextLabel.setText(self.__tr("""Hostname or IP Address:"""))
37
38         elif self.bus == 'usb':
39             self.findHeadingText.setText(self.__tr("""Please enter the USB ID for the printer."""))
40             self.hintTextLabel.setText(self.__tr("""<i>("xxx:yyy" where xxx is the USB bus ID and yyy is the USB device ID. The ':' and all leading zeroes must be present. Use 'lsusb' to determine this information.)</i>"""))
41             self.findTextLabel.setText(self.__tr("""USB ID:"""))
42             self.findLineEdit.setInputMask("000:000;0")
43
44         elif self.bus == 'par':
45             self.findHeadingText.setText(self.__tr("""Please enter the filesystem device node for the printer."""))
46             self.hintTextLabel.setText(self.__tr(""" <i>("/dev/parportX", X=0,1,2,...)</i>"""))
47             self.findTextLabel.setText(self.__tr("""Device Node:"""))
48
49     def findLineEdit_textChanged(self,a0):
50         self.param = unicode(a0)
51
52         if self.bus == 'usb':
53             bus, dev = self.param.split(':')
54             self.param = ''.join(['0'*(3-len(bus)), bus, ':', '0'*(3-len(dev)), dev])
55
56     def __tr(self,s,c = None):
57         return qApp.translate("SetupManualFind_base",s,c)