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 / settingsdialog.py < prev    next >
Encoding:
Python Source  |  2007-04-04  |  4.6 KB  |  143 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. from base import utils, service
  25. from qt import *
  26. from settingsdialog_base import SettingsDialog_base
  27.  
  28. class SettingsDialog(SettingsDialog_base):
  29.     def __init__(self, hpssd_sock, parent = None,name = None,modal = 0,fl = 0):
  30.         SettingsDialog_base.__init__(self,parent,name,modal,fl)
  31.         self.DefaultsButton.setEnabled(False)
  32.         self.hpssd_sock = hpssd_sock
  33.         self.sendmail = utils.which('sendmail')
  34.         
  35.         if not self.sendmail:
  36.             self.EmailTestButton.setEnabled(False)
  37.  
  38.     def PrintCmdChangeButton_clicked(self):
  39.         pass
  40.  
  41.     def ScanCmdChangeButton_clicked(self):
  42.         pass
  43.  
  44.     def AccessPCardCmdChangeButton_clicked(self):
  45.         pass
  46.  
  47.     def SendFaxCmdChangeButton_clicked(self):
  48.         pass
  49.  
  50.     def MakeCopiesCmdChangeButton_clicked(self):
  51.         pass
  52.  
  53.     def DefaultsButton_clicked(self):
  54.         cmd_print, cmd_scan, cmd_pcard, \
  55.         cmd_copy, cmd_fax, cmd_fab = utils.deviceDefaultFunctions()
  56.  
  57.         self.PrintCommand.setText(cmd_print)
  58.         self.printButtonGroup.setButton(0)
  59.         
  60.         self.ScanCommand.setText(cmd_scan)
  61.         self.scanButtonGroup.setButton(1)
  62.         
  63.         self.AccessPCardCommand.setText(cmd_pcard)
  64.         self.pcardButtonGroup.setButton(1)
  65.         
  66.         self.SendFaxCommand.setText(cmd_fax)
  67.         self.faxButtonGroup.setButton(1)
  68.         
  69.         self.MakeCopiesCommand.setText(cmd_copy)
  70.         self.copyButtonGroup.setButton(1)
  71.  
  72.     def TabWidget_currentChanged(self,a0):
  73.         name = str(a0.name())
  74.  
  75.         if name == 'FunctionCommands':
  76.             self.DefaultsButton.setEnabled(True)
  77.         else:
  78.             self.DefaultsButton.setEnabled(False)
  79.  
  80.     def EmailTestButton_clicked(self): 
  81.         email_to_addresses = str(self.EmailAddress.text())
  82.         email_from_address = str(self.senderLineEdit.text())
  83.  
  84.         if not email_to_addresses or not email_from_address:
  85.             QMessageBox.warning(self,
  86.                                  self.caption(),
  87.                                  self.__tr("<b>One or more email addresses are missing.</b><p>Please enter this information and try again."),
  88.                                   QMessageBox.Ok,
  89.                                   QMessageBox.NoButton,
  90.                                   QMessageBox.NoButton)
  91.             return
  92.  
  93.         user_cfg.alerts.email_to_addresses = email_to_addresses
  94.         user_cfg.alerts.email_from_address = email_from_address
  95.         user_cfg.alerts.email_alerts = True
  96.  
  97.         service.setAlerts(self.hpssd_sock, 
  98.                           True,
  99.                           email_from_address,
  100.                           email_to_addresses)
  101.  
  102.         result_code = service.testEmail(self.hpssd_sock, prop.username)
  103.         log.debug(result_code)
  104.  
  105.         QMessageBox.information(self,
  106.                      self.caption(),
  107.                      self.__tr("<p><b>Please check your email for a test message.</b><p>If the message doesn't arrive, please check your settings and try again."),
  108.                       QMessageBox.Ok,
  109.                       QMessageBox.NoButton,
  110.                       QMessageBox.NoButton)
  111.  
  112.  
  113.     def autoRefreshCheckBox_clicked(self):
  114.         pass
  115.  
  116.     def CleaningLevel_clicked(self,a0):
  117.         pass
  118.  
  119.     def refreshScopeButtonGroup_clicked(self,a0):
  120.         self.auto_refresh_type = int(a0)
  121.         
  122.     def printButtonGroup_clicked(self,a0):
  123.         self.PrintCommand.setEnabled(a0)
  124.  
  125.     def scanButtonGroup_clicked(self,a0):
  126.         self.ScanCommand.setEnabled(a0)
  127.  
  128.     def faxButtonGroup_clicked(self,a0):
  129.         self.SendFaxCommand.setEnabled(a0)
  130.  
  131.     def pcardButtonGroup_clicked(self,a0):
  132.         self.AccessPCardCommand.setEnabled(a0)
  133.  
  134.     def copyButtonGroup_clicked(self,a0):
  135.         self.MakeCopiesCommand.setEnabled(a0)
  136.         
  137.  
  138.  
  139.     def __tr(self,s,c = None):
  140.         return qApp.translate("SettingsDialog",s,c)
  141.  
  142.  
  143.