def node_icon( cls, node_type: NodeType, model: str, gui_config: GuiConfig, scale: float = 1.0 ) -> PhotoImage: image_enum = TypeToImage.get(node_type, model) if image_enum: return Images.get(image_enum, int(ICON_SIZE * scale)) else: image_stem = cls.get_image_file(gui_config, model) if image_stem: return Images.get_with_image_file(image_stem, int(ICON_SIZE * scale))
def node_icon( cls, node_type: NodeType, model: str, gui_config: Dict[str, List[Dict[str, str]]], scale=1.0, ) -> "ImageTk.PhotoImage": image_enum = TypeToImage.get(node_type, model) if image_enum: return Images.get(image_enum, int(ICON_SIZE * scale)) else: image_stem = cls.get_image_file(gui_config, model) if image_stem: return Images.get_with_image_file(image_stem, int(ICON_SIZE * scale))
def scale_graph(self) -> None: for nid, canvas_node in self.nodes.items(): img = None if NodeUtils.is_custom(canvas_node.core_node.type, canvas_node.core_node.model): for custom_node in self.app.guiconfig.nodes: if custom_node.name == canvas_node.core_node.model: img = self.app.get_custom_icon(custom_node.image, ICON_SIZE) else: image_enum = TypeToImage.get(canvas_node.core_node.type, canvas_node.core_node.model) img = self.app.get_icon(image_enum, ICON_SIZE) self.itemconfig(nid, image=img) canvas_node.image = img canvas_node.scale_text() canvas_node.scale_antennas() for edge_id in self.find_withtag(tags.EDGE): self.itemconfig(edge_id, width=int(EDGE_WIDTH * self.app.app_scale))