#coding=utf8
import ConfigParser
import md5
import Tkinter

def GetMD5(toMD5):
  m1 = md5.new()
  m1.update(toMD5)
  return m1.hexdigest()

cf = ConfigParser.ConfigParser()
def SaveConfig():
    cf.write(open("../Seting/Seting.ini", "w"))

def SetConfig(secs,key,value):
    if(cf.has_section(secs) == False):
        cf.add_section(secs)
    cf.set(secs, key, value)

def GetConfig(secs,key):
  cf = ConfigParser.ConfigParser()
  cf.read("../Seting/Seting.ini")
  return cf.get(secs,key)

def SetAdmin(name,pw):
    SetConfig("Admin","Name",name)
    SetConfig("Admin","Password",GetMD5(pw))

 
SetConfig("Index","Title","标题测试")
SetConfig("Index","PageTitle","标题页面测试")
SetConfig("Index","Tips","提示信息测试")
SetConfig("Index","About1","关于测试1")
SetConfig("Index","About2","关于测试2")
SetConfig("Index","RegName","点击注册")
SetConfig("Index","LoginName","点击登陆")

SetConfig("Net","Domain","car.jijiea.com")
SetConfig("Net","Port","8088")

SetConfig("Reg","Title","注册标题测试")
SetConfig("Reg","PageTitle","注册标题页面测试")
SetConfig("Reg","About1","关于测试12")
SetConfig("Reg","About2","关于测试22")
SetConfig("Reg","MoNumberName","队长学号")
SetConfig("Reg","MoNameName","队长姓名")
SetConfig("Reg","MoPasswordName","登录密码")

SetConfig("RegPost","Title","注册完成标题测试")
SetConfig("RegPost","PageTitle","注册完成标题页面测试")
SetConfig("RegPost","About1","关于测试123")
SetConfig("RegPost","About2","关于测试223")
SetConfig("RegPost","TipsNone","信息不能为空")
SetConfig("RegPost","TipsExists","学号重复注册")
SetConfig("RegPost","TipsSuccess","注册成功")
SetConfig("RegPost","TipsNo","存在非法符号")

SetConfig("Login","Title","登陆标题测试")
SetConfig("Login","PageTitle","登陆标题页面测试")
SetConfig("Login","About1","关于测试223")
SetConfig("Login","About2","关于测试423")

SetConfig("LoginPost","Title","登陆完成标题测试")
SetConfig("LoginPost","PageTitle","2登录完成标题页面测试")
SetConfig("LoginPost","About1","关于测试423")
SetConfig("LoginPost","About2","关于测试323")
SetConfig("LoginPost","TipsNone","信息不能为空")
SetConfig("LoginPost","TipsNoExists","学号不存在")
SetConfig("LoginPost","TipsSuccess","登陆成功")
SetConfig("LoginPost","TipsErrPW","密码错误")

SetConfig("Main","Pa0","str|队伍名称")
SetConfig("Main","Pa1","lin|0")
SetConfig("Main","Pa2","int|手机号码")
SetConfig("Main","Pa5","int|队员1学号")
SetConfig("Main","Pa7","str|队员1名称")
SetConfig("Main","Pa3","ins|0")
SetConfig("Main","Pa4","ins|1")
SetConfig("Main","Pa6","ins|1")

SetConfig("MainPage","Title","0登陆完成标题测试")
SetConfig("MainPage","PageTitle","1登录完成标题页面测试")
SetConfig("MainPage","About1","关于测试723")
SetConfig("MainPage","About2","关于测试523")

SetConfig("ChangePage","Title","6完成标题测试")
SetConfig("ChangePage","PageTitle","6完成标题页面测试")
SetConfig("ChangePage","About1","关于测试623")
SetConfig("ChangePage","About2","关于测试563")
SetConfig("ChangePage","TipsNo","非法访问,IP已被记录")
SetConfig("ChangePage","TipsNoNo","存在非法符号")
SetConfig("ChangePage","TipsSuccess","修改成功")

SetAdmin("root","admin")
SetConfig("Admin","Path","admin")

SetConfig("AdminPage","Title","Admin5登陆完成标题测试")
SetConfig("AdminPage","PageTitle","Admin5登录完成标题页面测试")
SetConfig("AdminPage","About1","关于测试523")
SetConfig("AdminPage","About2","Admin关于测试523")

SetConfig("AdminPost","Title","Post登陆完成标题测试")
SetConfig("AdminPost","PageTitle","Post登录完成标题页面测试")
SetConfig("AdminPost","About1","Post关于测试523")
SetConfig("AdminPost","About2","Post关于测试523")
SetConfig("AdminPost","ListName1","主要联系人")
SetConfig("AdminPost","ListName2","队伍总信息")

SaveConfig()



