mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
use isdisjoint
This commit is contained in:
@@ -147,6 +147,7 @@ class ScalarOffset(NamedTuple):
|
||||
|
||||
@classmethod
|
||||
def null(cls) -> ScalarOffset:
|
||||
"""Get a null scalar offset (0, 0)."""
|
||||
return cls(Scalar.from_number(0), Scalar.from_number(0))
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
|
||||
@@ -53,6 +53,13 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class RulesMap(TypedDict):
|
||||
"""A typed dict for CSS rules.
|
||||
|
||||
Any key may be absent, indiciating that rule has not been set.
|
||||
|
||||
Does not define composite rules, that is a rule that is made of a combination of other rules. For instance,
|
||||
the text style is made up of text_color, text_background, and text_style.
|
||||
"""
|
||||
|
||||
display: Display
|
||||
visibility: Visibility
|
||||
@@ -117,30 +124,30 @@ class Styles:
|
||||
if rule in RULE_NAMES and rule in self._rules:
|
||||
return True
|
||||
if rule == "text":
|
||||
return bool(
|
||||
{"text_color", "text_background", "text_style"}.intersection(
|
||||
return not (
|
||||
{"text_color", "text_background", "text_style"}.isdisjoint(
|
||||
self._rules.keys()
|
||||
)
|
||||
)
|
||||
|
||||
if rule == "border":
|
||||
return bool(
|
||||
return not (
|
||||
{
|
||||
"border_top",
|
||||
"border_right",
|
||||
"border_bottom",
|
||||
"border_left",
|
||||
}.intersection(self._rules.keys())
|
||||
}.isdisjoint(self._rules.keys())
|
||||
)
|
||||
|
||||
if rule == "outline" and any(self.outline):
|
||||
return bool(
|
||||
return not (
|
||||
{
|
||||
"outline_top",
|
||||
"outline_right",
|
||||
"outline_bottom",
|
||||
"outline_left",
|
||||
}.intersection(self._rules.keys())
|
||||
}.isdisjoint(self._rules.keys())
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user