flexablelib-components 3.7.1__tar.gz → 3.7.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {flexablelib_components-3.7.1/flexablelib_components.egg-info → flexablelib_components-3.7.3}/PKG-INFO +3 -3
  2. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/__init__.py +1 -1
  3. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/display.py +6 -3
  4. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/navigation.py +18 -9
  5. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/overlays.py +5 -3
  6. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3/flexablelib_components.egg-info}/PKG-INFO +3 -3
  7. flexablelib_components-3.7.3/flexablelib_components.egg-info/requires.txt +2 -0
  8. flexablelib_components-3.7.1/flexablelib_components.egg-info/requires.txt +0 -2
  9. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/LICENSE +0 -0
  10. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/MANIFEST.in +0 -0
  11. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/README.md +0 -0
  12. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/base.py +0 -0
  13. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/data.py +0 -0
  14. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/dates.py +0 -0
  15. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/inputs.py +0 -0
  16. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/media.py +0 -0
  17. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components/py.typed +0 -0
  18. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components.egg-info/SOURCES.txt +0 -0
  19. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components.egg-info/dependency_links.txt +0 -0
  20. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/flexablelib_components.egg-info/top_level.txt +0 -0
  21. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/setup.cfg +0 -0
  22. {flexablelib_components-3.7.1 → flexablelib_components-3.7.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib-components
3
- Version: 3.7.1
3
+ Version: 3.7.3
4
4
  Summary: Interactive terminal components for flexablelib: inputs, dates, tables, forms, menus, tabs, dialogs and more.
5
5
  Home-page: https://github.com/Opus-Perpetuus/flexablelib
6
6
  Author: Benjamin Ramirez
@@ -17,8 +17,8 @@ Classifier: Topic :: Software Development :: User Interfaces
17
17
  Requires-Python: >=3.8
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: flexablelib>=3.7.1
21
- Requires-Dist: flexablelib-tui>=3.7.1
20
+ Requires-Dist: flexablelib>=3.7.3
21
+ Requires-Dist: flexablelib-tui>=3.7.3
22
22
  Dynamic: author
23
23
  Dynamic: author-email
24
24
  Dynamic: classifier
@@ -18,7 +18,7 @@ keys to the focused component) and also renders on its own with
18
18
  ``render(width)``. See docs/COMPONENTS.md.
19
19
  """
20
20
 
21
- __version__ = '3.7.1'
21
+ __version__ = '3.7.3'
22
22
 
23
23
  from .base import Theme, DEFAULT_THEME, Input, Box, Button, frame
24
24
  from .inputs import (TextInput, PasswordInput, NumberInput, ExpressionInput,
@@ -869,9 +869,9 @@ class DetailView(_Themed):
869
869
 
870
870
  class Timeline(_Themed):
871
871
  """
872
- Events down a line: ``(when, title, detail)`` or dicts with ``when``,
873
- ``title``, ``detail``, ``kind`` / ``status``. Also a status history: give
874
- ``kind`` per event (``'success'``, ``'error'`` ...).
872
+ Events down a line: ``(when, title, detail)``, a bare title, or dicts
873
+ with ``when``, ``title``, ``detail``, ``kind`` / ``status``. Also a
874
+ status history: give ``kind`` per event (``'success'``, ``'error'`` ...).
875
875
  """
876
876
 
877
877
  role = 'list'
@@ -896,6 +896,9 @@ class Timeline(_Themed):
896
896
  return (str(event.get('when', '')), str(event.get('title', '')),
897
897
  event.get('detail'), event.get('kind',
898
898
  event.get('status')))
899
+ if isinstance(event, str):
900
+ # A bare string is the event's title, not (when, title) letters.
901
+ return ('', event, None, None)
899
902
  event = tuple(event) + (None, None)
900
903
  return (str(event[0]), str(event[1]), event[2], event[3])
901
904
 
@@ -653,8 +653,9 @@ class TopBar(_Themed):
653
653
 
654
654
  class Toolbar(_Themed):
655
655
  """
656
- A row of :class:`Button` s (or ``(label, action)`` pairs): Left/Right
657
- move between them while one has focus; each keeps its own shortcut.
656
+ A row of :class:`Button` s (or ``(label, action)`` pairs, or bare
657
+ labels): Left/Right move between them while one has focus; each keeps
658
+ its own shortcut.
658
659
  """
659
660
 
660
661
  role = 'toolbar'
@@ -662,12 +663,19 @@ class Toolbar(_Themed):
662
663
  def __init__(self, buttons, gap=1, align='l', **kwargs):
663
664
  super(Toolbar, self).__init__(**kwargs)
664
665
  self.buttons = [b if isinstance(b, Button) else
665
- Button(b[0], b[1], theme=self._theme,
666
- use_colors=kwargs.get('use_colors'))
666
+ self._button(b, kwargs.get('use_colors'))
667
667
  for b in buttons]
668
668
  self.gap = gap
669
669
  self.align = align
670
670
 
671
+ def _button(self, spec, use_colors):
672
+ # A bare label is a button with no action -- not a label made of
673
+ # its first character and an "action" made of the second.
674
+ if isinstance(spec, str):
675
+ spec = (spec,)
676
+ return Button(spec[0], spec[1] if len(spec) > 1 else None,
677
+ theme=self._theme, use_colors=use_colors)
678
+
671
679
  def children(self):
672
680
  return list(self.buttons)
673
681
 
@@ -1122,9 +1130,9 @@ class Tree(_Themed):
1122
1130
 
1123
1131
  class CommandPalette(_Themed):
1124
1132
  """
1125
- A search box over commands -- ``(label, action)`` pairs or dicts with
1126
- ``label``, ``action``, ``hint``, ``keywords`` -- matched by fuzzy
1127
- subsequence, best first. Up/Down choose, Enter runs, Escape closes.
1133
+ A search box over commands -- ``(label, action)`` pairs, bare labels
1134
+ (no action) or dicts with ``label``, ``action``, ``hint``, ``keywords``
1135
+ -- matched by fuzzy subsequence, best first. Up/Down choose, Enter runs, Escape closes.
1128
1136
  Open it with ``open(app)`` (bind it to ``ctrl+k`` or ``/``).
1129
1137
  """
1130
1138
 
@@ -1154,8 +1162,9 @@ class CommandPalette(_Themed):
1154
1162
  title='Comandos', **kwargs):
1155
1163
  super(CommandPalette, self).__init__(**kwargs)
1156
1164
  self.commands = [c if isinstance(c, dict) else
1157
- {'label': c[0], 'action': c[1] if len(c) > 1
1158
- else None} for c in commands]
1165
+ {'label': c, 'action': None} if isinstance(c, str)
1166
+ else {'label': c[0], 'action': c[1] if len(c) > 1
1167
+ else None} for c in commands]
1159
1168
  self.placeholder = placeholder
1160
1169
  self.max_visible = max_visible
1161
1170
  self.title = title
@@ -18,9 +18,9 @@ __all__ = ['Modal', 'ConfirmDialog', 'PromptDialog', 'LoadingOverlay',
18
18
  class Modal(_Themed):
19
19
  """
20
20
  A framed dialog over the screen: ``content`` and a row of ``buttons``
21
- (``(label, action)`` pairs or :class:`Button` s; an action returning
22
- anything but False closes the dialog). ``open(app)`` shows it; Escape
23
- closes it when ``closable``. ``width`` caps its width.
21
+ (``(label, action)`` pairs, bare labels or :class:`Button` s; an action
22
+ returning anything but False closes the dialog). ``open(app)`` shows it;
23
+ Escape closes it when ``closable``. ``width`` caps its width.
24
24
  """
25
25
 
26
26
  role = 'dialog'
@@ -43,6 +43,8 @@ class Modal(_Themed):
43
43
  colors = kwargs.get('use_colors')
44
44
  for b in buttons:
45
45
  if not isinstance(b, Button):
46
+ if isinstance(b, str):
47
+ b = (b,) # a bare label: a button that just closes
46
48
  label, action = b[0], b[1] if len(b) > 1 else None
47
49
  kind = b[2] if len(b) > 2 else 'default'
48
50
  b = Button(label, None, kind=kind, theme=self._theme,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib-components
3
- Version: 3.7.1
3
+ Version: 3.7.3
4
4
  Summary: Interactive terminal components for flexablelib: inputs, dates, tables, forms, menus, tabs, dialogs and more.
5
5
  Home-page: https://github.com/Opus-Perpetuus/flexablelib
6
6
  Author: Benjamin Ramirez
@@ -17,8 +17,8 @@ Classifier: Topic :: Software Development :: User Interfaces
17
17
  Requires-Python: >=3.8
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: flexablelib>=3.7.1
21
- Requires-Dist: flexablelib-tui>=3.7.1
20
+ Requires-Dist: flexablelib>=3.7.3
21
+ Requires-Dist: flexablelib-tui>=3.7.3
22
22
  Dynamic: author
23
23
  Dynamic: author-email
24
24
  Dynamic: classifier
@@ -0,0 +1,2 @@
1
+ flexablelib>=3.7.3
2
+ flexablelib-tui>=3.7.3
@@ -1,2 +0,0 @@
1
- flexablelib>=3.7.1
2
- flexablelib-tui>=3.7.1