home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / hplip / ui / setupsettings.py < prev    next >
Encoding:
Python Source  |  2007-04-04  |  3.3 KB  |  114 lines

  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. from base.codes import *
  24.  
  25. from qt import *
  26. from setupsettings_base import SetupSettings_base
  27.  
  28. class SetupSettings(SetupSettings_base):
  29.     def __init__(self, bus, filter, search, ttl, timeout, parent=None, name=None, modal=0, fl = 0):
  30.         SetupSettings_base.__init__(self, parent, name, modal, fl)
  31.  
  32.         self.filter = filter
  33.         self.search = search
  34.         self.ttl = ttl
  35.         self.timeout = timeout
  36.  
  37.         if 'none' in filter:
  38.             self.filterButtonGroup.setButton(0)
  39.         else:
  40.             self.filterButtonGroup.setButton(1)
  41.             self.faxCheckBox.setChecked('fax' in filter)
  42.             self.scanCheckBox.setChecked('scan' in filter)
  43.             self.pcardCheckBox.setChecked('pcard' in filter)
  44.             self.copyCheckBox.setChecked('copy' in filter)
  45.  
  46.         self.searchTermLineEdit.setText(self.search)
  47.  
  48.         self.ttlSpinBox.setValue(self.ttl)
  49.         self.timeoutSpinBox.setValue(self.timeout)
  50.  
  51.  
  52.     def faxCheckBox_toggled(self,a0):
  53.         self.updateFilter()
  54.  
  55.     def scanCheckBox_toggled(self,a0):
  56.         self.updateFilter()
  57.  
  58.     def pcardCheckBox_toggled(self,a0):
  59.         self.updateFilter()
  60.  
  61.     def copyCheckBox_toggled(self,a0):
  62.         self.updateFilter()
  63.  
  64.     def filterButtonGroup_clicked(self, a0):
  65.         self.updateFilter(a0)
  66.  
  67.     def searchTermLineEdit_textChanged(self, a0):
  68.         self.search = str(a0)
  69.  
  70.     def ttlSpinBox_valueChanged(self, a0):
  71.         self.ttl = a0
  72.         log.debug(self.ttl)
  73.  
  74.     def timeoutSpinBox_valueChanged(self, a0):
  75.         self.timeout = a0
  76.         log.debug(self.timeout)
  77.  
  78.     def updateFilter(self, id=-1):
  79.         if id == 0:
  80.             self.filter = 'none'
  81.  
  82.         else:
  83.             filters = []
  84.  
  85.             if self.faxCheckBox.isChecked():
  86.                 filters.append('fax')
  87.  
  88.             if self.scanCheckBox.isChecked():
  89.                 filters.append('scan')
  90.  
  91.             if self.pcardCheckBox.isChecked():
  92.                 filters.append('pcard')
  93.  
  94.             if self.copyCheckBox.isChecked():
  95.                 filters.append('copy')
  96.  
  97.             if not filters:
  98.                 filters.append('none')
  99.  
  100.             self.filter = ','.join(filters)
  101.  
  102.         log.debug(self.filter)
  103.  
  104.  
  105.     def defaultsPushButton_clicked(self):
  106.         self.filterButtonGroup.setButton(0)
  107.         self.updateFilter(0)
  108.         self.searchTermLineEdit.setText('')
  109.         self.ttlSpinBox.setValue(4)
  110.         self.timeoutSpinBox.setValue(5)
  111.  
  112.     def __tr(self,s,c = None):
  113.         return qApp.translate("SetupSettings_base",s,c)
  114.