# -*- coding: ISO-8859-1 -*- """ capellaScript -- Copyright (c) 2005 Peter Becker >>> Stimmumfang : Ermitteln des Stimmumfangs pro Notenzeile Der Stimmumfang wird an der ausgewählten Position eingefügt.|| Ist "vor dem System" ausgewählt, muss der linke Einzug justiert werden. | Dieses Script ist nur sinnvoll, wenn das erste System alle Stimmen ( Notenzeilen ) des Partitur Layouts enthält. || Bei Problemen bitte eine Mail an peter_becker@freenet.de <<< History: 11.07.05 - Erste Ausgabe 12.07.05 - Vorzeichen bei Umfang unterdrücken, ist nicht Tonart konform - besseres Alignment durch einfügen nach Schlüssel - falls kein Schlüssel, Anker am Zeilenanfang - vergleicht jetzt abhängig von der Stimmenbezeichnung - Partiturlayout muss mit dem ersten System übereinstimmen 13.07.05 - Abend wenn Zeile nur mit Pausen - Auswahlmöglichkeit 15.07.05 - Unterstützung von Sonderzeichen im Layout 03.08.05 - Erweiterte Darstellung vor dem System 18.01.10 - Vorzeichen werden, je nach Position relativ zu Vorzeichen, angezeigt 20.01.10 - Fehler bei mehr als einer Zeile behoben 22.01.10 - Optik bei "vor dem System" verbessert 25.01.10 - noch mehr Optik und Auswahl WavyLine und Line 26.01.10 - Berücksichtigung der Instrumentenbezeichnung 21.01.11 - Jetzt auch markierte System unterstützt. Damit ist auch Stimmumfang pro Satz möglich 01.08.11 - Bugfix wenn beim tiefsten Ton ein Halbtonunterschied in unterschiedlichen Systemen 09.01.12 - 1.2.2 Bugfix in der Formatierung wenn mehrstimmige Zeilen 17.01.12 - 1.3.0 nur markierte Zeile 25.01.12 - 1.3.1 Bugfix wenn Partiturlayout nicht mit Partitur übereinstimmt 25.01.12 - 1.3.2 Bugfix Einrücken wenn "vor dem System" und "markierte Systeme" """ import xml.dom, tempfile from caplib.capDOM import ScoreChange from xml.dom.minidom import NodeList, Node, Element import string version = '1.3.2' def latin1_e(u): return u.encode('Latin-1') def latin1_d(u): return u.decode('Latin-1') def insertNewElementNode(el,tagName,ref): # add new Node with tagName "tagName" to el global doc newChild = doc.createElement(tagName) el.insertBefore(newChild,ref) return newChild def addNewElementNode(el,tagName): # add new Node with tagName "tagName" to el global doc newChild = doc.createElement(tagName) el.appendChild(newChild) return newChild def addElementNode(el,tagName): # Neue Node zu "el" hinzufügen wenn Node "tagName" nicht existiert # ansonsten existierende Node zurückmelden global doc childs = el.childNodes for n in range(childs.length): if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == tagName: return childs[n] newChild = doc.createElement(tagName) el.appendChild(newChild) return newChild def umfangEinsetzen(score, staff, dtief, dhoch, vztief, vzhoch, sy, mode): #messageBox('UMFANG', str(dtief) + '\n' + str(vztief) + '\n' + str(dhoch) + '\n' + str(vzhoch)) global doc, rAr, rWa, eEr, syvon, shiftOK doc=score.parentNode list = ('C','D','E','F','G','A','B') octTief = dtief/7 octHoch = dhoch/7 tonTief = dtief-octTief*7 tonHoch = dhoch-octHoch*7 pitTief = list[tonTief]+str(octTief) pitHoch = list[tonHoch]+str(octHoch) anchor = 0 #y2dist = ((octHoch-octTief)*3) + ((tonHoch-tonTief)/2) -0.5 ix = staff.index() sys = score.getElementsByTagName('system') staff1 = sys[sy].getElementsByTagName('staff') voices = staff1[ix].getElementsByTagName('voices') voice = voices[0].getElementsByTagName('voice') noteObjs = voice[0].getElementsByTagName('noteObjects') noteObjs = voice[0].getElementsByTagName('noteObjects') childs = noteObjs[0].childNodes for n in range(childs.length): if rWo == 1: # Ankerpunkt nach Schlüssel if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'clefSign': ch = childs[n+1] anchor = 1 break elif rWo == 2 or rWo == 3: # Ankerpunkt vor Taktangabe if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'timeSign': ch = childs[n] anchor = 1 break elif rWo == 4: # Ankerpunkt an erster Note oder Pause = vor System if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'clefSign': clef = childs[n].getAttribute('clef') # Schlüssel merken #messageBox('CLEF',str(clef)) elif childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'chord': ch = childs[n] anchor = 1 break elif childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'rest': ch = childs[n] anchor = 1 break if anchor == 0: # ansonsten Anker am Anfang der Zeile ch = childs[0] #messageBox('SYS',str(voice) + '\n' + str(ix)) if rWo <> 4: for nn in range(voice.length): noteObjs = voice[nn].getElementsByTagName('noteObjects') childs = noteObjs[0].childNodes for n in range(childs.length): if rWo == 1: # Ankerpunkt nach Schlüssel if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'clefSign': ch = childs[n+1] anchor = 1 break elif rWo == 2 or rWo == 3: # Ankerpunkt vor Taktangabe if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'timeSign': ch = childs[n] anchor = 1 break elif rWo == 4: # Ankerpunkt an erster Note oder Pause = vor System if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'clefSign': clef = childs[n].getAttribute('clef') # Schlüssel merken #messageBox('CLEF',str(clef)) elif childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'chord': ch = childs[n] anchor = 1 break elif childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == 'rest': ch = childs[n] anchor = 1 break if anchor == 0: # ansonsten Anker am Anfang der Zeile ch = childs[0] el = insertNewElementNode(noteObjs[0],'chord',ch) du = addNewElementNode(el,'duration') di = addNewElementNode(el,'display') st = addNewElementNode(el,'stem') hds = addNewElementNode(el,'heads') hd1 = addNewElementNode(hds,'head') hd2 = addNewElementNode(hds,'head') al1 = addNewElementNode(hd1,'alter') al2 = addNewElementNode(hd2,'alter') du.setAttribute('base','1/4') if rWo <> 3: du.setAttribute('noDuration','true') di.setAttribute('small','true') di.setAttribute('xShift','-0.75') st.setAttribute('invisible','true') #messageBox('Mode',str(mode)) if mode == '0': hd1.setAttribute('pitch',pitHoch) al1.setAttribute('step',str(vzhoch)) hd2.setAttribute('pitch',pitTief) al2.setAttribute('step',str(vztief)) else: hd1.setAttribute('pitch','A5') hd2.setAttribute('pitch','A5') di.setAttribute('invisible','true') hd1.setAttribute('silent','true') hd2.setAttribute('silent','true') #al1.setAttribute('display','suppress') #al2.setAttribute('display','suppress') elif rWo == 4 and mode == '0': for note in staff.noteObjs(): # Auswahl: vor System if note.isChord() or note.isRest(): # Ankerpunkt suchen anchorPos = note.posX(True) # und Position feststellen break #messageBox('SYS',str(len(sys)) + '\n' + str(syvon)) leftInd = int(3) #messageBox('shiftOK',str(shiftOK)) if shiftOK == 0: if len(sys) > 1: if sys[syvon].hasAttribute('leftIndent'): # sys[1] leftInd = int(sys[syvon].getAttribute('leftIndent')) messageBox('LI1',str(leftInd)) else: if sys[0].hasAttribute('leftIndent'): leftInd = int(sys[0].getAttribute('leftIndent')) leftInd = leftInd + int(13) + int(eEr) #messageBox('LI2',str(leftInd) + ' *** ' + str(anchorPos)) sys[syvon].setAttribute('leftIndent',str(leftInd)) # sys[0] shiftOK = 1 nlx1 = -anchorPos - 13 nlx2 = -anchorPos - 2.4 #messageBox('LI',str(leftInd) + ' *** ' + str(anchorPos) + '\n' + str(nlx1)) dos = addElementNode(ch,'drawObjects') do = addNewElementNode(dos,'drawObj') nln = addNewElementNode(do,'notelines') # Notenlinien davorsetzen nln.setAttribute('y','0') nln.setAttribute('x1',str(nlx1)) nln.setAttribute('x2',str(nlx2)) nclx = nlx1 oct = 'no' if clef[2:3] == '+': oct = '+' if clef[2:3] == '-': oct = '-' if clef == 'treble' or clef[0:1] == 'G': # Schlüssel einsetzen ncly = '1' clForm = 'A' if clef[0:1] == 'G': if clef[1:2] == '1': ncly = '2' elif clef == 'bass' or clef[0:1] == 'F': ncly = '-1' clForm = 'E' if clef[0:1] == 'F': if clef[1:2] == '3': ncly = '0' elif clef[1:2] == '5': ncly = '-2' elif clef == 'alto' or clef == 'tenor' or clef[0:1] == 'C': ncly = '0' clForm = 'C' if clef[0:1] == 'C': if clef[1:2] == '1': ncly = '2' elif clef[1:2] == '2': ncly = '1' elif clef[1:2] == '5': ncly = '-2' elif clef == 'tenor': ncly = '-1' else: ncly = 0 clForm = 'noClef' clef = 'treble' do = addNewElementNode(dos,'drawObj') ncl = addNewElementNode(do,'text') # Schlüssel davorsetzen ncl.setAttribute('x',str(nclx)) ncl.setAttribute('y',str(ncly)) nft = addNewElementNode(ncl,'font') nft.setAttribute('face','capella3') nft.setAttribute('height','18') nft.setAttribute('weight','0') nft.setAttribute('charSet','2') nft.setAttribute('pitchAndFamily','0') nct = addNewElementNode(ncl,'content') if clForm <> 'noClef': textNode = doc.createTextNode(clForm) nct.appendChild(textNode) if oct <> 'no': #messageBox('OKT',str(oct)) if oct == '+': ncly = '-4.5' if oct == '-': ncly = '4.5' if clef[0:1] == 'F' and oct == '-': ncly = '2.2' #messageBox('OKT',str(nclx)) do = addNewElementNode(dos,'drawObj') ncl = addNewElementNode(do,'text') # Oktavierung davorsetzen ncl.setAttribute('x',str(nclx+1.1)) ncl.setAttribute('y',str(ncly)) nft = addNewElementNode(ncl,'font') nft.setAttribute('face','capella3') nft.setAttribute('height','15') nft.setAttribute('weight','0') nft.setAttribute('charSet','2') nft.setAttribute('pitchAndFamily','0') nct = addNewElementNode(ncl,'content') textNode = doc.createTextNode('8') nct.appendChild(textNode) posHoch = getNotePos(pitHoch, clef) # Position der oberen Note ermitteln insertNote(dos, nclx, nct, posHoch, vzhoch, '1') # Note einsetzen insertStrich(dos, nclx, nct, posHoch, '1') # Hilfslinien zeichnen posTief = getNotePos(pitTief, clef) # Position der unteren Note ermitteln insertNote(dos, nclx, nct, posTief, vztief, '0') # Note einsetzen insertStrich(dos, nclx, nct, posTief, '0') # Hilfslinien zeichnen insertWavy(dos, nclx, nct, posHoch+0.8, posTief-0.8)# mit Wellenlinie verbinden layout = score.getElementsByTagName('layout') # Formatieren Instrumentenbezeichnung instNa = layout[0].getElementsByTagName('instrumentNames') if rAr == 0: instNa[0].setAttribute('align','left') elif rAr == 2: instNa[0].setAttribute('align','right') else: if instNa[0].hasAttribute('align'): instNa[0].removeAttribute('align') return def insertWavy(dos, nclx, nct, posHoch, posTief): # Hilfslinien einsetzen global rLi action = 'Yes' if action == 'Yes': do = addNewElementNode(dos,'drawObj') if rLi == 0: ncl = addNewElementNode(do,'wavyLine') else: ncl = addNewElementNode(do,'line') ncl.setAttribute('lineWidth',"0.2") ncl.setAttribute('x1',str(nclx+8.8)) ncl.setAttribute('y1',str(posHoch)) ncl.setAttribute('x2',str(nclx+5.9)) ncl.setAttribute('y2',str(posTief)) return def insertStrich(dos, nclx, nct, pos, versatz): # Hilfslinien einsetzen if pos >= 3: if str(pos)[-2:] == '.5': pos = pos-0.5 while pos >= 3: do = addNewElementNode(dos,'drawObj') ncl = addNewElementNode(do,'line') if versatz == '0': ncl.setAttribute('x1',str(nclx+4.4)) ncl.setAttribute('y1',str(pos)) ncl.setAttribute('x2',str(nclx+6.2)) ncl.setAttribute('y2',str(pos)) else: ncl.setAttribute('x1',str(nclx+8.3)) ncl.setAttribute('y1',str(pos)) ncl.setAttribute('x2',str(nclx+10.1)) ncl.setAttribute('y2',str(pos)) ncl.setAttribute('lineWidth',"0.2") pos = pos-1 if pos <= -3: if str(pos)[-2:] == '.5': pos = pos+0.5 while pos <= -3: do = addNewElementNode(dos,'drawObj') ncl = addNewElementNode(do,'line') if versatz == '0': ncl.setAttribute('x1',str(nclx+4.4)) ncl.setAttribute('y1',str(pos)) ncl.setAttribute('x2',str(nclx+6.2)) ncl.setAttribute('y2',str(pos)) else: ncl.setAttribute('x1',str(nclx+8.3)) ncl.setAttribute('y1',str(pos)) ncl.setAttribute('x2',str(nclx+10.1)) ncl.setAttribute('y2',str(pos)) pos = pos+1 ncl.setAttribute('lineWidth',"0.2") return def insertNote(dos, nclx, nct, pos, vz, versatz): # Note einsetzen vz = str(vz) do = addNewElementNode(dos,'drawObj') ncl = addNewElementNode(do,'text') if versatz == '0': ncl.setAttribute('x',str(nclx+4.7)) else: ncl.setAttribute('x',str(nclx+8.7)) ncl.setAttribute('y',str(pos)) nft = addNewElementNode(ncl,'font') nft.setAttribute('face','capella3') nft.setAttribute('height','18') nft.setAttribute('weight','0') nft.setAttribute('charSet','2') nft.setAttribute('pitchAndFamily','0') nct = addNewElementNode(ncl,'content') textNode = doc.createTextNode(latin1_d('å')) nct.appendChild(textNode) if vz <> '0': #messageBox('VZ',str(vz)) do = addNewElementNode(dos,'drawObj') ncl = addNewElementNode(do,'text') if versatz == '0': ncl.setAttribute('x',str(nclx+3.2)) else: ncl.setAttribute('x',str(nclx+7.2)) ncl.setAttribute('y',str(pos)) nft = addNewElementNode(ncl,'font') nft.setAttribute('face','capella3') nft.setAttribute('height','18') nft.setAttribute('weight','0') nft.setAttribute('charSet','2') nft.setAttribute('pitchAndFamily','0') nct = addNewElementNode(ncl,'content') if vz == '1': vz = 'S' else: vz = 'Q' textNode = doc.createTextNode(latin1_d(vz)) nct.appendChild(textNode) return def getNotePos(pitch,clef): #messageBox('POS',str(pitch) + '\n' + str(clef)) pOffset = dict(C='0', D='1', E='2', F='3', G='4', A='5', B='6') cOffset = dict(treble=0, G2P=3.5, G2M=-3.5, G1=1, alto=-3, C1=-1, C2=-2,tenor=-4,C5=-5,bass=-6, F5=-7, F4M=-9.5) if clef[2:3] == '+': clef = clef[0:2] + 'P' if clef[2:3] == '-': clef = clef[0:2] + 'M' pi = float(pOffset[pitch[0:1]]) # pitch offset ci = float(cOffset[clef]) # clef offset oi = float(pitch[1:3]) # octave offset po = 20.5-(oi*3.5)-(pi*0.5)+ci return po def getLayout(score,sy,st): sys = score.getElementsByTagName('system') staff = sys[sy].getElementsByTagName('staff') layout = staff[st].getAttribute('layout') return layout def changeDoc(score): global statusList, anzahlZeilen, syvon, shiftOK # rWa=2 nur markierte Stimme noch codieren save ={} start1 = 0 shiftOK = 0 stimmen = activeScore().voiceList() #Stimmenbezeichnungen merken for ix in range(len(stimmen)): save['sn' + str(ix)] = stimmen[ix] st = activeScore().system(0).nStaves() if st <> len(stimmen): #messageBox('Stimmumfang','Partitur Layout stimmt nicht mit erstem System überein.') return sel = curSelection() #messageBox('CURSOR',str(sel)) selvon = sel[0] selbis = sel[1] if rWa == 0: syvon = 0 sybis = int(activeScore().nSystems())-1 stvon = selvon[1] stbis = selbis[1] else: syvon = selvon[0] sybis = selbis[0] stvon = selvon[1] stbis = selbis[1] if syvon >= sybis: syvon = selbis[0] sybis = selvon[0] #messageBox('CURSOR',str(syvon) + '\n' + str(sybis)) System = activeScore().system(syvon) # Position des ersten Systems sichern for st in range(System.nStaves()): Staff = System.staff(st) layout = getLayout(score,syvon,st) layout = latin1_e(layout) save['ss' + str(layout)] = Staff #messageBox('staves',str('ss' + str(layout))) sy = syvon #messageBox('System',str(sy) + '\n' + str(selbis[0])) while sy <= sybis: System = activeScore().system(sy) #messageBox('System',str(sy)) for st in range(System.nStaves()): #messageBox('Staff',str(st)) ctief = 0 choch = 0 dtief = 0 dhoch = 0 start = 0 Staff = System.staff(st) layout = getLayout(score,sy,st) found = 0 saved = 0 for vo in range(Staff.nVoices()): # Umfang für jede Zeile in jedem System ermitteln #messageBox('Voice',str(vo)) Voice = Staff.voice(vo) for no in range(Voice.nNoteObjs()): NoteObj = Voice.noteObj(no) if NoteObj.isChord(): found = 1 for hd in range(NoteObj.nHeads()): head = NoteObj.head(hd) cpitch = head.chromaticPitch() dpitch = head.diatonicPitch() #messageBox('PITCH',str(no) +'\n' + str(cpitch) + '\n' + str(dpitch) + '\nStart=' + str(start) ) if cpitch > choch: #messageBox('S1','S1') choch = cpitch dhoch = dpitch if start == 0: #messageBox('S2','S2') ctief = cpitch dtief = dpitch start = 1 else: if cpitch < ctief: #messageBox('S3','S3') ctief = cpitch dtief = dpitch #messageBox('tiefhoch','SY=' + str(sy) + '\n' + str(ctief) + ' *** ' + str(dtief) + '\n' + str(choch) + ' *** ' + str(dhoch)) if found == 1: #messageBox('FOUND',str(sy) + str(layout)) layout = latin1_e(layout) save['dt' + str(sy) + str(layout)] = dtief save['dh' + str(sy) + str(layout)] = dhoch save['syst'] = sy #messageBox('TEIL',str(dhoch[0]) + ' *** ' + str(dhoch[1])) if start1 == 0: start = 1 save['st' + str(layout)] = Staff found = 0 sy = sy + 1 ixsy = save['syst']+1 #messageBox('STIMMEN',str(stimmen) + ' *** ' + str(ixsy) + '\n' + str(save)) for w2 in range(len(stimmen)): # Umfang für jede Zeile ermitteln dhoch = (0,0) dtief = (999,0) for w1 in range(ixsy): if 'dh' + str(w1) + str(stimmen[w2]) in save: Staff = save['st' + str(stimmen[w2])] hochg = save['dh' + str(w1) + str(stimmen[w2])] tiefg = save['dt' + str(w1) + str(stimmen[w2])] #messageBox('STIMMEN',str(hochg) + '\n' + str(tiefg)) hoch = int(hochg[0]) hochK = int(hochg[1]) tief = int(tiefg[0]) tiefK = int(tiefg[1]) #messageBox('HochTIEF_G', str(dhoch) + ' *** ' + str(dtief) + '\n' + str(hoch) + ' *** ' + str(tief)) #messageBox('TIEF',str(dtief[0]) + ' ' + str(dtief[1])) if dhoch[0] < hoch: dhoch = hochg if dtief[0] > tief: dtief = tiefg elif dtief[0] == tief: if dtief[1] == 0 and tiefK <> 0: tiefg = (tiefg[0],0) dtief = tiefg #messageBox('HochTIEF_S', str(dhoch) + ' *** ' + str(dtief)) save['tt' + str(stimmen[w2])] = dtief save['th' + str(stimmen[w2])] = dhoch if rWa <> 2: for w1 in range(len(stimmen)): # und einsetzen #messageBox('1',str(stimmen) + '\n' + str(save)) found = 0 if 'th' + str(stimmen[w1]) in save: hoch = save['th' + str(stimmen[w1])] found = 1 if 'tt' + str(stimmen[w1]) in save: tief = save['tt' + str(stimmen[w1])] found = 1 if 'st' + str(stimmen[w1]) in save: Staff = save['ss' + str(stimmen[w1])] found = 1 if found == 1: if statusList[w1] == 1: umfangEinsetzen(score, Staff, tief[0], hoch[0], tief[1], hoch[1], syvon, '0') else: umfangEinsetzen(score, Staff, tief[0], hoch[0], tief[1], hoch[1], syvon, '1') return def suDialog(score): global rWo,rLi,rAr,eEr,rWa,anzahlZeilen,statusList options = ScriptOptions() opt = options.get() wo = '1' # nach Schlüssel li = '0' # wavy line ar = '0' # Ausrichtung Instrumentenbezeichnung er = '10' # zusätzlicher Einzug wa = '0' # Bereich if opt: wo = opt.get('DrWo',wo) li = opt.get('DrLi',li) ar = opt.get('DrAr',ar) er = opt.get('DrEr',er) wa = opt.get('DrWa',wa) statusList = [] layout = score.getElementsByTagName('layout') staves = layout[0].getElementsByTagName('staves') sl = staves[0].getElementsByTagName('staffLayout') execString2 = 'subboxSt = VBox([' #execString3 = 'global ' anzahlZeilen = sl.length for n in range(sl.length): stimme = latin1_e(sl[n].getAttribute('description')) if n <> 0: execString2 = execString2 + ',' execString1 = 'chkZeile' + str(n) + ' = CheckBox("' + str(stimme) + '",value=1)' exec(execString1) execString2 = execString2 + 'chkZeile' + str(n) execString2 = execString2 + '])' exec(execString2) placeholder1 = Label(' ',width=1) radWa = Radio(['gesamte Partitur','nur markierte Systeme'],text='Feststellung für',value=int(opt.get('rWa',str(wa)))) radWo = Radio(['am Zeilenanfang','nach Schlüssel','vor Taktangabe - alle Zeilen in der selben Tonart','vor Taktangabe - eine Zeile in C-Dur','vor dem System'],text='Stimmumfang einfügen',value=int(opt.get('rWo',str(wo)))) radLi = Radio(['Wellenlinie','Strich'],text='Verbindungslinie',value=int(opt.get('rLi',str(li)))) radAr = Radio(['Ausrichtung linksbündig','Ausrichtung zentriert','Ausrichtung rechtsbündig'],text='bei Instrumentenbezeichnung',value=int(opt.get('rAr',str(ar)))) lablEr = Label('zusätzliches Einrücken um ',width=6) editEr = Edit(opt.get('eEr',str(er)),width=4) subboxWa = HBox([radWa,subboxSt],padding=4) subboxWo = VBox([radWo],padding=4) subboxZe = HBox([lablEr,editEr]) subboxIb = VBox([radAr,subboxZe]) subboxVo = HBox([radLi,subboxIb],text='Zusätzliche Parameter bei "vor dem System"') text1 = Label('Achtung : wird "am Zeilenanfang" ausgewählt, erfolgt die Darstellung',width=10) text2 = Label(' ohne Berücksichtigung eventuell folgender Schlüssel ! ',width=10) box = VBox([subboxWa,subboxWo,subboxVo,text1,text2,placeholder1],padding=1) dlg = Dialog('Stimmumfang Version ' + version, box) if dlg.run(): rWo = radWo.value() rLi = radLi.value() rAr = radAr.value() eEr = editEr.value() rWa = radWa.value() wo = opt.get('DrWo','') li = opt.get('DrLi','') ar = opt.get('DrAr','') er = opt.get('DrEr','') wa = opt.get('DrWa','') opt = dict(DrWo = str(rWo), DrLi = str(rLi), DrAr = str(rAr), DrEr = str(eEr), DrWa = str(rWa) ) options.set(opt) for n in range(anzahlZeilen): execString = "v = chkZeile" + str(n) + ".value()" exec(execString) statusList.append(v) return True else: return False # Hauptprogramm: from caplib.capDOM import ScoreChange import tempfile activeScore().registerUndo("Stimmumfang") class ScoreChange(ScoreChange): def changeScore(self, score): if suDialog(score): changeDoc(score) if activeScore(): global tempInput, tempOutput tempInput = tempfile.mktemp('.capx') tempOutput = tempfile.mktemp('.capx') activeScore().write(tempInput) ScoreChange(tempInput, tempOutput) activeScore().read(tempOutput) os.remove(tempInput) os.remove(tempOutput)