Make CliMenuHeader and CliMenuOption private

These classes don't need to be used by the user, only via the API, so we
can mark them private.
Sebastian Lohff 3 years ago
parent 24dab5f69b
commit 68e6ecbe4f

@ -12,7 +12,7 @@ from prompt_toolkit import search
from prompt_toolkit.widgets import SearchToolbar
class CliMenuHeader:
class _CliMenuHeader:
"""Hold a menu header"""
def __init__(self, text, indent=False):
self.text = text
@ -20,7 +20,7 @@ class CliMenuHeader:
self.focusable = False
class CliMenuOption:
class _CliMenuOption:
"""Hold a menu option"""
def __init__(self, text, num, item=None):
self.text = text
@ -117,10 +117,10 @@ class CliMenu:
def add_text(self, title, indent=True):
for text in title.split('\n'):
self._items.append(CliMenuHeader(text, indent=indent))
self._items.append(_CliMenuHeader(text, indent=indent))
def add_option(self, text, item=None):
self._items.append(CliMenuOption(text, self._item_num, item=item))
self._items.append(_CliMenuOption(text, self._item_num, item=item))
self._item_num += 1
@ -131,7 +131,7 @@ class CliMenu:
return self._success
def get_options(self):
return [_item for _item in self._items if isinstance(_item, CliMenuOption)]
return [_item for _item in self._items if isinstance(_item, _CliMenuOption)]
def num_options(self):