Пример #1
0
    def __init__(self, parent=None):
        self.uri = ""
        self.callswidgets = []
        self.contactswidgets = []
        self.config = ConfigParser.RawConfigParser()
        self.config.readfp(getConfig())
        super(Dialer, self).__init__(parent, QtCore.Qt.FramelessWindowHint)
        self.errortimer = QtCore.QTimer()
        self.errortimer.setInterval(1000)
        self.setupUi(self)
        try:
            if self.config.getboolean("main", "aot"):
                self.setWindowFlags(QtCore.Qt.FramelessWindowHint
                                    | QtCore.Qt.WindowStaysOnTopHint)
        except:
            pass

        try:
            if not self.config.getboolean("main", "ust"):
                a = 1 / 0
            else:
                self.dialButton.setIcon(QtGui.QIcon.fromTheme("call-start"))
                self.hangupButton.setIcon(QtGui.QIcon.fromTheme("call-stop"))
        except:
            self.setStyleSheet(
                """QPushButton,QToolButton {background-color: rgb(40,40,40); height: 20px; color: rgb(255,255,255);  border-style: outset; border-width: 1px;
                              border-color: rgb(50,50,50);}
                              QDialog {background-color: rgb(10,10,10); color: rgb(255,255,255); border-style: outset; border-width: 1px;
                                         border-color: rgb(50,50,50);
}
                              QLabel {color: rgb(255,255,255);}
                              QLineEdit {color: white; background-color: rgb(30,30,30); border-style: outset; border-width: 1px;
                                         border-color: rgb(50,50,50); }""")

        self.contactsForm = ContactsForm()
        self.numberEdit.button.setStyleSheet(
            "background: transparent; border: none; margin-right: 5px")
        self.notify = NotifyManager()
        self.inactiveIcon = QtGui.QIcon(":/inactive.png")
        self.connectedIcon = QtGui.QIcon(":/connected.png")
        self.errorIcon = QtGui.QIcon(":/error.png")

        self.dialIcon = QtGui.QIcon(":/call.png")
        self.hangupIcon = QtGui.QIcon(":/stop.png")
        self.settings = SettingsForm()
        self.controller = Controller(self)
        self.settings.load()
        self.createTrayIcon()
        self.connectSignals()

        self.server = None
        self.login = None
        self.password = None

        self.calls = HistoryAdapter()
        self.contacts = ContactsAdapter()
        try:
            self.server = self.config.get("sip", "server")
            self.login = self.config.get("sip", "login")
            self.password = self.config.get("sip", "password")
        except:
            pass

        for sd in self.controller.core.lib.enum_snd_dev():
            self.settings.inputComboBox.addItem(self.trans(sd.name))
            self.settings.outputComboBox.addItem(self.trans(sd.name))
        self.settings.load()
        try:
            self.controller.core.lib.set_snd_dev(
                self.settings.inputComboBox.currentIndex(),
                self.settings.outputComboBox.currentIndex())
        except:
            debug(_("Audio-device error"))