def loadConfig(self, config_dict, filename, argb_check=False):
print("Loading config: {}".format(filename))
if os.path.isfile(filename):
with open(filename) as f:
config_content = [line.rstrip('\n') for line in f]
malformed_color = []
for key in config_dict:
for line in config_content:
value = line.split("=")[1]
if key == line.split("=")[0]:
if argb_check:
argbstring = re.compile(r'[a-fA-F0-9]{8}$')
if argbstring.match(value):
a, b, g, r = tuple([value[i:i+2] for i in range(0, len(value), 2)])
config_dict.update({key : (int(r, 16), int(g, 16), int(b, 16), int(a, 16)) })
self.sliders[key][0].set(int(a, 16))
else:
malformed_color.append(line)
else:
if key == "screen_gap" or key == "anim_duration":
try:
value = int(value)
except:
value = config_dict[key]
config_dict.update({key : value})
if malformed_color:
malformed_color.sort()
messagebox.showwarning("Error", "Malformed text color (ABGR):\n{}".format('\n'.join(malformed_color)))
fbi_theme_preview.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录