(self)
| 54 | self.update_stats() # Start the stats update thread |
| 55 | |
| 56 | def run(self): |
| 57 | Echo("-" * 53) |
| 58 | self.menu_items, self.numbered_menu = self.create_menu() |
| 59 | |
| 60 | while not self.loop_terminate: |
| 61 | Echo("\n") |
| 62 | |
| 63 | self.display_menu() |
| 64 | |
| 65 | # input |
| 66 | choice = input("Choice: \n") |
| 67 | Echo("Please wait...") |
| 68 | if choice == "": # refresh |
| 69 | continue |
| 70 | |
| 71 | if choice.isdigit(): |
| 72 | choice = int(choice) |
| 73 | else: |
| 74 | Echo("Invalid choice. Please enter a number.") |
| 75 | |
| 76 | if choice in self.numbered_menu: |
| 77 | fun = self.numbered_menu[choice][1] |
| 78 | if fun is not None: |
| 79 | fun() |
| 80 | else: |
| 81 | Echo("Invalid choice.") |
| 82 | |
| 83 | def get_max_width(self): |
| 84 | """Determine the maximum width of menu item texts.""" |
no test coverage detected