home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / hplip / ui / settingsdialog.py < prev    next >
Encoding:
Python Source  |  2006-08-30  |  4.2 KB  |  121 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. 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.         #print repr(user_cfg.refresh.enable)
  34.         #self.auto_refresh = utils.to_bool(user_cfg.refresh.enable)
  35.         #self.autoRefreshCheckBox.setChecked(self.auto_refresh)
  36.         
  37.         self.sendmail = utils.which('sendmail')
  38.         if not self.sendmail:
  39.             self.EmailTestButton.setEnabled(False)
  40.  
  41.     def PrintCmdChangeButton_clicked(self):
  42.         pass
  43.  
  44.     def ScanCmdChangeButton_clicked(self):
  45.         pass
  46.  
  47.     def AccessPCardCmdChangeButton_clicked(self):
  48.         pass
  49.  
  50.     def SendFaxCmdChangeButton_clicked(self):
  51.         pass
  52.  
  53.     def MakeCopiesCmdChangeButton_clicked(self):
  54.         pass
  55.  
  56.     def DefaultsButton_clicked(self):
  57.         cmd_print, cmd_scan, cmd_pcard, \
  58.         cmd_copy, cmd_fax, cmd_fab = utils.deviceDefaultFunctions()
  59.         
  60.         self.PrintCommand.setText(cmd_print)
  61.         self.ScanCommand.setText(cmd_scan)
  62.         self.AccessPCardCommand.setText(cmd_pcard)
  63.         self.SendFaxCommand.setText(cmd_fax)
  64.         self.MakeCopiesCommand.setText(cmd_copy)
  65.  
  66.     def TabWidget_currentChanged(self,a0):
  67.         name = str(a0.name())
  68.  
  69.         if name == 'FunctionCommands':
  70.             self.DefaultsButton.setEnabled(True)
  71.         else:
  72.             self.DefaultsButton.setEnabled(False)
  73.  
  74.     def EmailTestButton_clicked(self): 
  75.         email_to_addresses = str(self.EmailAddress.text())
  76.         email_from_address = str(self.senderLineEdit.text())
  77.         
  78.         if not email_to_addresses or not email_from_address:
  79.             QMessageBox.warning(self,
  80.                                  self.caption(),
  81.                                  self.__tr("<b>One or more email addresses are missing.</b><p>Please enter this information and try again."),
  82.                                   QMessageBox.Ok,
  83.                                   QMessageBox.NoButton,
  84.                                   QMessageBox.NoButton)
  85.             return
  86.         
  87.         user_cfg.alerts.email_to_addresses = email_to_addresses
  88.         user_cfg.alerts.email_from_address = email_from_address
  89.         user_cfg.alerts.email_alerts = True
  90.         
  91.         service.setAlerts(self.hpssd_sock, 
  92.                           True,
  93.                           email_from_address,
  94.                           email_to_addresses)
  95.  
  96.         result_code = service.testEmail(self.hpssd_sock, prop.username)
  97.         log.debug(result_code)
  98.         
  99.         QMessageBox.information(self,
  100.                      self.caption(),
  101.                      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."),
  102.                       QMessageBox.Ok,
  103.                       QMessageBox.NoButton,
  104.                       QMessageBox.NoButton)
  105.  
  106.         
  107.     def autoRefreshCheckBox_clicked(self):
  108.         pass
  109.         
  110.     def CleaningLevel_clicked(self,a0):
  111.         pass
  112.         
  113.     def refreshScopeButtonGroup_clicked(self,a0):
  114.         self.auto_refresh_type = int(a0)
  115.         
  116.         
  117.     def __tr(self,s,c = None):
  118.         return qApp.translate("SettingsDialog",s,c)
  119.  
  120.         
  121.