def change_theme(self, new_theme_name): ''' Change theme with given new theme name. @param new_theme_name: New theme name. ''' # Update ticker. self.ticker += 1 # Change theme name. self.theme_name = new_theme_name # Update dynamic pixbuf. for (path, pixbuf) in self.pixbuf_dict.items(): pixbuf.update(self.get_theme_file_path("image/%s" % (path))) # Update dynamic colors. theme_info = eval_file(self.get_theme_file_path(self.theme_info_file)) for (color_name, color) in theme_info["colors"].items(): self.color_dict[color_name].update(color) # Update dynamic alpha colors. for (color_name, color_info) in theme_info["alpha_colors"].items(): self.alpha_color_dict[color_name].update(color_info) # Update shadow colors. for (color_name, color_info) in theme_info["shadow_colors"].items(): self.shadow_color_dict[color_name].update(color_info)
def load_theme(self): ''' Load theme. ''' self.theme_name = skin_config.theme_name # Scan dynamic theme_info file. theme_info = eval_file(self.get_theme_file_path(self.theme_info_file)) # Init dynamic colors. for (color_name, color) in theme_info["colors"].items(): self.color_dict[color_name] = DynamicColor(color) # Init dynamic alpha colors. for (color_name, color_info) in theme_info["alpha_colors"].items(): self.alpha_color_dict[color_name] = DynamicAlphaColor(color_info) # Init dynamic shadow colors. for (color_name, color_info) in theme_info["shadow_colors"].items(): self.shadow_color_dict[color_name] = DynamicShadowColor(color_info) # Add in theme list of skin_config. skin_config.add_theme(self)
def eval_file(filepath, check_exists=False): print "Please import deepin_utils.file.eval_file, this function will departed in next release version." return file.eval_file(filepath, check_exists=False)