summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/build/complay.py
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-07-10 04:26:57 +1000
committer Vas Crabb <vas@vastheman.com>2018-07-10 04:26:57 +1000
commit82c6d7dbc54694c544283bf5b77e209000c2d54d (patch)
treed2b96f06d70859ac49df3a2d349db586b66525b3 /scripts/build/complay.py
parentdfb09f2c175ac5f0195d79d4762b68c5725ff652 (diff)
Allow layouts to specify screen tags rather than indices - makes order of instantiation irrelevant in Model 1 etc.
Diffstat (limited to 'scripts/build/complay.py')
-rw-r--r--scripts/build/complay.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/build/complay.py b/scripts/build/complay.py
index af5003581e6..ff60a19158f 100644
--- a/scripts/build/complay.py
+++ b/scripts/build/complay.py
@@ -92,6 +92,7 @@ class XmlError(Exception):
class LayoutChecker(Minifyer):
+ BADTAGPATTERN = re.compile('[^abcdefghijklmnopqrstuvwxyz0123456789_.:^$]')
VARPATTERN = re.compile('^~scr(0|[1-9][0-9]*)(native[xy]aspect|width|height)~$')
SHAPES = frozenset(('disk', 'led14seg', 'led14segsc', 'led16seg', 'led16segsc', 'led7seg', 'led8seg_gts1', 'rect'))
OBJECTS = frozenset(('backdrop', 'bezel', 'cpanel', 'marquee', 'overlay'))
@@ -181,6 +182,21 @@ class LayoutChecker(Minifyer):
self.handleError('Element screen attribute index "%s" is negative' % (attrs['index'], ))
except:
self.handleError('Element screen attribute index "%s" is not an integer' % (attrs['index'], ))
+ if 'tag' in attrs:
+ self.handleError('Element screen has both index and tag attributes');
+ if 'tag' in attrs:
+ tag = attrs['tag']
+ if '' == tag:
+ self.handleError('Element screen attribute tag is empty')
+ else:
+ if self.BADTAGPATTERN.search(tag):
+ self.handleError('Element screen attribute tag "%s" contains invalid characters' % (tag, ));
+ if tag.find('^') >= 0:
+ self.handleError('Element screen attribute tag "%s" contains parent device reference' % (tag, ));
+ if ':' == tag[-1]:
+ self.handleError('Element screen attribute tag "%s" ends with separator' % (tag, ));
+ if tag.find('::') >= 0:
+ self.handleError('Element screen attribute tag "%s" contains double separator' % (tag, ));
self.in_object = True
self.have_bounds.append(False)
elif 'group' == name: