def __init__(self,parent = None,name = None,modal = 0,fl = 0): FaxAddrBookForm_base.__init__(self,parent,name,modal,fl) self.setIcon(load_pixmap('hp_logo', '128x128')) global db db = fax.FaxAddressBook() self.init_problem = False QTimer.singleShot(0, self.InitialUpdate)
def initDB(self): self.db = fax.FaxAddressBook() # Fixup data from old-style database data = self.db.get_all_records() for d in data: if to_unicode('All') not in data[d]['groups']: data[d]['groups'].append(to_unicode('All')) if not data: self.db.set('__' + utils.gen_random_uuid(), '', '', '', '', [to_unicode('All')], '')
try: import struct from base.sixext.moves import queue from base.sixext import PY3 from base.sixext import to_unicode from prnt import cups from base import magic try: from fax import fax except ImportError: # This can fail on Python < 2.3 due to the datetime module log.error("Fax address book disabled - Python 2.3+ required.") sys.exit(1) db = fax.FaxAddressBook() # FAB instance try: import dbus except ImportError: log.error("PC send fax requires dBus and python-dbus") sys.exit(1) import warnings # Ignore: .../dbus/connection.py:242: DeprecationWarning: object.__init__() takes no parameters # (occurring on Python 2.6/dBus 0.83/Ubuntu 9.04) warnings.simplefilter("ignore", DeprecationWarning) dbus_avail, service, session_bus = device.init_dbus() if not dbus_avail or service is None:
def initRecipientsPage(self): # setup validators self.QuickAddFaxEdit.setValidator( PhoneNumValidator(self.QuickAddFaxEdit)) # Fax address book database self.db = fax.FaxAddressBook() # Fax address book window self.fab = FABWindow(self) self.fab.setWindowFlags(Qt.Tool) # Keeps the Fab window on top self.connect(self.fab, SIGNAL("databaseChanged"), self.FABWindow_databaseChanged) # connect signals self.connect(self.QuickAddFaxEdit, SIGNAL("textChanged(const QString &)"), self.QuickAddFaxEdit_textChanged) self.connect(self.QuickAddNameEdit, SIGNAL("textChanged(const QString &)"), self.QuickAddNameEdit_textChanged) self.connect(self.QuickAddButton, SIGNAL("clicked()"), self.QuickAddButton_clicked) self.connect(self.FABButton, SIGNAL("clicked()"), self.FABButton_clicked) self.connect(self.AddIndividualButton, SIGNAL("clicked()"), self.AddIndividualButton_clicked) self.connect(self.AddGroupButton, SIGNAL("clicked()"), self.AddGroupButton_clicked) self.connect(self.RemoveRecipientButton, SIGNAL("clicked()"), self.RemoveRecipientButton_clicked) self.connect(self.MoveRecipientUpButton, SIGNAL("clicked()"), self.MoveRecipientUpButton_clicked) self.connect(self.MoveRecipientDownButton, SIGNAL("clicked()"), self.MoveRecipientDownButton_clicked) self.connect(self.RecipientsTable, SIGNAL("itemSelectionChanged()"), self.RecipientsTable_itemSelectionChanged) self.connect(self.RecipientsTable, SIGNAL("itemDoubleClicked(QTableWidgetItem *)"), self.RecipientsTable_itemDoubleClicked) # setup icons self.FABButton.setIcon(QIcon(load_pixmap("fab", "16x16"))) self.AddIndividualButton.setIcon( QIcon(load_pixmap("add_user", "16x16"))) self.AddGroupButton.setIcon(QIcon(load_pixmap("add_users", "16x16"))) self.RemoveRecipientButton.setIcon( QIcon(load_pixmap("remove_user", "16x16"))) self.MoveRecipientUpButton.setIcon( QIcon(load_pixmap("up_user", "16x16"))) self.MoveRecipientDownButton.setIcon( QIcon(load_pixmap("down_user", "16x16"))) self.QuickAddButton.setIcon( QIcon(load_pixmap("add_user_quick", "16x16"))) # setup initial state self.QuickAddButton.setEnabled(False) self.recipient_headers = [ self.__tr("Name"), self.__tr("Fax number"), self.__tr("Notes") ]