config file

This commit is contained in:
DonRenando 2015-04-08 15:23:48 +02:00
parent 63f7b0cac4
commit 34ffc59c23
2 changed files with 31 additions and 3 deletions

View File

@ -0,0 +1,7 @@
[NETWORK]
port = 2222
ip = 127.0.0.1
[PSEUDO]
name = bob

View File

@ -5,8 +5,8 @@ from PySide.QtGui import *
import time, threading, datetime, time, random,re
from socket import *
from pmWindow import Ui_Dialog2
Host = "127.0.0.1"
Port = 2222
import configparser
class MySignal(QObject):
@ -476,7 +476,28 @@ class start(QtGui.QDialog):
self.ui.setupUi(self)
ano = "anonymous" + ''.join(str(random.randint(1,9)) for _ in range(2))
self.ui.lineEdit_2.setText(ano)
config = configparser.ConfigParser()
config.read("dncClient.conf")
port = config.get("NETWORK", "port")
ip = config.get("NETWORK", "ip")
name = config.get("PSEUDO", "name")
if name is not None :
self.ui.lineEdit_2.setText(name)
else :
self.ui.lineEdit_2.setText(ano)
if ip is not None :
self.ui.lineEdit_4.setText(ip)
if port is not None :
self.ui.lineEdit_3.setText(port)
self.ui.lineEdit.setDisabled(True)
self.ui.pushButton.setDisabled(True)