Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove docks references & other tidying #795

Merged
merged 6 commits into from
Sep 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/textual/_arrange.py
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ def arrange(
)

dock_spacing = Spacing(top, right, bottom, left)
region = size.region.shrink(dock_spacing)
region = region.shrink(dock_spacing)
layout_placements, arranged_layout_widgets = widget._layout.arrange(
widget, layout_widgets, region.size
)
39 changes: 0 additions & 39 deletions src/textual/css/_style_properties.py
Original file line number Diff line number Diff line change
@@ -511,45 +511,6 @@ def __set__(self, obj: StylesBase, spacing: SpacingDimensions | None):
obj.refresh(layout=True)


class DocksProperty:
"""Descriptor for getting and setting the docks property. This property
is used to define docks and their location on screen.
"""

def __get__(
self, obj: StylesBase, objtype: type[StylesBase] | None = None
) -> tuple[DockGroup, ...]:
"""Get the Docks property

Args:
obj (Styles): The ``Styles`` object.
objtype (type[Styles]): The ``Styles`` class.

Returns:
tuple[DockGroup, ...]: A ``tuple`` containing the defined docks.
"""
if obj.has_rule("docks"):
return obj.get_rule("docks")
from .styles import DockGroup

return (DockGroup("_default", "top", 1),)

def __set__(self, obj: StylesBase, docks: Iterable[DockGroup] | None):
"""Set the Docks property

Args:
obj (Styles): The ``Styles`` object.
docks (Iterable[DockGroup]): Iterable of DockGroups
"""
_rich_traceback_omit = True
if docks is None:
if obj.clear_rule("docks"):
obj.refresh(layout=True)
else:
if obj.set_rule("docks", tuple(docks)):
obj.refresh(layout=True)


class DockProperty:
"""Descriptor for getting and setting the dock property. The dock property
allows you to specify which edge you want to fix a Widget to.
9 changes: 0 additions & 9 deletions src/textual/css/styles.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@
BoxProperty,
ColorProperty,
DockProperty,
DocksProperty,
FractionalProperty,
IntegerProperty,
LayoutProperty,
@@ -720,14 +719,6 @@ def append_declaration(name: str, value: str) -> None:
append_declaration("offset", f"{x} {y}")
if has_rule("dock"):
append_declaration("dock", rules["dock"])
if has_rule("docks"):
append_declaration(
"docks",
" ".join(
(f"{name}={edge}/{z}" if z else f"{name}={edge}")
for name, edge, z in rules["docks"]
),
)
if has_rule("layers"):
append_declaration("layers", " ".join(self.layers))
if has_rule("layer"):