def on_import(self, boolean=False): """ Handle a subsequence import """ # Get the path main = self.treeWidget().window() filename = unicode(QtGui.QFileDialog().getOpenFileName(main, "Import" , ".", "*.xml")) if filename == u"": return # Open the sequence self.file_path = os.path.abspath(filename) file_name = os.path.basename(self.file_path) self.log(u'IMPORT : {}'.format(file_name)) try: subsequence = parse_sequence_file(self.file_path, execution=False) except StandardError as error: self.log('ERROR : '+ unicode(error)) self.on_new() return self.sequence.subsequences.append(subsequence) item = SequenceItem(self, subsequence, self.editor) self.setExpanded(True) item.apply_rename() self.editor.set_changed(True, global_change=True)
def load(self, xml_file, max_depth=None, backup=None): """ Load an xml file :param xml_file: str -- path of the xml file to load :param max_depth: int -- maximum depth for sequence creation :param backup: str -- path of the xml backup file """ if self.loaded and self.started: if not self.interrupted: return self.wait() xml_sequence = parse_sequence_file(xml_file, max_depth, backup) self.sequence = RootSequenceThread(xml_sequence) self.loaded = True self.started = False self.interrupted = False
def open(self, filename): """ Open a sequence from an XML file """ # Open the sequence self.file_path = os.path.abspath(filename) file_name = os.path.basename(self.file_path) self.log(u'OPEN : {}'.format(file_name)) try: self.current_sequence = parse_sequence_file(self.file_path, execution=False) except StandardError as error: self.log('ERROR : '+ repr(error)) self.on_new() return # Update self.update() # No changes self.set_changed(False)
def open(self, filename): """ Open a sequence from an XML file """ # Open the sequence self.file_path = os.path.abspath(filename) file_name = os.path.basename(self.file_path) self.log(u'OPEN : {}'.format(file_name)) try: self.current_sequence = parse_sequence_file(self.file_path, execution=False) except StandardError as error: self.log('ERROR : ' + repr(error)) self.on_new() return # Update self.update() # No changes self.set_changed(False)