def call(self, rom): files = rom["files"] system = get_system(rom["system"], self.context) if len(files) == 0: return get_mru(self.context).add(rom) if len(files) == 1: cmd = system.cmd + [files[0]["path"]] exec(cmd, bg=True) else: self._launch_multi_rom(system, files)
def call(self, rom): system = get_system(rom["system"], self.context) replacements = { "%title%": rom["title"], "%system%": system.name } cmd = [] for part in self.cmd: for f, t in replacements.items(): part = part.replace(f, t) cmd.append(part) exec(cmd, bg=True)
def _launch_multi_rom(self, system, files): label = "Select ROM / Disc" items = [] for file in files: cmd = system.cmd + [file["path"]] items.append({"text": split(file["path"])[1], "action": lambda: exec(cmd, bg=True)}) store = Store(items) dialog = ActionMenuDialog(store, label, self.context.theme["dialog"]) self.context.dialog_handler.start_dialog(dialog)
def call(self, stream): exec(self._get_cmd(stream), bg=True)