tui-utilities 1.1.7__tar.gz → 1.1.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Personal-use console utilities library
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tui_utilities"
3
- version = "1.1.7"
3
+ version = "1.1.9"
4
4
  description = "Personal-use console utilities library"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -62,25 +62,22 @@ def _style(
62
62
  if current_segment: styleable.append(current_segment, style = style)
63
63
  return styleable
64
64
 
65
- def apply_alignment(alignable): return Align(alignable, alignment)
65
+ def apply_alignment(renderable): return Align(renderable, alignment) if alignment else renderable
66
66
 
67
- def apply_padding(paddable):
67
+ def apply_padding(renderable):
68
+ if not needs_padding: return renderable
69
+ base = padding or 0
68
70
  final_padding = (
69
- top_padding if top_padding is not None else padding,
70
- (right_padding if right_padding is not None else padding) * 2,
71
- bottom_padding if bottom_padding is not None else padding,
72
- (left_padding if left_padding is not None else padding) * 2
71
+ top_padding if top_padding else base,
72
+ (right_padding if right_padding else base) * 2,
73
+ bottom_padding if bottom_padding else base,
74
+ (left_padding if left_padding else base) * 2
73
75
  )
74
- return Padding(paddable, final_padding)
76
+ return Padding(renderable, final_padding)
75
77
 
76
- needs_layout = (
77
- alignment is not None or
78
- padding is not None or
79
- top_padding is not None or
80
- right_padding is not None or
81
- bottom_padding is not None or
82
- left_padding is not None
83
- )
78
+ needs_alignment = alignment is not None
79
+ needs_padding = (padding or top_padding or right_padding or bottom_padding or left_padding)
80
+ needs_layout = needs_alignment or needs_padding
84
81
  if isinstance(object, (str, list)):
85
82
  styled = apply_text_styles(object)
86
83
  if not needs_layout: return styled
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Personal-use console utilities library
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  License: MIT
File without changes
File without changes