This repository was archived by the owner on Aug 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathConnectionDialog.py
More file actions
39 lines (33 loc) · 1.69 KB
/
ConnectionDialog.py
File metadata and controls
39 lines (33 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from PyQt4.QtGui import QDialog
from PyQt4.QtCore import QSettings, QVariant, SIGNAL
from ui.ui_ConnectionDialog import Ui_ConnectionDialog
class DEADConnectionDialog(QDialog, Ui_ConnectionDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)
self.connect(self, SIGNAL("accepted()"), self.saveSettings)
self.readSettings()
def readSettings(self):
settings = QSettings("Trunat", "PyTalk")
settings.beginGroup("Connection")
self.userID.setText(settings.value("userID").toString())
self.password.setText(settings.value("password").toString())
self.server.setText(settings.value("server").toString())
self.useSSL.setChecked(settings.value("useSSL", QVariant(True)).toBool())
if self.useSSL.isChecked():
self.port.setText(settings.value("port", QVariant("5223")).toString())
else:
self.port.setText(settings.value("port", QVariant("5222")).toString())
self.ressource.setText(settings.value("ressource", QVariant("PyTalk")).toString())
settings.endGroup()
def saveSettings(self):
settings = QSettings("Trunat", "PyTalk")
settings.beginGroup("Connection")
settings.setValue("userID", QVariant(self.userID.text()))
settings.setValue("password", QVariant(self.password.text()))
settings.setValue("server", QVariant(self.server.text()))
settings.setValue("port", QVariant(int(self.port.text())))
settings.setValue("ressource", QVariant(self.ressource.text()))
settings.setValue("useSSL", QVariant(self.useSSL.isChecked()))
settings.endGroup()
self.emit(SIGNAL("configured()"))