home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.4)
-
- from qt import *
- from faxsettingsform_base import FaxSettingsForm_base
- from base.g import *
- from base import device, pml, utils
-
- class PhoneNumValidator(QValidator):
-
- def __init__(self, parent = None, name = None):
- QValidator.__init__(self, parent, name)
-
-
- def validate(self, input, pos):
- input = str(input)
- if not input:
- return (QValidator.Acceptable, pos)
- elif input[pos - 1] not in '0123456789-(+) ':
- return (QValidator.Invalid, pos)
- elif len(input) > 50:
- return (QValidator.Invalid, pos)
- else:
- return (QValidator.Acceptable, pos)
-
-
-
- class StationNameValidator(QValidator):
-
- def __init__(self, parent = None, name = None):
- QValidator.__init__(self, parent, name)
-
-
- def validate(self, input, pos):
- input = str(input)
- if not input:
- return (QValidator.Acceptable, pos)
- elif input != utils.printable(input):
- return (QValidator.Invalid, pos)
- elif len(input) > 50:
- return (QValidator.Invalid, pos)
- else:
- return (QValidator.Acceptable, pos)
-
-
-
- class FaxSettingsForm(FaxSettingsForm_base):
-
- def __init__(self, dev, fax_num, name_co, parent = None, name = None, modal = 0, fl = 0):
- FaxSettingsForm_base.__init__(self, parent, name, modal, fl)
- self.dev = dev
- self.faxEdit.setValidator(PhoneNumValidator(self.faxEdit))
- self.nameEdit.setValidator(StationNameValidator(self.nameEdit))
- self.voiceEdit.setValidator(PhoneNumValidator(self.voiceEdit))
- self.faxEdit.setText(fax_num)
- self.nameEdit.setText(name_co)
- if fax_num:
- pass
- self.setOKButton(name_co)
- if not user_cfg.fax.voice_phone:
- pass
- self.voiceEdit.setText('')
- if not user_cfg.fax.email_address and user_cfg.alerts.email_address:
- pass
- self.emailEdit.setText('')
-
-
- def faxEdit_textChanged(self, a0):
- self.setOKButton()
-
-
- def nameEdit_textChanged(self, a0):
- self.setOKButton()
-
-
- def setOKButton(self, toggle = None):
- if toggle is not None:
- self.pushButtonOK.setEnabled(bool(toggle))
- else:
- name = str(self.nameEdit.text())
- fax_num = str(self.faxEdit.text())
- if name:
- pass
- self.pushButtonOK.setEnabled(bool(fax_num))
-
-
- def accept(self):
-
- try:
- self.dev.setPML(pml.OID_FAX_LOCAL_PHONE_NUM, str(self.faxEdit.text()))
- self.dev.setPML(pml.OID_FAX_STATION_NAME, str(self.nameEdit.text()))
- except Error:
- log.error('Error setting fax settings to device.')
-
- user_cfg.fax.voice_phone = str(self.voiceEdit.text())
- user_cfg.fax.email_address = str(self.emailEdit.text())
- FaxSettingsForm_base.accept(self)
-
-
-