def on_cue_list(self, model, user_data): self.emit('action', 'list') cl = CueStack(name="Untitled Cue List", project=self.__main_window.project) d = SCRenameCueListDialog(self.__main_window, cl.name) result = d.run() if result == Gtk.ResponseType.OK: cl.rename(d.get_name()) logger.debug("Adding CueList {0}".format(cl.name)) self.__main_window.project.add_cuelist(cl) d.destroy()
def load(path): if not os.path.isdir(os.path.join(path, ".soundclip")): raise FileNotFoundError("Path does not exist or not a soundclip project") with open(os.path.join(path, ".soundclip", "project.json"), "rt") as dbobj: content = dbobj.read() if not content: raise ProjectParserException({ "message": "The project is corrupted (project.json was empty)!", "path": path }) j = json.loads(content) name = j['name'] if 'name' in j else "Untitled Project" creator = j['creator'] if 'creator' in j else "" panic_fade_time = j['panicFadeTime'] if 'panicFadeTime' in j else 500 panic_hard_stop_time = j['panicHardStopTime'] if 'panicHardStopTime' in j else 1000 eps = j['discoveryEpsilon'] if 'discoveryEpsilon' in j else 5 last_hash = j['previousRevision'] if 'previousRevision' in j else None p = Project(name=name, creator=creator, root=path, cue_stacks=[], panic_fade_time=panic_fade_time, panic_hard_stop_time=panic_hard_stop_time, current_hash=sha(content), last_hash=last_hash, max_duration_discovery_difference=eps) if 'stacks' in j: for key in j['stacks']: p += CueStack.load(path, key, p) return p