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

Also check prefixed style properties for incompatibilities #5335

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions module/generate_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def __init__(self, index, name, priority, alts):
# A list of prefix indexes that should be updated when this prefix is
# updated, including this prefix.
if index >= 0:
self.alts = [ self.index ]
self.alt_names = [ self.name ]
self.alts = [index]
self.alt_names = [name]
else:
self.alts = [ ]
self.alt_names = [ ]
self.alts = []
self.alt_names = []

for i in alts:
self.alts.append(prefixes[i].index)
Expand Down Expand Up @@ -640,12 +640,12 @@ def generate_sets():
ap = collections.OrderedDict()

for k, v in all_properties.items():
ap[k] = [ i[0] for i in v ]
ap[k] = [i[0] for i in v]

proxy_property_code = "{"

for p, l in synthetic_properties.items():
proxy_property_code += '"{}" : frozenset({}),'.format(p, [ el[0] for el in l ])
proxy_property_code += '"{}" : frozenset({}),'.format(p, [el[0] for el in l])

proxy_property_code += "}"

Expand Down
24 changes: 16 additions & 8 deletions renpy/sl2/slparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Style(object):
def __init__(self, name):
self.name = name

properties['', True].add(self.name)
properties['', True].add(name)

if parser:
parser.add(self)
Expand All @@ -115,13 +115,21 @@ def __init__(self, prefix, name):
self.prefix = prefix
self.name = name

properties[prefix, True].add(self.name)
properties[prefix, True].add(name)
update_incompatible_props(prefix, name)

if parser:
parser.add(self)


from renpy.styledata.stylesets import proxy_properties as incompatible_props
from renpy.styledata.stylesets import proxy_properties

incompatible_props = proxy_properties.copy()

def update_incompatible_props(prefix, prop):
res = incompatible_props.get(prop, None)
if res is not None:
incompatible_props[prefix + prop] = frozenset(prefix + p for p in res)

def check_incompatible_props(new, olds):
"""
Expand Down Expand Up @@ -448,18 +456,18 @@ def add_property_group(self, group, prefix=''):
PrefixStyle(prefix, prop.name)

return self

def copy_properties(self, name):
global parser
parser = self

parser_to_copy = statements.get(name, None)
if parser_to_copy is None:
raise Exception("{!r} is not a known screen statement".format(name))

for p in parser_to_copy.positional:
Positional(p.name)

for v in set(parser_to_copy.keyword.values()):
if isinstance(v, Keyword):
Keyword(v.name)
Expand Down Expand Up @@ -578,7 +586,7 @@ def register_sl_displayable(*args, **kwargs):

These correspond to groups of :doc:`style_properties`. Group can
also be "ui", in which case it adds the :ref:`common ui properties <common-properties>`.

.. method:: copy_properties(name)

Adds all styles and positional/keyword arguments that can be passed to the `name` screen statement.
Expand Down Expand Up @@ -1143,4 +1151,4 @@ def parse_screen(l, loc):
Parses the screen statement.
"""

return screen_parser.parse(loc, l, None)
return screen_parser.parse(loc, l, None)