#coding=utf-8

from PyQt4.QtGui import QDialog,QRegExpValidator
from PyQt4.QtCore import SIGNAL,QRegExp
from PyQt4.Qt import QIcon
from src.view.setting.editcenter import Ui_Dialog



class EditCenter(QDialog,Ui_Dialog):
    def __init__(self):
        super(EditCenter,self).__init__()
        #--------------界面初始化-top
        self.setupUi(self)
        pReg=QRegExp("[0-9]{0,3}[.][0-9]{0,3}[.][0-9]{0,3}[.][0-9]{0,3}")
        pRegExpValidator2 = QRegExpValidator(pReg)
        self.lineEditIpAddr.setValidator(pRegExpValidator2)
        windowIconPath="../images/logo32.png"
        self.setWindowIcon(QIcon(windowIconPath))#设置windows窗口图标
        self.connect(self.pushButtonQ,SIGNAL("clicked()"),self.closeSelf)
        self.connect(self.pushButtonY,SIGNAL("clicked()"),self.editChanged)

    def editChanged(self):
        self.emit(SIGNAL("changeCenterDate"),self.lineEditCenterName.text(),self.lineEditIpAddr.text())

    def closeSelf(self):
        self.close()