tui-utilities 1.1.5__tar.gz → 1.1.7__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.

Potentially problematic release.


This version of tui-utilities might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.1.5
3
+ Version: 1.1.7
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.5"
3
+ version = "1.1.7"
4
4
  description = "Personal-use console utilities library"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -62,27 +62,32 @@ 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) if alignment else alignable
65
+ def apply_alignment(alignable): return Align(alignable, alignment)
66
66
 
67
67
  def apply_padding(paddable):
68
- if not padding and not top_padding and not right_padding and not bottom_padding and not left_padding: return paddable
69
68
  final_padding = (
70
- top_padding if top_padding else padding,
71
- (right_padding if right_padding else padding) * 2,
72
- bottom_padding if bottom_padding else padding,
73
- (left_padding if left_padding else padding) * 2
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
74
73
  )
75
74
  return Padding(paddable, final_padding)
76
75
 
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
+ )
77
84
  if isinstance(object, (str, list)):
78
85
  styled = apply_text_styles(object)
79
- aligned = apply_alignment(styled)
80
- padded = apply_padding(aligned)
81
- return padded
86
+ if not needs_layout: return styled
87
+ return apply_padding(apply_alignment(styled))
82
88
  if isinstance(object, RenderableType):
83
- aligned = apply_alignment(object)
84
- padded = apply_padding(aligned)
85
- return padded
89
+ if not needs_layout: return object
90
+ return apply_padding(apply_alignment(object))
86
91
  styled = apply_text_styles(str(object))
87
92
  aligned = apply_alignment(styled)
88
93
  padded = apply_padding(aligned)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.1.5
3
+ Version: 1.1.7
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