Fixed _get_separator_length()

* Use title line(s) and 'Display Name' instead of name
  * Menu()._update() is required to be run previously
This commit is contained in:
2Shirt 2019-08-20 22:34:38 -06:00
parent 1542ba39cd
commit 2b08654d7c
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -128,10 +128,14 @@ class Menu():
"""Format separator length based on name lengths, returns str."""
separator_length = 0
# Check title line(s)
for line in self.title.split('\n'):
separator_length = max(separator_length, len(line))
# Loop over all item names
for section in (self.actions, self.options, self.sets, self.toggles):
for name in section.keys():
separator_length = max(separator_length, len(name))
for details in section.values():
separator_length = max(separator_length, len(details['Display Name']))
separator_length += 1
# Done