Skip to content

Commit

Permalink
Support the "multiple" property for rules of type "parent"
Browse files Browse the repository at this point in the history
Step towards #46
  • Loading branch information
JulienCochuyt committed Aug 26, 2024
1 parent 7c0f60d commit 2cb7412
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions addon/globalPlugins/webAccess/ruleHandler/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
from typing import Any, TypeAlias
import weakref

from . import ruleTypes

import addonHandler


Expand Down Expand Up @@ -69,7 +71,7 @@ def getDisplayName(self, ruleType) -> str:
class PropertySpec(Enum):

autoAction = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.ZONE),
valueType=str,
default=None,
# Translators: The display name for a rule property
Expand All @@ -79,7 +81,7 @@ class PropertySpec(Enum):
isRestrictedChoice=True
)
multiple = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.PARENT, ruleTypes.ZONE),
valueType=bool,
default=False,
# Translators: The display name for a rule property
Expand All @@ -88,7 +90,7 @@ class PropertySpec(Enum):
isRestrictedChoice=False
)
formMode = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.ZONE),
valueType=bool,
default=False,
# Translators: The display name for a rule property
Expand All @@ -97,7 +99,7 @@ class PropertySpec(Enum):
isRestrictedChoice=False
)
skip = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.ZONE),
valueType=bool,
default=False,
# Translators: The display name for a rule property
Expand All @@ -106,7 +108,7 @@ class PropertySpec(Enum):
isRestrictedChoice=False
)
sayName = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.ZONE),
valueType=bool,
default=False,
# Translators: The display name for a rule property
Expand All @@ -115,7 +117,7 @@ class PropertySpec(Enum):
isRestrictedChoice=False
)
customName = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.ZONE),
valueType=str,
default="",
# Translators: The display name for a rule property
Expand All @@ -125,11 +127,16 @@ class PropertySpec(Enum):
isRestrictedChoice=False
)
customValue = PropertySpecValue(
ruleTypes=("marker", "pageTitle1", "pageTitle2", "zone"),
ruleTypes=(
ruleTypes.MARKER,
ruleTypes.PAGE_TITLE_1,
ruleTypes.PAGE_TITLE_2,
ruleTypes.ZONE
),
valueType=str,
default="",
displayName={
("marker", "zone"):
(ruleTypes.MARKER, ruleTypes.ZONE):
# Translators: The display name for a rule property
pgettext("webAccess.ruleProperty", "Custom message"),
("pageTitle1", "pageTitle2"):
Expand All @@ -141,7 +148,7 @@ class PropertySpec(Enum):
isRestrictedChoice=False
)
mutation = PropertySpecValue(
ruleTypes=("marker", "zone"),
ruleTypes=(ruleTypes.MARKER, ruleTypes.ZONE),
valueType=str,
default=None,
# Translators: The display name for a rule property
Expand All @@ -151,7 +158,7 @@ class PropertySpec(Enum):
isRestrictedChoice=True
)
subModule = PropertySpecValue(
ruleTypes=("zone",),
ruleTypes=(ruleTypes.ZONE,),
valueType=str,
default="",
# Translators: The display name for a rule property
Expand Down

0 comments on commit 2cb7412

Please sign in to comment.