def __init__(self, configFile): printdebug(configFile) self.configFile = str(configFile) self.userControlMedia = "" self.userControlMediaPath="" self.language = "" self.config = ConfigParser.RawConfigParser() self.getServerConfig()
def getServerConfig(self): '''读取服务器配置文件''' printdebug(self.configFile) data = self.config.read(self.configFile) if data: #查找配置,填写相应数据 try: self.userControlMedia = self.config.get('User Control Section', 'media') if self.userControlMedia not in mediaValue: self.userControlMedia = 'txt' self.saveServerConfig() self.userControlMediaPath = self.config.get('User Control Section', 'mediaPath') self.language = self.config.get('User Control Section', 'language') except: self.saveDefaultConfig() else: #如果没有找到,填写默认值 self.saveDefaultConfig()
def getLanguage(self): '''设置界面语言''' printdebug(self.language) return self.language
def getControlMediaPath(self): '''获取用户存储媒介''' printdebug(self.userControlMediaPath) return self.userControlMediaPath