# -*- coding: ISO-8859-1 -*- """ capellaScript -- Copyright (c) 2006 Peter Becker >>> Stimmumfang_Verwaltung : Verwaltung des unter Datei/Info/Stimmumfang dargestellten Stimmumfangs. Es sind 16 Profile mit je bis zu 16 Instrumenten/Stimmen möglich.|| Bei Problemen bitte eine e-Mail an peter_becker@freenet.de <<< Voice range management

Management of the voice range, which is presented under File/Info/Voice Range. There are 16 profiles possible each with up to 16 instruments/voices.

In case of problems please mail to peter_becker@freenet.de

Stimmumfang-Verwaltung

Verwaltung des unter Datei/Info/Stimmumfang dargestellten Stimmumfangs. Es sind 16 Profile mit je bis zu 16 Instrumenten/Stimmen möglich.

Bei Problemen bitte eine e-Mail an peter_becker@freenet.de

Beheer stemomvang

Beheer van de onder Bestand/Info/Stemomvang weergegeven stemomvang. Er zijn 16 profielen mogelijk met telkens tot 16 instrumenten/stemmen.

Bij problemen graag een mail naar peter_becker@freenet.de

13.11.2006 initial Version 14.11.2006 Gültigkeitsprüfung beim erfassen und aktivieren 15.11.2006 tonList auf das von Capella verwendete Midimodell abgeändert (c'=c1=60) 20.11.2006 Bugfix Loop bei gelöschten Feldern 21.11.2006 Profil löschen und diverse Bugfixe 22.11.2006 Profile exportieren und importieren 01.07.2009 Anpassung an Capella 2008 und VISTA 04.01.2019 WW Internationalisierung (en-de-nl) 07.01.2019 PB Prüfung auf Capella Version. Ab Capella 8 nicht mehr lauffähig 11.09.2020 WW Fehler beim Ändern leeres Profil und 'IF' geändert in 'IG' in Zeilen 1067 und 1360 """ #-------------------------------------------- english = { 'version' :'Version ', 'noCap8' :'\nThis script no longer functions from capella 8', 'existingProf' :'Has the existing Profile ', 'by' :' to be overwritten by ', 'overwritten' :' ?', 'overwriteOK' :'OK for overwrite', 'profImport' :'Profile import', 'availableProf' :'Available profiles', 'activateProf' :'Activate profile', 'compProf' :'Compose/change profile', 'importProf' :'Import profile', 'exportProf' :'Export Profile', 'delProf' :'Delete profile', 'profSel' :'Select profile', 'profName' :'Profile name', 'voiceRangeTotal' :'The tone range embraces the tones C3 until g6,', 'c1=c1=C' :' c1 corresponds with c\' resp. the onelined C', 'c#2=db1' :' Halftones can be designated e.g. with c#2 or db1.', 'Instr' :'Instrument ', 'lowestT' :' lowest tone ', 'highestT' :' highest tone ', 'profComp' :'Profile composition', 'error' :'Error', 'invalDesign' :'Unvalid tone designation', 'nProf' :'\nProfile : ', 'nInstr' :'\nInstrument : ', 'nLow' :'\nlow : ', 'nHigh' :'\nhigh : ', 'lowTAboveHighT' :'Low tone ist higher than high tone', 'equallyHigh' :'\nor both tones are equally high', 'nnProf' :'\n\nProfile : ', 'B3' :'Bb3', 'H3' :'B3', 'B2' :'Bb2', 'H2' :'B2', 'B1' :'Bb1', 'H1' :'B1', 'b' :'bb', 'h' :'b', 'b1' :'bb1', 'h1' :'b1', 'b2' :'bb2', 'h2' :'b2', 'b3' :'bb3', 'h3' :'b3', 'b4' :'bb4', 'h4' :'b4', 'b5' :'bb5', 'h5' :'b5', 'selTargetFile' :'Please select target directory', 'txtFile' :'Text File', 'selProf' :'Please select Profile', 'empty' :'empty', 'list' :'List of profiles', 'noProfAvailable' :'At the moment there are no profiles available.', 'composition' :'Composition', 'number' :'Number', #'voRaMaExpProf' :'Voice_Range_Management_:_exported_profile\n', 'importCancelled' :'The import was cancelled', 'noValidProf' :'This file has not a valid profile', 'profExport' :'Profile export', 'emptyProfNotExp' :'An empty profile can not be exported' } german = { 'version' :'Version ', 'noCap8' :'\nDieses Skript ist ab Capella 8 nicht mehr lauffähig', 'existingProf' :'Soll das bestehende Profil ', 'by' :' mit ', 'overwritten' :' überschrieben werden ?', 'overwriteOK' :'OK für überschreiben', 'profImport' :'Profil Import', 'availableProf' :'vorhandene Profile', 'activateProf' :'Profil aktivieren', 'compProf' :'Profil erfassen/ändern', 'importProf' :'Profil importieren', 'exportProf' :'Profil exportieren', 'delProf' :'Profil löschen', 'profSel' :'Profilauswahl', 'profName' :'Profilname', 'voiceRangeTotal' :'Der Tonumfang umfasst die Töne C3 bis g6', 'c1=c1=C' :' c1 entspricht dabei c\' bzw dem eingestrichenen C', 'c#2=db1' :' Halbtöne werde z.B.: mit c#2 oder db1 angegeben', 'Instr' :'Instrument ', 'lowestT' :' tiefster Ton ', 'highestT' :' höchster Ton ', 'profComp' :'Profilerfassung', 'error' :'Fehler', 'invalDesign' :'ungültige Tonbezeichnung', 'nProf' :'\nProfil : ', 'nInstr' :'\nInstrument : ', 'nLow' :'\ntief : ', 'nHigh' :'\nhoch : ', 'lowTAboveHighT' :'tiefer Ton ist höher als hoher Ton', 'equallyHigh' :'\noder beide Töne sind gleich', 'nnProf' :'\n\nProfil : ', 'B3' :'B3', 'H3' :'H3', 'B2' :'B2', 'H2' :'H2', 'B1' :'B1', 'H1' :'H1', 'b' :'b', 'h' :'h', 'b1' :'b1', 'h1' :'h1', 'b2' :'b2', 'h2' :'h2', 'b3' :'b3', 'h3' :'h3', 'b4' :'b4', 'h4' :'h4', 'b5' :'b5', 'h5' :'h5', 'selTargetFile' :'Bitte Zielordner auswählen', 'txtFile' :'Text Datei', 'selProf' :'Bitte Profil auswählen', 'empty' :'leer', 'list' :'Profilen-Liste', 'noProfAvailable' :'Zur Zeit sind keine Profile vorhanden.', 'composition' :'Besetzung', 'number' :'Anzahl', #'voRaMaExpProf' :'Stimmumfang_Verwaltung_exportiertes_Profil\n', 'importCancelled' :'Der Import wurde abgebrochen', 'noValidProf' :'diese Datei enthält kein gültiges Profil', 'profExport' :'Profil Export', 'emptyProfNotExp' :'ein leeres Profil lässt sich nicht exportieren' } dutch = { 'version' :'Versie ', 'noCap8' :'\nDit script functioneert niet meer vanaf Capella 8', 'existingProf' :'Moet het bestaande profiel ', 'by' :' door ', 'overwritten' :' overschreven worden ?', 'overwriteOK' :'OK voor overschrijven', 'profImport' :'Profiel import', 'availableProf' :'beschikbare Profielen', 'activateProf' :'Profiel activeren', 'compProf' :'Profiel samenstellen/veranderen', 'importProf' :'Profiel importeren', 'exportProf' :'Profiel exporteren', 'delProf' :'Profiel verwijderen', 'profSel' :'Profielkeuze', 'profName' :'Profielnaam', 'voiceRangeTotal' :'Het toonbereik omvat de tonen C3 tot g6,', 'c1=c1=C' :' c1 komt daarbij overeen met c\' resp. ééngestreepte C.', 'c#2=db1' :' Halve tonen kunnen bv. met c#2 of db1 worden aangeduid.', 'Instr' :'Instrument ', 'lowestT' :' laagste toon ', 'highestT' :' hoogste toon ', 'profComp' :'Profielsamenstelling', 'error' :'Fout', 'invalDesign' :'ongeldige toonaanduiding', 'nProf' :'\nProfiel : ', 'nInstr' :'\nInstrument : ', 'nLow' :'\nlaag : ', 'nHigh' :'\nhooog : ', 'lowTAboveHighT' :'lage toon is hoger dan hoge toon', 'equallyHigh' : '\nof beide tonen zijn even hoog', 'nnProf' :'\n\nProfiel : ', 'B3' :'Bb3', 'H3' :'B3', 'B2' :'Bb2', 'H2' :'B2', 'B1' :'Bb1', 'H1' :'B1', 'b' :'bb', 'h' :'b', 'b1' :'bb1', 'h1' :'b1', 'b2' :'bb2', 'h2' :'b2', 'b3' :'bb3', 'h3' :'b3', 'b4' :'bb4', 'h4' :'b4', 'b5' :'bb5', 'h5' :'b5', 'selTargetFile' :'S.v.p. doelmap selecteren', 'txtFile' :'Tekstbestand', 'selProf' :'S.v.p. profiel selecteren', 'empty' :'leeg', 'list' :'Profielenlijst', 'noProfAvailable' :'Momenteel zijn er geen profielen beschikbaar.', 'composition' :'Bezetting', 'number' :'Aantal', #'voRaMaExpProf' :'Beheer_Stemomvang_:_geëxporteerd_profiel\n', 'importCancelled' :'De import werd geannuleerd', 'noValidProf' :'Dit bestand heeft geen geldig profiel', 'profExport' :'Profiel export', 'emptyProfNotExp' :'een leeg profiel kan niet worden geëxporteerd' } try: setStringTable( ("en", english), ("de", german), ("nl", dutch)) except: def tr(s): return german[s] #-------------------------------------------- import _winreg import os.path as path from xml.dom.minidom import NodeList, Node, Element from caplib.capDOM import ScoreChange import tempfile, string, new class RegConfig: """ Class that encapsulates a registry (path) as a configuration store. section = registry key option = registry valuename value = registry value Storage model = dictionary """ def __init__(self, reg_path=None, autowrite=False): self._regpath = reg_path self._autowrite = autowrite self._store = {} # Autowrite is available only if a registry path is provided. if not self._regpath: self._autowrite = False # read the registry and store values if path given. if self._regpath: self.read(self._regpath) def add_section(self, section): """ Add a section named section to the instance. If a section by the given name already exists, ValueError is raised. """ if not self.has_section(section): self._store[section] = {} else: raise ValueError("Section already exists") def get(self, section, option): """ Get an option value for the named section. """ if self.has_option(section, option): return self._store[section][option][0] def _get_default_regkey(self, regpath=None, forwriting=False): """ Get the registry key handle for registry operations. provided the registry path. """ if regpath: key = regpath subkey = '' while path.split(key)[0]: key, tmp = path.split(key) subkey = '\\'.join([tmp, subkey]) if key == 'HKEY_CLASSES_ROOT': key = _winreg.HKEY_CLASSES_ROOT elif key == 'HKEY_CURRENT_CONFIG': key = _winreg.HKEY_CURRENT_CONFIG elif key == 'HKEY_CURRENT_USER': key = _winreg.HKEY_CURRENT_USER elif key == 'HKEY_DYN_DATA': key = _winreg.HKEY_DYN_DATA elif key == 'HKEY_LOCAL_MACHINE': key = _winreg.HKEY_LOCAL_MACHINE elif key == 'HKEY_PERFORMANCE_DATA': key = _winreg.HKEY_PERFORMANCE_DATA elif key == 'HKEY_USERS': key = _winreg.HKEY_USERS else: raise TypeError('Invalid registry key (HKEY_)') try: if forwriting: hkey = _winreg.CreateKey(key, subkey) else: hkey = _winreg.OpenKey(key, subkey) except: raise WindowsError('Cannot open registry path') else: return hkey def items(self, section): """ Return a list of (name, value) pairs for each option in the given section. """ if self.has_section(section): sectiondict = self._store[section] ret = [] for option in sectiondict.keys(): value, type = sectiondict[option] ret.append((option, value)) return ret def has_option(self, section, option): """ If the given section exists, and contains the given option. """ if self._store.has_key(section): sectiondict = self._store[section] return sectiondict.has_key(option) def has_section(self, section): """ Indicates whether the named section is present in the configuration. """ return self._store.has_key(section) def options(self, section): """ Returns a list of options available in the specified section. """ if self._store.has_key(section): sectiondict = self._store[section] if sectiondict: return sectiondict.keys() def read(self, regpath=None): """ Can be a single or a list of registry paths. When multiple registry keys are read, options and values are overwritten in a FIFO fashion ordered from the list. """ if regpath: try: if isinstance(regpath, list): for rp in regpath: self._read(self._get_default_regkey(rp)) else: self._read(self._get_default_regkey(regpath)) except Exception, e: if not self._autowrite: raise e def _read(self, regkey=None): """ Parses a registry path into sections, options and values. """ if regkey: index = 0 while 1: try: section = _winreg.EnumKey(regkey, index) except: break else: try: self.add_section(section) except: pass index += 1 for section in self.sections(): index = 0 while 1: try: hkey = _winreg.OpenKey(regkey, section) valuename, data, type = _winreg.EnumValue(hkey, index) except: break else: self.set(section, valuename, (data, type), readop=True) index += 1 if hkey: _winreg.CloseKey(hkey) if regkey: _winreg.CloseKey(regkey) def remove_option(self, section, option): if self.has_option(section, option): del self._store[section][option] def remove_section(self, section): if self.has_section(section): del self._store[section] def sections(self): """ Return a list of the sections available. """ return self._store.keys() def set(self, section, option, value, check=True, readop=False): """ If the given section exists, set the given option to the specified value; if check=True ValueError is raised if it nonexistent otherwise the section is written. """ if not self.has_section(section): if check and not self._autowrite: raise ValueError('Section does not exist') self.add_section(section) sectiondict = self._store[section] if isinstance(value, tuple): pass else: value = self._valueregform(value) # Automatically write to rgistry if specified. if self._autowrite and not readop: self._write_reg(self._regpath, section, option, value) sectiondict[option] = value def _valueregform(self, value): """ Converts values set by the user to a from to be stored in the registry. """ if isinstance(value, str) or isinstance(value, unicode): value = (value, _winreg.REG_SZ) elif isinstance(value, int): value = (value, _winreg.REG_DWORD) elif isinstance(value, list): for s in value: if not isinstance(s, str) or isinstance(s, unicode): raise TypeError( "Values in list must be of type str or unicode.") value = (value, _winreg.REG_MULTI_SZ) else: raise TypeError('Invalid value') return value def write(self, regpath=None): """ Writes configuration to the registry path. """ if not regpath: regpath = self._regpath if regpath: for section in self.sections(): sectiondict = self._store[section] for option in sectiondict.keys(): apply(self._write_reg, (regpath, section, option, sectiondict[option])) def _write_reg(self, regpath, section, option, value): """ Writes to the registry path. """ hkey = _winreg.CreateKey(self._get_default_regkey(regpath, True), section) _winreg.SetValueEx(hkey, option, 0, value[1], value[0]) if hkey: _winreg.CloseKey(hkey) #------------------------------------------------------------------------------------------------------------------------------------------------------------ # Hier folgen Unterroutinen für den Main Code def pqDialog3(profalt, profneu): # Sicherheitsabfrage placeholder1 = Label(' ',width=1) placeholder2 = Label(' ',width=1) placeholder3 = Label(' ',width=1) placeholder4 = Label(' ',width=1) label1 = Label(tr('existingProf') + "'" + profalt + "'" + tr('by') + "'" + profneu + "'" + tr('overwritten')) label2 = Label(' ') label3 = Label(tr('overwriteOK')) #subboxProf = HBox([radDefProf,placeholder4],padding=0) #subboxAction = HBox([radDefAction,placeholder4],padding=0) #subboxShow = HBox([radDefProf,placeholder3,radDefAction,placeholder4],padding=0) box = VBox([label1,label2,label3],padding=1) dlg = Dialog(tr('profImport'), box) if dlg.run(): return True else: return False def pqDialog2(): # vorhandene Profile anzeigen global profValue, profAction global prof01, prof02, prof03, prof04, prof05, prof06, prof07, prof08, prof09, prof10, prof11, prof12, prof13, prof14, prof15, prof16 placeholder1 = Label(' ',width=1) placeholder2 = Label(' ',width=1) placeholder3 = Label(' ',width=1) placeholder4 = Label(' ',width=1) radDefProf = Radio([prof01,prof02,prof03,prof04,prof05,prof06,prof07,prof08,prof09,prof10,prof11,prof12,prof13,prof14,prof15,prof16],text=tr('availableProf'),value=0) radDefAction = Radio([tr('activateProf'),tr('compProf'),tr('importProf'),tr('exportProf'),tr('delProf')],value=0) subboxProf = HBox([radDefProf,placeholder4],padding=0) subboxAction = HBox([radDefAction,placeholder4],padding=0) subboxShow = HBox([radDefProf,placeholder3,radDefAction,placeholder4],padding=0) box = VBox([subboxShow,placeholder1],padding=1) dlg = Dialog(tr('profSel'), box) if dlg.run(): profValue = int(radDefProf.value()) profAction = int(radDefAction.value()) return True else: return False def pqDialog1(): # ausgewähltes Profil ändern oder neues Profil erfassen global profname, I1name, I1hoch, I1tief, I2name, I2hoch, I2tief, I3name, I3hoch, I3tief, I4name, I4hoch, I4tief global I5name, I5hoch, I5tief, I6name, I6hoch, I6tief, I7name, I7hoch, I7tief, I8name, I8hoch, I8tief global I9name, I9hoch, I9tief, I10name, I10hoch, I10tief, I11name, I11hoch, I11tief, I12name, I12hoch, I12tief global I13name, I13hoch, I13tief, I14name, I14hoch, I14tief, I15name, I15hoch, I15tief, I16name, I16hoch, I16tief placeholder1 = Label(' ',width=1) placeholder2 = Label(' ',width=1) placeholder3 = Label(' ',width=1) placeholder4 = Label(' ',width=1) lablPn = Label(tr('profName'),width=10) editPn = Edit (profname,width=15) lablInfo1 = Label(tr('voiceRangeTotal')) subboxPn = HBox([lablPn,editPn,placeholder4,lablInfo1,placeholder4],padding=0) lablInfo2 = Label(tr('c1=c1=C')) lablInfo3 = Label(tr('c#2=db1')) subboxLabl1 = HBox([placeholder1,placeholder1,placeholder1,placeholder1,lablInfo2],padding=0) subboxLabl2 = HBox([placeholder1,placeholder1,placeholder1,placeholder1,lablInfo3],padding=0) subboxLeer = HBox([placeholder4],padding=0) lablI1 = Label(tr('Instr')+'1',width=10) lablI1t = Label(tr('lowestT'),width=6) lablI1h = Label(tr('highestT'),width=6) editI1n = Edit (I1name,width=15) editI1t = Edit (I1tief,width=3) editI1h = Edit (I1hoch,width=3) subboxI1 = HBox([lablI1,editI1n,lablI1t,editI1t,lablI1h,editI1h,placeholder4],padding=0) lablI2 = Label(tr('Instr')+'2',width=10) lablI2t = Label(tr('lowestT'),width=6) lablI2h = Label(tr('highestT'),width=6) editI2n = Edit (I2name,width=15) editI2t = Edit (I2tief,width=3) editI2h = Edit (I2hoch,width=3) subboxI2 = HBox([lablI2,editI2n,lablI2t,editI2t,lablI2h,editI2h,placeholder4],padding=0) lablI3 = Label(tr('Instr')+'3',width=10) lablI3t = Label(tr('lowestT'),width=6) lablI3h = Label(tr('highestT'),width=6) editI3n = Edit (I3name,width=15) editI3t = Edit (I3tief,width=3) editI3h = Edit (I3hoch,width=3) subboxI3 = HBox([lablI3,editI3n,lablI3t,editI3t,lablI3h,editI3h,placeholder4],padding=0) lablI4 = Label(tr('Instr')+'4',width=10) lablI4t = Label(tr('lowestT'),width=6) lablI4h = Label(tr('highestT'),width=6) editI4n = Edit (I4name,width=15) editI4t = Edit (I4tief,width=3) editI4h = Edit (I4hoch,width=3) subboxI4 = HBox([lablI4,editI4n,lablI4t,editI4t,lablI4h,editI4h,placeholder4],padding=0) lablI5 = Label(tr('Instr')+'5',width=10) lablI5t = Label(tr('lowestT'),width=6) lablI5h = Label(tr('highestT'),width=6) editI5n = Edit (I5name,width=15) editI5t = Edit (I5tief,width=3) editI5h = Edit (I5hoch,width=3) subboxI5 = HBox([lablI5,editI5n,lablI5t,editI5t,lablI5h,editI5h,placeholder4],padding=0) lablI6 = Label(tr('Instr')+'6',width=10) lablI6t = Label(tr('lowestT'),width=6) lablI6h = Label(tr('highestT'),width=6) editI6n = Edit (I6name,width=15) editI6t = Edit (I6tief,width=3) editI6h = Edit (I6hoch,width=3) subboxI6 = HBox([lablI6,editI6n,lablI6t,editI6t,lablI6h,editI6h,placeholder4],padding=0) lablI7 = Label(tr('Instr')+'7',width=10) lablI7t = Label(tr('lowestT'),width=6) lablI7h = Label(tr('highestT'),width=6) editI7n = Edit (I7name,width=15) editI7t = Edit (I7tief,width=3) editI7h = Edit (I7hoch,width=3) subboxI7 = HBox([lablI7,editI7n,lablI7t,editI7t,lablI7h,editI7h,placeholder4],padding=0) lablI8 = Label(tr('Instr')+'8',width=10) lablI8t = Label(tr('lowestT'),width=6) lablI8h = Label(tr('highestT'),width=6) editI8n = Edit (I8name,width=15) editI8t = Edit (I8tief,width=3) editI8h = Edit (I8hoch,width=3) subboxI8 = HBox([lablI8,editI8n,lablI8t,editI8t,lablI8h,editI8h,placeholder4],padding=0) lablI9 = Label(tr('Instr')+'9',width=10) lablI9t = Label(tr('lowestT'),width=6) lablI9h = Label(tr('highestT'),width=6) editI9n = Edit (I9name,width=15) editI9t = Edit (I9tief,width=3) editI9h = Edit (I9hoch,width=3) subboxI9 = HBox([lablI9,editI9n,lablI9t,editI9t,lablI9h,editI9h,placeholder4],padding=0) lablI10 = Label(tr('Instr')+'10',width=10) lablI10t = Label(tr('lowestT'),width=6) lablI10h = Label(tr('highestT'),width=6) editI10n = Edit (I10name,width=15) editI10t = Edit (I10tief,width=3) editI10h = Edit (I10hoch,width=3) subboxI10 = HBox([lablI10,editI10n,lablI10t,editI10t,lablI10h,editI10h,placeholder4],padding=0) lablI11 = Label(tr('Instr')+'11',width=10) lablI11t = Label(tr('lowestT'),width=6) lablI11h = Label(tr('highestT'),width=6) editI11n = Edit (I11name,width=15) editI11t = Edit (I11tief,width=3) editI11h = Edit (I11hoch,width=3) subboxI11 = HBox([lablI11,editI11n,lablI11t,editI11t,lablI11h,editI11h,placeholder4],padding=0) lablI12 = Label(tr('Instr')+'12',width=10) lablI12t = Label(tr('lowestT'),width=6) lablI12h = Label(tr('highestT'),width=6) editI12n = Edit (I12name,width=15) editI12t = Edit (I12tief,width=3) editI12h = Edit (I12hoch,width=3) subboxI12 = HBox([lablI12,editI12n,lablI12t,editI12t,lablI12h,editI12h,placeholder4],padding=0) lablI13 = Label(tr('Instr')+'13',width=10) lablI13t = Label(tr('lowestT'),width=6) lablI13h = Label(tr('highestT'),width=6) editI13n = Edit (I13name,width=15) editI13t = Edit (I13tief,width=3) editI13h = Edit (I13hoch,width=3) subboxI13 = HBox([lablI13,editI13n,lablI13t,editI13t,lablI13h,editI13h,placeholder4],padding=0) lablI14 = Label(tr('Instr')+'14',width=10) lablI14t = Label(tr('lowestT'),width=6) lablI14h = Label(tr('highestT'),width=6) editI14n = Edit (I14name,width=15) editI14t = Edit (I14tief,width=3) editI14h = Edit (I14hoch,width=3) subboxI14 = HBox([lablI14,editI14n,lablI14t,editI14t,lablI14h,editI14h,placeholder4],padding=0) lablI15 = Label('Instrument 15',width=10) lablI15t = Label(tr('lowestT'),width=6) lablI15h = Label(tr('highestT'),width=6) editI15n = Edit (I15name,width=15) editI15t = Edit (I15tief,width=3) editI15h = Edit (I15hoch,width=3) subboxI15 = HBox([lablI15,editI15n,lablI15t,editI15t,lablI15h,editI15h,placeholder4],padding=0) lablI16 = Label(tr('Instr')+'16',width=10) lablI16t = Label(tr('lowestT'),width=6) lablI16h = Label(tr('highestT'),width=6) editI16n = Edit (I16name,width=15) editI16t = Edit (I16tief,width=3) editI16h = Edit (I16hoch,width=3) subboxI16 = HBox([lablI16,editI16n,lablI16t,editI16t,lablI16h,editI16h,placeholder4],padding=0) box = VBox([subboxPn,subboxLabl1,subboxLabl2,subboxLeer,subboxI1,subboxI2,subboxI3,subboxI4,subboxI5,subboxI6,subboxI7,subboxI8,subboxI9,subboxI10,subboxI11,subboxI12,subboxI13,subboxI14,subboxI15,subboxI16,placeholder1],padding=1) dlg = Dialog(tr('profComp'), box) if dlg.run(): profname = editPn.value().strip() I1name = editI1n.value().strip() I1tief = editI1t.value().strip() I1hoch = editI1h.value().strip() I2name = editI2n.value().strip() I2tief = editI2t.value().strip() I2hoch = editI2h.value().strip() I3name = editI3n.value().strip() I3tief = editI3t.value().strip() I3hoch = editI3h.value().strip() I4name = editI4n.value().strip() I4tief = editI4t.value().strip() I4hoch = editI4h.value().strip() I5name = editI5n.value().strip() I5tief = editI5t.value().strip() I5hoch = editI5h.value().strip() I6name = editI6n.value().strip() I6tief = editI6t.value().strip() I6hoch = editI6h.value().strip() I7name = editI7n.value().strip() I7tief = editI7t.value().strip() I7hoch = editI7h.value().strip() I8name = editI8n.value().strip() I8tief = editI8t.value().strip() I8hoch = editI8h.value().strip() I9name = editI9n.value().strip() I9tief = editI9t.value().strip() I9hoch = editI9h.value().strip() I10name = editI10n.value().strip() I10tief = editI10t.value().strip() I10hoch = editI10h.value().strip() I11name = editI11n.value().strip() I11tief = editI11t.value().strip() I11hoch = editI11h.value().strip() I12name = editI12n.value().strip() I12tief = editI12t.value().strip() I12hoch = editI12h.value().strip() I13name = editI13n.value().strip() I13tief = editI13t.value().strip() I13hoch = editI13h.value().strip() I14name = editI14n.value().strip() I14tief = editI14t.value().strip() I14hoch = editI14h.value().strip() I15name = editI15n.value().strip() I15tief = editI15t.value().strip() I15hoch = editI15h.value().strip() I16name = editI16n.value().strip() I16tief = editI16t.value().strip() I16hoch = editI16h.value().strip() return True else: return False def countInstr(): # Anzahl der erfassten Instrumente im Profil zählen. Instrumente müssen aufsteigend angegeben werden global profname, Icnt, I1name, I1hoch, I1tief, I2name, I2hoch, I2tief, I3name, I3hoch, I3tief, I4name, I4hoch, I4tief global I5name, I5hoch, I5tief, I6name, I6hoch, I6tief, I7name, I7hoch, I7tief, I8name, I8hoch, I8tief global I9name, I9hoch, I9tief, I10name, I10hoch, I10tief, I11name, I11hoch, I11tief, I12name, I12hoch, I12tief global I13name, I13hoch, I13tief, I14name, I14hoch, I14tief, I15name, I15hoch, I15tief, I16name, I16hoch, I16tief Icnt = 0 if I1name <> '': Icnt = Icnt + 1 else: return if I2name <> '': Icnt = Icnt + 1 else: return if I3name <> '': Icnt = Icnt + 1 else: return if I4name <> '': Icnt = Icnt + 1 else: return if I5name <> '': Icnt = Icnt + 1 else: return if I6name <> '': Icnt = Icnt + 1 else: return if I7name <> '': Icnt = Icnt + 1 else: return if I8name <> '': Icnt = Icnt + 1 else: return if I9name <> '': Icnt = Icnt + 1 else: return if I10name <> '': Icnt = Icnt + 1 else: return if I11name <> '': Icnt = Icnt + 1 else: return if I12name <> '': Icnt = Icnt + 1 else: return if I13name <> '': Icnt = Icnt + 1 else: return if I14name <> '': Icnt = Icnt + 1 else: return if I15name <> '': Icnt = Icnt + 1 else: return if I16name <> '': Icnt = Icnt + 1 return def checkMidi(tief,hoch,Ttief,Thoch,name): #messageBox('Input',str(tief) + ' ' + str(hoch)) if tief == 'xx': messageBox(tr('error'),tr('invalDesign') + tr('nProf') + str(profname) + tr('nInstr') + str(name) + tr('nLow') + str(Ttief) + tr('nHigh') +str(Thoch)) ret = 'xx' elif hoch == 'xx': messageBox(tr('error'),tr('invalDesign') + tr('nProf') + str(profname) + tr('nInstr') + str(name) + tr('nLow') + str(Ttief) + tr('nHigh') +str(Thoch)) ret = 'xx' elif int(tief) >= int(hoch): messageBox(tr('error'),tr('lowTAboveHighT') + tr('equallyHigh') + tr('nnProf') + str(profname) + tr('nInstr') + str(name) + tr('nLow') + str(Ttief) + tr('nHigh') +str(Thoch)) ret = 'xx' else: ret = 'OK' return ret def buildOption(): # Wert für Registry Key 'voices' zusammenbauen global profname, Icnt, I1name, I1hoch, I1tief, I2name, I2hoch, I2tief, I3name, I3hoch, I3tief, I4name, I4hoch, I4tief global I5name, I5hoch, I5tief, I6name, I6hoch, I6tief, I7name, I7hoch, I7tief, I8name, I8hoch, I8tief global I9name, I9hoch, I9tief, I10name, I10hoch, I10tief, I11name, I11hoch, I11tief, I12name, I12hoch, I12tief global I13name, I13hoch, I13tief, I14name, I14hoch, I14tief, I15name, I15hoch, I15tief, I16name, I16hoch, I16tief option = str(Icnt) + ',' if I1name <> '': #messageBox('I1','I1name = ' + str(I1name)) Mtief = xlateMidi(I1tief) Mhoch = xlateMidi(I1hoch) res = checkMidi(Mtief,Mhoch,I1tief,I1hoch,I1name) if res == 'OK':option = option + I1name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I2name <> '': Mtief = xlateMidi(I2tief) Mhoch = xlateMidi(I2hoch) res = checkMidi(Mtief,Mhoch,I2tief,I2hoch,I2name) if res == 'OK':option = option + ',' + I2name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I3name <> '': Mtief = xlateMidi(I3tief) Mhoch = xlateMidi(I3hoch) res = checkMidi(Mtief,Mhoch,I3tief,I3hoch,I3name) if res == 'OK':option = option + ',' + I3name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I4name <> '': Mtief = xlateMidi(I4tief) Mhoch = xlateMidi(I4hoch) res = checkMidi(Mtief,Mhoch,I4tief,I4hoch,I4name) if res == 'OK':option = option + ',' + I4name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I5name <> '': Mtief = xlateMidi(I5tief) Mhoch = xlateMidi(I5hoch) res = checkMidi(Mtief,Mhoch,I5tief,I5hoch,I5name) if res == 'OK':option = option + ',' + I5name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I6name <> '': Mtief = xlateMidi(I6tief) Mhoch = xlateMidi(I6hoch) res = checkMidi(Mtief,Mhoch,I6tief,I6hoch,I6name) if res == 'OK':option = option + ',' + I6name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I7name <> '': Mtief = xlateMidi(I7tief) Mhoch = xlateMidi(I7hoch) res = checkMidi(Mtief,Mhoch,I7tief,I7hoch,I7name) if res == 'OK':option = option + ',' + I7name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I8name <> '': Mtief = xlateMidi(I8tief) Mhoch = xlateMidi(I8hoch) res = checkMidi(Mtief,Mhoch,I8tief,I8hoch,I8name) if res == 'OK':option = option + ',' + I8name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I9name <> '': Mtief = xlateMidi(I9tief) Mhoch = xlateMidi(I9hoch) res = checkMidi(Mtief,Mhoch,I9tief,I9hoch,I9name) if res == 'OK':option = option + ',' + I9name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I10name <> '': Mtief = xlateMidi(I10tief) Mhoch = xlateMidi(I10hoch) res = checkMidi(Mtief,Mhoch,I10tief,I10hoch,I10name) if res == 'OK':option = option + ',' + I10name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I11name <> '': Mtief = xlateMidi(I11tief) Mhoch = xlateMidi(I11hoch) res = checkMidi(Mtief,Mhoch,I11tief,I11hoch,I11name) if res == 'OK':option = option + ',' + I11name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I12name <> '': Mtief = xlateMidi(I12tief) Mhoch = xlateMidi(I12hoch) res = checkMidi(Mtief,Mhoch,I12tief,I12hoch,I12name) if res == 'OK':option = option + ',' + I12name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I13name <> '': Mtief = xlateMidi(I13tief) Mhoch = xlateMidi(I13hoch) res = checkMidi(Mtief,Mhoch,I13tief,I13hoch,I13name) if res == 'OK':option = option + ',' + I13name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I14name <> '': Mtief = xlateMidi(I14tief) Mhoch = xlateMidi(I14hoch) res = checkMidi(Mtief,Mhoch,I14tief,I14hoch,I14name) if res == 'OK':option = option + ',' + I14name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I15name <> '': Mtief = xlateMidi(I15tief) Mhoch = xlateMidi(I15hoch) res = checkMidi(Mtief,Mhoch,I15tief,I15hoch,I15name) if res == 'OK':option = option + ',' + I15name + ',' + Mtief + ',' + Mhoch else: option = 'xx' else: return option if I16name <> '': Mtief = xlateMidi(I16tief) Mhoch = xlateMidi(I16hoch) res = checkMidi(Mtief,Mhoch,I16tief,I16hoch,I16name) if res == 'OK':option = option + ',' + I16name + ',' + Mtief + ',' + Mhoch else: option = 'xx' return option def xlateMidi(ton): # Ton Bezeichnung in Midi Nummer umsetzen tonList = {'C3':'0','C#3':'1','Db3':'1','D3':'2','D#3':'3','Eb3':'3','E3':'4','F3':'5','F#3':'6','Gb3':'6','G3':'7','G#3':'8','Ab3':'8','A3':'9','A#3':'10',tr('B3'):'10',tr('H3'):'11', 'C2':'12','C#2':'13','Db2':'13','D2':'14','D#2':'15','Eb2':'15','E2':'16','F2':'17','F#2':'18','Gb2':'18','G2':'19','G#2':'20','Ab2':'20','A2':'21','A#2':'22',tr('B2'):'22',tr('H2'):'23', 'C1':'24','C#1':'25','Db1':'25','D1':'26','D#1':'27','Eb1':'27','E1':'28','F1':'29','F#1':'30','Gb1':'30','G1':'31','G#1':'32','Ab1':'32','A1':'33','A#1':'34',tr('B1'):'34',tr('H1'):'35', 'C':'36','C#':'37','Db':'37','D':'38','D#':'39','Eb':'39','E':'40','F':'41','F#':'42','Gb':'42','G':'43','G#':'44','Ab':'44','A':'45','A#':'46',tr('B'):'46',tr('H'):'47', 'c':'48','c#':'49','db':'49','d':'50','d#':'51','eb':'51','e':'52','f':'53','f#':'54','gb':'54','g':'55','g#':'56','ab':'56','a':'57','a#':'58',tr('b'):'58',tr('h'):'59', 'c1':'60','c#1':'61','db1':'61','d1':'62','d#1':'62','eb1':'63','e1':'64','f1':'65','f#1':'66','gb1':'66','g1':'67','g#1':'68','ab1':'68','a1':'69','a#1':'70',tr('b1'):'70',tr('h1'):'71', 'c2':'72','c#2':'73','db2':'73','d2':'74','d#2':'74','eb2':'75','e2':'76','f2':'77','f#2':'78','gb2':'78','g2':'79','g#2':'80','ab2':'80','a2':'81','a#2':'82',tr('b2'):'82',tr('h2'):'83', 'c3':'84','c#3':'85','db3':'85','d3':'86','d#3':'86','eb3':'87','e3':'88','f3':'89','f#3':'90','gb3':'90','g3':'91','g#3':'92','ab3':'92','a3':'93','a#3':'94',tr('b3'):'94',tr('h3'):'95', 'c4':'96','c#4':'97','db4':'97','d4':'98','d#4':'98','eb4':'99','e4':'100','f4':'101','f#4':'102','gb4':'102','g4':'103','g#4':'104','ab4':'104','a4':'105','a#4':'106',tr('b4'):'106',tr('h4'):'107', 'c5':'108','c#5':'109','db5':'109','d5':'110','d#5':'110','eb5':'111','e5':'112','f5':'113','f#5':'114','gb5':'114','g5':'115','g#5':'116','ab5':'116','a5':'117','a#5':'118',tr('b5'):'118',tr('h5'):'119', 'c6':'120','c#6':'121','db6':'121','d6':'122','d#6':'123','eb6':'123','e6':'124','f6':'125','f#6':'126','gb6':'126','g6':'127' } if ton in tonList: midi = tonList[ton] else: midi = 'xx' return midi def xlateTon(midi): # Midi Nummer in Ton umsetzen tonList = ['C3','Db3','D3','Eb3','E3','F3','Gb3','G3','Ab3','A3',tr('B3'),tr('H3'), 'C2','Db2','D2','Eb2','E2','F2','Gb2','G2','Ab2','A2',tr('B2'),tr('H2'), 'C1','Db1','D1','Eb1','E1','F1','Gb1','G1','Ab1','A1',tr('B1'),tr('H1'), 'C','Db','D','Eb','E','F','Gb','G','Ab','A',tr('B'),tr('H'), 'c','db','d','eb','e','f','gb','g','ab','a',tr('b'),tr('h'), 'c1','db1','d1','eb1','e1','f1','gb1','g1','ab1','a1',tr('b1'),tr('h1'), 'c2','db2','d2','eb2','e2','f2','gb2','g2','ab2','a2',tr('b2'),tr('h2'), 'c3','db3','d3','eb3','e3','f3','gb3','g3','ab3','a3',tr('b3'),tr('h3'), 'c4','db4','d4','eb4','e4','f4','gb4','g4','ab4','a4',tr('b4'),tr('h4'), 'c5','db5','d5','eb5','e5','f5','gb5','g5','ab5','a5',tr('b5'),tr('h5'), 'c6','db6','d6','eb6','e6','f6','gb6','g6'] ton = tonList[midi] return ton def selectOutputFile(): global profname, destFile, destDir, destName continueScript = True dlg = FileDialog() dlg.__init__(bOpen=False) dlg.setTitle(tr('selTargetFile')) dlg.addFilter(tr('txtFile'), '*.txt') dlg.setStartFile(profname+'.txt') if continueScript and dlg.run(): destFile=dlg.filePath() destDir, destName = os.path.split(destFile) else: continueScript = False def selectInputFile(): global profname, sourceFile, sourceDir, sourceName continueScript = True dlg = FileDialog() dlg.__init__(bOpen=True) dlg.setTitle(tr('selProf')) dlg.addFilter(tr('txtFile'), '*.txt') dlg.setStartFile('*.txt') if continueScript and dlg.run(): sourceFile=dlg.filePath() sourceDir, sourceName = os.path.split(sourceFile) else: continueScript = False #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #Hier beginnt der Main Code #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- if __name__ == '__main__': ver, sub, sr = capVersion() if int(ver) > 7: messageBox('capella', tr('version') + '%d.%02d-%02d' % (ver, sub, sr) + tr('noCap8')) else: profname = ' ' I1name= I2name= I3name= I4name= I5name= I6name= I7name= I8name= I9name= I10name= I11name= I12name= I13name= I14name= I15name= I16name = '' I1tief= I2tief= I3tief= I4tief= I5tief= I6tief= I7tief= I8tief= I9tief= I10tief= I11tief= I12tief= I13tief= I14tief= I15tief= I16tief = '' I1hoch= I2hoch= I3hoch= I4hoch= I5hoch= I6hoch= I7hoch= I8hoch= I9hoch= I10hoch= I11hoch= I12hoch= I13hoch= I14hoch= I15hoch= I16hoch = '' rc = RegConfig(r"HKEY_CURRENT_USER\SOFTWARE\capella-software\capella", autowrite=True) # Registry Schlüssel laden if rc.has_option("General","Voices"): # prüfen ob General/Voices existiert option = rc.get("General","Voices") else: option = tr('empty') import shelve # Profile als Directory aus Datei laden dir, pyFile = os.path.split(sys.argv[0]) SuShl = os.path.join(dir, 'Stimmumfang_setzen.shl') #StimmList = shelve.open(getProgramDir()+'\scripts'+'\Stimmumfang_setzen.shl') StimmList = shelve.open(SuShl) profAction = 'x' if StimmList.keys() == []: messageBox(tr('list'),str(tr('noProfAvailable'))) # Wenn keine Profile erfasst sind option = 'xx' Icnt = 0 while option == 'xx': pqDialog1() # dann ein neues Profil erfassen option = buildOption() # Gültigkeitsprüfung countInstr() entry = {'01':{tr('composition'):profname,tr('number'):Icnt, 'I1':{'In':I1name,'It':I1tief,'Ih':I1hoch}, 'I2':{'In':I2name,'It':I2tief,'Ih':I2hoch}, 'I3':{'In':I3name,'It':I3tief,'Ih':I3hoch}, 'I4':{'In':I4name,'It':I4tief,'Ih':I4hoch}, 'I5':{'In':I5name,'It':I5tief,'Ih':I5hoch}, 'I6':{'In':I6name,'It':I6tief,'Ih':I6hoch}, 'I7':{'In':I7name,'It':I7tief,'Ih':I7hoch}, 'I8':{'In':I8name,'It':I8tief,'Ih':I8hoch}, 'I9':{'In':I9name,'It':I9tief,'Ih':I9hoch}, 'IA':{'In':I10name,'It':I10tief,'Ih':I10hoch}, 'IB':{'In':I11name,'It':I11tief,'Ih':I11hoch}, 'IC':{'In':I12name,'It':I12tief,'Ih':I12hoch}, 'ID':{'In':I13name,'It':I13tief,'Ih':I13hoch}, 'IE':{'In':I14name,'It':I14tief,'Ih':I14hoch}, 'IF':{'In':I15name,'It':I15tief,'Ih':I15hoch}, 'IG':{'In':I16name,'It':I16tief,'Ih':I16hoch} }} StimmList.update(entry) # ins Directory schreiben StimmList.close() # und abspeichern else: # sind Profile bereits erfasst #messageBox('Namen laden','Namen laden') if '01' in StimmList: prof01 = StimmList['01'].get(tr('composition'),tr('empty')).strip() # dann die Namen laden if prof01 =='': prof01 = tr('empty') else: prof01 = tr('empty') if '02' in StimmList: prof02 = StimmList['02'].get(tr('composition'),tr('empty')).strip() if prof02 =='': prof02 = tr('empty') else: prof02 = tr('empty') if '03' in StimmList: prof03 = StimmList['03'].get(tr('composition'),tr('empty')).strip() if prof03 =='': prof03 = tr('empty') else: prof03 = tr('empty') if '04' in StimmList: prof04 = StimmList['04'].get(tr('composition'),tr('empty')).strip() if prof04 =='': prof04 = tr('empty') else: prof04 = tr('empty') if '05' in StimmList: prof05 = StimmList['05'].get(tr('composition'),tr('empty')).strip() if prof05 =='': prof05 = tr('empty') else: prof05 = tr('empty') if '06' in StimmList: prof06 = StimmList['06'].get(tr('composition'),tr('empty')).strip() if prof06 =='': prof06 = tr('empty') else: prof06 = tr('empty') if '07' in StimmList: prof07 = StimmList['07'].get(tr('composition'),tr('empty')).strip() if prof07 =='': prof07 = tr('empty') else: prof07 = tr('empty') if '08' in StimmList: prof08 = StimmList['08'].get(tr('composition'),tr('empty')).strip() if prof08 =='': prof08 = tr('empty') else: prof08 = tr('empty') if '09' in StimmList: prof09 = StimmList['09'].get(tr('composition'),tr('empty')).strip() if prof09 =='': prof09 = tr('empty') else: prof09 = tr('empty') if '10' in StimmList: prof10 = StimmList['10'].get(tr('composition'),tr('empty')).strip() if prof10 =='': prof10 = tr('empty') else: prof10 = tr('empty') if '11' in StimmList: prof11 = StimmList['11'].get(tr('composition'),tr('empty')).strip() if prof11 =='': prof11 = tr('empty') else: prof11 = tr('empty') if '12' in StimmList: prof12 = StimmList['12'].get(tr('composition'),tr('empty')).strip() if prof12 =='': prof12 = tr('empty') else: prof12 = tr('empty') if '13' in StimmList: prof13 = StimmList['13'].get(tr('composition'),tr('empty')).strip() if prof13 =='': prof13 = tr('empty') else: prof13 = tr('empty') if '14' in StimmList: prof14 = StimmList['14'].get(tr('composition'),tr('empty')).strip() if prof14 =='': prof14 = tr('empty') else: prof14 = tr('empty') if '15' in StimmList: prof15 = StimmList['15'].get(tr('composition'),tr('empty')).strip() if prof15 =='': prof15 = tr('empty') else: prof15 = tr('empty') if '16' in StimmList: prof16 = StimmList['16'].get(tr('composition'),tr('empty')).strip() if prof16 =='': prof16 = tr('empty') else: prof16 = tr('empty') if pqDialog2(): # und anzeigen if profValue == 0: profIx = '01' # ausgewähltes Profil in Index umsetzen elif profValue == 1: profIx = '02' elif profValue == 2: profIx = '03' elif profValue == 3: profIx = '04' elif profValue == 4: profIx = '05' elif profValue == 5: profIx = '06' elif profValue == 6: profIx = '07' elif profValue == 7: profIx = '08' elif profValue == 8: profIx = '09' elif profValue == 9: profIx = '10' elif profValue == 10: profIx = '11' elif profValue == 11: profIx = '12' elif profValue == 12: profIx = '13' elif profValue == 13: profIx = '14' elif profValue == 14: profIx = '15' elif profValue == 15: profIx = '16' I1name= I2name= I3name= I4name= I5name= I6name= I7name= I8name= I9name= I10name= I11name= I12name= I13name= I14name= I15name= I16name = '' I1tief= I2tief= I3tief= I4tief= I5tief= I6tief= I7tief= I8tief= I9tief= I10tief= I11tief= I12tief= I13tief= I14tief= I15tief= I16tief = '' I1hoch= I2hoch= I3hoch= I4hoch= I5hoch= I6hoch= I7hoch= I8hoch= I9hoch= I10hoch= I11hoch= I12hoch= I13hoch= I14hoch= I15hoch= I16hoch = '' profname = '' if profIx in StimmList: # wenn es ein bestehendes Profil ist profname = StimmList[profIx].get(tr('composition'),tr('empty')) # alle Informationen aus Directory holen Icnt = StimmList[profIx].get(tr('number'),tr('empty')) if 'I1' in StimmList[profIx]: I1name = StimmList[profIx]['I1'].get('In',tr('empty')).strip() if 'I1' in StimmList[profIx]: I1tief = StimmList[profIx]['I1'].get('It',tr('empty')).strip() if 'I1' in StimmList[profIx]: I1hoch = StimmList[profIx]['I1'].get('Ih',tr('empty')).strip() if 'I2' in StimmList[profIx]: I2name = StimmList[profIx]['I2'].get('In',tr('empty')).strip() if 'I2' in StimmList[profIx]: I2tief = StimmList[profIx]['I2'].get('It',tr('empty')).strip() if 'I2' in StimmList[profIx]: I2hoch = StimmList[profIx]['I2'].get('Ih',tr('empty')).strip() if 'I3' in StimmList[profIx]: I3name = StimmList[profIx]['I3'].get('In',tr('empty')).strip() if 'I3' in StimmList[profIx]: I3tief = StimmList[profIx]['I3'].get('It',tr('empty')).strip() if 'I3' in StimmList[profIx]: I3hoch = StimmList[profIx]['I3'].get('Ih',tr('empty')).strip() if 'I4' in StimmList[profIx]: I4name = StimmList[profIx]['I4'].get('In',tr('empty')).strip() if 'I4' in StimmList[profIx]: I4tief = StimmList[profIx]['I4'].get('It',tr('empty')).strip() if 'I4' in StimmList[profIx]: I4hoch = StimmList[profIx]['I4'].get('Ih',tr('empty')).strip() if 'I5' in StimmList[profIx]: I5name = StimmList[profIx]['I5'].get('In',tr('empty')).strip() if 'I5' in StimmList[profIx]: I5tief = StimmList[profIx]['I5'].get('It',tr('empty')).strip() if 'I5' in StimmList[profIx]: I5hoch = StimmList[profIx]['I5'].get('Ih',tr('empty')).strip() if 'I6' in StimmList[profIx]: I6name = StimmList[profIx]['I6'].get('In',tr('empty')).strip() if 'I6' in StimmList[profIx]: I6tief = StimmList[profIx]['I6'].get('It',tr('empty')).strip() if 'I6' in StimmList[profIx]: I6hoch = StimmList[profIx]['I6'].get('Ih',tr('empty')).strip() if 'I7' in StimmList[profIx]: I7name = StimmList[profIx]['I7'].get('In',tr('empty')).strip() if 'I7' in StimmList[profIx]: I7tief = StimmList[profIx]['I7'].get('It',tr('empty')).strip() if 'I7' in StimmList[profIx]: I7hoch = StimmList[profIx]['I7'].get('Ih',tr('empty')).strip() if 'I8' in StimmList[profIx]: I8name = StimmList[profIx]['I8'].get('In',tr('empty')).strip() if 'I8' in StimmList[profIx]: I8tief = StimmList[profIx]['I8'].get('It',tr('empty')).strip() if 'I8' in StimmList[profIx]: I8hoch = StimmList[profIx]['I8'].get('Ih',tr('empty')).strip() if 'I9' in StimmList[profIx]: I9name = StimmList[profIx]['I9'].get('In',tr('empty')).strip() if 'I9' in StimmList[profIx]: I9tief = StimmList[profIx]['I9'].get('It',tr('empty')).strip() if 'I9' in StimmList[profIx]: I9hoch = StimmList[profIx]['I9'].get('Ih',tr('empty')).strip() if 'IA' in StimmList[profIx]: I10name = StimmList[profIx]['IA'].get('In',tr('empty')).strip() if 'IA' in StimmList[profIx]: I10tief = StimmList[profIx]['IA'].get('It',tr('empty')).strip() if 'IA' in StimmList[profIx]: I10hoch = StimmList[profIx]['IA'].get('Ih',tr('empty')).strip() if 'IB' in StimmList[profIx]: I11name = StimmList[profIx]['IB'].get('In',tr('empty')).strip() if 'IB' in StimmList[profIx]: I11tief = StimmList[profIx]['IB'].get('It',tr('empty')).strip() if 'IB' in StimmList[profIx]: I11hoch = StimmList[profIx]['IB'].get('Ih',tr('empty')).strip() if 'IC' in StimmList[profIx]: I12name = StimmList[profIx]['IC'].get('In',tr('empty')).strip() if 'IC' in StimmList[profIx]: I12tief = StimmList[profIx]['IC'].get('It',tr('empty')).strip() if 'IC' in StimmList[profIx]: I12hoch = StimmList[profIx]['IC'].get('Ih',tr('empty')).strip() if 'ID' in StimmList[profIx]: I13name = StimmList[profIx]['ID'].get('In',tr('empty')).strip() if 'ID' in StimmList[profIx]: I13tief = StimmList[profIx]['ID'].get('It',tr('empty')).strip() if 'ID' in StimmList[profIx]: I13hoch = StimmList[profIx]['ID'].get('Ih',tr('empty')).strip() if 'IE' in StimmList[profIx]: I14name = StimmList[profIx]['IE'].get('In',tr('empty')).strip() if 'IE' in StimmList[profIx]: I14tief = StimmList[profIx]['IE'].get('It',tr('empty')).strip() if 'IE' in StimmList[profIx]: I14hoch = StimmList[profIx]['IE'].get('Ih',tr('empty')).strip() if 'IF' in StimmList[profIx]: I15name = StimmList[profIx]['IF'].get('In',tr('empty')).strip() if 'IF' in StimmList[profIx]: I15tief = StimmList[profIx]['IF'].get('It',tr('empty')).strip() if 'IF' in StimmList[profIx]: I15hoch = StimmList[profIx]['IF'].get('Ih',tr('empty')).strip() if 'IG' in StimmList[profIx]: I16name = StimmList[profIx]['IG'].get('In',tr('empty')).strip() if 'IG' in StimmList[profIx]: I16tief = StimmList[profIx]['IG'].get('It',tr('empty')).strip() if 'IG' in StimmList[profIx]: I16hoch = StimmList[profIx]['IG'].get('Ih',tr('empty')).strip() else: I1name= I2name= I3name= I4name= I5name= I6name= I7name= I8name= I9name= I10name= I11name= I12name= I13name= I14name= I15name= I16name = '' I1tief= I2tief= I3tief= I4tief= I5tief= I6tief= I7tief= I8tief= I9tief= I10tief= I11tief= I12tief= I13tief= I14tief= I15tief= I16tief = '' I1hoch= I2hoch= I3hoch= I4hoch= I5hoch= I6hoch= I7hoch= I8hoch= I9hoch= I10hoch= I11hoch= I12hoch= I13hoch= I14hoch= I15hoch= I16hoch = '' profname = '' if profAction == 1: # bestehendes Profil ändern Icnt = 0 ##(WW) notwendig bei leeres Profil option = 'xx' while option == 'xx': xx = pqDialog1() option = buildOption() # Gültigkeitsprüfung elif profAction == 0: option = buildOption() # Wenn neues Profil geladen aktiviert werden soll, Registry Information erzeugen if option <> 'xx': rc.set('General', 'Voices', option) # und ins Registry schreiben elif profAction == 2: # Profil importieren selectInputFile() datei = file(sourceFile,'r') lines = datei.readlines() if lines[0] == 'Stimmumfang_Verwaltung_exportiertes_Profil\n': #if lines[0] == tr('voRaMaExpProf'): profildaten = lines[1].split(',') schreiben = 0 if profname <> '' and pqDialog3(profname, profildaten[0]): schreiben = 1 elif profname == '': schreiben = 1 else: messageBox(tr('profImport'),tr('importCancelled')) if schreiben == 1: I1name= I2name= I3name= I4name= I5name= I6name= I7name= I8name= I9name= I10name= I11name= I12name= I13name= I14name= I15name= I16name = '' I1tief= I2tief= I3tief= I4tief= I5tief= I6tief= I7tief= I8tief= I9tief= I10tief= I11tief= I12tief= I13tief= I14tief= I15tief= I16tief = '' I1hoch= I2hoch= I3hoch= I4hoch= I5hoch= I6hoch= I7hoch= I8hoch= I9hoch= I10hoch= I11hoch= I12hoch= I13hoch= I14hoch= I15hoch= I16hoch = '' profname = '' profname = profildaten[0] Icnt = profildaten[1] if int(Icnt) >= 1: I1name = profildaten[2] I1hoch = xlateTon(int(profildaten[4])) I1tief = xlateTon(int(profildaten[3])) if int(Icnt) >= 2: I2name = profildaten[5] I2hoch = xlateTon(int(profildaten[7])) I2tief = xlateTon(int(profildaten[6])) if int(Icnt) >= 3: I3name = profildaten[8] I3hoch = xlateTon(int(profildaten[10])) I3tief = xlateTon(int(profildaten[9])) if int(Icnt) >= 4: I4name = profildaten[11] I4hoch = xlateTon(int(profildaten[13])) I4tief = xlateTon(int(profildaten[12])) if int(Icnt) >= 5: I5name = profildaten[14] I5hoch = xlateTon(int(profildaten[16])) I5tief = xlateTon(int(profildaten[15])) if int(Icnt) >= 6: I6name = profildaten[17] I6hoch = xlateTon(int(profildaten[19])) I6tief = xlateTon(int(profildaten[18])) if int(Icnt) >= 7: I7name = profildaten[20] I7hoch = xlateTon(int(profildaten[22])) I7tief = xlateTon(int(profildaten[21])) if int(Icnt) >= 8: I8name = profildaten[23] I8hoch = xlateTon(int(profildaten[25])) I8tief = xlateTon(int(profildaten[24])) if int(Icnt) >= 9: I9name = profildaten[26] I9hoch = xlateTon(int(profildaten[28])) I9tief = xlateTon(int(profildaten[29])) if int(Icnt) >= 10: I10name = profildaten[29] I10hoch = xlateTon(int(profildaten[31])) I10tief = xlateTon(int(profildaten[30])) if int(Icnt) >= 11: I11name = profildaten[32] I11hoch = xlateTon(int(profildaten[34])) I11tief = xlateTon(int(profildaten[33])) if int(Icnt) >= 12: I12name = profildaten[35] I12hoch = xlateTon(int(profildaten[37])) I12tief = xlateTon(int(profildaten[36])) if int(Icnt) >= 13: I13name = profildaten[38] I13hoch = xlateTon(int(profildaten[40])) I13tief = xlateTon(int(profildaten[39])) if int(Icnt) >= 14: I14name = profildaten[41] I14hoch = xlateTon(int(profildaten[43])) I14tief = xlateTon(int(profildaten[42])) if int(Icnt) >= 15: I15name = profildaten[44] I15hoch = xlateTon(int(profildaten[46])) I15tief = xlateTon(int(profildaten[45])) if int(Icnt) >= 16: I16name = profildaten[47] I16hoch = xlateTon(int(profildaten[49])) I16tief = xlateTon(int(profildaten[48])) else: messageBox(tr('profImport'),tr('noValidProf')) datei.close() elif profAction == 3: # Profil exportieren if profname <> '': option = buildOption() header = 'Stimmumfang_Verwaltung_exportiertes_Profil\n' #header = tr('voRaMaExpProf') option = profname + ',' + option selectOutputFile() datei = file(destFile,'w') datei.write(header) datei.write(option) datei.close() else: messageBox(tr('profExport'),tr('emptyProfNotExp')) elif profAction == 4: # Profil löschen StimmList.pop(profIx) #else: # Icnt = 0 # option = 'xx' # while option == 'xx': # pqDialog1() # dann ein neues Profil erfassen # option = buildOption() # Gültigkeitsprüfung # Gültigkeitsprüfung if profAction <> 'x' and profAction <> 4: countInstr() # Stimmen zählen entry = {profIx:{tr('composition'):profname,tr('number'):Icnt, 'I1':{'In':I1name,'It':I1tief,'Ih':I1hoch}, 'I2':{'In':I2name,'It':I2tief,'Ih':I2hoch}, 'I3':{'In':I3name,'It':I3tief,'Ih':I3hoch}, 'I4':{'In':I4name,'It':I4tief,'Ih':I4hoch}, 'I5':{'In':I5name,'It':I5tief,'Ih':I5hoch}, 'I6':{'In':I6name,'It':I6tief,'Ih':I6hoch}, 'I7':{'In':I7name,'It':I7tief,'Ih':I7hoch}, 'I8':{'In':I8name,'It':I8tief,'Ih':I8hoch}, 'I9':{'In':I9name,'It':I9tief,'Ih':I9hoch}, 'IA':{'In':I10name,'It':I10tief,'Ih':I10hoch}, 'IB':{'In':I11name,'It':I11tief,'Ih':I11hoch}, 'IC':{'In':I12name,'It':I12tief,'Ih':I12hoch}, 'ID':{'In':I13name,'It':I13tief,'Ih':I13hoch}, 'IE':{'In':I14name,'It':I14tief,'Ih':I14hoch}, 'IF':{'In':I15name,'It':I15tief,'Ih':I15hoch}, 'IG':{'In':I16name,'It':I16tief,'Ih':I16hoch} }} StimmList.update(entry) # ins Directory schreiben StimmList.close() # und Directory speichern StimmList.close() # nur zur Sicherheit Directory schließen