def assign_colors_to_managers(cls): colors = [] for i, j in enumerate(cls.get_manager_names_and_companies()): for k in Company.get_companies(): if j[1] == k.name: colors.append(k.avg_color) return colors
def menu(cls): cls.input_ceck() tag_cloud_1 = """(1) Generates tag cloud that shows the company names: - font size based on number of projects (the more, the bigger) - font color are a mixture of their project colors""" tag_cloud_2 = """(2) Generates tag cloud that shows the project names: - font size based on the budget of the project (the more, the bigger) - font color based on the project colors""" tag_cloud_3 = """(3) Generates tag cloud that shows the project names: - font size based on the due date of the project (the older, the smaller) - font color based on whether the project requires maintenance or not""" tag_cloud_4 = """(4) Generates tag cloud that shows the names of the manager: - font size based on the budget of the project (the older, the smaller) - font color is based on the company they work for""" for i in range(1, 5): print("(%d) Generate tag cloud. Type 'info %d' for more information." % (i, i)) user_input = input("").lower() while True: if user_input == "info 1": print(tag_cloud_1) user_input = input("").lower() if user_input == "info 2": print(tag_cloud_2) user_input = input("").lower() if user_input == "info 3": print(tag_cloud_3) user_input = input("").lower() if user_input == "info 4": print(tag_cloud_4) user_input = input("").lower() if user_input == "1": cls.database = Company.get_companies() cls.multiplicator_height = 1.5 cls.multiplicator_width = 2.7 cls.image = "image.jpg" break if user_input == "2": cls.database = Image2.get_image2() cls.multiplicator_height = 1.5 cls.multiplicator_width = 3 cls.image = "image7.jpg" break if user_input == "3": cls.database = Image3.get_image3() cls.multiplicator_height = 1.8 cls.multiplicator_width = 3.4 cls.image = "image6.jpg" break if user_input == "4": cls.database = Manager.get_all() cls.multiplicator_height = 1.5 cls.multiplicator_width = 3 cls.image = "image.jpg" break else: print("Unavailable, please try again.")
# return 11 * self.weight, self.text_size[0] else: raise Exception('No text_size parameters') class Cloud(): def __init__(self, max_width, max_height, color): self.max_width = max_width * 2 self.max_height = max_height self.color = color def create_cloud(self): img = Image.new("RGB", (self.max_width, self.max_height), self.color) return img world_tuple = Company.get_companies() text_size = 0 picture = 0 text_list = [] for world in world_tuple: worlds = Text(world.name, world.weight, world.avg_color) text_list.append(worlds) # worlds, w, h = worlds.get_text_size() text_size += w*h cloud = Cloud(math.ceil(math.sqrt(text_size))*2, math.ceil(math.sqrt(text_size)), (120, 120, 120)) # img = Image.new("RGB", (math.ceil(math.sqrt(text_size))*2, math.ceil(math.sqrt(text_size))), (120, 120, 120)) img = cloud.create_cloud() draw = ImageDraw.Draw(img) MAX_HEIGHT = cloud.max_height # math.ceil(math.sqrt(text_size))