diff options
Diffstat (limited to 'src/unlock.py')
-rw-r--r-- | src/unlock.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/unlock.py b/src/unlock.py index 446cd0a..cf3e6fd 100644 --- a/src/unlock.py +++ b/src/unlock.py @@ -11,6 +11,8 @@ def parseUnlockText(text): parsed = _parseUnlockBit(text.lower()) if parsed == ('always',): return None + else: + return parsed def _parseUnlockBit(text): # blank criterion @@ -110,7 +112,7 @@ def stringifyUnlockData(data): return (' %s ' % kind).join(map(lambda x: '(%s)' % stringifyUnlockData(x), data[1])) -def packUnlockSpec(spec): +def packUnlockSpec(data): kind = data[0] if kind == 'always': @@ -119,7 +121,7 @@ def packUnlockSpec(spec): elif kind == 'level': k, world, level, secret = data - one = (1 << 6) | (0x10 if secret else 0) | (worldNumber - 1) + one = (1 << 6) | (0x10 if secret else 0) | (world - 1) return chr(one) + chr(level - 1) @@ -198,6 +200,8 @@ class KPUnlockSpecDialog(QtGui.QDialog): self.layout.addWidget(self.statusLabel) self.layout.addWidget(self.buttons) self.setLayout(self.layout) + + self.spec = None def setSpec(self, spec): self.textBox.setText(stringifyUnlockData(spec)) |