代码拉取完成,页面将自动刷新
同步操作将从 edwinfound/SerialGenius 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# coding:utf-8
import ConfigParser, os
import Config
import ELog
import Global
### 增加模块这里需要添加 -----------------------------------------------------------
sections = ['setting', 'module_recv', 'module_send',
'module_terminal', 'module_variable', 'module_variable_track',
'module_video', ]
class IniFile:
def __init__(self, filename):
self.filename = filename
self.cfg = None
if not os.path.exists(filename):
f = open(filename, 'w')
f.close()
Save()
def Init(self):
self.cfg = ConfigParser.ConfigParser()
try:
readhandle = open(self.filename, 'r')
self.cfg.readfp(readhandle)
readhandle.close()
except:
ELog.Trace()
def Save(self):
try:
writehandle = open(self.filename, 'w')
self.cfg.write(writehandle)
writehandle.close()
except:
ELog.Trace()
def Get(self, Section, Key, Default=""):
try:
value = self.cfg.get(Section, Key)
except:
value = Default
return value
def Set(self, Section, Key, Value):
try:
self.cfg.set(Section, Key, Value)
except:
self.cfg.add_section(Section)
self.cfg.set(Section, Key, Value)
def Save():
setting = IniFile(Global.env['app_root'] + "setting.ini")
setting.Init()
for section in sections:
for key, value in Config.APP_CONFIG[section].items():
setting.Set(section, key, value)
setting.Save()
def Load():
setting = IniFile(Global.env['app_root'] + "setting.ini")
setting.Init()
for section in sections:
for key, value in Config.APP_CONFIG[section].items():
Config.APP_CONFIG[section][key] = setting.Get(section, key, Config.APP_CONFIG[section][key])
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。