def setcurrentcuestate(self, cueindex): ''' Constructor ''' #print('{0:03}'.format(cueindex)) thiscue = self.cuelist.find("./cue[@num='" + '{0:03}'.format(cueindex) + "']") print(ET.dump(thiscue)) try: ents = thiscue.find('Entrances') # print(ET.dump(ents)) # print(ents.text) if ents != None: entlist = ents.text for entidx in entlist.split(","): self.mutestate[entidx.strip()] = 1 except: print('Entrances Index ' + '{0:03}'.format(cueindex) + ' not found!') try: exts = thiscue.find('Exits') if exts != None: extlist = exts.text for extidx in extlist.split(","): self.mutestate[extidx.strip()] = 0 except: print('Exits Index ' + '{0:03}'.format(cueindex) + ' not found!')
newdoctree.write(filename, xml_declaration=True) logging.debug('Configuration written to: ' + filename) return if __name__ == "__main__": #/home/mac/SharedData/PycharmProjs/ShowControl/ShowControl/utils/ logging.basicConfig(level=logging.INFO, filename='CueList.log', filemode='w', format='%(name)s %(levelname)s %(message)s') app = QtWidgets.QApplication(['']) cues = CueList('/home/mac/Shows/Fiddler/Fiddler_cuesx.xml') cues.getcuetype(0) ET.dump(cues.cuelist) allcues = cues.cuelist.findall(".cues/cue") showcontrol = ET.Element('showcontrol') sortedcues = ET.SubElement(showcontrol, 'cues') ET.SubElement(sortedcues, 'version').text = '1.0' for count, cue in enumerate(allcues): cuenum = cue.get("num") print('count: {}, num: {} {}'.format(count, cuenum, count == int(cuenum))) if count == int(cuenum): # save it in new doc sortedcues.append(cue) else: # find the cue element for this count and save it in the new doc nextcue = cues.cuelist.find(".cues/cue[@num='" + '{0:03}'.format(count) + "']") sortedcues.append(nextcue) ET.dump(showcontrol) cuesxml = CuesXML()
if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) fileNames = [] fdlg = QtWidgets.QFileDialog() fdlg.setFilter(QDir.AllEntries | QDir.Hidden) if (fdlg.exec()): fileNames = fdlg.selectedFiles() fdlg.close() if len(fileNames) != 0: conffile = fileNames[0] print('File>Open: {0}'.format(fileNames)) mixers = MixerConf(conffile) print(mixers.mixer_count) print(mixers.mfr_list) print(mixers.model_list) mixers.set_selected_mixer('Behringer', 'X32') ET.dump(mixers.selected_mixer) mixers.set_element_attrib(mixers.selected_mixer, 'model', 'X32++') print(mixers.get_selected_mixer_element('protocol', '', '')) print('illuminated = ' + mixers.get_selected_mixer_element_attrib('mutestyle', 'illuminated')) selectedmixerstrip = mixers.get_selected_mixer_element( 'strip', 'type', 'input') mixers.set_element_attrib(selectedmixerstrip, 'name', 'Ccc') selectedmixerstripcontrol = mixers.get_selected_strip_control_element( selectedmixerstrip, 'fader') mixers.set_control_attrib(selectedmixerstrip, 'fader', 'anoms', 'fake') mixers.savemixers(False, 'TestMixerSave.xml') pass