Skip to content

Commit

Permalink
Replace most If true/false, idioms with Whether
Browse files Browse the repository at this point in the history
  • Loading branch information
salt-die committed Aug 17, 2024
1 parent 2bc00eb commit e67d824
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 80 deletions.
16 changes: 8 additions & 8 deletions src/batgrl/gadgets/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class Animation(Gadget):
Time each frame is displayed. If a sequence is provided, it's length should be
equal to number of frames.
loop : bool, default: True
If true, restart animation after last frame.
Whether to restart animation after last frame.
reverse : bool, default: False
If true, play animation in reverse.
Whether to play animation in reverse.
alpha : float, default: 1.0
Transparency of gadget.
interpolation : Interpolation, default: "linear"
Expand Down Expand Up @@ -84,9 +84,9 @@ class Animation(Gadget):
frame_durations : list[int | float]
Time each frame is displayed.
loop : bool
If true, animation is restarted after last frame.
Whether to animation is restarted after last frame.
reverse : bool
If true, animation is played in reverse.
Whether to animation is played in reverse.
alpha : float
Transparency of gadget.
interpolation : Interpolation
Expand Down Expand Up @@ -386,9 +386,9 @@ def from_textures(
Time each frame is displayed. If a sequence is provided, it's length should
be equal to number of frames.
loop : bool, default: True
If true, restart animation after last frame.
Whether to restart animation after last frame.
reverse : bool, default: False
If true, play animation in reverse.
Whether to play animation in reverse.
alpha : float, default: 1.0
Transparency of gadget.
interpolation : Interpolation, default: "linear"
Expand Down Expand Up @@ -473,9 +473,9 @@ def from_images(
Time each frame is displayed. If a sequence is provided, it's length should
be equal to number of frames.
loop : bool, default: True
If true, restart animation after last frame.
Whether to restart animation after last frame.
reverse : bool, default: False
If true, play animation in reverse.
Whether to play animation in reverse.
alpha : float, default: 1.0
Transparency of gadget.
interpolation : Interpolation, default: "linear"
Expand Down
8 changes: 4 additions & 4 deletions src/batgrl/gadgets/behaviors/grabbable.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ class Grabbable:
Parameters
----------
is_grabbable : bool, default: True
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool, default: False
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton, default: "left"
Mouse button used for grabbing.
Attributes
----------
is_grabbable : bool
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton
Mouse button used for grabbing.
is_grabbed : bool
Expand Down
12 changes: 6 additions & 6 deletions src/batgrl/gadgets/behaviors/movable.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ class Movable(Grabbable):
Parameters
----------
disable_oob : bool, default: False
If true, gadget won't be translated outside of its parent's bounding box.
Whether the gadget must be contained in its parent's bounding box.
allow_vertical_translation : bool, default: True
Allow vertical translation.
allow_horizontal_translation : bool, default: True
Allow horizontal translation.
is_grabbable : bool, default: True
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool, default: False
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton, default: "left"
Mouse button used for grabbing.
Attributes
----------
disable_oob : bool
If true, gadget won't be translated outside of its parent's bounding box.
Whether the gadget must be contained in its parent's bounding box.
allow_vertical_translation : bool
Allow vertical translation.
allow_horizontal_translation : bool
Allow horizontal translation.
is_grabbable : bool
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton
Mouse button used for grabbing.
is_grabbed : bool
Expand Down
12 changes: 6 additions & 6 deletions src/batgrl/gadgets/behaviors/movable_children.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class MovableChildren(Grabbable):
disable_child_oob : bool, default: False
Disallow child gadgets from being translated out-of-bounds if true.
disable_child_ptf : bool, default: False
If true, child gadgets won't be pulled-to-front when clicked.
Whether child gadgets are pulled-to-front when clicked.
is_grabbable : bool, default: True
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool, default: False
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton, default: "left"
Mouse button used for grabbing.
Expand All @@ -35,11 +35,11 @@ class MovableChildren(Grabbable):
disable_child_oob : bool
Disallow child gadgets from being translated out-of-bounds if true.
disable_child_ptf : bool
If true, child gadgets won't be pulled-to-front when clicked.
Whether child gadgets are pulled-to-front when clicked.
is_grabbable : bool
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton
Mouse button used for grabbing.
is_grabbed : bool
Expand Down
8 changes: 4 additions & 4 deletions src/batgrl/gadgets/braille_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BrailleVideo(Gadget):
bg_color : Color, default: BLACK
Background color of video.
loop : bool, default: True
If true, restart video after last frame.
Whether to restart video after last frame.
gray_threshold : int, default: 127
Pixel values over this threshold in the source video will be rendered.
enable_shading : bool, default: False
Expand Down Expand Up @@ -76,17 +76,17 @@ class BrailleVideo(Gadget):
bg_color : Color
Background color of video.
loop : bool
If true, video will restart after last frame.
Whether to restart video after last frame.
gray_threshold : int
Pixel values over this threshold in the source video will be rendered.
enable_shading : bool
Whether foreground colors are shaded.
invert_colors : bool
If true, colors in the source are inverted before video is rendered.
Whether colors in the source are inverted before video is rendered.
alpha : float
Transparency of gadget.
is_device : bool
If true, video is from a video capturing device.
Whether video is from a video capturing device.
size : Size
Size of gadget.
height : int
Expand Down
28 changes: 14 additions & 14 deletions src/batgrl/gadgets/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ class Menu(GridLayout):
Parameters
----------
close_on_release : bool, default: True
If true, close the menu when an item is selected.
Whether to close the menu when an item is selected.
close_on_click : bool, default: True
If true, close the menu when a click doesn't collide with it.
Whether to close the menu when a click doesn't collide with it.
alpha : float, default: 1.0
Transparency of gadget.
grid_rows : int, default: 1
Expand Down Expand Up @@ -222,9 +222,9 @@ class Menu(GridLayout):
Attributes
----------
close_on_release : bool
If true, close the menu when an item is selected.
Whether to close the menu when an item is selected.
close_on_click : bool
If true, close the menu when a click doesn't collide with it.
Whether to close the menu when a click doesn't collide with it.
alpha : float
Transparency of gadget.
minimum_grid_size : Size
Expand Down Expand Up @@ -576,9 +576,9 @@ def from_dict_of_dicts(
pos : Point, default: Point(0, 0)
Position of menu.
close_on_release : bool, default: True
If true, close the menu when an item is selected.
Whether to close the menu when an item is selected.
close_on_click : bool, default: True
If true, close the menu when a click doesn't collide with it.
Whether to close the menu when a click doesn't collide with it.
alpha : float, default: 1.0
Transparency of gadget.
Expand Down Expand Up @@ -700,9 +700,9 @@ class MenuBar(GridLayout):
Parameters
----------
close_on_release : bool, default: True
If true, close the menu when an item is selected.
Whether to close the menu when an item is selected.
close_on_click : bool, default: True
If true, close the menu when a click doesn't collide with it.
Whether to close the menu when a click doesn't collide with it.
alpha : float, default: 1.0
Transparency of gadget.
grid_rows : int, default: 1
Expand Down Expand Up @@ -747,9 +747,9 @@ class MenuBar(GridLayout):
Attributes
----------
close_on_release : bool
If true, close the menu when an item is selected.
Whether to close the menu when an item is selected.
close_on_click : bool
If true, close the menu when a click doesn't collide with it.
Whether to close the menu when a click doesn't collide with it.
alpha : float
Transparency of gadget.
grid_rows : int
Expand Down Expand Up @@ -929,7 +929,7 @@ def __init__(

@property
def close_on_release(self) -> bool:
"""If true, close the menu when an item is selected."""
"""Whether to close the menu when an item is selected."""
return self._close_on_release

@close_on_release.setter
Expand All @@ -941,7 +941,7 @@ def close_on_release(self, close_on_release: bool):

@property
def close_on_click(self) -> bool:
"""If true, close the menu when a click doesn't collide with it."""
"""Whether to close the menu when a click doesn't collide with it."""
return self._close_on_click

@close_on_click.setter
Expand Down Expand Up @@ -1021,9 +1021,9 @@ def from_iterable(
pos : Point, default: Point(0, 0)
Position of menu.
close_on_release : bool, default: True
If true, close the menu when an item is selected.
Whether to close the menu when an item is selected.
close_on_click : bool, default: True
If true, close the menu when a click doesn't collide with it.
Whether to close the menu when a click doesn't collide with it.
alpha : float, default: 1.0
Transparency of gadget.
Expand Down
8 changes: 4 additions & 4 deletions src/batgrl/gadgets/scroll_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ class ScrollView(Themable, Grabbable, Gadget):
arrow_keys_enabled : bool, default: True
Allow scrolling with arrow keys.
is_grabbable : bool, default: True
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool, default: False
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton, default: "left"
Mouse button used for grabbing.
alpha : float, default: 1.0
Expand Down Expand Up @@ -261,9 +261,9 @@ class ScrollView(Themable, Grabbable, Gadget):
port_width : int
Width of view.
is_grabbable : bool
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton
Mouse button used for grabbing.
is_grabbed : bool
Expand Down
4 changes: 2 additions & 2 deletions src/batgrl/gadgets/shadow_caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class ShadowCaster(Graphics):
smoothing : float, default: 1.0 / 3.0
Smoothness of shadow edges. This value will be clamped between `0` and `1`.
not_visible_blocks : bool, default: True
If true, all not-visible cells will be treated as opaque.
Whether all not-visible cells will be treated as opaque.
default_color : AColor, default: AColor(0, 0, 0, 0)
Default texture color.
alpha : float, default: 1.0
Expand Down Expand Up @@ -232,7 +232,7 @@ class ShadowCaster(Graphics):
smoothing : float
Smoothness of shadow edges.
not_visible_blocks : bool
If true, all not-visible cells will be treated as opaque.
Whether all not-visible cells will be treated as opaque.
texture : NDArray[np.uint8]
uint8 RGBA color array.
default_color : AColor
Expand Down
8 changes: 4 additions & 4 deletions src/batgrl/gadgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class Slider(Grabbable, Pane):
slider_enabled : bool, default: True
Whether slider value can be changed.
is_grabbable : bool, default: True
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool, default: False
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton, default: "left"
Mouse button used for grabbing.
bg_color : Color, default: BLACK
Expand Down Expand Up @@ -89,9 +89,9 @@ class Slider(Grabbable, Pane):
proportion : float
Current proportion of slider.
is_grabbable : bool
If false, grabbable behavior is disabled.
Whether grabbable behavior is enabled.
ptf_on_grab : bool
If true, gadget will be pulled to front when grabbed.
Whether the gadget will be pulled to front when grabbed.
mouse_button : MouseButton
Mouse button used for grabbing.
bg_color : Color
Expand Down
24 changes: 10 additions & 14 deletions src/batgrl/gadgets/split_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ class HSplitLayout(Gadget):
min_split_height : int, default: 1
Minimum height of either pane.
anchor_top_pane : bool, default: True
If true, :attr:`split_row` will be calculated from the top,
else from the bottom.
If true, :attr:`split_row` is be calculated from the top, else from the bottom.
split_resizable : bool, default: True
If true, the split will be resizable with a grabbable
handle.
Whether split is resizable with a grabbable handle.
handle_color : AColor, default: AGRAY
Color of the resize handle.
size : Size, default: Size(10, 10)
Expand Down Expand Up @@ -94,10 +92,10 @@ class HSplitLayout(Gadget):
split_resizable : bool
Whether split is resizable with a grabbable handle.
anchor_top_pane : bool
If true, :attr:`split_row` is calculated from the top.
If true, :attr:`split_row` is calculated from the top, else from the bottom.
split_row : int
Height of top pane if :attr:`anchor_top_pane` is true, else
height of right pane.
Height of top pane if :attr:`anchor_top_pane` is true, else height of bottom
pane.
min_split_height : int
Minimum height of either pane.
size : Size
Expand Down Expand Up @@ -316,11 +314,9 @@ class VSplitLayout(Gadget):
min_split_width : int, default: 1
Minimum width of either pane.
anchor_left_pane : bool, default: True
If true, :attr:`split_col` will be calculated from the left,
else from the right.
If true, :attr:`split_col` is be calculated from the left, else from the right.
split_resizable : bool, default: True
If true, the split will be resizable with a grabbable
handle.
Whether split is resizable with a grabbable handle.
handle_color : AColor, default: AGRAY
Color of the resize handle.
size : Size, default: Size(10, 10)
Expand Down Expand Up @@ -351,10 +347,10 @@ class VSplitLayout(Gadget):
split_resizable : bool
Whether split is resizable with a grabbable handle.
anchor_left_pane : bool
If true, :attr:`split_col` is calculated from the left.
If true, :attr:`split_col` is calculated from the left, else from the right.
split_col : int
Width of left pane if :attr:`anchor_left_pane` is true, else
width of right pane.
Width of left pane if :attr:`anchor_left_pane` is true, else width of right
pane.
min_split_width : int
Minimum width of either pane.
size : Size
Expand Down
Loading

0 comments on commit e67d824

Please sign in to comment.