(self)
| 2222 | Menu.update_labels(self) |
| 2223 | |
| 2224 | def calc_mode(self): |
| 2225 | modes = [k for (k, v) in self.values.items() if v and not isinstance(v, Cycler)] |
| 2226 | crab = 'crab' in modes |
| 2227 | if 'variable' in modes: modes.remove('variable') |
| 2228 | if 'combination' in modes: |
| 2229 | modes.remove('combination') |
| 2230 | modes.extend(['visvis', 'visaudio', 'audiovis']) # audio should already be there |
| 2231 | base = 0 |
| 2232 | base += 256 * (self.values['multi'].value()-1) |
| 2233 | if 'crab' in modes: |
| 2234 | modes.remove('crab') |
| 2235 | base += 128 |
| 2236 | if 'selfpaced' in modes: |
| 2237 | modes.remove('selfpaced') |
| 2238 | base += 1024 |
| 2239 | |
| 2240 | candidates = set([k for k,v in mode.modalities.items() if not |
| 2241 | [True for m in modes if not m in v] and not |
| 2242 | [True for m in v if not m in modes]]) |
| 2243 | candidates = candidates & set(range(0, 128)) |
| 2244 | if len(candidates) == 1: |
| 2245 | candidate = list(candidates)[0] + base |
| 2246 | if candidate in mode.modalities: |
| 2247 | self.newmode = candidate |
| 2248 | else: self.newmode = False |
| 2249 | else: |
| 2250 | if DEBUG: print(candidates, base) |
| 2251 | self.newmode = False |
| 2252 | |
| 2253 | def close(self): |
| 2254 | Menu.close(self) |
no test coverage detected