home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / hplip / ui / align10form.py < prev    next >
Encoding:
Python Source  |  2006-08-30  |  3.1 KB  |  82 lines

  1. # -*- coding: utf-8 -*-
  2. #
  3. # (c) Copyright 2001-2006 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. import os.path
  24. from qt import *
  25. from align10form_base import Align10Form_Base
  26.  
  27. class Align10Form(Align10Form_Base):
  28.     def __init__(self, pattern, parent = None, name = None, modal = 0, fl = 0):
  29.         Align10Form_Base.__init__(self,parent,name,modal,fl)
  30.         self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, 'align10.png')))
  31.         if pattern == 1:
  32.             self.controls = {'A' : (True, 23),
  33.                              'B' : (True, 9),
  34.                              'C' : (True, 9),
  35.                              'D' : (False, 0),
  36.                              'E' : (False, 0),
  37.                              'F' : (False, 0),
  38.                              'G' : (False, 0),
  39.                              'H' : (False, 0),}
  40.         elif pattern == 2:
  41.             self.controls = {'A' : (True, 23),
  42.                              'B' : (True, 17),
  43.                              'C' : (True, 23),
  44.                              'D' : (True, 23),
  45.                              'E' : (True, 9),
  46.                              'F' : (True, 9),
  47.                              'G' : (True, 9),
  48.                              'H' : (True, 9),}
  49.         
  50.         elif pattern == 3:
  51.             self.controls = {'A' : (True, 23),
  52.                              'B' : (True, 9),
  53.                              'C' : (True, 23),
  54.                              'D' : (True, 23),
  55.                              'E' : (True, 9),
  56.                              'F' : (True, 9),
  57.                              'G' : (True, 9),
  58.                              'H' : (True, 9),}
  59.  
  60.         for line in self.controls:
  61.             if not self.controls[line][0]:
  62.                 eval('self.comboBox%s.setEnabled(False)' % line)
  63.             else:
  64.                 for x in range(self.controls[line][1]):
  65.                     eval('self.comboBox%s.insertItem("%s%d")' % (line, line, x+1))
  66.     
  67.     def getValues(self):
  68.         ret = []
  69.         for line in self.controls:
  70.             if not self.controls[line][0]:
  71.                 ret.append(0)
  72.             else:
  73.                 exec('selected = str(self.comboBox%s.currentText())' % line)
  74.                 try:
  75.                     selected = int(selected[1:])
  76.                 except ValueError:
  77.                     selected = 0
  78.                 ret.append(selected)
  79.         
  80.         return ret
  81.         
  82.