MCPcopy
hub / github.com/Sathvik-Rao/ClipCascade / display_menu

Method display_menu

ClipCascade_Desktop/src/cli/tray.py:90–117  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

88 return max(len(text) for text in menu_texts) + 1
89
90 def display_menu(self):
91 counter = count(1)
92 max_width = self.get_max_width()
93
94 total_width = max_width + 8
95
96 # Box Top Border
97 print("\n╔" + "═" * (max_width + 6) + "╗")
98 print(f"║{' MAIN MENU ':^{max_width + 6}}║")
99 print("╠" + "═" * (max_width + 6) + "╣")
100
101 # Menu Items
102 for item in self.menu_items:
103 if isinstance(item, tuple):
104 width = max_width
105 if "disconnect" in item[0].lower() or "logs" in item[0].lower():
106 if "disconnecting" in item[0].lower():
107 width -= 1
108 else:
109 width += 1
110 else:
111 width -= 1
112 print(f"║ {next(counter):<2}. {item[0]:<{width}} ║")
113 else:
114 print(f"║ {'─' * (max_width + 4)} ║")
115
116 # Box Bottom Border
117 print("╚" + "═" * (max_width + 6) + "╝")
118
119 def create_menu(self, item_: tuple = None):
120 # Menu items

Callers 1

runMethod · 0.95

Calls 2

get_max_widthMethod · 0.95
nextFunction · 0.85

Tested by

no test coverage detected