rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
"""Data capsule for load list editing dialog.""" def __init__(self,parent): """Initialize.""" self.data = settings['bash.loadLists.data'] balt.ListEditorData.__init__(self,parent) self.showRename = True self.showRemove = True def getItemList(self): """Returns load list keys in alpha order.""" return sorted(self.data.keys(),key=lambda a: a.lower()) def rename(self,oldName,newName): """Renames oldName to newName.""" if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False settings.setChanged('bash.loadLists.data') self.data[newName] = self.data[oldName] del self.data[oldName] return newName def remove(self,item): """Removes load list.""" settings.setChanged('bash.loadLists.data') del self.data[item] return True
"""Data capsule for load list editing dialog.""" def __init__(self,parent): """Initialize.""" self.data = settings['bash.loadLists.data'] balt.ListEditorData.__init__(self,parent) self.showRename = True self.showRemove = True def getItemList(self): """Returns load list keys in alpha order.""" return sorted(self.data.keys(),key=lambda a: a.lower()) def rename(self,oldName,newName): """Renames oldName to newName.""" if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False settings.setChanged('bash.loadLists.data') self.data[newName] = self.data[oldName] del self.data[oldName] return newName def remove(self,item): """Removes load list.""" settings.setChanged('bash.loadLists.data') del self.data[item] return True
def AppendToMenu(self,menu,window,data): subMenu = wx.Menu() menu.AppendMenu(-1,self.name,subMenu) #--Only enable the menu and append the subMenu's if all of the selected items are archives for item in window.GetSelected(): if not isinstance(window.data[item],bosh.InstallerArchive): id = menu.FindItem(self.name) menu.Enable(id,False) break else: for link in self.links: link.AppendToMenu(subMenu,window,data)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Add load list links.""" def __init__(self): self.data = settings['bash.loadLists.data'] def GetItems(self): items = self.data.keys() items.sort(lambda a,b: cmp(a.lower(),b.lower())) return items def SortWindow(self): self.window.PopulateItems() def AppendToMenu(self,menu,window,data): self.window = window menu.Append(ID_LOADERS.NONE,_('None')) menu.Append(ID_LOADERS.SAVE,_('Save List...')) menu.Append(ID_LOADERS.EDIT,_('Edit Lists...')) menu.AppendSeparator() for id,item in zip(ID_LOADERS,self.GetItems()): menu.Append(id,item) if not bosh.modInfos.ordered: menu.FindItemById(ID_LOADERS.SAVE).Enable(False) wx.EVT_MENU(window,ID_LOADERS.NONE,self.DoNone) wx.EVT_MENU(window,ID_LOADERS.SAVE,self.DoSave) wx.EVT_MENU(window,ID_LOADERS.EDIT,self.DoEdit) wx.EVT_MENU_RANGE(window,ID_LOADERS.BASE,ID_LOADERS.MAX,self.DoList) def DoNone(self,event): """Unselect all mods.""" bosh.modInfos.selectExact([]) modList.RefreshUI() def DoList(self,event): """Select mods in list.""" item = self.GetItems()[event.GetId()-ID_LOADERS.BASE] selectList = [GPath(modName) for modName in self.data[item]] errorMessage = bosh.modInfos.selectExact(selectList) modList.RefreshUI() if errorMessage: balt.showError(self.window,errorMessage,item) def DoSave(self,event): if len(self.data) >= (ID_LOADERS.MAX - ID_LOADERS.BASE + 1): balt.showError(self,_('All load list slots are full. Please delete an existing load list before adding another.')) return newItem = (balt.askText(self.window,_('Save current load list as:'),'Wrye Bash') or '').strip() if not newItem: return if len(newItem) > 64: message = _('Load list name must be between 1 and 64 characters long.') return balt.showError(self.window,message) self.data[newItem] = bosh.modInfos.ordered[:] settings.setChanged('bash.loadLists.data') def DoEdit(self,event): data = Mods_LoadListData(self.window) dialog = balt.ListEditor(self.window,-1,_('Load Lists'),data) dialog.ShowModal() dialog.Destroy()
"""Add load list links.""" def __init__(self): self.data = settings['bash.loadLists.data'] def GetItems(self): items = self.data.keys() items.sort(lambda a,b: cmp(a.lower(),b.lower())) return items def SortWindow(self): self.window.PopulateItems() def AppendToMenu(self,menu,window,data): self.window = window menu.Append(ID_LOADERS.NONE,_('None')) menu.Append(ID_LOADERS.SAVE,_('Save List...')) menu.Append(ID_LOADERS.EDIT,_('Edit Lists...')) menu.AppendSeparator() for id,item in zip(ID_LOADERS,self.GetItems()): menu.Append(id,item) if not bosh.modInfos.ordered: menu.FindItemById(ID_LOADERS.SAVE).Enable(False) wx.EVT_MENU(window,ID_LOADERS.NONE,self.DoNone) wx.EVT_MENU(window,ID_LOADERS.SAVE,self.DoSave) wx.EVT_MENU(window,ID_LOADERS.EDIT,self.DoEdit) wx.EVT_MENU_RANGE(window,ID_LOADERS.BASE,ID_LOADERS.MAX,self.DoList) def DoNone(self,event): """Unselect all mods.""" bosh.modInfos.selectExact([]) modList.RefreshUI() def DoList(self,event): """Select mods in list.""" item = self.GetItems()[event.GetId()-ID_LOADERS.BASE] selectList = [GPath(modName) for modName in self.data[item]] errorMessage = bosh.modInfos.selectExact(selectList) modList.RefreshUI() if errorMessage: balt.showError(self.window,errorMessage,item) def DoSave(self,event): if len(self.data) >= (ID_LOADERS.MAX - ID_LOADERS.BASE + 1): balt.showError(self,_('All load list slots are full. Please delete an existing load list before adding another.')) return newItem = (balt.askText(self.window,_('Save current load list as:'),'Wrye Bash') or '').strip() if not newItem: return if len(newItem) > 64: message = _('Load list name must be between 1 and 64 characters long.') return balt.showError(self.window,message) self.data[newItem] = bosh.modInfos.ordered[:] settings.setChanged('bash.loadLists.data') def DoEdit(self,event): data = Mods_LoadListData(self.window) dialog = balt.ListEditor(self.window,-1,_('Load Lists'),data) dialog.ShowModal() dialog.Destroy()
def remove(self,item): """Removes load list.""" settings.setChanged('bash.loadLists.data') del self.data[item] return True
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Sort esms to the top.""" def __init__(self,prefix=''): Link.__init__(self) self.prefix = prefix def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,self.prefix+_('Type'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(window.esmsFirst) def Execute(self,event): self.window.esmsFirst = not self.window.esmsFirst self.window.PopulateItems()
"""Sort esms to the top.""" def __init__(self,prefix=''): Link.__init__(self) self.prefix = prefix def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,self.prefix+_('Type'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(window.esmsFirst) def Execute(self,event): self.window.esmsFirst = not self.window.esmsFirst self.window.PopulateItems()
def DoEdit(self,event): data = Mods_LoadListData(self.window) dialog = balt.ListEditor(self.window,-1,_('Load Lists'),data) dialog.ShowModal() dialog.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Sort loaded mods to the top.""" def __init__(self,prefix=''): Link.__init__(self) self.prefix = prefix def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,self.prefix+_('Selection'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) if window.selectedFirst: menuItem.Check() def Execute(self,event): self.window.selectedFirst = not self.window.selectedFirst self.window.PopulateItems()
"""Sort loaded mods to the top.""" def __init__(self,prefix=''): Link.__init__(self) self.prefix = prefix def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,self.prefix+_('Selection'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) if window.selectedFirst: menuItem.Check() def Execute(self,event): self.window.selectedFirst = not self.window.selectedFirst self.window.PopulateItems()
def Execute(self,event): self.window.esmsFirst = not self.window.esmsFirst self.window.PopulateItems()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Toggle Auto-ghosting.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Auto-Ghost'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings.get('bash.mods.autoGhost',True)) def Execute(self,event): settings['bash.mods.autoGhost'] ^= True bosh.modInfos.autoGhost(True) self.window.RefreshUI()
"""Toggle Auto-ghosting.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Auto-Ghost'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings.get('bash.mods.autoGhost',True)) def Execute(self,event): settings['bash.mods.autoGhost'] ^= True bosh.modInfos.autoGhost(True) self.window.RefreshUI()
def Execute(self,event): self.window.selectedFirst = not self.window.selectedFirst self.window.PopulateItems()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Turn on autogrouping.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Auto Group'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings.get('bash.balo.autoGroup',True)) def Execute(self,event): settings['bash.balo.autoGroup'] = not settings.get('bash.balo.autoGroup',True) bosh.modInfos.updateAutoGroups()
"""Turn on autogrouping.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Auto Group'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings.get('bash.balo.autoGroup',True)) def Execute(self,event): settings['bash.balo.autoGroup'] = not settings.get('bash.balo.autoGroup',True) bosh.modInfos.updateAutoGroups()
def Execute(self,event): settings['bash.mods.autoGhost'] ^= True bosh.modInfos.autoGhost(True) self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Turn on deprint/delist.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Debug Mode'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(bolt.deprintOn) def Execute(self,event): deprint(_('Debug Printing: Off')) bolt.deprintOn = not bolt.deprintOn deprint(_('Debug Printing: On'))
"""Turn on deprint/delist.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Debug Mode'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(bolt.deprintOn) def Execute(self,event): deprint(_('Debug Printing: Off')) bolt.deprintOn = not bolt.deprintOn deprint(_('Debug Printing: On'))
def Execute(self,event): settings['bash.balo.autoGroup'] = not settings.get('bash.balo.autoGroup',True) bosh.modInfos.updateAutoGroups()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Turn Full Balo off/on.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Full Balo'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings.get('bash.balo.full',False)) def Execute(self,event): if not settings.get('bash.balo.full',False): message = _("Activate Full Balo?\n\nFull Balo segregates mods by groups, and then autosorts mods within those groups by alphabetical order. Full Balo is still in development and may have some rough edges.") if balt.askContinue(self.window,message,'bash.balo.full.continue',_('Balo Groups')): dialog = Mod_BaloGroups_Edit(self.window) dialog.ShowModal() dialog.Destroy() return else: settings['bash.balo.full'] = False bosh.modInfos.fullBalo = False bosh.modInfos.refresh(doInfos=False)
"""Turn Full Balo off/on.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Full Balo'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings.get('bash.balo.full',False)) def Execute(self,event): if not settings.get('bash.balo.full',False): message = _("Activate Full Balo?\n\nFull Balo segregates mods by groups, and then autosorts mods within those groups by alphabetical order. Full Balo is still in development and may have some rough edges.") if balt.askContinue(self.window,message,'bash.balo.full.continue',_('Balo Groups')): dialog = Mod_BaloGroups_Edit(self.window) dialog.ShowModal() dialog.Destroy() return else: settings['bash.balo.full'] = False bosh.modInfos.fullBalo = False bosh.modInfos.refresh(doInfos=False)
def Execute(self,event): deprint(_('Debug Printing: Off')) bolt.deprintOn = not bolt.deprintOn deprint(_('Debug Printing: On'))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Dumps new translation key file using existing key, value pairs.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Dump Translator')) menu.AppendItem(menuItem) def Execute(self,event): message = _("Generate Bash program translator file?\n\nThis function is for translating Bash itself (NOT mods) into non-English languages. For more info, see Internationalization section of Bash readme.") if not balt.askContinue(self.window,message,'bash.dumpTranslator.continue',_('Dump Translator')): return import locale language = locale.getlocale()[0].split('_',1)[0] outPath = bosh.dirs['app'].join('Mopy','Data','NEW%s.txt' % (language,)) outFile = outPath.open('w') keyCount = 0 dumpedKeys = set() reKey = re.compile(r'_\([\'\"](.+?)[\'\"]\)') reTrans = bolt.reTrans for pyPath in (GPath(x+'.py') for x in ('bolt','balt','bush','bosh','bash','basher','bashmon')): pyText = pyPath.open() for lineNum,line in enumerate(pyText): line = re.sub(' for key in reKey.findall(line): key = reTrans.match(key).group(2) if key in dumpedKeys: continue outFile.write('=== %s, %d\n' % (pyPath.s,lineNum+1)) outFile.write(key+'\n>>>>\n') value = _(key,False) if value != key: outFile.write(value) outFile.write('\n') dumpedKeys.add(key) keyCount += 1 pyText.close() outFile.close() balt.showOk(self.window, '%d translation keys written to Mopy\\Data\\%s.' % (keyCount,outPath.stail), _('Dump Translator')+': '+outPath.stail)
"""Dumps new translation key file using existing key, value pairs.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Dump Translator')) menu.AppendItem(menuItem) def Execute(self,event): message = _("Generate Bash program translator file?\n\nThis function is for translating Bash itself (NOT mods) into non-English languages. For more info, see Internationalization section of Bash readme.") if not balt.askContinue(self.window,message,'bash.dumpTranslator.continue',_('Dump Translator')): return import locale language = locale.getlocale()[0].split('_',1)[0] outPath = bosh.dirs['app'].join('Mopy','Data','NEW%s.txt' % (language,)) outFile = outPath.open('w') keyCount = 0 dumpedKeys = set() reKey = re.compile(r'_\([\'\"](.+?)[\'\"]\)') reTrans = bolt.reTrans for pyPath in (GPath(x+'.py') for x in ('bolt','balt','bush','bosh','bash','basher','bashmon')): pyText = pyPath.open() for lineNum,line in enumerate(pyText): line = re.sub(' for key in reKey.findall(line): key = reTrans.match(key).group(2) if key in dumpedKeys: continue outFile.write('=== %s, %d\n' % (pyPath.s,lineNum+1)) outFile.write(key+'\n>>>>\n') value = _(key,False) if value != key: outFile.write(value) outFile.write('\n') dumpedKeys.add(key) keyCount += 1 pyText.close() outFile.close() balt.showOk(self.window, '%d translation keys written to Mopy\\Data\\%s.' % (keyCount,outPath.stail), _('Dump Translator')+': '+outPath.stail)
def Execute(self,event): if not settings.get('bash.balo.full',False): message = _("Activate Full Balo?\n\nFull Balo segregates mods by groups, and then autosorts mods within those groups by alphabetical order. Full Balo is still in development and may have some rough edges.") if balt.askContinue(self.window,message,'bash.balo.full.continue',_('Balo Groups')): dialog = Mod_BaloGroups_Edit(self.window) dialog.ShowModal() dialog.Destroy() return else: settings['bash.balo.full'] = False bosh.modInfos.fullBalo = False bosh.modInfos.refresh(doInfos=False)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Applies ini tweaks to Fallout3.ini.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('INI Tweaks...')) menu.AppendItem(menuItem) def Execute(self,event): """Handle menu selection.""" window = getattr(self,'gTank',None) or self.window message = _("Apply an ini tweak to Fallout3.ini?\n\nWARNING: Incorrect tweaks can result in CTDs and even damage to you computer!") if not balt.askContinue(window,message,'bash.iniTweaks.continue',_("INI Tweaks")): return tweakDir = bosh.modInfos.dir.join("INI Tweaks") tweakDir.makedirs() tweakPath = balt.askOpen(window,_('INI Tweaks'),tweakDir,'', '*.ini') if not tweakPath: return bosh.fallout3Ini.applyTweakFile(tweakPath) balt.showInfo(window,tweakPath.stail+_(' applied.'),_('INI Tweaks'))
"""Applies ini tweaks to Fallout3.ini.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('INI Tweaks...')) menu.AppendItem(menuItem) def Execute(self,event): """Handle menu selection.""" window = getattr(self,'gTank',None) or self.window message = _("Apply an ini tweak to Fallout3.ini?\n\nWARNING: Incorrect tweaks can result in CTDs and even damage to you computer!") if not balt.askContinue(window,message,'bash.iniTweaks.continue',_("INI Tweaks")): return tweakDir = bosh.modInfos.dir.join("INI Tweaks") tweakDir.makedirs() tweakPath = balt.askOpen(window,_('INI Tweaks'),tweakDir,'', '*.ini') if not tweakPath: return bosh.fallout3Ini.applyTweakFile(tweakPath) balt.showInfo(window,tweakPath.stail+_(' applied.'),_('INI Tweaks'))
def Execute(self,event): message = _("Generate Bash program translator file?\n\nThis function is for translating Bash itself (NOT mods) into non-English languages. For more info, see Internationalization section of Bash readme.") if not balt.askContinue(self.window,message,'bash.dumpTranslator.continue',_('Dump Translator')): return import locale language = locale.getlocale()[0].split('_',1)[0] outPath = bosh.dirs['app'].join('Mopy','Data','NEW%s.txt' % (language,)) outFile = outPath.open('w') #--Scan for keys and dump to keyCount = 0 dumpedKeys = set() reKey = re.compile(r'_\([\'\"](.+?)[\'\"]\)') reTrans = bolt.reTrans for pyPath in (GPath(x+'.py') for x in ('bolt','balt','bush','bosh','bash','basher','bashmon')): pyText = pyPath.open() for lineNum,line in enumerate(pyText): line = re.sub('#.*','',line) for key in reKey.findall(line): key = reTrans.match(key).group(2) if key in dumpedKeys: continue outFile.write('=== %s, %d\n' % (pyPath.s,lineNum+1)) outFile.write(key+'\n>>>>\n') value = _(key,False) if value != key: outFile.write(value) outFile.write('\n') dumpedKeys.add(key) keyCount += 1 pyText.close() outFile.close() balt.showOk(self.window, '%d translation keys written to Mopy\\Data\\%s.' % (keyCount,outPath.stail), _('Dump Translator')+': '+outPath.stail)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Copies list of mod files to clipboard.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("List Mods...")) menu.AppendItem(menuItem) def Execute(self,event): text = bosh.modInfos.getModList() if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.window,text,_("Active Mod Files"),asDialog=False,fixedFont=False,icons=bashBlue)
"""Copies list of mod files to clipboard.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("List Mods...")) menu.AppendItem(menuItem) def Execute(self,event): text = bosh.modInfos.getModList() if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.window,text,_("Active Mod Files"),asDialog=False,fixedFont=False,icons=bashBlue)
def Execute(self,event): """Handle menu selection.""" window = getattr(self,'gTank',None) or self.window #--Continue Query message = _("Apply an ini tweak to Fallout3.ini?\n\nWARNING: Incorrect tweaks can result in CTDs and even damage to you computer!") if not balt.askContinue(window,message,'bash.iniTweaks.continue',_("INI Tweaks")): return #--File dialog tweakDir = bosh.modInfos.dir.join("INI Tweaks") tweakDir.makedirs() tweakPath = balt.askOpen(window,_('INI Tweaks'),tweakDir,'', '*.ini') if not tweakPath: return bosh.fallout3Ini.applyTweakFile(tweakPath) balt.showInfo(window,tweakPath.stail+_(' applied.'),_('INI Tweaks'))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Turn on resetMTimes feature.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Lock Times'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(bosh.modInfos.lockTimes) def Execute(self,event): lockTimes = not bosh.modInfos.lockTimes if not lockTimes: bosh.modInfos.mtimes.clear() settings['bosh.modInfos.resetMTimes'] = bosh.modInfos.lockTimes = lockTimes bosh.modInfos.refresh(doInfos=False) modList.RefreshUI()
"""Turn on resetMTimes feature.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Lock Times'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(bosh.modInfos.lockTimes) def Execute(self,event): lockTimes = not bosh.modInfos.lockTimes if not lockTimes: bosh.modInfos.mtimes.clear() settings['bosh.modInfos.resetMTimes'] = bosh.modInfos.lockTimes = lockTimes bosh.modInfos.refresh(doInfos=False) modList.RefreshUI()
def Execute(self,event): #--Get masters list text = bosh.modInfos.getModList() if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.window,text,_("Active Mod Files"),asDialog=False,fixedFont=False,icons=bashBlue)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Open Fallout3.ini.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Fallout3.ini...')) menu.AppendItem(menuItem) self.path = bosh.dirs['saveBase'].join('Fallout3.ini') menuItem.Enable(self.path.exists()) def Execute(self,event): """Handle selection.""" self.path.start()
"""Open Fallout3.ini.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Fallout3.ini...')) menu.AppendItem(menuItem) self.path = bosh.dirs['saveBase'].join('Fallout3.ini') menuItem.Enable(self.path.exists()) def Execute(self,event): """Handle selection.""" self.path.start()
def Execute(self,event): lockTimes = not bosh.modInfos.lockTimes if not lockTimes: bosh.modInfos.mtimes.clear() settings['bosh.modInfos.resetMTimes'] = bosh.modInfos.lockTimes = lockTimes bosh.modInfos.refresh(doInfos=False) modList.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Open Data/masterlist.txt.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('masterlist.txt...')) menu.AppendItem(menuItem) self.path = bosh.dirs['mods'].join('masterlist.txt') menuItem.Enable(self.path.exists()) def Execute(self,event): """Handle selection.""" self.path.start()
"""Open Data/masterlist.txt.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('masterlist.txt...')) menu.AppendItem(menuItem) self.path = bosh.dirs['mods'].join('masterlist.txt') menuItem.Enable(self.path.exists()) def Execute(self,event): """Handle selection.""" self.path.start()
def Execute(self,event): """Handle selection.""" self.path.start()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Specify/set Fallout3 version.""" def __init__(self,key,setProfile=False): Link.__init__(self) self.key = key self.setProfile = setProfile def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,self.key,kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Enable(bosh.modInfos.voCurrent != None and self.key in bosh.modInfos.voAvailable) if bosh.modInfos.voCurrent == self.key: menuItem.Check() def Execute(self,event): """Handle selection.""" bosh.modInfos.setFallout3Version(self.key) bosh.modInfos.refresh() modList.RefreshUI() if self.setProfile: bosh.saveInfos.profiles.setItem(bosh.saveInfos.localSave,'vFallout3',self.key) bashFrame.SetTitle()
"""Specify/set Fallout3 version.""" def __init__(self,key,setProfile=False): Link.__init__(self) self.key = key self.setProfile = setProfile def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,self.key,kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Enable(bosh.modInfos.voCurrent != None and self.key in bosh.modInfos.voAvailable) if bosh.modInfos.voCurrent == self.key: menuItem.Check() def Execute(self,event): """Handle selection.""" bosh.modInfos.setFallout3Version(self.key) bosh.modInfos.refresh() modList.RefreshUI() if self.setProfile: bosh.saveInfos.profiles.setItem(bosh.saveInfos.localSave,'vFallout3',self.key) bashFrame.SetTitle()
def Execute(self,event): """Handle selection.""" self.path.start()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Turn on deprint/delist.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('FO3Edit Expert'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings['fo3Edit.iKnowWhatImDoing']) def Execute(self,event): settings['fo3Edit.iKnowWhatImDoing'] ^= True
"""Turn on deprint/delist.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('FO3Edit Expert'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(settings['fo3Edit.iKnowWhatImDoing']) def Execute(self,event): settings['fo3Edit.iKnowWhatImDoing'] ^= True
def Execute(self,event): """Handle selection.""" bosh.modInfos.setFallout3Version(self.key) bosh.modInfos.refresh() modList.RefreshUI() if self.setProfile: bosh.saveInfos.profiles.setItem(bosh.saveInfos.localSave,'vFallout3',self.key) bashFrame.SetTitle()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Mod Replacers dialog.""" def AppendToMenu(self,menu,window,data): """Append ref replacer items to menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Update Archive Invalidator')) menu.AppendItem(menuItem) def Execute(self,event): message = (_("Update ArchiveInvalidation.txt? This updates the file that forces the game engine to recognize replaced textures. Note that this feature is experimental and most probably somewhat incomplete. You may prefer to use another program to do AI.txt file updating.")) if not balt.askContinue(self.window,message,'bash.updateAI.continue',_('ArchiveInvalidation.txt')): return bosh.ResourceReplacer.updateInvalidator() balt.showOk(self.window,"ArchiveInvalidation.txt updated.")
"""Mod Replacers dialog.""" def AppendToMenu(self,menu,window,data): """Append ref replacer items to menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Update Archive Invalidator')) menu.AppendItem(menuItem) def Execute(self,event): message = (_("Update ArchiveInvalidation.txt? This updates the file that forces the game engine to recognize replaced textures. Note that this feature is experimental and most probably somewhat incomplete. You may prefer to use another program to do AI.txt file updating.")) if not balt.askContinue(self.window,message,'bash.updateAI.continue',_('ArchiveInvalidation.txt')): return bosh.ResourceReplacer.updateInvalidator() balt.showOk(self.window,"ArchiveInvalidation.txt updated.")
def Execute(self,event): settings['fo3Edit.iKnowWhatImDoing'] ^= True
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export actor levels from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('NPC Levels')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("This command will export the level info for NPCs whose level is offset with respect to the PC. The exported file can be edited with most spreadsheet programs and then reimported.\n\nSee the Bash help file for more info.")) if not balt.askContinue(self.window,message,'bash.actorLevels.export.continue',_('Export NPC Levels')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_NPC_Levels.csv') textDir = settings.get('bash.workDir',bosh.dirs['app']) textPath = balt.askSave(self.window,_('Export NPC levels to:'), textDir,textName, '*.csv') if not textPath: return (textDir,textName) = textPath.headTail settings['bash.workDir'] = textDir progress = balt.Progress(_("Export NPC Levels")) try: bosh.ActorLevels.dumpText(fileInfo,textPath,progress) finally: progress = progress.Destroy()
"""Export actor levels from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('NPC Levels')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("This command will export the level info for NPCs whose level is offset with respect to the PC. The exported file can be edited with most spreadsheet programs and then reimported.\n\nSee the Bash help file for more info.")) if not balt.askContinue(self.window,message,'bash.actorLevels.export.continue',_('Export NPC Levels')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_NPC_Levels.csv') textDir = settings.get('bash.workDir',bosh.dirs['app']) textPath = balt.askSave(self.window,_('Export NPC levels to:'), textDir,textName, '*.csv') if not textPath: return (textDir,textName) = textPath.headTail settings['bash.workDir'] = textDir progress = balt.Progress(_("Export NPC Levels")) try: bosh.ActorLevels.dumpText(fileInfo,textPath,progress) finally: progress = progress.Destroy()
def Execute(self,event): message = (_("Update ArchiveInvalidation.txt? This updates the file that forces the game engine to recognize replaced textures. Note that this feature is experimental and most probably somewhat incomplete. You may prefer to use another program to do AI.txt file updating.")) if not balt.askContinue(self.window,message,'bash.updateAI.continue',_('ArchiveInvalidation.txt')): return bosh.ResourceReplacer.updateInvalidator() balt.showOk(self.window,"ArchiveInvalidation.txt updated.")
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export actor levels from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('NPC Levels...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("This command will import NPC level info from a previously exported file.\n\nSee the Bash help file for more info.")) if not balt.askContinue(self.window,message,'bash.actorLevels.import.continue',_('Import NPC Levels')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_NPC_Levels.csv') textDir = settings.get('bash.workDir',bosh.dirs['app']) textPath = balt.askOpen(self.window,_('Export NPC levels to:'), textDir, textName, '*.csv') if not textPath: return (textDir,textName) = textPath.headTail settings['bash.workDir'] = textDir progress = balt.Progress(_("Import NPC Levels")) try: bosh.ActorLevels.loadText(fileInfo,textPath, progress) finally: progress = progress.Destroy()
"""Export actor levels from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('NPC Levels...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("This command will import NPC level info from a previously exported file.\n\nSee the Bash help file for more info.")) if not balt.askContinue(self.window,message,'bash.actorLevels.import.continue',_('Import NPC Levels')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_NPC_Levels.csv') textDir = settings.get('bash.workDir',bosh.dirs['app']) textPath = balt.askOpen(self.window,_('Export NPC levels to:'), textDir, textName, '*.csv') if not textPath: return (textDir,textName) = textPath.headTail settings['bash.workDir'] = textDir progress = balt.Progress(_("Import NPC Levels")) try: bosh.ActorLevels.loadText(fileInfo,textPath, progress) finally: progress = progress.Destroy()
def Execute(self,event): message = (_("This command will export the level info for NPCs whose level is offset with respect to the PC. The exported file can be edited with most spreadsheet programs and then reimported.\n\nSee the Bash help file for more info.")) if not balt.askContinue(self.window,message,'bash.actorLevels.export.continue',_('Export NPC Levels')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_NPC_Levels.csv') textDir = settings.get('bash.workDir',bosh.dirs['app']) #--File dialog textPath = balt.askSave(self.window,_('Export NPC levels to:'), textDir,textName, '*.csv') if not textPath: return (textDir,textName) = textPath.headTail settings['bash.workDir'] = textDir #--Export progress = balt.Progress(_("Export NPC Levels")) try: bosh.ActorLevels.dumpText(fileInfo,textPath,progress) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Adds master.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Add Master...')) menu.AppendItem(menuItem) menuItem.Enable(len(data)==1) def Execute(self,event): message = _("WARNING! For advanced modders only! Adds specified master to list of masters, thus ceding ownership of new content of this mod to the new master. Useful for splitting mods into esm/esp pairs.") if not balt.askContinue(self.window,message,'bash.addMaster.continue',_('Add Master')): return fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] wildcard = _('Fallout3 Masters')+' (*.esm;*.esp)|*.esm;*.esp' masterPath = balt.askOpen(self.window,_('Add master:'),fileInfo.dir, '', wildcard) if not masterPath: return (dir,name) = masterPath.headTail if dir != fileInfo.dir: return balt.showError(self.window, _("File must be selected from Fallout3 Data Files directory.")) if name in fileInfo.header.masters: return balt.showError(self.window,_("%s is already a master!") % (name.s,)) if name in bosh.modInfos: name = bosh.modInfos[name].name fileInfo.header.masters.append(name) fileInfo.header.changed = True fileInfo.writeHeader() bosh.modInfos.refreshFile(fileInfo.name) self.window.RefreshUI()
"""Adds master.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Add Master...')) menu.AppendItem(menuItem) menuItem.Enable(len(data)==1) def Execute(self,event): message = _("WARNING! For advanced modders only! Adds specified master to list of masters, thus ceding ownership of new content of this mod to the new master. Useful for splitting mods into esm/esp pairs.") if not balt.askContinue(self.window,message,'bash.addMaster.continue',_('Add Master')): return fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] wildcard = _('Fallout3 Masters')+' (*.esm;*.esp)|*.esm;*.esp' masterPath = balt.askOpen(self.window,_('Add master:'),fileInfo.dir, '', wildcard) if not masterPath: return (dir,name) = masterPath.headTail if dir != fileInfo.dir: return balt.showError(self.window, _("File must be selected from Fallout3 Data Files directory.")) if name in fileInfo.header.masters: return balt.showError(self.window,_("%s is already a master!") % (name.s,)) if name in bosh.modInfos: name = bosh.modInfos[name].name fileInfo.header.masters.append(name) fileInfo.header.changed = True fileInfo.writeHeader() bosh.modInfos.refreshFile(fileInfo.name) self.window.RefreshUI()
def Execute(self,event): message = (_("This command will import NPC level info from a previously exported file.\n\nSee the Bash help file for more info.")) if not balt.askContinue(self.window,message,'bash.actorLevels.import.continue',_('Import NPC Levels')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_NPC_Levels.csv') textDir = settings.get('bash.workDir',bosh.dirs['app']) #--File dialog textPath = balt.askOpen(self.window,_('Export NPC levels to:'), textDir, textName, '*.csv') if not textPath: return (textDir,textName) = textPath.headTail settings['bash.workDir'] = textDir #--Export progress = balt.Progress(_("Import NPC Levels")) try: bosh.ActorLevels.loadText(fileInfo,textPath, progress) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Dialog for editing Balo groups.""" def __init__(self,parent): self.parent = parent self.groups = [list(x) for x in bosh.modInfos.getBaloGroups(True)] self.removed = set() wx.Dialog.__init__(self,parent,-1,_("Balo Groups"),style=wx.CAPTION|wx.RESIZE_BORDER) self.gList = wx.ListBox(self,-1,choices=self.GetItems(),style=wx.LB_SINGLE) self.gList.SetSizeHints(125,150) self.gList.Bind(wx.EVT_LISTBOX,self.DoSelect) self.gLowerBounds = spinCtrl(self,'-10',size=(15,15),min=-10,max=0,onSpin=self.OnSpin) self.gUpperBounds = spinCtrl(self,'10',size=(15,15),min=0,max=10, onSpin=self.OnSpin) self.gLowerBounds.SetSizeHints(35,-1) self.gUpperBounds.SetSizeHints(35,-1) self.gAdd = button(self,_('Add'),onClick=self.DoAdd) self.gRename = button(self,_('Rename'),onClick=self.DoRename) self.gRemove = button(self,_('Remove'),onClick=self.DoRemove) self.gMoveEarlier = button(self,_('Move Up'),onClick=self.DoMoveEarlier) self.gMoveLater = button(self,_('Move Down'),onClick=self.DoMoveLater) topLeftCenter= wx.ALIGN_CENTER|wx.LEFT|wx.TOP sizer = hSizer( (self.gList,1,wx.EXPAND|wx.TOP,4), (vSizer( (self.gAdd,0,topLeftCenter,4), (self.gRename,0,topLeftCenter,4), (self.gRemove,0,topLeftCenter,4), (self.gMoveEarlier,0,topLeftCenter,4), (self.gMoveLater,0,topLeftCenter,4), (hsbSizer((self,-1,_('Offsets')), (self.gLowerBounds,1,wx.EXPAND|wx.LEFT|wx.TOP,4), (self.gUpperBounds,1,wx.EXPAND|wx.TOP,4), ),0,wx.LEFT|wx.TOP,4), spacer, (button(self,id=wx.ID_SAVE,onClick=self.DoSave),0,topLeftCenter,4), (button(self,id=wx.ID_CANCEL,onClick=self.DoCancel),0,topLeftCenter|wx.BOTTOM,4), ),0,wx.EXPAND|wx.RIGHT,4), ) self.SetSizeHints(200,300) className = self.__class__.__name__ if className in balt.sizes: self.SetSizer(sizer) self.SetSize(balt.sizes[className]) else: self.SetSizerAndFit(sizer) self.Refresh(0) def AskNewName(self,message,title): """Ask user for new/copy name.""" newName = (balt.askText(self,message,title) or '').strip() if not newName: return None maValid = re.match('([a-zA-Z][ _a-zA-Z]+)',newName) if not maValid or maValid.group(1) != newName: showWarning(self, _("Group name must be letters, spaces, underscores only!"),title) return None elif newName in self.GetItems(): showWarning(self,_("group %s already exists.") % (newName,),title) return None elif len(newName) >= 40: showWarning(self,_("Group names must be less than forty characters."),title) return None else: return newName def GetItems(self): """Return a list of item strings.""" return [x[5] for x in self.groups] def GetItemLabel(self,index): info = self.groups[index] lower,upper,group = info[1],info[2],info[5] if lower == upper: return group else: return '%s %d : %d' % (group,lower,upper) def Refresh(self,index): """Refresh items in list.""" labels = [self.GetItemLabel(x) for x in range(len(self.groups))] self.gList.Set(labels) self.gList.SetSelection(index) self.RefreshButtons() def RefreshBounds(self,index): """Refresh bounds info.""" if index < 0 or index >= len(self.groups): lower,upper = 0,0 else: lower,upper,usedStart,usedStop = self.groups[index][1:5] self.gLowerBounds.SetRange(-10,usedStart) self.gUpperBounds.SetRange(usedStop-1,10) self.gLowerBounds.SetValue(lower) self.gUpperBounds.SetValue(upper) def RefreshButtons(self,index=None): """Updates buttons.""" if index == None: index = (self.gList.GetSelections() or (0,))[0] self.RefreshBounds(index) usedStart,usedStop = self.groups[index][3:5] mutable = index <= len(self.groups) - 3 self.gAdd.Enable(mutable) self.gRename.Enable(mutable) self.gRemove.Enable(mutable and usedStart == usedStop) self.gMoveEarlier.Enable(mutable and index > 0) self.gMoveLater.Enable(mutable and index <= len(self.groups) - 4) self.gLowerBounds.Enable(index != len(self.groups) - 2) self.gUpperBounds.Enable(index != len(self.groups) - 2) def DoAdd(self,event): """Adds a new item.""" title = _("Add Balo Group") index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= len(self.groups) - 2: return bell() oldName = self.groups[index][0] message = _("Name of new group (spaces and letters only):") newName = self.AskNewName(message,title) if newName: self.groups.insert(index+1,['',0,0,0,0,newName]) self.Refresh(index+1) def DoMoveEarlier(self,event): """Moves selected group up (earlier) in order.)""" index = (self.gList.GetSelections() or (0,))[0] if index < 1 or index >= (len(self.groups)-2): return bell() swapped = [self.groups[index],self.groups[index-1]] self.groups[index-1:index+1] = swapped self.Refresh(index-1) def DoMoveLater(self,event): """Moves selected group down (later) in order.)""" index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= (len(self.groups) - 3): return bell() swapped = [self.groups[index+1],self.groups[index]] self.groups[index:index+2] = swapped self.Refresh(index+1) def DoRename(self,event): """Renames selected item.""" title = _("Rename Balo Group") index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= len(self.groups): return bell() oldName = self.groups[index][5] message = _("Rename %s to (spaces, letters and underscores only):") % (oldName,) newName = self.AskNewName(message,title) if newName: self.groups[index][5] = newName self.gList.SetString(index,self.GetItemLabel(index)) def DoRemove(self,event): """Removes selected item.""" index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= len(self.groups): return bell() name = self.groups[index][0] if name: self.removed.add(name) del self.groups[index] self.gList.Delete(index) self.Refresh(index) def DoSelect(self,event): """Handle select event.""" self.Refresh(event.GetSelection()) self.gList.SetFocus() def OnSpin(self,event): """Show label editing dialog.""" index = (self.gList.GetSelections() or (0,))[0] self.groups[index][1] = self.gLowerBounds.GetValue() self.groups[index][2] = self.gUpperBounds.GetValue() self.gList.SetString(index,self.GetItemLabel(index)) event.Skip() def DoSave(self,event): """Handle save button.""" balt.sizes[self.__class__.__name__] = self.GetSizeTuple() settings['bash.balo.full'] = True bosh.modInfos.setBaloGroups(self.groups,self.removed) bosh.modInfos.updateAutoGroups() bosh.modInfos.refresh() modList.RefreshUI() self.EndModal(wx.ID_OK) def DoCancel(self,event): """Handle save button.""" balt.sizes[self.__class__.__name__] = self.GetSizeTuple() self.EndModal(wx.ID_CANCEL)
"""Dialog for editing Balo groups.""" def __init__(self,parent): self.parent = parent self.groups = [list(x) for x in bosh.modInfos.getBaloGroups(True)] self.removed = set() wx.Dialog.__init__(self,parent,-1,_("Balo Groups"),style=wx.CAPTION|wx.RESIZE_BORDER) self.gList = wx.ListBox(self,-1,choices=self.GetItems(),style=wx.LB_SINGLE) self.gList.SetSizeHints(125,150) self.gList.Bind(wx.EVT_LISTBOX,self.DoSelect) self.gLowerBounds = spinCtrl(self,'-10',size=(15,15),min=-10,max=0,onSpin=self.OnSpin) self.gUpperBounds = spinCtrl(self,'10',size=(15,15),min=0,max=10, onSpin=self.OnSpin) self.gLowerBounds.SetSizeHints(35,-1) self.gUpperBounds.SetSizeHints(35,-1) self.gAdd = button(self,_('Add'),onClick=self.DoAdd) self.gRename = button(self,_('Rename'),onClick=self.DoRename) self.gRemove = button(self,_('Remove'),onClick=self.DoRemove) self.gMoveEarlier = button(self,_('Move Up'),onClick=self.DoMoveEarlier) self.gMoveLater = button(self,_('Move Down'),onClick=self.DoMoveLater) topLeftCenter= wx.ALIGN_CENTER|wx.LEFT|wx.TOP sizer = hSizer( (self.gList,1,wx.EXPAND|wx.TOP,4), (vSizer( (self.gAdd,0,topLeftCenter,4), (self.gRename,0,topLeftCenter,4), (self.gRemove,0,topLeftCenter,4), (self.gMoveEarlier,0,topLeftCenter,4), (self.gMoveLater,0,topLeftCenter,4), (hsbSizer((self,-1,_('Offsets')), (self.gLowerBounds,1,wx.EXPAND|wx.LEFT|wx.TOP,4), (self.gUpperBounds,1,wx.EXPAND|wx.TOP,4), ),0,wx.LEFT|wx.TOP,4), spacer, (button(self,id=wx.ID_SAVE,onClick=self.DoSave),0,topLeftCenter,4), (button(self,id=wx.ID_CANCEL,onClick=self.DoCancel),0,topLeftCenter|wx.BOTTOM,4), ),0,wx.EXPAND|wx.RIGHT,4), ) self.SetSizeHints(200,300) className = self.__class__.__name__ if className in balt.sizes: self.SetSizer(sizer) self.SetSize(balt.sizes[className]) else: self.SetSizerAndFit(sizer) self.Refresh(0) def AskNewName(self,message,title): """Ask user for new/copy name.""" newName = (balt.askText(self,message,title) or '').strip() if not newName: return None maValid = re.match('([a-zA-Z][ _a-zA-Z]+)',newName) if not maValid or maValid.group(1) != newName: showWarning(self, _("Group name must be letters, spaces, underscores only!"),title) return None elif newName in self.GetItems(): showWarning(self,_("group %s already exists.") % (newName,),title) return None elif len(newName) >= 40: showWarning(self,_("Group names must be less than forty characters."),title) return None else: return newName def GetItems(self): """Return a list of item strings.""" return [x[5] for x in self.groups] def GetItemLabel(self,index): info = self.groups[index] lower,upper,group = info[1],info[2],info[5] if lower == upper: return group else: return '%s %d : %d' % (group,lower,upper) def Refresh(self,index): """Refresh items in list.""" labels = [self.GetItemLabel(x) for x in range(len(self.groups))] self.gList.Set(labels) self.gList.SetSelection(index) self.RefreshButtons() def RefreshBounds(self,index): """Refresh bounds info.""" if index < 0 or index >= len(self.groups): lower,upper = 0,0 else: lower,upper,usedStart,usedStop = self.groups[index][1:5] self.gLowerBounds.SetRange(-10,usedStart) self.gUpperBounds.SetRange(usedStop-1,10) self.gLowerBounds.SetValue(lower) self.gUpperBounds.SetValue(upper) def RefreshButtons(self,index=None): """Updates buttons.""" if index == None: index = (self.gList.GetSelections() or (0,))[0] self.RefreshBounds(index) usedStart,usedStop = self.groups[index][3:5] mutable = index <= len(self.groups) - 3 self.gAdd.Enable(mutable) self.gRename.Enable(mutable) self.gRemove.Enable(mutable and usedStart == usedStop) self.gMoveEarlier.Enable(mutable and index > 0) self.gMoveLater.Enable(mutable and index <= len(self.groups) - 4) self.gLowerBounds.Enable(index != len(self.groups) - 2) self.gUpperBounds.Enable(index != len(self.groups) - 2) def DoAdd(self,event): """Adds a new item.""" title = _("Add Balo Group") index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= len(self.groups) - 2: return bell() oldName = self.groups[index][0] message = _("Name of new group (spaces and letters only):") newName = self.AskNewName(message,title) if newName: self.groups.insert(index+1,['',0,0,0,0,newName]) self.Refresh(index+1) def DoMoveEarlier(self,event): """Moves selected group up (earlier) in order.)""" index = (self.gList.GetSelections() or (0,))[0] if index < 1 or index >= (len(self.groups)-2): return bell() swapped = [self.groups[index],self.groups[index-1]] self.groups[index-1:index+1] = swapped self.Refresh(index-1) def DoMoveLater(self,event): """Moves selected group down (later) in order.)""" index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= (len(self.groups) - 3): return bell() swapped = [self.groups[index+1],self.groups[index]] self.groups[index:index+2] = swapped self.Refresh(index+1) def DoRename(self,event): """Renames selected item.""" title = _("Rename Balo Group") index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= len(self.groups): return bell() oldName = self.groups[index][5] message = _("Rename %s to (spaces, letters and underscores only):") % (oldName,) newName = self.AskNewName(message,title) if newName: self.groups[index][5] = newName self.gList.SetString(index,self.GetItemLabel(index)) def DoRemove(self,event): """Removes selected item.""" index = (self.gList.GetSelections() or (0,))[0] if index < 0 or index >= len(self.groups): return bell() name = self.groups[index][0] if name: self.removed.add(name) del self.groups[index] self.gList.Delete(index) self.Refresh(index) def DoSelect(self,event): """Handle select event.""" self.Refresh(event.GetSelection()) self.gList.SetFocus() def OnSpin(self,event): """Show label editing dialog.""" index = (self.gList.GetSelections() or (0,))[0] self.groups[index][1] = self.gLowerBounds.GetValue() self.groups[index][2] = self.gUpperBounds.GetValue() self.gList.SetString(index,self.GetItemLabel(index)) event.Skip() def DoSave(self,event): """Handle save button.""" balt.sizes[self.__class__.__name__] = self.GetSizeTuple() settings['bash.balo.full'] = True bosh.modInfos.setBaloGroups(self.groups,self.removed) bosh.modInfos.updateAutoGroups() bosh.modInfos.refresh() modList.RefreshUI() self.EndModal(wx.ID_OK) def DoCancel(self,event): """Handle save button.""" balt.sizes[self.__class__.__name__] = self.GetSizeTuple() self.EndModal(wx.ID_CANCEL)
def Execute(self,event): message = _("WARNING! For advanced modders only! Adds specified master to list of masters, thus ceding ownership of new content of this mod to the new master. Useful for splitting mods into esm/esp pairs.") if not balt.askContinue(self.window,message,'bash.addMaster.continue',_('Add Master')): return fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] wildcard = _('Fallout3 Masters')+' (*.esm;*.esp)|*.esm;*.esp' masterPath = balt.askOpen(self.window,_('Add master:'),fileInfo.dir, '', wildcard) if not masterPath: return (dir,name) = masterPath.headTail if dir != fileInfo.dir: return balt.showError(self.window, _("File must be selected from Fallout3 Data Files directory.")) if name in fileInfo.header.masters: return balt.showError(self.window,_("%s is already a master!") % (name.s,)) if name in bosh.modInfos: #--Avoid capitalization errors by getting the actual name from modinfos. name = bosh.modInfos[name].name fileInfo.header.masters.append(name) fileInfo.header.changed = True fileInfo.writeHeader() bosh.modInfos.refreshFile(fileInfo.name) self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Select Balo group to use.""" def __init__(self): """Initialize.""" self.id_group = {} self.idList = ID_GROUPS def GetItems(self): items = self.labels[:] items.sort(key=lambda a: a.lower()) return items def AppendToMenu(self,menu,window,data): """Append label list to menu.""" if not settings.get('bash.balo.full'): return self.window = window self.data = data id_group = self.id_group menu.Append(self.idList.EDIT,_('Edit...')) setableMods = [GPath(x) for x in self.data if GPath(x) not in bosh.modInfos.autoHeaders] if setableMods: menu.AppendSeparator() ids = iter(self.idList) if len(setableMods) == 1: modGroup = bosh.modInfos.table.getItem(setableMods[0],'group') else: modGroup = None for group,lower,upper in bosh.modInfos.getBaloGroups(): if lower == upper: id = ids.next() id_group[id] = group menu.AppendCheckItem(id,group) menu.Check(id,group == modGroup) else: subMenu = wx.Menu() for x in range(lower,upper+1): offGroup = bosh.joinModGroup(group,x) id = ids.next() id_group[id] = offGroup subMenu.AppendCheckItem(id,offGroup) subMenu.Check(id,offGroup == modGroup) menu.AppendMenu(-1,group,subMenu) wx.EVT_MENU(window,self.idList.EDIT,self.DoEdit) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoList(self,event): """Handle selection of label.""" label = self.id_group[event.GetId()] mod_group = bosh.modInfos.table.getColumn('group') for mod in self.data: if mod not in bosh.modInfos.autoHeaders: mod_group[mod] = label if bosh.modInfos.refresh(doInfos=False): modList.SortItems() self.window.RefreshUI() def DoEdit(self,event): """Show label editing dialog.""" dialog = Mod_BaloGroups_Edit(self.window) dialog.ShowModal() dialog.Destroy()
"""Select Balo group to use.""" def __init__(self): """Initialize.""" self.id_group = {} self.idList = ID_GROUPS def GetItems(self): items = self.labels[:] items.sort(key=lambda a: a.lower()) return items def AppendToMenu(self,menu,window,data): """Append label list to menu.""" if not settings.get('bash.balo.full'): return self.window = window self.data = data id_group = self.id_group menu.Append(self.idList.EDIT,_('Edit...')) setableMods = [GPath(x) for x in self.data if GPath(x) not in bosh.modInfos.autoHeaders] if setableMods: menu.AppendSeparator() ids = iter(self.idList) if len(setableMods) == 1: modGroup = bosh.modInfos.table.getItem(setableMods[0],'group') else: modGroup = None for group,lower,upper in bosh.modInfos.getBaloGroups(): if lower == upper: id = ids.next() id_group[id] = group menu.AppendCheckItem(id,group) menu.Check(id,group == modGroup) else: subMenu = wx.Menu() for x in range(lower,upper+1): offGroup = bosh.joinModGroup(group,x) id = ids.next() id_group[id] = offGroup subMenu.AppendCheckItem(id,offGroup) subMenu.Check(id,offGroup == modGroup) menu.AppendMenu(-1,group,subMenu) wx.EVT_MENU(window,self.idList.EDIT,self.DoEdit) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoList(self,event): """Handle selection of label.""" label = self.id_group[event.GetId()] mod_group = bosh.modInfos.table.getColumn('group') for mod in self.data: if mod not in bosh.modInfos.autoHeaders: mod_group[mod] = label if bosh.modInfos.refresh(doInfos=False): modList.SortItems() self.window.RefreshUI() def DoEdit(self,event): """Show label editing dialog.""" dialog = Mod_BaloGroups_Edit(self.window) dialog.ShowModal() dialog.Destroy()
def DoCancel(self,event): """Handle save button.""" balt.sizes[self.__class__.__name__] = self.GetSizeTuple() self.EndModal(wx.ID_CANCEL)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Allow Ghosting")) menu.AppendItem(menuItem) def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Allow Ghosting")) menu.AppendItem(menuItem) def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Allow Ghosting")) menu.AppendItem(menuItem)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Disallow Ghosting")) menu.AppendItem(menuItem) def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = False bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = False oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Disallow Ghosting")) menu.AppendItem(menuItem) def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = False bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = False oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Disallow Ghosting")) menu.AppendItem(menuItem)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Invert Ghosting")) menu.AppendItem(menuItem) def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = bosh.modInfos.table.getItem(fileName,'allowGhosting',True) ^ True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = allowGhosting and fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Invert Ghosting")) menu.AppendItem(menuItem) def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = bosh.modInfos.table.getItem(fileName,'allowGhosting',True) ^ True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = allowGhosting and fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Invert Ghosting")) menu.AppendItem(menuItem)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Toggles Ghostability.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) if len(data) == 1: menuItem = wx.MenuItem(menu,self.id,_("Don't Ghost"),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) self.allowGhosting = bosh.modInfos.table.getItem(data[0],'allowGhosting',True) menuItem.Check(not self.allowGhosting) else: subMenu = wx.Menu() menu.AppendMenu(-1,"Ghosting",subMenu) Mod_AllowAllGhosting().AppendToMenu(subMenu,window,data) Mod_AllowNoGhosting().AppendToMenu(subMenu,window,data) Mod_AllowInvertGhosting().AppendToMenu(subMenu,window,data) def Execute(self,event): fileName = self.data[0] fileInfo = bosh.modInfos[fileName] allowGhosting = self.allowGhosting ^ True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = allowGhosting and fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
"""Toggles Ghostability.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) if len(data) == 1: menuItem = wx.MenuItem(menu,self.id,_("Don't Ghost"),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) self.allowGhosting = bosh.modInfos.table.getItem(data[0],'allowGhosting',True) menuItem.Check(not self.allowGhosting) else: subMenu = wx.Menu() menu.AppendMenu(-1,"Ghosting",subMenu) Mod_AllowAllGhosting().AppendToMenu(subMenu,window,data) Mod_AllowNoGhosting().AppendToMenu(subMenu,window,data) Mod_AllowInvertGhosting().AppendToMenu(subMenu,window,data) def Execute(self,event): fileName = self.data[0] fileInfo = bosh.modInfos[fileName] allowGhosting = self.allowGhosting ^ True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = allowGhosting and fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
def Execute(self,event): for fileName in self.data: fileInfo = bosh.modInfos[fileName] allowGhosting = bosh.modInfos.table.getItem(fileName,'allowGhosting',True) ^ True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = allowGhosting and fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Fix fog on selected csll.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Nvidia Fog Fix')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): message = _("Apply Nvidia fog fix. This modify fog values in interior cells to avoid the Nvidia black screen bug.") if not balt.askContinue(self.window,message,'bash.cleanMod.continue', _('Nvidia Fog Fix')): return progress = balt.Progress(_("Nvidia Fog Fix")) progress.setFull(len(self.data)) try: fixed = [] for index,fileName in enumerate(map(GPath,self.data)): if fileName == 'Fallout3.esm': continue progress(index,_("Scanning %s.") % (fileName.s,)) fileInfo = bosh.modInfos[fileName] cleanMod = bosh.CleanMod(fileInfo) cleanMod.clean(SubProgress(progress,index,index+1)) if cleanMod.fixedCells: fixed.append('* %4d %s' % (len(cleanMod.fixedCells),fileName.s)) progress.Destroy() if fixed: message = _("===Cells Fixed:\n")+('\n'.join(fixed)) balt.showWryeLog(self.window,message,_('Nvidia Fog Fix'),icons=bashBlue) else: message = _("No changes required.") balt.showOk(self.window,message,_('Nvidia Fog Fix')) finally: progress = progress.Destroy()
"""Fix fog on selected csll.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Nvidia Fog Fix')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): message = _("Apply Nvidia fog fix. This modify fog values in interior cells to avoid the Nvidia black screen bug.") if not balt.askContinue(self.window,message,'bash.cleanMod.continue', _('Nvidia Fog Fix')): return progress = balt.Progress(_("Nvidia Fog Fix")) progress.setFull(len(self.data)) try: fixed = [] for index,fileName in enumerate(map(GPath,self.data)): if fileName == 'Fallout3.esm': continue progress(index,_("Scanning %s.") % (fileName.s,)) fileInfo = bosh.modInfos[fileName] cleanMod = bosh.CleanMod(fileInfo) cleanMod.clean(SubProgress(progress,index,index+1)) if cleanMod.fixedCells: fixed.append('* %4d %s' % (len(cleanMod.fixedCells),fileName.s)) progress.Destroy() if fixed: message = _("===Cells Fixed:\n")+('\n'.join(fixed)) balt.showWryeLog(self.window,message,_('Nvidia Fog Fix'),icons=bashBlue) else: message = _("No changes required.") balt.showOk(self.window,message,_('Nvidia Fog Fix')) finally: progress = progress.Destroy()
def Execute(self,event): fileName = self.data[0] fileInfo = bosh.modInfos[fileName] allowGhosting = self.allowGhosting ^ True bosh.modInfos.table.setItem(fileName,'allowGhosting',allowGhosting) toGhost = allowGhosting and fileName not in bosh.modInfos.ordered oldGhost = fileInfo.isGhost if fileInfo.setGhost(toGhost) != oldGhost: self.window.RefreshUI(fileName)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Create a duplicate of the file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('New Mod...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): data = self.data fileName = GPath(data[0]) fileInfos = self.window.data fileInfo = fileInfos[fileName] count = 0 newName = GPath('New Mod.esp') while newName in fileInfos: count += 1 newName = GPath('New Mod %d.esp' % (count,)) newInfo = bosh.ModInfo(fileInfo.dir,newName) newInfo.mtime = fileInfo.mtime+20 newFile = bosh.ModFile(newInfo,bosh.LoadFactory(True)) newFile.tes4.masters = [GPath('Fallout3.esm')] newFile.safeSave() mod_group = bosh.modInfos.table.getColumn('group') mod_group[newName] = mod_group.get(fileName,'') bosh.modInfos.refresh() self.window.RefreshUI(detail=newName)
"""Create a duplicate of the file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('New Mod...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): data = self.data fileName = GPath(data[0]) fileInfos = self.window.data fileInfo = fileInfos[fileName] count = 0 newName = GPath('New Mod.esp') while newName in fileInfos: count += 1 newName = GPath('New Mod %d.esp' % (count,)) newInfo = bosh.ModInfo(fileInfo.dir,newName) newInfo.mtime = fileInfo.mtime+20 newFile = bosh.ModFile(newInfo,bosh.LoadFactory(True)) newFile.tes4.masters = [GPath('Fallout3.esm')] newFile.safeSave() mod_group = bosh.modInfos.table.getColumn('group') mod_group[newName] = mod_group.get(fileName,'') bosh.modInfos.refresh() self.window.RefreshUI(detail=newName)
def Execute(self,event): message = _("Apply Nvidia fog fix. This modify fog values in interior cells to avoid the Nvidia black screen bug.") if not balt.askContinue(self.window,message,'bash.cleanMod.continue', _('Nvidia Fog Fix')): return progress = balt.Progress(_("Nvidia Fog Fix")) progress.setFull(len(self.data)) try: fixed = [] for index,fileName in enumerate(map(GPath,self.data)): if fileName == 'Fallout3.esm': continue progress(index,_("Scanning %s.") % (fileName.s,)) fileInfo = bosh.modInfos[fileName] cleanMod = bosh.CleanMod(fileInfo) cleanMod.clean(SubProgress(progress,index,index+1)) if cleanMod.fixedCells: fixed.append('* %4d %s' % (len(cleanMod.fixedCells),fileName.s)) progress.Destroy() if fixed: message = _("===Cells Fixed:\n")+('\n'.join(fixed)) balt.showWryeLog(self.window,message,_('Nvidia Fog Fix'),icons=bashBlue) else: message = _("No changes required.") balt.showOk(self.window,message,_('Nvidia Fog Fix')) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export faction relationss from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Relations...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Relations.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export faction relations to:'),textDir,textName, '*Relations.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Relations")) try: factionRelations = bosh.FactionRelations() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) factionRelations.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) factionRelations.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
"""Export faction relationss from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Relations...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Relations.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export faction relations to:'),textDir,textName, '*Relations.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Relations")) try: factionRelations = bosh.FactionRelations() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) factionRelations.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) factionRelations.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
def Execute(self,event): data = self.data fileName = GPath(data[0]) fileInfos = self.window.data fileInfo = fileInfos[fileName] count = 0 newName = GPath('New Mod.esp') while newName in fileInfos: count += 1 newName = GPath('New Mod %d.esp' % (count,)) newInfo = bosh.ModInfo(fileInfo.dir,newName) newInfo.mtime = fileInfo.mtime+20 newFile = bosh.ModFile(newInfo,bosh.LoadFactory(True)) newFile.tes4.masters = [GPath('Fallout3.esm')] newFile.safeSave() mod_group = bosh.modInfos.table.getColumn('group') mod_group[newName] = mod_group.get(fileName,'') bosh.modInfos.refresh() self.window.RefreshUI(detail=newName)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export factions from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Factions...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Factions.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export factions to:'),textDir,textName, '*Factions.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Factions")) try: actorFactions = bosh.ActorFactions() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) actorFactions.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) actorFactions.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
"""Export factions from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Factions...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Factions.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export factions to:'),textDir,textName, '*Factions.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Factions")) try: actorFactions = bosh.ActorFactions() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) actorFactions.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) actorFactions.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Relations.csv') textDir = bosh.dirs['patches'] textDir.makedirs() #--File dialog textPath = balt.askSave(self.window,_('Export faction relations to:'),textDir,textName, '*Relations.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Export progress = balt.Progress(_("Export Relations")) try: factionRelations = bosh.FactionRelations() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) factionRelations.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) factionRelations.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Marks (tags) selected mods as Delevs and/or Relevs according to Leveled Lists.csv.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Mark Levelers...')) menu.AppendItem(menuItem) menuItem.Enable(bool(data)) def Execute(self,event): message = _('Obsolete. Mods are now automatically tagged when possible.') balt.showInfo(self.window,message,_('Mark Levelers'))
"""Marks (tags) selected mods as Delevs and/or Relevs according to Leveled Lists.csv.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Mark Levelers...')) menu.AppendItem(menuItem) menuItem.Enable(bool(data)) def Execute(self,event): message = _('Obsolete. Mods are now automatically tagged when possible.') balt.showInfo(self.window,message,_('Mark Levelers'))
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Factions.csv') textDir = bosh.dirs['patches'] textDir.makedirs() #--File dialog textPath = balt.askSave(self.window,_('Export factions to:'),textDir,textName, '*Factions.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Export progress = balt.Progress(_("Export Factions")) try: actorFactions = bosh.ActorFactions() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) actorFactions.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) actorFactions.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Returns true if can act as patch mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Mark Mergeable...')) menu.AppendItem(menuItem) menuItem.Enable(bool(data)) def Execute(self,event): yes,no = [],[] mod_mergeInfo = bosh.modInfos.table.getColumn('mergeInfo') for fileName in map(GPath,self.data): if fileName == 'Fallout3.esm': continue fileInfo = bosh.modInfos[fileName] descTags = fileInfo.getBashTagsDesc() if descTags and 'Merge' in descTags: descTags.discard('Merge') fileInfo.setBashTagsDesc(descTags) canMerge = bosh.PatchFile.modIsMergeable(fileInfo) mod_mergeInfo[fileName] = (fileInfo.size,canMerge == True) if canMerge == True: yes.append(fileName) else: no.append("%s (%s)" % (fileName.s,canMerge)) message = '' if yes: message += _('=== Mergeable\n* ') + '\n* '.join(x.s for x in yes) if yes and no: message += '\n\n' if no: message += _('=== Not Mergeable\n* ') + '\n* '.join(no) self.window.RefreshUI(yes) balt.showWryeLog(self.window,message,_('Mark Mergeable'),icons=bashBlue)
"""Returns true if can act as patch mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Mark Mergeable...')) menu.AppendItem(menuItem) menuItem.Enable(bool(data)) def Execute(self,event): yes,no = [],[] mod_mergeInfo = bosh.modInfos.table.getColumn('mergeInfo') for fileName in map(GPath,self.data): if fileName == 'Fallout3.esm': continue fileInfo = bosh.modInfos[fileName] descTags = fileInfo.getBashTagsDesc() if descTags and 'Merge' in descTags: descTags.discard('Merge') fileInfo.setBashTagsDesc(descTags) canMerge = bosh.PatchFile.modIsMergeable(fileInfo) mod_mergeInfo[fileName] = (fileInfo.size,canMerge == True) if canMerge == True: yes.append(fileName) else: no.append("%s (%s)" % (fileName.s,canMerge)) message = '' if yes: message += _('=== Mergeable\n* ') + '\n* '.join(x.s for x in yes) if yes and no: message += '\n\n' if no: message += _('=== Not Mergeable\n* ') + '\n* '.join(no) self.window.RefreshUI(yes) balt.showWryeLog(self.window,message,_('Mark Mergeable'),icons=bashBlue)
def Execute(self,event): message = _('Obsolete. Mods are now automatically tagged when possible.') balt.showInfo(self.window,message,_('Mark Levelers'))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Create an esp(esm) copy of selected esm(esp).""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) fileInfo = bosh.modInfos[data[0]] isEsm = fileInfo.isEsm() self.label = (_('Copy to Esm'),_('Copy to Esp'))[fileInfo.isEsm()] menuItem = wx.MenuItem(menu,self.id,self.label) menu.AppendItem(menuItem) for item in data: fileInfo = bosh.modInfos[item] if fileInfo.isInvertedMod() or fileInfo.isEsm() != isEsm: menuItem.Enable(False) return def Execute(self,event): for item in self.data: fileInfo = bosh.modInfos[item] newType = (fileInfo.isEsm() and 'esp') or 'esm' modsDir = fileInfo.dir curName = fileInfo.name newName = curName.root+'.'+newType if modsDir.join(newName).exists(): if not balt.askYes(self.window,_('Replace existing %s?') % (newName.s,),self.label): continue bosh.modInfos[newName].makeBackup() modInfos = bosh.modInfos timeSource = (curName,newName)[newName in modInfos] newTime = modInfos[timeSource].mtime modInfos.copy(curName,modsDir,newName,newTime) modInfos.table.copyRow(curName,newName) newInfo = modInfos[newName] newInfo.setType(newType) newInfo.setmtime(newTime) self.window.RefreshUI(detail=newName)
"""Create an esp(esm) copy of selected esm(esp).""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) fileInfo = bosh.modInfos[data[0]] isEsm = fileInfo.isEsm() self.label = (_('Copy to Esm'),_('Copy to Esp'))[fileInfo.isEsm()] menuItem = wx.MenuItem(menu,self.id,self.label) menu.AppendItem(menuItem) for item in data: fileInfo = bosh.modInfos[item] if fileInfo.isInvertedMod() or fileInfo.isEsm() != isEsm: menuItem.Enable(False) return def Execute(self,event): for item in self.data: fileInfo = bosh.modInfos[item] newType = (fileInfo.isEsm() and 'esp') or 'esm' modsDir = fileInfo.dir curName = fileInfo.name newName = curName.root+'.'+newType if modsDir.join(newName).exists(): if not balt.askYes(self.window,_('Replace existing %s?') % (newName.s,),self.label): continue bosh.modInfos[newName].makeBackup() modInfos = bosh.modInfos timeSource = (curName,newName)[newName in modInfos] newTime = modInfos[timeSource].mtime modInfos.copy(curName,modsDir,newName,newTime) modInfos.table.copyRow(curName,newName) newInfo = modInfos[newName] newInfo.setType(newType) newInfo.setmtime(newTime) self.window.RefreshUI(detail=newName)
def Execute(self,event): yes,no = [],[] mod_mergeInfo = bosh.modInfos.table.getColumn('mergeInfo') for fileName in map(GPath,self.data): if fileName == 'Fallout3.esm': continue fileInfo = bosh.modInfos[fileName] descTags = fileInfo.getBashTagsDesc() if descTags and 'Merge' in descTags: descTags.discard('Merge') fileInfo.setBashTagsDesc(descTags) canMerge = bosh.PatchFile.modIsMergeable(fileInfo) mod_mergeInfo[fileName] = (fileInfo.size,canMerge == True) if canMerge == True: yes.append(fileName) else: no.append("%s (%s)" % (fileName.s,canMerge)) message = '' if yes: message += _('=== Mergeable\n* ') + '\n* '.join(x.s for x in yes) if yes and no: message += '\n\n' if no: message += _('=== Not Mergeable\n* ') + '\n* '.join(no) self.window.RefreshUI(yes) balt.showWryeLog(self.window,message,_('Mark Mergeable'),icons=bashBlue)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Imports a face from a save to an esp.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Face...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): srcDir = bosh.saveInfos.dir wildcard = _('Fallout3 Files')+' (*.fos;*.for)|*.fos;*.for' srcPath = balt.askOpen(self.window,'Face Source:',srcDir, '', wildcard) if not srcPath: return srcDir,srcName = srcPath.headTail srcInfo = bosh.SaveInfo(srcDir,srcName) srcFace = bosh.PCFaces.save_getFace(srcInfo) fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] npc = bosh.PCFaces.mod_addFace(fileInfo,srcFace) imagePath = bosh.modInfos.dir.join('Docs','Images',npc.eid+'.jpg') if not imagePath.exists(): srcInfo.getHeader() width,height,data = srcInfo.header.image image = wx.EmptyImage(width,height) image.SetData(data) imagePath.head.makedirs() image.SaveFile(imagePath.s,wx.BITMAP_TYPE_JPEG) self.window.RefreshUI() balt.showOk(self.window,_('Imported face to: %s') % (npc.eid,),fileName.s)
"""Imports a face from a save to an esp.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Face...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): srcDir = bosh.saveInfos.dir wildcard = _('Fallout3 Files')+' (*.fos;*.for)|*.fos;*.for' srcPath = balt.askOpen(self.window,'Face Source:',srcDir, '', wildcard) if not srcPath: return srcDir,srcName = srcPath.headTail srcInfo = bosh.SaveInfo(srcDir,srcName) srcFace = bosh.PCFaces.save_getFace(srcInfo) fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] npc = bosh.PCFaces.mod_addFace(fileInfo,srcFace) imagePath = bosh.modInfos.dir.join('Docs','Images',npc.eid+'.jpg') if not imagePath.exists(): srcInfo.getHeader() width,height,data = srcInfo.header.image image = wx.EmptyImage(width,height) image.SetData(data) imagePath.head.makedirs() image.SaveFile(imagePath.s,wx.BITMAP_TYPE_JPEG) self.window.RefreshUI() balt.showOk(self.window,_('Imported face to: %s') % (npc.eid,),fileName.s)
def Execute(self,event): for item in self.data: fileInfo = bosh.modInfos[item] newType = (fileInfo.isEsm() and 'esp') or 'esm' modsDir = fileInfo.dir curName = fileInfo.name newName = curName.root+'.'+newType #--Replace existing file? if modsDir.join(newName).exists(): if not balt.askYes(self.window,_('Replace existing %s?') % (newName.s,),self.label): continue bosh.modInfos[newName].makeBackup() #--New Time modInfos = bosh.modInfos timeSource = (curName,newName)[newName in modInfos] newTime = modInfos[timeSource].mtime #--Copy, set type, update mtime. modInfos.copy(curName,modsDir,newName,newTime) modInfos.table.copyRow(curName,newName) newInfo = modInfos[newName] newInfo.setType(newType) newInfo.setmtime(newTime) #--Repopulate self.window.RefreshUI(detail=newName)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Swaps masters between esp and esm versions.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Esmify Masters')) menu.AppendItem(menuItem) fileInfo = self.fileInfo = window.data[data[0]] menuItem.Enable(False) self.toEsp = False if len(data) == 1 and len(fileInfo.header.masters) > 1: espMasters = [master for master in fileInfo.header.masters if bosh.reEspExt.search(master.s)] if not espMasters: return for masterName in espMasters: masterInfo = bosh.modInfos.get(GPath(masterName),None) if masterInfo and masterInfo.isInvertedMod(): menuItem.SetText(_('Espify Masters')) self.toEsm = False break else: self.toEsm = True menuItem.Enable(True) def Execute(self,event): message = _("WARNING! For advanced modders only! Flips esp/esm bit of esp masters to convert them to/from esm state. Useful for building/analyzing esp mastered mods.") if not balt.askContinue(self.window,message,'bash.flipMasters.continue'): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] updated = [fileName] espMasters = [GPath(master) for master in fileInfo.header.masters if bosh.reEspExt.search(master.s)] for masterPath in espMasters: masterInfo = bosh.modInfos.get(masterPath,None) if masterInfo: masterInfo.header.flags1.esm = self.toEsm masterInfo.writeHeader() updated.append(masterPath) self.window.RefreshUI(updated,fileName)
"""Swaps masters between esp and esm versions.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Esmify Masters')) menu.AppendItem(menuItem) fileInfo = self.fileInfo = window.data[data[0]] menuItem.Enable(False) self.toEsp = False if len(data) == 1 and len(fileInfo.header.masters) > 1: espMasters = [master for master in fileInfo.header.masters if bosh.reEspExt.search(master.s)] if not espMasters: return for masterName in espMasters: masterInfo = bosh.modInfos.get(GPath(masterName),None) if masterInfo and masterInfo.isInvertedMod(): menuItem.SetText(_('Espify Masters')) self.toEsm = False break else: self.toEsm = True menuItem.Enable(True) def Execute(self,event): message = _("WARNING! For advanced modders only! Flips esp/esm bit of esp masters to convert them to/from esm state. Useful for building/analyzing esp mastered mods.") if not balt.askContinue(self.window,message,'bash.flipMasters.continue'): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] updated = [fileName] espMasters = [GPath(master) for master in fileInfo.header.masters if bosh.reEspExt.search(master.s)] for masterPath in espMasters: masterInfo = bosh.modInfos.get(masterPath,None) if masterInfo: masterInfo.header.flags1.esm = self.toEsm masterInfo.writeHeader() updated.append(masterPath) self.window.RefreshUI(updated,fileName)
def Execute(self,event): #--Select source face file srcDir = bosh.saveInfos.dir wildcard = _('Fallout3 Files')+' (*.fos;*.for)|*.fos;*.for' #--File dialog srcPath = balt.askOpen(self.window,'Face Source:',srcDir, '', wildcard) if not srcPath: return #--Get face srcDir,srcName = srcPath.headTail srcInfo = bosh.SaveInfo(srcDir,srcName) srcFace = bosh.PCFaces.save_getFace(srcInfo) #--Save Face fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] npc = bosh.PCFaces.mod_addFace(fileInfo,srcFace) #--Save Face picture? imagePath = bosh.modInfos.dir.join('Docs','Images',npc.eid+'.jpg') if not imagePath.exists(): srcInfo.getHeader() width,height,data = srcInfo.header.image image = wx.EmptyImage(width,height) image.SetData(data) imagePath.head.makedirs() image.SaveFile(imagePath.s,wx.BITMAP_TYPE_JPEG) self.window.RefreshUI() balt.showOk(self.window,_('Imported face to: %s') % (npc.eid,),fileName.s)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Flip an esp(esm) to an esm(esp).""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) fileInfo = bosh.modInfos[data[0]] isEsm = fileInfo.isEsm() self.label = (_('Esmify Self'),_('Espify Self'))[isEsm] menuItem = wx.MenuItem(menu,self.id,self.label) menu.AppendItem(menuItem) for item in data: fileInfo = bosh.modInfos[item] if fileInfo.isEsm() != isEsm or not item.cext[-1] == 'p': menuItem.Enable(False) return def Execute(self,event): message = _('WARNING! For advanced modders only!\n\nThis command flips an internal bit in the mod, converting an esp to an esm and vice versa. Note that it is this bit and NOT the file extension that determines the esp/esm state of the mod.') if not balt.askContinue(self.window,message,'bash.flipToEsmp.continue',_('Flip to Esm')): return for item in self.data: fileInfo = bosh.modInfos[item] header = fileInfo.header header.flags1.esm = not header.flags1.esm fileInfo.writeHeader() self.window.RefreshUI(detail=fileInfo.name)
"""Flip an esp(esm) to an esm(esp).""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) fileInfo = bosh.modInfos[data[0]] isEsm = fileInfo.isEsm() self.label = (_('Esmify Self'),_('Espify Self'))[isEsm] menuItem = wx.MenuItem(menu,self.id,self.label) menu.AppendItem(menuItem) for item in data: fileInfo = bosh.modInfos[item] if fileInfo.isEsm() != isEsm or not item.cext[-1] == 'p': menuItem.Enable(False) return def Execute(self,event): message = _('WARNING! For advanced modders only!\n\nThis command flips an internal bit in the mod, converting an esp to an esm and vice versa. Note that it is this bit and NOT the file extension that determines the esp/esm state of the mod.') if not balt.askContinue(self.window,message,'bash.flipToEsmp.continue',_('Flip to Esm')): return for item in self.data: fileInfo = bosh.modInfos[item] header = fileInfo.header header.flags1.esm = not header.flags1.esm fileInfo.writeHeader() self.window.RefreshUI(detail=fileInfo.name)
def Execute(self,event): message = _("WARNING! For advanced modders only! Flips esp/esm bit of esp masters to convert them to/from esm state. Useful for building/analyzing esp mastered mods.") if not balt.askContinue(self.window,message,'bash.flipMasters.continue'): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] updated = [fileName] espMasters = [GPath(master) for master in fileInfo.header.masters if bosh.reEspExt.search(master.s)] for masterPath in espMasters: masterInfo = bosh.modInfos.get(masterPath,None) if masterInfo: masterInfo.header.flags1.esm = self.toEsm masterInfo.writeHeader() updated.append(masterPath) self.window.RefreshUI(updated,fileName)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Data capsule for label editing dialog.""" def __init__(self,parent,strings): """Initialize.""" self.column = strings.column self.setKey = strings.setKey self.addPrompt = strings.addPrompt self.data = settings[self.setKey] balt.ListEditorData.__init__(self,parent) self.showAdd = True self.showRename = True self.showRemove = True def getItemList(self): """Returns load list keys in alpha order.""" return sorted(self.data,key=lambda a: a.lower()) def add(self): """Adds a new group.""" dialog = wx.TextEntryDialog(self.parent,self.addPrompt) result = dialog.ShowModal() if result != wx.ID_OK: dialog.Destroy() return newName = dialog.GetValue() dialog.Destroy() if newName in self.data: balt.showError(self.parent,_('Name must be unique.')) return False elif len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False settings.setChanged(self.setKey) self.data.append(newName) self.data.sort() return newName def rename(self,oldName,newName): """Renames oldName to newName.""" if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False settings.setChanged(self.setKey) self.data.remove(oldName) self.data.append(newName) self.data.sort() colGroup = bosh.modInfos.table.getColumn(self.column) for fileName in colGroup.keys(): if colGroup[fileName] == oldName: colGroup[fileName] = newName self.parent.PopulateItems() return newName def remove(self,item): """Removes group.""" settings.setChanged(self.setKey) self.data.remove(item) colGroup = bosh.modInfos.table.getColumn(self.column) for fileName in colGroup.keys(): if colGroup[fileName] == item: del colGroup[fileName] self.parent.PopulateItems() return True
"""Data capsule for label editing dialog.""" def __init__(self,parent,strings): """Initialize.""" self.column = strings.column self.setKey = strings.setKey self.addPrompt = strings.addPrompt self.data = settings[self.setKey] balt.ListEditorData.__init__(self,parent) self.showAdd = True self.showRename = True self.showRemove = True def getItemList(self): """Returns load list keys in alpha order.""" return sorted(self.data,key=lambda a: a.lower()) def add(self): """Adds a new group.""" dialog = wx.TextEntryDialog(self.parent,self.addPrompt) result = dialog.ShowModal() if result != wx.ID_OK: dialog.Destroy() return newName = dialog.GetValue() dialog.Destroy() if newName in self.data: balt.showError(self.parent,_('Name must be unique.')) return False elif len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False settings.setChanged(self.setKey) self.data.append(newName) self.data.sort() return newName def rename(self,oldName,newName): """Renames oldName to newName.""" if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False settings.setChanged(self.setKey) self.data.remove(oldName) self.data.append(newName) self.data.sort() colGroup = bosh.modInfos.table.getColumn(self.column) for fileName in colGroup.keys(): if colGroup[fileName] == oldName: colGroup[fileName] = newName self.parent.PopulateItems() return newName def remove(self,item): """Removes group.""" settings.setChanged(self.setKey) self.data.remove(item) colGroup = bosh.modInfos.table.getColumn(self.column) for fileName in colGroup.keys(): if colGroup[fileName] == item: del colGroup[fileName] self.parent.PopulateItems() return True
def Execute(self,event): message = _('WARNING! For advanced modders only!\n\nThis command flips an internal bit in the mod, converting an esp to an esm and vice versa. Note that it is this bit and NOT the file extension that determines the esp/esm state of the mod.') if not balt.askContinue(self.window,message,'bash.flipToEsmp.continue',_('Flip to Esm')): return for item in self.data: fileInfo = bosh.modInfos[item] header = fileInfo.header header.flags1.esm = not header.flags1.esm fileInfo.writeHeader() #--Repopulate self.window.RefreshUI(detail=fileInfo.name)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Add mod label links.""" def __init__(self): """Initialize.""" self.labels = settings[self.setKey] def GetItems(self): items = self.labels[:] items.sort(key=lambda a: a.lower()) return items def AppendToMenu(self,menu,window,data): """Append label list to menu.""" self.window = window self.data = data menu.Append(self.idList.EDIT,self.editMenu) menu.AppendSeparator() menu.Append(self.idList.NONE,_('None')) for id,item in zip(self.idList,self.GetItems()): menu.Append(id,item) wx.EVT_MENU(window,self.idList.EDIT,self.DoEdit) wx.EVT_MENU(window,self.idList.NONE,self.DoNone) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoNone(self,event): """Handle selection of None.""" fileLabels = bosh.modInfos.table.getColumn(self.column) for fileName in self.data: fileLabels[fileName] = '' self.window.PopulateItems() def DoList(self,event): """Handle selection of label.""" label = self.GetItems()[event.GetId()-self.idList.BASE] fileLabels = bosh.modInfos.table.getColumn(self.column) for fileName in self.data: fileLabels[fileName] = label if isinstance(self,Mod_Groups) and bosh.modInfos.refresh(doInfos=False): modList.SortItems() self.window.RefreshUI() def DoEdit(self,event): """Show label editing dialog.""" data = Mod_LabelsData(self.window,self) dialog = balt.ListEditor(self.window,-1,self.editWindow,data) dialog.ShowModal() dialog.Destroy()
"""Add mod label links.""" def __init__(self): """Initialize.""" self.labels = settings[self.setKey] def GetItems(self): items = self.labels[:] items.sort(key=lambda a: a.lower()) return items def AppendToMenu(self,menu,window,data): """Append label list to menu.""" self.window = window self.data = data menu.Append(self.idList.EDIT,self.editMenu) menu.AppendSeparator() menu.Append(self.idList.NONE,_('None')) for id,item in zip(self.idList,self.GetItems()): menu.Append(id,item) wx.EVT_MENU(window,self.idList.EDIT,self.DoEdit) wx.EVT_MENU(window,self.idList.NONE,self.DoNone) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoNone(self,event): """Handle selection of None.""" fileLabels = bosh.modInfos.table.getColumn(self.column) for fileName in self.data: fileLabels[fileName] = '' self.window.PopulateItems() def DoList(self,event): """Handle selection of label.""" label = self.GetItems()[event.GetId()-self.idList.BASE] fileLabels = bosh.modInfos.table.getColumn(self.column) for fileName in self.data: fileLabels[fileName] = label if isinstance(self,Mod_Groups) and bosh.modInfos.refresh(doInfos=False): modList.SortItems() self.window.RefreshUI() def DoEdit(self,event): """Show label editing dialog.""" data = Mod_LabelsData(self.window,self) dialog = balt.ListEditor(self.window,-1,self.editWindow,data) dialog.ShowModal() dialog.Destroy()
def remove(self,item): """Removes group.""" settings.setChanged(self.setKey) self.data.remove(item) #--Edit table entries. colGroup = bosh.modInfos.table.getColumn(self.column) for fileName in colGroup.keys(): if colGroup[fileName] == item: del colGroup[fileName] self.parent.PopulateItems() #--Done return True
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Add mod group links.""" def __init__(self): """Initialize.""" self.column = 'group' self.setKey = 'bash.mods.groups' self.editMenu = _('Edit Groups...') self.editWindow = _('Groups') self.addPrompt = _('Add group:') self.idList = ID_GROUPS Mod_Labels.__init__(self) def AppendToMenu(self,menu,window,data): """Append label list to menu.""" if not settings.get('bash.balo.full'): Mod_Labels.AppendToMenu(self,menu,window,data)
"""Add mod group links.""" def __init__(self): """Initialize.""" self.column = 'group' self.setKey = 'bash.mods.groups' self.editMenu = _('Edit Groups...') self.editWindow = _('Groups') self.addPrompt = _('Add group:') self.idList = ID_GROUPS Mod_Labels.__init__(self) def AppendToMenu(self,menu,window,data): """Append label list to menu.""" if not settings.get('bash.balo.full'): Mod_Labels.AppendToMenu(self,menu,window,data)
def DoEdit(self,event): """Show label editing dialog.""" data = Mod_LabelsData(self.window,self) dialog = balt.ListEditor(self.window,-1,self.editWindow,data) dialog.ShowModal() dialog.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export mod groups to text file.""" def AppendToMenu(self,menu,window,data): data = bosh.ModGroups.filter(data) Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Groups...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = 'My_Groups.csv' textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export groups to:'),textDir,textName, '*Groups.csv') if not textPath: return (textDir,textName) = textPath.headTail modGroups = bosh.ModGroups() modGroups.readFromModInfos(self.data) modGroups.writeToText(textPath) balt.showOk(self.window, _("Exported %d mod/groups.") % (len(modGroups.mod_group),), _("Export Groups"))
"""Export mod groups to text file.""" def AppendToMenu(self,menu,window,data): data = bosh.ModGroups.filter(data) Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Groups...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = 'My_Groups.csv' textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export groups to:'),textDir,textName, '*Groups.csv') if not textPath: return (textDir,textName) = textPath.headTail modGroups = bosh.ModGroups() modGroups.readFromModInfos(self.data) modGroups.writeToText(textPath) balt.showOk(self.window, _("Exported %d mod/groups.") % (len(modGroups.mod_group),), _("Export Groups"))
def AppendToMenu(self,menu,window,data): """Append label list to menu.""" #--For group labels if not settings.get('bash.balo.full'): Mod_Labels.AppendToMenu(self,menu,window,data)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Import editor ids from text file or other mod.""" def AppendToMenu(self,menu,window,data): data = bosh.ModGroups.filter(data) Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Groups...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): message = _("Import groups from a text file. Any mods that are moved into new auto-sorted groups will be immediately reordered.") if not balt.askContinue(self.window,message,'bash.groups.import.continue', _('Import Groups')): return textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import names from:'),textDir, '', '*Groups.csv') if not textPath: return (textDir,textName) = textPath.headTail if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return modGroups = bosh.ModGroups() modGroups.readFromText(textPath) changed = modGroups.writeToModInfos(self.data) bosh.modInfos.refresh() self.window.RefreshUI() balt.showOk(self.window, _("Imported %d mod/groups (%d changed).") % (len(modGroups.mod_group),changed), _("Import Groups"))
"""Import editor ids from text file or other mod.""" def AppendToMenu(self,menu,window,data): data = bosh.ModGroups.filter(data) Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Groups...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): message = _("Import groups from a text file. Any mods that are moved into new auto-sorted groups will be immediately reordered.") if not balt.askContinue(self.window,message,'bash.groups.import.continue', _('Import Groups')): return textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import names from:'),textDir, '', '*Groups.csv') if not textPath: return (textDir,textName) = textPath.headTail if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return modGroups = bosh.ModGroups() modGroups.readFromText(textPath) changed = modGroups.writeToModInfos(self.data) bosh.modInfos.refresh() self.window.RefreshUI() balt.showOk(self.window, _("Imported %d mod/groups (%d changed).") % (len(modGroups.mod_group),changed), _("Import Groups"))
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = 'My_Groups.csv' textDir = bosh.dirs['patches'] textDir.makedirs() #--File dialog textPath = balt.askSave(self.window,_('Export groups to:'),textDir,textName, '*Groups.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Export modGroups = bosh.ModGroups() modGroups.readFromModInfos(self.data) modGroups.writeToText(textPath) balt.showOk(self.window, _("Exported %d mod/groups.") % (len(modGroups.mod_group),), _("Export Groups"))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export editor ids from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Editor Ids...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Eids.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export eids to:'),textDir,textName, '*Eids.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Editor Ids")) try: editorIds = bosh.EditorIds() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) editorIds.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) editorIds.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
"""Export editor ids from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Editor Ids...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Eids.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export eids to:'),textDir,textName, '*Eids.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Editor Ids")) try: editorIds = bosh.EditorIds() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) editorIds.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) editorIds.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
def Execute(self,event): message = _("Import groups from a text file. Any mods that are moved into new auto-sorted groups will be immediately reordered.") if not balt.askContinue(self.window,message,'bash.groups.import.continue', _('Import Groups')): return textDir = bosh.dirs['patches'] #--File dialog textPath = balt.askOpen(self.window,_('Import names from:'),textDir, '', '*Groups.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Extension error check if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return #--Import modGroups = bosh.ModGroups() modGroups.readFromText(textPath) changed = modGroups.writeToModInfos(self.data) bosh.modInfos.refresh() self.window.RefreshUI() balt.showOk(self.window, _("Imported %d mod/groups (%d changed).") % (len(modGroups.mod_group),changed), _("Import Groups"))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Import editor ids from text file or other mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Editor Ids...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("Import editor ids from a text file. This will replace existing ids and is not reversible!")) if not balt.askContinue(self.window,message,'bash.editorIds.import.continue', _('Import Editor Ids')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Eids.csv') textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import names from:'),textDir, textName, '*Eids.csv') if not textPath: return (textDir,textName) = textPath.headTail if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return progress = balt.Progress(_("Import Editor Ids")) changed = None try: editorIds = bosh.EditorIds() progress(0.1,_("Reading %s.") % (textName.s,)) editorIds.readFromText(textPath) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = editorIds.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not changed: balt.showOk(self.window,_("No changes required.")) else: buff = cStringIO.StringIO() format = '%s >> %s\n' for old_new in sorted(changed): buff.write(format % old_new) balt.showLog(self.window,buff.getvalue(),_('Objects Changed'),icons=bashBlue)
"""Import editor ids from text file or other mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Editor Ids...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("Import editor ids from a text file. This will replace existing ids and is not reversible!")) if not balt.askContinue(self.window,message,'bash.editorIds.import.continue', _('Import Editor Ids')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Eids.csv') textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import names from:'),textDir, textName, '*Eids.csv') if not textPath: return (textDir,textName) = textPath.headTail if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return progress = balt.Progress(_("Import Editor Ids")) changed = None try: editorIds = bosh.EditorIds() progress(0.1,_("Reading %s.") % (textName.s,)) editorIds.readFromText(textPath) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = editorIds.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not changed: balt.showOk(self.window,_("No changes required.")) else: buff = cStringIO.StringIO() format = '%s >> %s\n' for old_new in sorted(changed): buff.write(format % old_new) balt.showLog(self.window,buff.getvalue(),_('Objects Changed'),icons=bashBlue)
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Eids.csv') textDir = bosh.dirs['patches'] textDir.makedirs() #--File dialog textPath = balt.askSave(self.window,_('Export eids to:'),textDir,textName, '*Eids.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Export progress = balt.Progress(_("Export Editor Ids")) try: editorIds = bosh.EditorIds() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) editorIds.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) editorIds.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Removes effects of a "recompile all" on the mod.""" def AppendToMenu(self,menu,window,data): """Append link to a menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Decompile All')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data) != 1 or (self.data[0] != 'Fallout3.esm')) def Execute(self,event): message = _("This command will remove the effects of a 'compile all' by removing all scripts whose texts appear to be identical to the version that they override.") if not balt.askContinue(self.window,message,'bash.decompileAll.continue',_('Decompile All')): return for item in self.data: fileName = GPath(item) if item == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Decompile All')) continue fileInfo = bosh.modInfos[fileName] loadFactory = bosh.LoadFactory(True,bosh.MreScpt) modFile = bosh.ModFile(fileInfo,loadFactory) modFile.load(True) badGenericLore = False removed = [] id_text = {} if modFile.SCPT.getNumRecords(False): loadFactory = bosh.LoadFactory(False,bosh.MreScpt) for master in modFile.tes4.masters: masterFile = bosh.ModFile(bosh.modInfos[master],loadFactory) masterFile.load(True) mapper = masterFile.getLongMapper() for record in masterFile.SCPT.getActiveRecords(): id_text[mapper(record.fid)] = record.scriptText mapper = modFile.getLongMapper() newRecords = [] for record in modFile.SCPT.records: fid = mapper(record.fid) if (fid in id_text and record.fid == 0x00025811 and record.compiledSize == 4 and record.lastIndex == 0): removed.append(record.eid) badGenericLore = True elif fid in id_text and id_text[fid] == record.scriptText: removed.append(record.eid) else: newRecords.append(record) modFile.SCPT.records = newRecords modFile.SCPT.setChanged() if len(removed) >= 50 or badGenericLore: modFile.safeSave() balt.showOk(self.window,_("Scripts removed: %d.\nScripts remaining: %d") % (len(removed),len(modFile.SCPT.records)),fileName.s) elif removed: balt.showOk(self.window,_("Only %d scripts were identical. This is probably intentional, so no changes have been made.") % len(removed),fileName.s) else: balt.showOk(self.window,_("No changes required."),fileName.s)
"""Removes effects of a "recompile all" on the mod.""" def AppendToMenu(self,menu,window,data): """Append link to a menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Decompile All')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data) != 1 or (self.data[0] != 'Fallout3.esm')) def Execute(self,event): message = _("This command will remove the effects of a 'compile all' by removing all scripts whose texts appear to be identical to the version that they override.") if not balt.askContinue(self.window,message,'bash.decompileAll.continue',_('Decompile All')): return for item in self.data: fileName = GPath(item) if item == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Decompile All')) continue fileInfo = bosh.modInfos[fileName] loadFactory = bosh.LoadFactory(True,bosh.MreScpt) modFile = bosh.ModFile(fileInfo,loadFactory) modFile.load(True) badGenericLore = False removed = [] id_text = {} if modFile.SCPT.getNumRecords(False): loadFactory = bosh.LoadFactory(False,bosh.MreScpt) for master in modFile.tes4.masters: masterFile = bosh.ModFile(bosh.modInfos[master],loadFactory) masterFile.load(True) mapper = masterFile.getLongMapper() for record in masterFile.SCPT.getActiveRecords(): id_text[mapper(record.fid)] = record.scriptText mapper = modFile.getLongMapper() newRecords = [] for record in modFile.SCPT.records: fid = mapper(record.fid) if (fid in id_text and record.fid == 0x00025811 and record.compiledSize == 4 and record.lastIndex == 0): removed.append(record.eid) badGenericLore = True elif fid in id_text and id_text[fid] == record.scriptText: removed.append(record.eid) else: newRecords.append(record) modFile.SCPT.records = newRecords modFile.SCPT.setChanged() if len(removed) >= 50 or badGenericLore: modFile.safeSave() balt.showOk(self.window,_("Scripts removed: %d.\nScripts remaining: %d") % (len(removed),len(modFile.SCPT.records)),fileName.s) elif removed: balt.showOk(self.window,_("Only %d scripts were identical. This is probably intentional, so no changes have been made.") % len(removed),fileName.s) else: balt.showOk(self.window,_("No changes required."),fileName.s)
def Execute(self,event): message = (_("Import editor ids from a text file. This will replace existing ids and is not reversible!")) if not balt.askContinue(self.window,message,'bash.editorIds.import.continue', _('Import Editor Ids')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Eids.csv') textDir = bosh.dirs['patches'] #--File dialog textPath = balt.askOpen(self.window,_('Import names from:'),textDir, textName, '*Eids.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Extension error check if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return #--Export progress = balt.Progress(_("Import Editor Ids")) changed = None try: editorIds = bosh.EditorIds() progress(0.1,_("Reading %s.") % (textName.s,)) editorIds.readFromText(textPath) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = editorIds.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() #--Log if not changed: balt.showOk(self.window,_("No changes required.")) else: buff = cStringIO.StringIO() format = '%s >> %s\n' for old_new in sorted(changed): buff.write(format % old_new) balt.showLog(self.window,buff.getvalue(),_('Objects Changed'),icons=bashBlue)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Replace fids according to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Form IDs...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = _("For advanced modders only! Systematically replaces one set of Form Ids with another in npcs, creatures, containers and leveled lists according to a Replacers.csv file.") if not balt.askContinue(self.window,message,'bash.formIds.replace.continue', _('Import Form IDs')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Form ID mapper file:'),textDir, '', '*Formids.csv') if not textPath: return (textDir,textName) = textPath.headTail if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return progress = balt.Progress(_("Import Form IDs")) changed = None try: replacer = bosh.FidReplacer() progress(0.1,_("Reading %s.") % (textName.s,)) replacer.readFromText(textPath) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = replacer.updateMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not changed: balt.showOk(self.window,_("No changes required.")) else: balt.showLog(self.window,changed,_('Objects Changed'),icons=bashBlue)
"""Replace fids according to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Form IDs...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = _("For advanced modders only! Systematically replaces one set of Form Ids with another in npcs, creatures, containers and leveled lists according to a Replacers.csv file.") if not balt.askContinue(self.window,message,'bash.formIds.replace.continue', _('Import Form IDs')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Form ID mapper file:'),textDir, '', '*Formids.csv') if not textPath: return (textDir,textName) = textPath.headTail if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return progress = balt.Progress(_("Import Form IDs")) changed = None try: replacer = bosh.FidReplacer() progress(0.1,_("Reading %s.") % (textName.s,)) replacer.readFromText(textPath) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = replacer.updateMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not changed: balt.showOk(self.window,_("No changes required.")) else: balt.showLog(self.window,changed,_('Objects Changed'),icons=bashBlue)
def Execute(self,event): message = _("This command will remove the effects of a 'compile all' by removing all scripts whose texts appear to be identical to the version that they override.") if not balt.askContinue(self.window,message,'bash.decompileAll.continue',_('Decompile All')): return for item in self.data: fileName = GPath(item) if item == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Decompile All')) continue fileInfo = bosh.modInfos[fileName] loadFactory = bosh.LoadFactory(True,bosh.MreScpt) modFile = bosh.ModFile(fileInfo,loadFactory) modFile.load(True) badGenericLore = False removed = [] id_text = {} if modFile.SCPT.getNumRecords(False): loadFactory = bosh.LoadFactory(False,bosh.MreScpt) for master in modFile.tes4.masters: masterFile = bosh.ModFile(bosh.modInfos[master],loadFactory) masterFile.load(True) mapper = masterFile.getLongMapper() for record in masterFile.SCPT.getActiveRecords(): id_text[mapper(record.fid)] = record.scriptText mapper = modFile.getLongMapper() newRecords = [] for record in modFile.SCPT.records: fid = mapper(record.fid) #--Special handling for genericLoreScript if (fid in id_text and record.fid == 0x00025811 and record.compiledSize == 4 and record.lastIndex == 0): removed.append(record.eid) badGenericLore = True elif fid in id_text and id_text[fid] == record.scriptText: removed.append(record.eid) else: newRecords.append(record) modFile.SCPT.records = newRecords modFile.SCPT.setChanged() if len(removed) >= 50 or badGenericLore: modFile.safeSave() balt.showOk(self.window,_("Scripts removed: %d.\nScripts remaining: %d") % (len(removed),len(modFile.SCPT.records)),fileName.s) elif removed: balt.showOk(self.window,_("Only %d scripts were identical. This is probably intentional, so no changes have been made.") % len(removed),fileName.s) else: balt.showOk(self.window,_("No changes required."),fileName.s)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export full names from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Names...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Names.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export names to:'), textDir,textName, '*Names.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Names")) try: fullNames = bosh.FullNames() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) fullNames.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) fullNames.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
"""Export full names from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Names...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Names.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export names to:'), textDir,textName, '*Names.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Names")) try: fullNames = bosh.FullNames() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) fullNames.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) fullNames.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
def Execute(self,event): message = _("For advanced modders only! Systematically replaces one set of Form Ids with another in npcs, creatures, containers and leveled lists according to a Replacers.csv file.") if not balt.askContinue(self.window,message,'bash.formIds.replace.continue', _('Import Form IDs')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textDir = bosh.dirs['patches'] #--File dialog textPath = balt.askOpen(self.window,_('Form ID mapper file:'),textDir, '', '*Formids.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Extension error check if textName.cext != '.csv': balt.showError(self.window,_('Source file must be a csv file.')) return #--Export progress = balt.Progress(_("Import Form IDs")) changed = None try: replacer = bosh.FidReplacer() progress(0.1,_("Reading %s.") % (textName.s,)) replacer.readFromText(textPath) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = replacer.updateMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() #--Log if not changed: balt.showOk(self.window,_("No changes required.")) else: balt.showLog(self.window,changed,_('Objects Changed'),icons=bashBlue)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Import full names from text file or other mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Names...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("Import record names from a text file. This will replace existing names and is not reversible!")) if not balt.askContinue(self.window,message,'bash.fullNames.import.continue', _('Import Names')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Names.csv') textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import names from:'), textDir,textName, 'Mod/Text File|*Names.csv;*.esp;*.esm') if not textPath: return (textDir,textName) = textPath.headTail ext = textName.cext if ext not in ('.esp','.esm','.csv'): balt.showError(self.window,_('Source file must be mod (.esp or .esm) or csv file.')) return progress = balt.Progress(_("Import Names")) renamed = None try: fullNames = bosh.FullNames() progress(0.1,_("Reading %s.") % (textName.s,)) if ext == '.csv': fullNames.readFromText(textPath) else: srcInfo = bosh.ModInfo(textDir,textName) fullNames.readFromMod(srcInfo) progress(0.2,_("Applying to %s.") % (fileName.s,)) renamed = fullNames.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not renamed: balt.showOk(self.window,_("No changes required.")) else: buff = cStringIO.StringIO() format = '%s: %s >> %s\n' for eid in sorted(renamed.keys()): full,newFull = renamed[eid] buff.write(format % (eid,full,newFull)) balt.showLog(self.window,buff.getvalue(),_('Objects Renamed'),icons=bashBlue)
"""Import full names from text file or other mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Names...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("Import record names from a text file. This will replace existing names and is not reversible!")) if not balt.askContinue(self.window,message,'bash.fullNames.import.continue', _('Import Names')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Names.csv') textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import names from:'), textDir,textName, 'Mod/Text File|*Names.csv;*.esp;*.esm') if not textPath: return (textDir,textName) = textPath.headTail ext = textName.cext if ext not in ('.esp','.esm','.csv'): balt.showError(self.window,_('Source file must be mod (.esp or .esm) or csv file.')) return progress = balt.Progress(_("Import Names")) renamed = None try: fullNames = bosh.FullNames() progress(0.1,_("Reading %s.") % (textName.s,)) if ext == '.csv': fullNames.readFromText(textPath) else: srcInfo = bosh.ModInfo(textDir,textName) fullNames.readFromMod(srcInfo) progress(0.2,_("Applying to %s.") % (fileName.s,)) renamed = fullNames.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not renamed: balt.showOk(self.window,_("No changes required.")) else: buff = cStringIO.StringIO() format = '%s: %s >> %s\n' for eid in sorted(renamed.keys()): full,newFull = renamed[eid] buff.write(format % (eid,full,newFull)) balt.showLog(self.window,buff.getvalue(),_('Objects Renamed'),icons=bashBlue)
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Names.csv') textDir = bosh.dirs['patches'] textDir.makedirs() #--File dialog textPath = balt.askSave(self.window,_('Export names to:'), textDir,textName, '*Names.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Export progress = balt.Progress(_("Export Names")) try: fullNames = bosh.FullNames() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) fullNames.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) fullNames.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Updates a Bashed Patch.""" def AppendToMenu(self,menu,window,data): """Append link to a menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Rebuild Patch...')) menu.AppendItem(menuItem) enable = (len(self.data) == 1 and bosh.modInfos[self.data[0]].header.author in ('BASHED PATCH','BASHED LISTS')) menuItem.Enable(enable) def Execute(self,event): """Handle activation event.""" unfiltered = [x for x in bosh.modInfos.ordered if 'Filter' in bosh.modInfos[x].getBashTags()] message = balt.fill(_("The following mods are tagged 'Filter'. These should be deactivated before building the patch, and then merged into the patch during build.\n*%s\n\nDeactivate the mods now?") % ('\n* '.join(x.s for x in unfiltered),),80) if unfiltered and balt.askYes(self.window,message,_("Deactivate Filter Mods")): for mod in unfiltered: bosh.modInfos.unselect(mod,False) bosh.modInfos.refreshInfoLists() bosh.modInfos.plugins.save() fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] if not bosh.modInfos.ordered: balt.showWarning(self.window,_("That which does not exist cannot be patched.\nLoad some mods and try again."),_("Existential Error")) return patchDialog = PatchDialog(self.window,fileInfo) patchDialog.ShowModal() self.window.RefreshUI(detail=fileName)
"""Updates a Bashed Patch.""" def AppendToMenu(self,menu,window,data): """Append link to a menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Rebuild Patch...')) menu.AppendItem(menuItem) enable = (len(self.data) == 1 and bosh.modInfos[self.data[0]].header.author in ('BASHED PATCH','BASHED LISTS')) menuItem.Enable(enable) def Execute(self,event): """Handle activation event.""" unfiltered = [x for x in bosh.modInfos.ordered if 'Filter' in bosh.modInfos[x].getBashTags()] message = balt.fill(_("The following mods are tagged 'Filter'. These should be deactivated before building the patch, and then merged into the patch during build.\n*%s\n\nDeactivate the mods now?") % ('\n* '.join(x.s for x in unfiltered),),80) if unfiltered and balt.askYes(self.window,message,_("Deactivate Filter Mods")): for mod in unfiltered: bosh.modInfos.unselect(mod,False) bosh.modInfos.refreshInfoLists() bosh.modInfos.plugins.save() fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] if not bosh.modInfos.ordered: balt.showWarning(self.window,_("That which does not exist cannot be patched.\nLoad some mods and try again."),_("Existential Error")) return patchDialog = PatchDialog(self.window,fileInfo) patchDialog.ShowModal() self.window.RefreshUI(detail=fileName)
def Execute(self,event): message = (_("Import record names from a text file. This will replace existing names and is not reversible!")) if not balt.askContinue(self.window,message,'bash.fullNames.import.continue', _('Import Names')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Names.csv') textDir = bosh.dirs['patches'] #--File dialog textPath = balt.askOpen(self.window,_('Import names from:'), textDir,textName, 'Mod/Text File|*Names.csv;*.esp;*.esm') if not textPath: return (textDir,textName) = textPath.headTail #--Extension error check ext = textName.cext if ext not in ('.esp','.esm','.csv'): balt.showError(self.window,_('Source file must be mod (.esp or .esm) or csv file.')) return #--Export progress = balt.Progress(_("Import Names")) renamed = None try: fullNames = bosh.FullNames() progress(0.1,_("Reading %s.") % (textName.s,)) if ext == '.csv': fullNames.readFromText(textPath) else: srcInfo = bosh.ModInfo(textDir,textName) fullNames.readFromMod(srcInfo) progress(0.2,_("Applying to %s.") % (fileName.s,)) renamed = fullNames.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() #--Log if not renamed: balt.showOk(self.window,_("No changes required.")) else: buff = cStringIO.StringIO() format = '%s: %s >> %s\n' #buff.write(format % (_('Editor Id'),_('Name'))) for eid in sorted(renamed.keys()): full,newFull = renamed[eid] buff.write(format % (eid,full,newFull)) balt.showLog(self.window,buff.getvalue(),_('Objects Renamed'),icons=bashBlue)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Add mod rating links.""" def __init__(self): """Initialize.""" self.column = 'rating' self.setKey = 'bash.mods.ratings' self.editMenu = _('Edit Ratings...') self.editWindow = _('Ratings') self.addPrompt = _('Add rating:') self.idList = ID_RATINGS Mod_Labels.__init__(self)
"""Add mod rating links.""" def __init__(self): """Initialize.""" self.column = 'rating' self.setKey = 'bash.mods.ratings' self.editMenu = _('Edit Ratings...') self.editWindow = _('Ratings') self.addPrompt = _('Add rating:') self.idList = ID_RATINGS Mod_Labels.__init__(self)
def Execute(self,event): """Handle activation event.""" unfiltered = [x for x in bosh.modInfos.ordered if 'Filter' in bosh.modInfos[x].getBashTags()] message = balt.fill(_("The following mods are tagged 'Filter'. These should be deactivated before building the patch, and then merged into the patch during build.\n*%s\n\nDeactivate the mods now?") % ('\n* '.join(x.s for x in unfiltered),),80) if unfiltered and balt.askYes(self.window,message,_("Deactivate Filter Mods")): for mod in unfiltered: bosh.modInfos.unselect(mod,False) bosh.modInfos.refreshInfoLists() bosh.modInfos.plugins.save() fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] if not bosh.modInfos.ordered: balt.showWarning(self.window,_("That which does not exist cannot be patched.\nLoad some mods and try again."),_("Existential Error")) return patchDialog = PatchDialog(self.window,fileInfo) patchDialog.ShowModal() self.window.RefreshUI(detail=fileName)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Sets version of file back to 0.8.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) self.fileInfo = window.data[data[0]] menuItem = wx.MenuItem(menu,self.id,_('Version 0.8')) menu.AppendItem(menuItem) menuItem.Enable((len(data) == 1) and (int(10*self.fileInfo.header.version) != 8)) def Execute(self,event): message = _("WARNING! For advanced modders only! This feature allows you to edit newer official mods in the TES Construction Set by resetting the internal file version number back to 0.8. While this will make the mod editable, it may also break the mod in some way.") if not balt.askContinue(self.window,message,'bash.setModVersion.continue',_('Set File Version')): return self.fileInfo.header.version = 0.8 self.fileInfo.header.setChanged() self.fileInfo.writeHeader() self.window.RefreshUI(detail=self.fileInfo.name)
"""Sets version of file back to 0.8.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) self.fileInfo = window.data[data[0]] menuItem = wx.MenuItem(menu,self.id,_('Version 0.8')) menu.AppendItem(menuItem) menuItem.Enable((len(data) == 1) and (int(10*self.fileInfo.header.version) != 8)) def Execute(self,event): message = _("WARNING! For advanced modders only! This feature allows you to edit newer official mods in the TES Construction Set by resetting the internal file version number back to 0.8. While this will make the mod editable, it may also break the mod in some way.") if not balt.askContinue(self.window,message,'bash.setModVersion.continue',_('Set File Version')): return self.fileInfo.header.version = 0.8 self.fileInfo.header.setChanged() self.fileInfo.writeHeader() self.window.RefreshUI(detail=self.fileInfo.name)
def __init__(self): """Initialize.""" self.column = 'rating' self.setKey = 'bash.mods.ratings' self.editMenu = _('Edit Ratings...') self.editWindow = _('Ratings') self.addPrompt = _('Add rating:') self.idList = ID_RATINGS Mod_Labels.__init__(self)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Show Mod Details""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) self.fileInfo = window.data[data[0]] menuItem = wx.MenuItem(menu,self.id,_('Details...')) menu.AppendItem(menuItem) menuItem.Enable((len(data) == 1)) def Execute(self,event): modName = GPath(self.data[0]) modInfo = bosh.modInfos[modName] progress = balt.Progress(_(modName.s)) try: modDetails = bosh.ModDetails() modDetails.readFromMod(modInfo,SubProgress(progress,0.1,0.7)) buff = cStringIO.StringIO() progress(0.7,_("Sorting records.")) for group in sorted(modDetails.group_records): buff.write(group+'\n') if group in ('CELL','WRLD','DIAL'): buff.write(_(' (Details not provided for this record type.)\n\n')) continue records = modDetails.group_records[group] records.sort(key = lambda a: a[1].lower()) for fid,eid in records: buff.write(' %08X %s\n' % (fid,eid)) buff.write('\n') balt.showLog(self.window,buff.getvalue(), modInfo.name.s, asDialog=False, fixedFont=True, icons=bashBlue) progress.Destroy() buff.close() finally: if progress: progress.Destroy()
"""Show Mod Details""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) self.fileInfo = window.data[data[0]] menuItem = wx.MenuItem(menu,self.id,_('Details...')) menu.AppendItem(menuItem) menuItem.Enable((len(data) == 1)) def Execute(self,event): modName = GPath(self.data[0]) modInfo = bosh.modInfos[modName] progress = balt.Progress(_(modName.s)) try: modDetails = bosh.ModDetails() modDetails.readFromMod(modInfo,SubProgress(progress,0.1,0.7)) buff = cStringIO.StringIO() progress(0.7,_("Sorting records.")) for group in sorted(modDetails.group_records): buff.write(group+'\n') if group in ('CELL','WRLD','DIAL'): buff.write(_(' (Details not provided for this record type.)\n\n')) continue records = modDetails.group_records[group] records.sort(key = lambda a: a[1].lower()) for fid,eid in records: buff.write(' %08X %s\n' % (fid,eid)) buff.write('\n') balt.showLog(self.window,buff.getvalue(), modInfo.name.s, asDialog=False, fixedFont=True, icons=bashBlue) progress.Destroy() buff.close() finally: if progress: progress.Destroy()
def Execute(self,event): message = _("WARNING! For advanced modders only! This feature allows you to edit newer official mods in the TES Construction Set by resetting the internal file version number back to 0.8. While this will make the mod editable, it may also break the mod in some way.") if not balt.askContinue(self.window,message,'bash.setModVersion.continue',_('Set File Version')): return self.fileInfo.header.version = 0.8 self.fileInfo.header.setChanged() self.fileInfo.writeHeader() #--Repopulate self.window.RefreshUI(detail=self.fileInfo.name)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Remove orphaned cell records.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Remove World Orphans')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): message = _("In some circumstances, editing a mod will leave orphaned cell records in the world group. This command will remove such orphans.") if not balt.askContinue(self.window,message,'bash.removeWorldOrphans.continue',_('Remove World Orphans')): return for item in self.data: fileName = GPath(item) if item == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Remove World Orphans')) continue fileInfo = bosh.modInfos[fileName] progress = balt.Progress(_("Remove World Orphans")) orphans = 0 try: loadFactory = bosh.LoadFactory(True,bosh.MreCell,bosh.MreWrld) modFile = bosh.ModFile(fileInfo,loadFactory) progress(0,_("Reading %s.") % (fileName.s,)) modFile.load(True,SubProgress(progress,0,0.7)) orphans = ('WRLD' in modFile.tops) and modFile.WRLD.orphansSkipped if orphans: progress(0.1,_("Saving %s.") % (fileName.s,)) modFile.safeSave() progress(1.0,_("Done.")) finally: progress = progress.Destroy() if orphans: balt.showOk(self.window,_("Orphan cell blocks removed: %d.") % (orphans,),fileName.s) else: balt.showOk(self.window,_("No changes required."),fileName.s)
"""Remove orphaned cell records.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Remove World Orphans')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): message = _("In some circumstances, editing a mod will leave orphaned cell records in the world group. This command will remove such orphans.") if not balt.askContinue(self.window,message,'bash.removeWorldOrphans.continue',_('Remove World Orphans')): return for item in self.data: fileName = GPath(item) if item == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Remove World Orphans')) continue fileInfo = bosh.modInfos[fileName] progress = balt.Progress(_("Remove World Orphans")) orphans = 0 try: loadFactory = bosh.LoadFactory(True,bosh.MreCell,bosh.MreWrld) modFile = bosh.ModFile(fileInfo,loadFactory) progress(0,_("Reading %s.") % (fileName.s,)) modFile.load(True,SubProgress(progress,0,0.7)) orphans = ('WRLD' in modFile.tops) and modFile.WRLD.orphansSkipped if orphans: progress(0.1,_("Saving %s.") % (fileName.s,)) modFile.safeSave() progress(1.0,_("Done.")) finally: progress = progress.Destroy() if orphans: balt.showOk(self.window,_("Orphan cell blocks removed: %d.") % (orphans,),fileName.s) else: balt.showOk(self.window,_("No changes required."),fileName.s)
def Execute(self,event): modName = GPath(self.data[0]) modInfo = bosh.modInfos[modName] progress = balt.Progress(_(modName.s)) try: modDetails = bosh.ModDetails() modDetails.readFromMod(modInfo,SubProgress(progress,0.1,0.7)) buff = cStringIO.StringIO() progress(0.7,_("Sorting records.")) for group in sorted(modDetails.group_records): buff.write(group+'\n') if group in ('CELL','WRLD','DIAL'): buff.write(_(' (Details not provided for this record type.)\n\n')) continue records = modDetails.group_records[group] records.sort(key = lambda a: a[1].lower()) #if group != 'GMST': records.sort(key = lambda a: a[0] >> 24) for fid,eid in records: buff.write(' %08X %s\n' % (fid,eid)) buff.write('\n') balt.showLog(self.window,buff.getvalue(), modInfo.name.s, asDialog=False, fixedFont=True, icons=bashBlue) progress.Destroy() buff.close() finally: if progress: progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Open the readme.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Readme...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] if not docBrowser: DocBrowser().Show() settings['bash.modDocs.show'] = True docBrowser.SetMod(fileInfo.name) docBrowser.Raise()
"""Open the readme.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Readme...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] if not docBrowser: DocBrowser().Show() settings['bash.modDocs.show'] = True docBrowser.SetMod(fileInfo.name) docBrowser.Raise()
def Execute(self,event): message = _("In some circumstances, editing a mod will leave orphaned cell records in the world group. This command will remove such orphans.") if not balt.askContinue(self.window,message,'bash.removeWorldOrphans.continue',_('Remove World Orphans')): return for item in self.data: fileName = GPath(item) if item == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Remove World Orphans')) continue fileInfo = bosh.modInfos[fileName] #--Export progress = balt.Progress(_("Remove World Orphans")) orphans = 0 try: loadFactory = bosh.LoadFactory(True,bosh.MreCell,bosh.MreWrld) modFile = bosh.ModFile(fileInfo,loadFactory) progress(0,_("Reading %s.") % (fileName.s,)) modFile.load(True,SubProgress(progress,0,0.7)) orphans = ('WRLD' in modFile.tops) and modFile.WRLD.orphansSkipped if orphans: progress(0.1,_("Saving %s.") % (fileName.s,)) modFile.safeSave() progress(1.0,_("Done.")) finally: progress = progress.Destroy() #--Log if orphans: balt.showOk(self.window,_("Orphan cell blocks removed: %d.") % (orphans,),fileName.s) else: balt.showOk(self.window,_("No changes required."),fileName.s)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export armor and weapon stats from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Stats...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Stats.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export stats to:'), textDir, textName, '*Stats.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Stats")) try: itemStats = bosh.ItemStats() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) itemStats.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) itemStats.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
"""Export armor and weapon stats from mod to text file.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Stats...')) menu.AppendItem(menuItem) menuItem.Enable(bool(self.data)) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Stats.csv') textDir = bosh.dirs['patches'] textDir.makedirs() textPath = balt.askSave(self.window,_('Export stats to:'), textDir, textName, '*Stats.csv') if not textPath: return (textDir,textName) = textPath.headTail progress = balt.Progress(_("Export Stats")) try: itemStats = bosh.ItemStats() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) itemStats.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) itemStats.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] if not docBrowser: DocBrowser().Show() settings['bash.modDocs.show'] = True #balt.ensureDisplayed(docBrowser) docBrowser.SetMod(fileInfo.name) docBrowser.Raise()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Import stats from text file or other mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Stats...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("Import item stats from a text file. This will replace existing stats and is not reversible!")) if not balt.askContinue(self.window,message,'bash.stats.import.continue', _('Import Stats')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Stats.csv') textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import stats from:'), textDir, textName, '*Stats.csv') if not textPath: return (textDir,textName) = textPath.headTail ext = textName.cext if ext != '.csv': balt.showError(self.window,_('Source file must be a Stats.csv file.')) return progress = balt.Progress(_("Import Stats")) changed = None try: itemStats = bosh.ItemStats() progress(0.1,_("Reading %s.") % (textName.s,)) if ext == '.csv': itemStats.readFromText(textPath) else: srcInfo = bosh.ModInfo(textDir,textName) itemStats.readFromMod(srcInfo) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = itemStats.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not changed: balt.showOk(self.window,_("No relevant stats to import."),_("Import Stats")) else: buff = cStringIO.StringIO() for modName in sorted(changed): buff.write('* %03d %s:\n' % (changed[modName], modName.s)) balt.showLog(self.window,buff.getvalue(),_('Import Stats'),icons=bashBlue)
"""Import stats from text file or other mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Stats...')) menu.AppendItem(menuItem) menuItem.Enable(len(self.data)==1) def Execute(self,event): message = (_("Import item stats from a text file. This will replace existing stats and is not reversible!")) if not balt.askContinue(self.window,message,'bash.stats.import.continue', _('Import Stats')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Stats.csv') textDir = bosh.dirs['patches'] textPath = balt.askOpen(self.window,_('Import stats from:'), textDir, textName, '*Stats.csv') if not textPath: return (textDir,textName) = textPath.headTail ext = textName.cext if ext != '.csv': balt.showError(self.window,_('Source file must be a Stats.csv file.')) return progress = balt.Progress(_("Import Stats")) changed = None try: itemStats = bosh.ItemStats() progress(0.1,_("Reading %s.") % (textName.s,)) if ext == '.csv': itemStats.readFromText(textPath) else: srcInfo = bosh.ModInfo(textDir,textName) itemStats.readFromMod(srcInfo) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = itemStats.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() if not changed: balt.showOk(self.window,_("No relevant stats to import."),_("Import Stats")) else: buff = cStringIO.StringIO() for modName in sorted(changed): buff.write('* %03d %s:\n' % (changed[modName], modName.s)) balt.showLog(self.window,buff.getvalue(),_('Import Stats'),icons=bashBlue)
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Stats.csv') textDir = bosh.dirs['patches'] textDir.makedirs() #--File dialog textPath = balt.askSave(self.window,_('Export stats to:'), textDir, textName, '*Stats.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Export progress = balt.Progress(_("Export Stats")) try: itemStats = bosh.ItemStats() readProgress = SubProgress(progress,0.1,0.8) readProgress.setFull(len(self.data)) for index,fileName in enumerate(map(GPath,self.data)): fileInfo = bosh.modInfos[fileName] readProgress(index,_("Reading %s.") % (fileName.s,)) itemStats.readFromMod(fileInfo) progress(0.8,_("Exporting to %s.") % (textName.s,)) itemStats.writeToText(textPath) progress(1.0,_("Done.")) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Undeletes refs in cells.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Undelete Refs')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): message = _("Changes deleted refs to ignored. This is a very advanced feature and should only be used by modders who know exactly what they're doing.") if not balt.askContinue(self.window,message,'bash.undeleteRefs.continue', _('Undelete Refs')): return progress = balt.Progress(_("Undelete Refs")) progress.setFull(len(self.data)) try: hasFixed = False log = bolt.LogFile(cStringIO.StringIO()) for index,fileName in enumerate(map(GPath,self.data)): if fileName == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Undelete Refs')) continue progress(index,_("Scanning %s.") % (fileName.s,)) fileInfo = bosh.modInfos[fileName] undeleteRefs = bosh.UndeleteRefs(fileInfo) undeleteRefs.undelete(SubProgress(progress,index,index+1)) if undeleteRefs.fixedRefs: hasFixed = True log.setHeader('==%s' % (fileName.s,)) for fid in sorted(undeleteRefs.fixedRefs): log('. %08X' % (fid,)) progress.Destroy() if hasFixed: message = log.out.getvalue() balt.showWryeLog(self.window,message,_('Undelete Refs'),icons=bashBlue) else: message = _("No changes required.") balt.showOk(self.window,message,_('Undelete Refs')) finally: progress = progress.Destroy()
"""Undeletes refs in cells.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Undelete Refs')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): message = _("Changes deleted refs to ignored. This is a very advanced feature and should only be used by modders who know exactly what they're doing.") if not balt.askContinue(self.window,message,'bash.undeleteRefs.continue', _('Undelete Refs')): return progress = balt.Progress(_("Undelete Refs")) progress.setFull(len(self.data)) try: hasFixed = False log = bolt.LogFile(cStringIO.StringIO()) for index,fileName in enumerate(map(GPath,self.data)): if fileName == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Undelete Refs')) continue progress(index,_("Scanning %s.") % (fileName.s,)) fileInfo = bosh.modInfos[fileName] undeleteRefs = bosh.UndeleteRefs(fileInfo) undeleteRefs.undelete(SubProgress(progress,index,index+1)) if undeleteRefs.fixedRefs: hasFixed = True log.setHeader('==%s' % (fileName.s,)) for fid in sorted(undeleteRefs.fixedRefs): log('. %08X' % (fid,)) progress.Destroy() if hasFixed: message = log.out.getvalue() balt.showWryeLog(self.window,message,_('Undelete Refs'),icons=bashBlue) else: message = _("No changes required.") balt.showOk(self.window,message,_('Undelete Refs')) finally: progress = progress.Destroy()
def Execute(self,event): message = (_("Import item stats from a text file. This will replace existing stats and is not reversible!")) if not balt.askContinue(self.window,message,'bash.stats.import.continue', _('Import Stats')): return fileName = GPath(self.data[0]) fileInfo = bosh.modInfos[fileName] textName = fileName.root+_('_Stats.csv') textDir = bosh.dirs['patches'] #--File dialog textPath = balt.askOpen(self.window,_('Import stats from:'), textDir, textName, '*Stats.csv') if not textPath: return (textDir,textName) = textPath.headTail #--Extension error check ext = textName.cext if ext != '.csv': balt.showError(self.window,_('Source file must be a Stats.csv file.')) return #--Export progress = balt.Progress(_("Import Stats")) changed = None try: itemStats = bosh.ItemStats() progress(0.1,_("Reading %s.") % (textName.s,)) if ext == '.csv': itemStats.readFromText(textPath) else: srcInfo = bosh.ModInfo(textDir,textName) itemStats.readFromMod(srcInfo) progress(0.2,_("Applying to %s.") % (fileName.s,)) changed = itemStats.writeToMod(fileInfo) progress(1.0,_("Done.")) finally: progress = progress.Destroy() #--Log if not changed: balt.showOk(self.window,_("No relevant stats to import."),_("Import Stats")) else: buff = cStringIO.StringIO() for modName in sorted(changed): buff.write('* %03d %s:\n' % (changed[modName], modName.s)) balt.showLog(self.window,buff.getvalue(),_('Import Stats'),icons=bashBlue)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Data capsule for save profiles editing dialog.""" def __init__(self,parent): """Initialize.""" self.baseSaves = bosh.dirs['saveBase'].join('Saves') balt.ListEditorData.__init__(self,parent) self.showAdd = True self.showRename = True self.showRemove = True self.showInfo = True self.infoWeight = 2 self.infoReadOnly = False def getItemList(self): """Returns load list keys in alpha order.""" items = [x.s for x in bosh.saveInfos.getLocalSaveDirs()] items.sort(key=lambda a: a.lower()) return items def getInfo(self,item): """Returns string info on specified item.""" profileSaves = 'Saves\\'+item+'\\' return bosh.saveInfos.profiles.getItem(profileSaves,'info',_('About %s:') % (item,)) def setInfo(self,item,text): """Sets string info on specified item.""" profileSaves = 'Saves\\'+item+'\\' bosh.saveInfos.profiles.setItem(profileSaves,'info',text) def add(self): """Adds a new profile.""" newName = balt.askText(self.parent,_("Enter profile name:")) if not newName: return False if newName in self.getItemList(): balt.showError(self.parent,_('Name must be unique.')) return False if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False self.baseSaves.join(newName).makedirs() newSaves = 'Saves\\'+newName+'\\' bosh.saveInfos.profiles.setItem(newSaves,'vFallout3',bosh.modInfos.voCurrent) return newName def rename(self,oldName,newName): """Renames profile oldName to newName.""" newName = newName.strip() lowerNames = [name.lower() for name in self.getItemList()] if newName.lower() in lowerNames: balt.showError(self,_('Name must be unique.')) return False if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False oldDir,newDir = (self.baseSaves.join(dir) for dir in (oldName,newName)) oldDir.moveTo(newDir) oldSaves,newSaves = (('Saves\\'+name+'\\') for name in (oldName,newName)) if bosh.saveInfos.localSave == oldSaves: bosh.saveInfos.setLocalSave(newSaves) bashFrame.SetTitle() bosh.saveInfos.profiles.moveRow(oldSaves,newSaves) return newName def remove(self,profile): """Removes load list.""" profileSaves = 'Saves\\'+profile+'\\' if bosh.saveInfos.localSave == profileSaves: balt.showError(self.parent,_('Active profile cannot be removed.')) return False profileDir = bosh.dirs['saveBase'].join(profileSaves) files = [file for file in profileDir.list() if bosh.reSaveExt.search(file.s)] if files: message = _('Delete profile %s and the %d save files it contains?') % (profile,len(files)) if not balt.askYes(self.parent,message,_('Delete Profile')): return False if GPath('Fallout3/Saves').s not in profileDir.s: raise BoltError(_('Sanity check failed: No "Fallout3\\Saves" in %s.') % (profileDir.s,)) shutil.rmtree(profileDir.s) bosh.saveInfos.profiles.delRow(profileSaves) return True
"""Data capsule for save profiles editing dialog.""" def __init__(self,parent): """Initialize.""" self.baseSaves = bosh.dirs['saveBase'].join('Saves') balt.ListEditorData.__init__(self,parent) self.showAdd = True self.showRename = True self.showRemove = True self.showInfo = True self.infoWeight = 2 self.infoReadOnly = False def getItemList(self): """Returns load list keys in alpha order.""" items = [x.s for x in bosh.saveInfos.getLocalSaveDirs()] items.sort(key=lambda a: a.lower()) return items def getInfo(self,item): """Returns string info on specified item.""" profileSaves = 'Saves\\'+item+'\\' return bosh.saveInfos.profiles.getItem(profileSaves,'info',_('About %s:') % (item,)) def setInfo(self,item,text): """Sets string info on specified item.""" profileSaves = 'Saves\\'+item+'\\' bosh.saveInfos.profiles.setItem(profileSaves,'info',text) def add(self): """Adds a new profile.""" newName = balt.askText(self.parent,_("Enter profile name:")) if not newName: return False if newName in self.getItemList(): balt.showError(self.parent,_('Name must be unique.')) return False if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False self.baseSaves.join(newName).makedirs() newSaves = 'Saves\\'+newName+'\\' bosh.saveInfos.profiles.setItem(newSaves,'vFallout3',bosh.modInfos.voCurrent) return newName def rename(self,oldName,newName): """Renames profile oldName to newName.""" newName = newName.strip() lowerNames = [name.lower() for name in self.getItemList()] if newName.lower() in lowerNames: balt.showError(self,_('Name must be unique.')) return False if len(newName) == 0 or len(newName) > 64: balt.showError(self.parent, _('Name must be between 1 and 64 characters long.')) return False oldDir,newDir = (self.baseSaves.join(dir) for dir in (oldName,newName)) oldDir.moveTo(newDir) oldSaves,newSaves = (('Saves\\'+name+'\\') for name in (oldName,newName)) if bosh.saveInfos.localSave == oldSaves: bosh.saveInfos.setLocalSave(newSaves) bashFrame.SetTitle() bosh.saveInfos.profiles.moveRow(oldSaves,newSaves) return newName def remove(self,profile): """Removes load list.""" profileSaves = 'Saves\\'+profile+'\\' if bosh.saveInfos.localSave == profileSaves: balt.showError(self.parent,_('Active profile cannot be removed.')) return False profileDir = bosh.dirs['saveBase'].join(profileSaves) files = [file for file in profileDir.list() if bosh.reSaveExt.search(file.s)] if files: message = _('Delete profile %s and the %d save files it contains?') % (profile,len(files)) if not balt.askYes(self.parent,message,_('Delete Profile')): return False if GPath('Fallout3/Saves').s not in profileDir.s: raise BoltError(_('Sanity check failed: No "Fallout3\\Saves" in %s.') % (profileDir.s,)) shutil.rmtree(profileDir.s) bosh.saveInfos.profiles.delRow(profileSaves) return True
def Execute(self,event): message = _("Changes deleted refs to ignored. This is a very advanced feature and should only be used by modders who know exactly what they're doing.") if not balt.askContinue(self.window,message,'bash.undeleteRefs.continue', _('Undelete Refs')): return progress = balt.Progress(_("Undelete Refs")) progress.setFull(len(self.data)) try: hasFixed = False log = bolt.LogFile(cStringIO.StringIO()) for index,fileName in enumerate(map(GPath,self.data)): if fileName == 'Fallout3.esm': balt.showWarning(self.window,_("Skipping %s") % fileName.s,_('Undelete Refs')) continue progress(index,_("Scanning %s.") % (fileName.s,)) fileInfo = bosh.modInfos[fileName] undeleteRefs = bosh.UndeleteRefs(fileInfo) undeleteRefs.undelete(SubProgress(progress,index,index+1)) if undeleteRefs.fixedRefs: hasFixed = True log.setHeader('==%s' % (fileName.s,)) for fid in sorted(undeleteRefs.fixedRefs): log('. %08X' % (fid,)) progress.Destroy() if hasFixed: message = log.out.getvalue() balt.showWryeLog(self.window,message,_('Undelete Refs'),icons=bashBlue) else: message = _("No changes required.") balt.showOk(self.window,message,_('Undelete Refs')) finally: progress = progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Select a save set profile -- i.e., the saves directory.""" def __init__(self): """Initialize.""" self.idList = ID_PROFILES def GetItems(self): return [x.s for x in bosh.saveInfos.getLocalSaveDirs()] def AppendToMenu(self,menu,window,data): """Append label list to menu.""" self.window = window menu.Append(self.idList.EDIT,_("Edit Profiles...")) menu.AppendSeparator() localSave = bosh.saveInfos.localSave menuItem = wx.MenuItem(menu,self.idList.DEFAULT,_('Default'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(localSave == 'Saves\\') for id,item in zip(self.idList,self.GetItems()): menuItem = wx.MenuItem(menu,id,item,kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(localSave == ('Saves\\'+item+'\\')) wx.EVT_MENU(window,self.idList.EDIT,self.DoEdit) wx.EVT_MENU(window,self.idList.DEFAULT,self.DoDefault) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoEdit(self,event): """Show profiles editing dialog.""" data = Saves_ProfilesData(self.window) dialog = balt.ListEditor(self.window,-1,_('Save Profiles'),data) dialog.ShowModal() dialog.Destroy() def DoDefault(self,event): """Handle selection of Default.""" arcSaves,newSaves = bosh.saveInfos.localSave,'Saves\\' bosh.saveInfos.setLocalSave(newSaves) self.swapPlugins(arcSaves,newSaves) self.swapFallout3Version(newSaves) bashFrame.SetTitle() self.window.details.SetFile(None) modList.RefreshUI() bashFrame.RefreshData() def DoList(self,event): """Handle selection of label.""" profile = self.GetItems()[event.GetId()-self.idList.BASE] arcSaves = bosh.saveInfos.localSave newSaves = 'Saves\\%s\\' % (profile,) bosh.saveInfos.setLocalSave(newSaves) self.swapPlugins(arcSaves,newSaves) self.swapFallout3Version(newSaves) bashFrame.SetTitle() self.window.details.SetFile(None) bashFrame.RefreshData() bosh.modInfos.autoGhost() modList.RefreshUI() def swapPlugins(self,arcSaves,newSaves): """Saves current plugins into arcSaves directory and loads plugins from newSaves directory (if present).""" arcPath,newPath = (bosh.dirs['saveBase'].join(saves,'plugins.txt') for saves in (arcSaves,newSaves)) bosh.modInfos.plugins.path.copyTo(arcPath) if newPath.exists(): newPath.copyTo(bosh.modInfos.plugins.path) def swapFallout3Version(self,newSaves): """Swaps Fallout3 version to memorized version.""" voNew = bosh.saveInfos.profiles.setItemDefault(newSaves,'vFallout3',bosh.modInfos.voCurrent) if voNew in bosh.modInfos.voAvailable: bosh.modInfos.setFallout3Version(voNew)
"""Select a save set profile -- i.e., the saves directory.""" def __init__(self): """Initialize.""" self.idList = ID_PROFILES def GetItems(self): return [x.s for x in bosh.saveInfos.getLocalSaveDirs()] def AppendToMenu(self,menu,window,data): """Append label list to menu.""" self.window = window menu.Append(self.idList.EDIT,_("Edit Profiles...")) menu.AppendSeparator() localSave = bosh.saveInfos.localSave menuItem = wx.MenuItem(menu,self.idList.DEFAULT,_('Default'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(localSave == 'Saves\\') for id,item in zip(self.idList,self.GetItems()): menuItem = wx.MenuItem(menu,id,item,kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Check(localSave == ('Saves\\'+item+'\\')) wx.EVT_MENU(window,self.idList.EDIT,self.DoEdit) wx.EVT_MENU(window,self.idList.DEFAULT,self.DoDefault) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoEdit(self,event): """Show profiles editing dialog.""" data = Saves_ProfilesData(self.window) dialog = balt.ListEditor(self.window,-1,_('Save Profiles'),data) dialog.ShowModal() dialog.Destroy() def DoDefault(self,event): """Handle selection of Default.""" arcSaves,newSaves = bosh.saveInfos.localSave,'Saves\\' bosh.saveInfos.setLocalSave(newSaves) self.swapPlugins(arcSaves,newSaves) self.swapFallout3Version(newSaves) bashFrame.SetTitle() self.window.details.SetFile(None) modList.RefreshUI() bashFrame.RefreshData() def DoList(self,event): """Handle selection of label.""" profile = self.GetItems()[event.GetId()-self.idList.BASE] arcSaves = bosh.saveInfos.localSave newSaves = 'Saves\\%s\\' % (profile,) bosh.saveInfos.setLocalSave(newSaves) self.swapPlugins(arcSaves,newSaves) self.swapFallout3Version(newSaves) bashFrame.SetTitle() self.window.details.SetFile(None) bashFrame.RefreshData() bosh.modInfos.autoGhost() modList.RefreshUI() def swapPlugins(self,arcSaves,newSaves): """Saves current plugins into arcSaves directory and loads plugins from newSaves directory (if present).""" arcPath,newPath = (bosh.dirs['saveBase'].join(saves,'plugins.txt') for saves in (arcSaves,newSaves)) bosh.modInfos.plugins.path.copyTo(arcPath) if newPath.exists(): newPath.copyTo(bosh.modInfos.plugins.path) def swapFallout3Version(self,newSaves): """Swaps Fallout3 version to memorized version.""" voNew = bosh.saveInfos.profiles.setItemDefault(newSaves,'vFallout3',bosh.modInfos.voCurrent) if voNew in bosh.modInfos.voAvailable: bosh.modInfos.setFallout3Version(voNew)
def remove(self,profile): """Removes load list.""" profileSaves = 'Saves\\'+profile+'\\' #--Can't remove active or Default directory. if bosh.saveInfos.localSave == profileSaves: balt.showError(self.parent,_('Active profile cannot be removed.')) return False #--Get file count. If > zero, verify with user. profileDir = bosh.dirs['saveBase'].join(profileSaves) files = [file for file in profileDir.list() if bosh.reSaveExt.search(file.s)] if files: message = _('Delete profile %s and the %d save files it contains?') % (profile,len(files)) if not balt.askYes(self.parent,message,_('Delete Profile')): return False #--Remove directory if GPath('Fallout3/Saves').s not in profileDir.s: raise BoltError(_('Sanity check failed: No "Fallout3\\Saves" in %s.') % (profileDir.s,)) shutil.rmtree(profileDir.s) #--DO NOT SCREW THIS UP!!! bosh.saveInfos.profiles.delRow(profileSaves) return True
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Sets the load list to the save game's masters.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Load Masters')) menu.AppendItem(menuItem) if len(data) != 1: menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] errorMessage = bosh.modInfos.selectExact(fileInfo.masterNames) modList.PopulateItems() saveList.PopulateItems() self.window.details.SetFile(fileName) if errorMessage: balt.showError(self.window,errorMessage,fileName.s)
"""Sets the load list to the save game's masters.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Load Masters')) menu.AppendItem(menuItem) if len(data) != 1: menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] errorMessage = bosh.modInfos.selectExact(fileInfo.masterNames) modList.PopulateItems() saveList.PopulateItems() self.window.details.SetFile(fileName) if errorMessage: balt.showError(self.window,errorMessage,fileName.s)
def swapFallout3Version(self,newSaves): """Swaps Fallout3 version to memorized version.""" voNew = bosh.saveInfos.profiles.setItemDefault(newSaves,'vFallout3',bosh.modInfos.voCurrent) if voNew in bosh.modInfos.voAvailable: bosh.modInfos.setFallout3Version(voNew)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Imports a face from another save.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Import Face...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] srcDir = fileInfo.dir wildcard = _('Fallout3 Files')+' (*.esp;*.esm;*.fos;*.for)|*.esp;*.esm;*.fos;*.for' srcPath = balt.askOpen(self.window,'Face Source:',srcDir, '', wildcard) if not srcPath: return if bosh.reSaveExt.search(srcPath.s): self.FromSave(fileInfo,srcPath) elif bosh.reModExt.search(srcPath.s): self.FromMod(fileInfo,srcPath) def FromSave(self,fileInfo,srcPath): """Import from a save.""" srcDir,srcName = GPath(srcPath).headTail srcInfo = bosh.SaveInfo(srcDir,srcName) progress = balt.Progress(srcName.s) try: saveFile = bosh.SaveFile(srcInfo) saveFile.load(progress) progress.Destroy() srcFaces = bosh.PCFaces.save_getFaces(saveFile) dialog = ImportFaceDialog(self.window,-1,srcName.s,fileInfo,srcFaces) dialog.ShowModal() dialog.Destroy() finally: if progress: progress.Destroy() def FromMod(self,fileInfo,srcPath): """Import from a mod.""" srcDir,srcName = GPath(srcPath).headTail srcInfo = bosh.ModInfo(srcDir,srcName) srcFaces = bosh.PCFaces.mod_getFaces(srcInfo) if not srcFaces: balt.showOk(self.window,_('No player (PC) faces found in %s.') % (srcName.s,),srcName.s) return dialog = ImportFaceDialog(self.window,-1,srcName.s,fileInfo,srcFaces) dialog.ShowModal() dialog.Destroy()
"""Imports a face from another save.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Import Face...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] srcDir = fileInfo.dir wildcard = _('Fallout3 Files')+' (*.esp;*.esm;*.fos;*.for)|*.esp;*.esm;*.fos;*.for' srcPath = balt.askOpen(self.window,'Face Source:',srcDir, '', wildcard) if not srcPath: return if bosh.reSaveExt.search(srcPath.s): self.FromSave(fileInfo,srcPath) elif bosh.reModExt.search(srcPath.s): self.FromMod(fileInfo,srcPath) def FromSave(self,fileInfo,srcPath): """Import from a save.""" srcDir,srcName = GPath(srcPath).headTail srcInfo = bosh.SaveInfo(srcDir,srcName) progress = balt.Progress(srcName.s) try: saveFile = bosh.SaveFile(srcInfo) saveFile.load(progress) progress.Destroy() srcFaces = bosh.PCFaces.save_getFaces(saveFile) dialog = ImportFaceDialog(self.window,-1,srcName.s,fileInfo,srcFaces) dialog.ShowModal() dialog.Destroy() finally: if progress: progress.Destroy() def FromMod(self,fileInfo,srcPath): """Import from a mod.""" srcDir,srcName = GPath(srcPath).headTail srcInfo = bosh.ModInfo(srcDir,srcName) srcFaces = bosh.PCFaces.mod_getFaces(srcInfo) if not srcFaces: balt.showOk(self.window,_('No player (PC) faces found in %s.') % (srcName.s,),srcName.s) return dialog = ImportFaceDialog(self.window,-1,srcName.s,fileInfo,srcFaces) dialog.ShowModal() dialog.Destroy()
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] errorMessage = bosh.modInfos.selectExact(fileInfo.masterNames) modList.PopulateItems() saveList.PopulateItems() self.window.details.SetFile(fileName) if errorMessage: balt.showError(self.window,errorMessage,fileName.s)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Shows how saves masters differ from active mod list.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Diff Masters...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) in (1,2)) def Execute(self,event): oldNew = map(GPath,self.data) oldNew.sort(key = lambda x: bosh.saveInfos.dir.join(x).mtime) oldName = oldNew[0] oldInfo = self.window.data[GPath(oldName)] oldMasters = set(oldInfo.masterNames) if len(self.data) == 1: newName = GPath(_("Active Masters")) newMasters = set(bosh.modInfos.ordered) else: newName = oldNew[1] newInfo = self.window.data[GPath(newName)] newMasters = set(newInfo.masterNames) missing = oldMasters - newMasters extra = newMasters - oldMasters if not missing and not extra: message = _("Masters are the same.") balt.showInfo(self.window,message,_("Diff Masters")) else: message = '' if missing: message += _("=== Removed Masters (%s):\n* ") % (oldName.s,) message += '\n* '.join(x.s for x in bosh.modInfos.getOrdered(missing)) if extra: message += '\n\n' if extra: message += _("=== Added Masters (%s):\n* ") % (newName.s,) message += '\n* '.join(x.s for x in bosh.modInfos.getOrdered(extra)) balt.showWryeLog(self.window,message,_("Diff Masters"))
"""Shows how saves masters differ from active mod list.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Diff Masters...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) in (1,2)) def Execute(self,event): oldNew = map(GPath,self.data) oldNew.sort(key = lambda x: bosh.saveInfos.dir.join(x).mtime) oldName = oldNew[0] oldInfo = self.window.data[GPath(oldName)] oldMasters = set(oldInfo.masterNames) if len(self.data) == 1: newName = GPath(_("Active Masters")) newMasters = set(bosh.modInfos.ordered) else: newName = oldNew[1] newInfo = self.window.data[GPath(newName)] newMasters = set(newInfo.masterNames) missing = oldMasters - newMasters extra = newMasters - oldMasters if not missing and not extra: message = _("Masters are the same.") balt.showInfo(self.window,message,_("Diff Masters")) else: message = '' if missing: message += _("=== Removed Masters (%s):\n* ") % (oldName.s,) message += '\n* '.join(x.s for x in bosh.modInfos.getOrdered(missing)) if extra: message += '\n\n' if extra: message += _("=== Added Masters (%s):\n* ") % (newName.s,) message += '\n* '.join(x.s for x in bosh.modInfos.getOrdered(extra)) balt.showWryeLog(self.window,message,_("Diff Masters"))
def FromMod(self,fileInfo,srcPath): """Import from a mod.""" #--Get faces srcDir,srcName = GPath(srcPath).headTail srcInfo = bosh.ModInfo(srcDir,srcName) srcFaces = bosh.PCFaces.mod_getFaces(srcInfo) #--No faces to import? if not srcFaces: balt.showOk(self.window,_('No player (PC) faces found in %s.') % (srcName.s,),srcName.s) return #--Dialog dialog = ImportFaceDialog(self.window,-1,srcName.s,fileInfo,srcFaces) dialog.ShowModal() dialog.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Data capsule for custom item editing dialog.""" def __init__(self,parent,saveFile,recordTypes): """Initialize.""" self.changed = False self.saveFile = saveFile data = self.data = {} self.enchantments = {} for index,record in enumerate(saveFile.created): if record.recType == 'ENCH': self.enchantments[record.fid] = record.getTypeCopy() elif record.recType in recordTypes: record = record.getTypeCopy() if not record.full: continue record.getSize() saveFile.created[index] = record if record.full not in data: data[record.full] = (record.full,[]) data[record.full][1].append(record) balt.ListEditorData.__init__(self,parent) self.showRename = True self.showInfo = True self.showSave = True self.showCancel = True def getItemList(self): """Returns load list keys in alpha order.""" items = sorted(self.data.keys()) items.sort(key=lambda x: self.data[x][1][0].recType) return items def getInfo(self,item): """Returns string info on specified item.""" buff = cStringIO.StringIO() name,records = self.data[item] record = records[0] if record.recType == 'ARMO': buff.write(_('Armor\nFlags: ')) buff.write(', '.join(record.flags.getTrueAttrs())+'\n') for attr in ('strength','value','weight'): buff.write('%s: %s\n' % (attr,getattr(record,attr))) elif record.recType == 'CLOT': buff.write(_('Clothing\nFlags: ')) buff.write(', '.join(record.flags.getTrueAttrs())+'\n') elif record.recType == 'WEAP': buff.write(bush.weaponTypes[record.weaponType]+'\n') for attr in ('damage','value','speed','reach','weight'): buff.write('%s: %s\n' % (attr,getattr(record,attr))) if hasattr(record,'enchantment') and record.enchantment in self.enchantments: buff.write('\nEnchantment:\n') record = self.enchantments[record.enchantment].getTypeCopy() if record.recType in ('ALCH','SPEL','ENCH'): buff.write(record.getEffectsSummary()) return buff.getvalue() def rename(self,oldName,newName): """Renames oldName to newName.""" if len(newName) == 0: return False elif len(newName) > 128: balt.showError(self.parent,_('Name is too long.')) return False elif newName in self.data: balt.showError(self.parent,_("Name is already used.")) return False self.data[newName] = self.data.pop(oldName) self.changed = True return newName def save(self): """Handles save button.""" if not self.changed: balt.showOk(self.parent,_("No changes made.")) else: self.changed = False count = 0 for newName,(oldName,records) in self.data.items(): if newName == oldName: continue for record in records: record.full = newName record.setChanged() record.getSize() count += 1 self.saveFile.safeSave() balt.showOk(self.parent, _("Names modified: %d.") % (count,),self.saveFile.fileInfo.name.s)
"""Data capsule for custom item editing dialog.""" def __init__(self,parent,saveFile,recordTypes): """Initialize.""" self.changed = False self.saveFile = saveFile data = self.data = {} self.enchantments = {} for index,record in enumerate(saveFile.created): if record.recType == 'ENCH': self.enchantments[record.fid] = record.getTypeCopy() elif record.recType in recordTypes: record = record.getTypeCopy() if not record.full: continue record.getSize() saveFile.created[index] = record if record.full not in data: data[record.full] = (record.full,[]) data[record.full][1].append(record) balt.ListEditorData.__init__(self,parent) self.showRename = True self.showInfo = True self.showSave = True self.showCancel = True def getItemList(self): """Returns load list keys in alpha order.""" items = sorted(self.data.keys()) items.sort(key=lambda x: self.data[x][1][0].recType) return items def getInfo(self,item): """Returns string info on specified item.""" buff = cStringIO.StringIO() name,records = self.data[item] record = records[0] if record.recType == 'ARMO': buff.write(_('Armor\nFlags: ')) buff.write(', '.join(record.flags.getTrueAttrs())+'\n') for attr in ('strength','value','weight'): buff.write('%s: %s\n' % (attr,getattr(record,attr))) elif record.recType == 'CLOT': buff.write(_('Clothing\nFlags: ')) buff.write(', '.join(record.flags.getTrueAttrs())+'\n') elif record.recType == 'WEAP': buff.write(bush.weaponTypes[record.weaponType]+'\n') for attr in ('damage','value','speed','reach','weight'): buff.write('%s: %s\n' % (attr,getattr(record,attr))) if hasattr(record,'enchantment') and record.enchantment in self.enchantments: buff.write('\nEnchantment:\n') record = self.enchantments[record.enchantment].getTypeCopy() if record.recType in ('ALCH','SPEL','ENCH'): buff.write(record.getEffectsSummary()) return buff.getvalue() def rename(self,oldName,newName): """Renames oldName to newName.""" if len(newName) == 0: return False elif len(newName) > 128: balt.showError(self.parent,_('Name is too long.')) return False elif newName in self.data: balt.showError(self.parent,_("Name is already used.")) return False self.data[newName] = self.data.pop(oldName) self.changed = True return newName def save(self): """Handles save button.""" if not self.changed: balt.showOk(self.parent,_("No changes made.")) else: self.changed = False count = 0 for newName,(oldName,records) in self.data.items(): if newName == oldName: continue for record in records: record.full = newName record.setChanged() record.getSize() count += 1 self.saveFile.safeSave() balt.showOk(self.parent, _("Names modified: %d.") % (count,),self.saveFile.fileInfo.name.s)
def Execute(self,event): oldNew = map(GPath,self.data) oldNew.sort(key = lambda x: bosh.saveInfos.dir.join(x).mtime) oldName = oldNew[0] oldInfo = self.window.data[GPath(oldName)] oldMasters = set(oldInfo.masterNames) if len(self.data) == 1: newName = GPath(_("Active Masters")) newMasters = set(bosh.modInfos.ordered) else: newName = oldNew[1] newInfo = self.window.data[GPath(newName)] newMasters = set(newInfo.masterNames) missing = oldMasters - newMasters extra = newMasters - oldMasters if not missing and not extra: message = _("Masters are the same.") balt.showInfo(self.window,message,_("Diff Masters")) else: message = '' if missing: message += _("=== Removed Masters (%s):\n* ") % (oldName.s,) message += '\n* '.join(x.s for x in bosh.modInfos.getOrdered(missing)) if extra: message += '\n\n' if extra: message += _("=== Added Masters (%s):\n* ") % (newName.s,) message += '\n* '.join(x.s for x in bosh.modInfos.getOrdered(extra)) balt.showWryeLog(self.window,message,_("Diff Masters"))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Allows user to rename custom items (spells, enchantments, etc.""" menuNames = {'ENCH':_('Rename Enchanted...'),'SPEL':_('Rename Spells...'),'ALCH':_('Rename Potions...')} recordTypes = {'ENCH':('ARMO','CLOT','WEAP')} def __init__(self,type): if type not in Save_EditCreated.menuNames: raise ArgumentError Link.__init__(self) self.type = type self.menuName = Save_EditCreated.menuNames[self.type] def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id, self.menuName) menu.AppendItem(menuItem) if len(data) != 1: menuItem.Enable(False) def Execute(self,event): """Handle menu selection.""" fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] progress = balt.Progress(_("Loading...")) try: saveFile = bosh.SaveFile(fileInfo) saveFile.load(progress) finally: if progress: progress.Destroy() recordTypes = Save_EditCreated.recordTypes.get(self.type,(self.type,)) records = [record for record in saveFile.created if record.recType in recordTypes] if not records: balt.showOk(self.window,_('No items to edit.')) return data = Save_EditCreatedData(self.window,saveFile,recordTypes) dialog = balt.ListEditor(self.window,-1,self.menuName,data) dialog.ShowModal() dialog.Destroy()
"""Allows user to rename custom items (spells, enchantments, etc.""" menuNames = {'ENCH':_('Rename Enchanted...'),'SPEL':_('Rename Spells...'),'ALCH':_('Rename Potions...')} recordTypes = {'ENCH':('ARMO','CLOT','WEAP')} def __init__(self,type): if type not in Save_EditCreated.menuNames: raise ArgumentError Link.__init__(self) self.type = type self.menuName = Save_EditCreated.menuNames[self.type] def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id, self.menuName) menu.AppendItem(menuItem) if len(data) != 1: menuItem.Enable(False) def Execute(self,event): """Handle menu selection.""" fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] progress = balt.Progress(_("Loading...")) try: saveFile = bosh.SaveFile(fileInfo) saveFile.load(progress) finally: if progress: progress.Destroy() recordTypes = Save_EditCreated.recordTypes.get(self.type,(self.type,)) records = [record for record in saveFile.created if record.recType in recordTypes] if not records: balt.showOk(self.window,_('No items to edit.')) return data = Save_EditCreatedData(self.window,saveFile,recordTypes) dialog = balt.ListEditor(self.window,-1,self.menuName,data) dialog.ShowModal() dialog.Destroy()
def save(self): """Handles save button.""" if not self.changed: balt.showOk(self.parent,_("No changes made.")) else: self.changed = False #--Allows graceful effort if close fails. count = 0 for newName,(oldName,records) in self.data.items(): if newName == oldName: continue for record in records: record.full = newName record.setChanged() record.getSize() count += 1 self.saveFile.safeSave() balt.showOk(self.parent, _("Names modified: %d.") % (count,),self.saveFile.fileInfo.name.s)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Data capsule for pc spell editing dialog.""" def __init__(self,parent,saveInfo): """Initialize.""" self.saveSpells = bosh.SaveSpells(saveInfo) progress = balt.Progress(_('Loading Masters')) try: self.saveSpells.load(progress) finally: progress = progress.Destroy() self.data = self.saveSpells.getPlayerSpells() self.removed = set() balt.ListEditorData.__init__(self,parent) self.showRemove = True self.showInfo = True self.showSave = True self.showCancel = True def getItemList(self): """Returns load list keys in alpha order.""" return sorted(self.data.keys(),key=lambda a: a.lower()) def getInfo(self,item): """Returns string info on specified item.""" iref,record = self.data[item] return record.getEffectsSummary() def remove(self,item): """Removes item. Return true on success.""" if not item in self.data: return False iref,record = self.data[item] self.removed.add(iref) del self.data[item] return True def save(self): """Handles save button click.""" self.saveSpells.removePlayerSpells(self.removed)
"""Data capsule for pc spell editing dialog.""" def __init__(self,parent,saveInfo): """Initialize.""" self.saveSpells = bosh.SaveSpells(saveInfo) progress = balt.Progress(_('Loading Masters')) try: self.saveSpells.load(progress) finally: progress = progress.Destroy() self.data = self.saveSpells.getPlayerSpells() self.removed = set() balt.ListEditorData.__init__(self,parent) self.showRemove = True self.showInfo = True self.showSave = True self.showCancel = True def getItemList(self): """Returns load list keys in alpha order.""" return sorted(self.data.keys(),key=lambda a: a.lower()) def getInfo(self,item): """Returns string info on specified item.""" iref,record = self.data[item] return record.getEffectsSummary() def remove(self,item): """Removes item. Return true on success.""" if not item in self.data: return False iref,record = self.data[item] self.removed.add(iref) del self.data[item] return True def save(self): """Handles save button click.""" self.saveSpells.removePlayerSpells(self.removed)
def Execute(self,event): """Handle menu selection.""" #--Get save info for file fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] #--Get SaveFile progress = balt.Progress(_("Loading...")) try: saveFile = bosh.SaveFile(fileInfo) saveFile.load(progress) finally: if progress: progress.Destroy() #--No custom items? recordTypes = Save_EditCreated.recordTypes.get(self.type,(self.type,)) records = [record for record in saveFile.created if record.recType in recordTypes] if not records: balt.showOk(self.window,_('No items to edit.')) return #--Open editor dialog data = Save_EditCreatedData(self.window,saveFile,recordTypes) dialog = balt.ListEditor(self.window,-1,self.menuName,data) dialog.ShowModal() dialog.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Save spell list editing dialog.""" def AppendToMenu(self,menu,window,data): """Append ref replacer items to menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Delete Spells...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] data = Save_EditPCSpellsData(self.window,fileInfo) dialog = balt.ListEditor(self.window,-1,_('Player Spells'),data) dialog.ShowModal() dialog.Destroy()
"""Save spell list editing dialog.""" def AppendToMenu(self,menu,window,data): """Append ref replacer items to menu.""" Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Delete Spells...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] data = Save_EditPCSpellsData(self.window,fileInfo) dialog = balt.ListEditor(self.window,-1,_('Player Spells'),data) dialog.ShowModal() dialog.Destroy()
def save(self): """Handles save button click.""" self.saveSpells.removePlayerSpells(self.removed)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Moves or copies selected files to alternate profile.""" def __init__(self,copyMode=False): """Initialize.""" self.idList = ID_PROFILES self.copyMode = copyMode def GetItems(self): return [x.s for x in bosh.saveInfos.getLocalSaveDirs()] def AppendToMenu(self,menu,window,data): """Append label list to menu.""" self.window = window self.data = data localSave = bosh.saveInfos.localSave menuItem = wx.MenuItem(menu,self.idList.DEFAULT,_('Default'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Enable(localSave != 'Saves\\') menuItem.Enable(bool(data)) for id,item in zip(self.idList,self.GetItems()): menuItem = wx.MenuItem(menu,id,item,kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Enable(localSave != ('Saves\\'+item+'\\')) wx.EVT_MENU(window,self.idList.DEFAULT,self.DoDefault) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoDefault(self,event): """Handle selection of Default.""" self.MoveFiles(_('Default')) def DoList(self,event): """Handle selection of label.""" profile = self.GetItems()[event.GetId()-self.idList.BASE] self.MoveFiles(profile) def MoveFiles(self,profile): fileInfos = self.window.data destDir = bosh.dirs['saveBase'].join('Saves') if profile != _('Default'): destDir = destDir.join(profile) if destDir == fileInfos.dir: balt.showError(self.window,_("You can't move saves to the current profile!")) return savesTable = bosh.saveInfos.table destTable = bolt.Table(bosh.PickleDict(destDir.join('Bash','Table.dat'))) count = 0 for fileName in self.data: if not self.window.data.moveIsSafe(fileName,destDir): message = (_('A file named %s already exists in %s. Overwrite it?') % (fileName.s,profile)) if not balt.askYes(self.window,message,_('Move File')): continue if self.copyMode: bosh.saveInfos.copy(fileName,destDir) else: bosh.saveInfos.move(fileName,destDir,False) if fileName in savesTable: destTable[fileName] = savesTable.pop(fileName) count += 1 destTable.save() bashFrame.RefreshData() if self.copyMode: balt.showInfo(self.window,_('%d files copied to %s.') % (count,profile),_('Copy File'))
"""Moves or copies selected files to alternate profile.""" def __init__(self,copyMode=False): """Initialize.""" self.idList = ID_PROFILES self.copyMode = copyMode def GetItems(self): return [x.s for x in bosh.saveInfos.getLocalSaveDirs()] def AppendToMenu(self,menu,window,data): """Append label list to menu.""" self.window = window self.data = data localSave = bosh.saveInfos.localSave menuItem = wx.MenuItem(menu,self.idList.DEFAULT,_('Default'),kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Enable(localSave != 'Saves\\') menuItem.Enable(bool(data)) for id,item in zip(self.idList,self.GetItems()): menuItem = wx.MenuItem(menu,id,item,kind=wx.ITEM_CHECK) menu.AppendItem(menuItem) menuItem.Enable(localSave != ('Saves\\'+item+'\\')) wx.EVT_MENU(window,self.idList.DEFAULT,self.DoDefault) wx.EVT_MENU_RANGE(window,self.idList.BASE,self.idList.MAX,self.DoList) def DoDefault(self,event): """Handle selection of Default.""" self.MoveFiles(_('Default')) def DoList(self,event): """Handle selection of label.""" profile = self.GetItems()[event.GetId()-self.idList.BASE] self.MoveFiles(profile) def MoveFiles(self,profile): fileInfos = self.window.data destDir = bosh.dirs['saveBase'].join('Saves') if profile != _('Default'): destDir = destDir.join(profile) if destDir == fileInfos.dir: balt.showError(self.window,_("You can't move saves to the current profile!")) return savesTable = bosh.saveInfos.table destTable = bolt.Table(bosh.PickleDict(destDir.join('Bash','Table.dat'))) count = 0 for fileName in self.data: if not self.window.data.moveIsSafe(fileName,destDir): message = (_('A file named %s already exists in %s. Overwrite it?') % (fileName.s,profile)) if not balt.askYes(self.window,message,_('Move File')): continue if self.copyMode: bosh.saveInfos.copy(fileName,destDir) else: bosh.saveInfos.move(fileName,destDir,False) if fileName in savesTable: destTable[fileName] = savesTable.pop(fileName) count += 1 destTable.save() bashFrame.RefreshData() if self.copyMode: balt.showInfo(self.window,_('%d files copied to %s.') % (count,profile),_('Copy File'))
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] data = Save_EditPCSpellsData(self.window,fileInfo) dialog = balt.ListEditor(self.window,-1,_('Player Spells'),data) dialog.ShowModal() dialog.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Repairs animation slowing by resetting counter(?) at end of TesClass data.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Repair Abomb')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] saveFile = bosh.SaveFile(fileInfo) saveFile.load() (tcSize,abombCounter,abombFloat) = saveFile.getAbomb() progress = 100*abombFloat/struct.unpack('f',struct.pack('I',0x49000000))[0] newCounter = 0x41000000 if abombCounter <= newCounter: balt.showOk(self.window,_('Abomb counter is too low to reset.'),_('Repair Abomb')) return message = _("Reset Abomb counter? (Current progress: %.0f%%.)\n\nNote: Abomb animation slowing won't occur until progress is near 100%%.") % (progress,) if balt.askYes(self.window,message,_('Repair Abomb'),default=False): saveFile.setAbomb(newCounter) saveFile.safeSave() balt.showOk(self.window,_('Abomb counter reset.'),_('Repair Abomb'))
"""Repairs animation slowing by resetting counter(?) at end of TesClass data.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Repair Abomb')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] saveFile = bosh.SaveFile(fileInfo) saveFile.load() (tcSize,abombCounter,abombFloat) = saveFile.getAbomb() progress = 100*abombFloat/struct.unpack('f',struct.pack('I',0x49000000))[0] newCounter = 0x41000000 if abombCounter <= newCounter: balt.showOk(self.window,_('Abomb counter is too low to reset.'),_('Repair Abomb')) return message = _("Reset Abomb counter? (Current progress: %.0f%%.)\n\nNote: Abomb animation slowing won't occur until progress is near 100%%.") % (progress,) if balt.askYes(self.window,message,_('Repair Abomb'),default=False): saveFile.setAbomb(newCounter) saveFile.safeSave() balt.showOk(self.window,_('Abomb counter reset.'),_('Repair Abomb'))
def MoveFiles(self,profile): fileInfos = self.window.data destDir = bosh.dirs['saveBase'].join('Saves') if profile != _('Default'): destDir = destDir.join(profile) if destDir == fileInfos.dir: balt.showError(self.window,_("You can't move saves to the current profile!")) return savesTable = bosh.saveInfos.table #--bashDir destTable = bolt.Table(bosh.PickleDict(destDir.join('Bash','Table.dat'))) count = 0 for fileName in self.data: if not self.window.data.moveIsSafe(fileName,destDir): message = (_('A file named %s already exists in %s. Overwrite it?') % (fileName.s,profile)) if not balt.askYes(self.window,message,_('Move File')): continue if self.copyMode: bosh.saveInfos.copy(fileName,destDir) else: bosh.saveInfos.move(fileName,destDir,False) if fileName in savesTable: destTable[fileName] = savesTable.pop(fileName) count += 1 destTable.save() bashFrame.RefreshData() if self.copyMode: balt.showInfo(self.window,_('%d files copied to %s.') % (count,profile),_('Copy File'))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Repair factions from v 105 Bash error, plus mod faction changes.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Repair Factions')) menu.AppendItem(menuItem) menuItem.Enable(bool(bosh.modInfos.ordered) and len(data) == 1) def Execute(self,event): debug = False message = _('This will (mostly) repair faction membership errors due to Wrye Bash v 105 bug and/or faction changes in underlying mods.\n\nWARNING! This repair is NOT perfect! Do not use it unless you have to!') if not balt.askContinue(self.window,message,'bash.repairFactions.continue',_('Update NPC Levels')): return question = _("Restore dropped factions too? WARNING: This may involve clicking through a LOT of yes/no dialogs.") restoreDropped = balt.askYes(self.window, question, _('Repair Factions'),default=False) progress = balt.Progress(_('Repair Factions')) legitNullSpells = bush.repairFactions_legitNullSpells legitNullFactions = bush.repairFactions_legitNullFactions legitDroppedFactions = bush.repairFactions_legitDroppedFactions try: log = bolt.LogFile(cStringIO.StringIO()) offsetFlag = 0x80 npc_info = {} fact_eid = {} loadFactory = bosh.LoadFactory(False,bosh.MreNpc,bosh.MreFact) ordered = list(bosh.modInfos.ordered) subProgress = SubProgress(progress,0,0.4,len(ordered)) for index,modName in enumerate(ordered): subProgress(index,_("Scanning ") + modName.s) modInfo = bosh.modInfos[modName] modFile = bosh.ModFile(modInfo,loadFactory) modFile.load(True) mapToOrdered = bosh.MasterMap(modFile.tes4.masters+[modName], ordered) for npc in modFile.NPC_.getActiveRecords(): fid = mapToOrdered(npc.fid,None) if not fid: continue factions = [] for entry in npc.factions: faction = mapToOrdered(entry.faction,None) if not faction: continue factions.append((faction,entry.rank)) npc_info[fid] = (npc.eid,factions) for fact in modFile.FACT.getActiveRecords(): fid = mapToOrdered(fact.fid,None) if not fid: continue fact_eid[fid] = fact.eid subProgress = SubProgress(progress,0.4,1.0,len(self.data)) message = _("NPC Factions Restored/UnNulled:") for index,saveName in enumerate(self.data): log.setHeader('== '+saveName.s,True) subProgress(index,_("Updating ") + saveName.s) saveInfo = self.window.data[saveName] saveFile = bosh.SaveFile(saveInfo) saveFile.load() records = saveFile.records mapToOrdered = bosh.MasterMap(saveFile.masters, ordered) mapToSave = bosh.MasterMap(ordered,saveFile.masters) refactionedCount = unNulledCount = 0 for recNum in xrange(len(records)): unFactioned = unSpelled = unModified = refactioned = False (recId,recType,recFlags,version,data) = records[recNum] if recType != 35: continue orderedRecId = mapToOrdered(recId,None) eid = npc_info.get(orderedRecId,('',))[0] npc = bosh.SreNPC(recFlags,data) recFlags = bosh.SreNPC.flags(recFlags) if recFlags.factions and not npc.factions and recId not in legitNullFactions: log('. %08X %s -- Factions' % (recId,eid)) npc.factions = None unFactioned = True if recFlags.modifiers and not npc.modifiers: log('. %08X %s -- Modifiers' % (recId,eid)) npc.modifiers = None unModified = True if recFlags.spells and not npc.spells and recId not in legitNullSpells: log('. %08X %s -- Spells' % (recId,eid)) npc.spells = None unSpelled = True unNulled = (unFactioned or unSpelled or unModified) unNulledCount += (0,1)[unNulled] if recId == 7: playerStartSpell = saveFile.getIref(0x00000136) if npc.spells != None and playerStartSpell not in npc.spells: log('. %08X %s -- **DefaultPlayerSpell**' % (recId,eid)) npc.spells.append(playerStartSpell) refactioned = True playerFactionIref = saveFile.getIref(0x0001dbcd) if (npc.factions != None and playerFactionIref not in [iref for iref,level in npc.factions] ): log('. %08X %s -- **PlayerFaction, 0**' % (recId,eid)) npc.factions.append((playerFactionIref,0)) refactioned = True elif orderedRecId in npc_info and restoreDropped: (npcEid,factions) = npc_info[orderedRecId] if npc.factions and factions: curFactions = set([iref for iref,level in npc.factions]) for orderedId,level in factions: fid = mapToSave(orderedId,None) if not fid: continue iref = saveFile.getIref(fid) if iref not in curFactions and (recId,fid) not in legitDroppedFactions: factEid = fact_eid.get(orderedId,'------') question = _('Restore %s to %s faction?') % (npcEid,factEid) if debug: print 'refactioned %08X %08X %s %s' % (recId,fid,npcEid,factEid) elif not balt.askYes(self.window, question, saveName.s,default=False): continue log('. %08X %s -- **%s, %d**' % (recId,eid,factEid,level)) npc.factions.append((iref,level)) refactioned = True refactionedCount += (0,1)[refactioned] if unNulled or refactioned: saveFile.records[recNum] = (recId,recType,npc.getFlags(),version,npc.getData()) subProgress(index+0.5,_("Updating ") + saveName.s) if unNulledCount or refactionedCount: saveFile.safeSave() message += '\n%d %d %s' % (refactionedCount,unNulledCount,saveName.s,) progress.Destroy() message = log.out.getvalue() balt.showWryeLog(self.window,message,_('Repair Factions'),icons=bashBlue) finally: if progress: progress.Destroy()
"""Repair factions from v 105 Bash error, plus mod faction changes.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Repair Factions')) menu.AppendItem(menuItem) menuItem.Enable(bool(bosh.modInfos.ordered) and len(data) == 1) def Execute(self,event): debug = False message = _('This will (mostly) repair faction membership errors due to Wrye Bash v 105 bug and/or faction changes in underlying mods.\n\nWARNING! This repair is NOT perfect! Do not use it unless you have to!') if not balt.askContinue(self.window,message,'bash.repairFactions.continue',_('Update NPC Levels')): return question = _("Restore dropped factions too? WARNING: This may involve clicking through a LOT of yes/no dialogs.") restoreDropped = balt.askYes(self.window, question, _('Repair Factions'),default=False) progress = balt.Progress(_('Repair Factions')) legitNullSpells = bush.repairFactions_legitNullSpells legitNullFactions = bush.repairFactions_legitNullFactions legitDroppedFactions = bush.repairFactions_legitDroppedFactions try: log = bolt.LogFile(cStringIO.StringIO()) offsetFlag = 0x80 npc_info = {} fact_eid = {} loadFactory = bosh.LoadFactory(False,bosh.MreNpc,bosh.MreFact) ordered = list(bosh.modInfos.ordered) subProgress = SubProgress(progress,0,0.4,len(ordered)) for index,modName in enumerate(ordered): subProgress(index,_("Scanning ") + modName.s) modInfo = bosh.modInfos[modName] modFile = bosh.ModFile(modInfo,loadFactory) modFile.load(True) mapToOrdered = bosh.MasterMap(modFile.tes4.masters+[modName], ordered) for npc in modFile.NPC_.getActiveRecords(): fid = mapToOrdered(npc.fid,None) if not fid: continue factions = [] for entry in npc.factions: faction = mapToOrdered(entry.faction,None) if not faction: continue factions.append((faction,entry.rank)) npc_info[fid] = (npc.eid,factions) for fact in modFile.FACT.getActiveRecords(): fid = mapToOrdered(fact.fid,None) if not fid: continue fact_eid[fid] = fact.eid subProgress = SubProgress(progress,0.4,1.0,len(self.data)) message = _("NPC Factions Restored/UnNulled:") for index,saveName in enumerate(self.data): log.setHeader('== '+saveName.s,True) subProgress(index,_("Updating ") + saveName.s) saveInfo = self.window.data[saveName] saveFile = bosh.SaveFile(saveInfo) saveFile.load() records = saveFile.records mapToOrdered = bosh.MasterMap(saveFile.masters, ordered) mapToSave = bosh.MasterMap(ordered,saveFile.masters) refactionedCount = unNulledCount = 0 for recNum in xrange(len(records)): unFactioned = unSpelled = unModified = refactioned = False (recId,recType,recFlags,version,data) = records[recNum] if recType != 35: continue orderedRecId = mapToOrdered(recId,None) eid = npc_info.get(orderedRecId,('',))[0] npc = bosh.SreNPC(recFlags,data) recFlags = bosh.SreNPC.flags(recFlags) if recFlags.factions and not npc.factions and recId not in legitNullFactions: log('. %08X %s -- Factions' % (recId,eid)) npc.factions = None unFactioned = True if recFlags.modifiers and not npc.modifiers: log('. %08X %s -- Modifiers' % (recId,eid)) npc.modifiers = None unModified = True if recFlags.spells and not npc.spells and recId not in legitNullSpells: log('. %08X %s -- Spells' % (recId,eid)) npc.spells = None unSpelled = True unNulled = (unFactioned or unSpelled or unModified) unNulledCount += (0,1)[unNulled] if recId == 7: playerStartSpell = saveFile.getIref(0x00000136) if npc.spells != None and playerStartSpell not in npc.spells: log('. %08X %s -- **DefaultPlayerSpell**' % (recId,eid)) npc.spells.append(playerStartSpell) refactioned = True playerFactionIref = saveFile.getIref(0x0001dbcd) if (npc.factions != None and playerFactionIref not in [iref for iref,level in npc.factions] ): log('. %08X %s -- **PlayerFaction, 0**' % (recId,eid)) npc.factions.append((playerFactionIref,0)) refactioned = True elif orderedRecId in npc_info and restoreDropped: (npcEid,factions) = npc_info[orderedRecId] if npc.factions and factions: curFactions = set([iref for iref,level in npc.factions]) for orderedId,level in factions: fid = mapToSave(orderedId,None) if not fid: continue iref = saveFile.getIref(fid) if iref not in curFactions and (recId,fid) not in legitDroppedFactions: factEid = fact_eid.get(orderedId,'------') question = _('Restore %s to %s faction?') % (npcEid,factEid) if debug: print 'refactioned %08X %08X %s %s' % (recId,fid,npcEid,factEid) elif not balt.askYes(self.window, question, saveName.s,default=False): continue log('. %08X %s -- **%s, %d**' % (recId,eid,factEid,level)) npc.factions.append((iref,level)) refactioned = True refactionedCount += (0,1)[refactioned] if unNulled or refactioned: saveFile.records[recNum] = (recId,recType,npc.getFlags(),version,npc.getData()) subProgress(index+0.5,_("Updating ") + saveName.s) if unNulledCount or refactionedCount: saveFile.safeSave() message += '\n%d %d %s' % (refactionedCount,unNulledCount,saveName.s,) progress.Destroy() message = log.out.getvalue() balt.showWryeLog(self.window,message,_('Repair Factions'),icons=bashBlue) finally: if progress: progress.Destroy()
def Execute(self,event): #--File Info fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] #--Check current value saveFile = bosh.SaveFile(fileInfo) saveFile.load() (tcSize,abombCounter,abombFloat) = saveFile.getAbomb() #--Continue? progress = 100*abombFloat/struct.unpack('f',struct.pack('I',0x49000000))[0] newCounter = 0x41000000 if abombCounter <= newCounter: balt.showOk(self.window,_('Abomb counter is too low to reset.'),_('Repair Abomb')) return message = _("Reset Abomb counter? (Current progress: %.0f%%.)\n\nNote: Abomb animation slowing won't occur until progress is near 100%%.") % (progress,) if balt.askYes(self.window,message,_('Repair Abomb'),default=False): saveFile.setAbomb(newCounter) saveFile.safeSave() balt.showOk(self.window,_('Abomb counter reset.'),_('Repair Abomb'))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Repairs hair that has been zeroed due to removal of a hair mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Repair Hair')) menu.AppendItem(menuItem) if len(data) != 1: menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] if bosh.PCFaces.save_repairHair(fileInfo): balt.showOk(self.window,_('Hair repaired.')) else: balt.showOk(self.window,_('No repair necessary.'),fileName.s)
"""Repairs hair that has been zeroed due to removal of a hair mod.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Repair Hair')) menu.AppendItem(menuItem) if len(data) != 1: menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] if bosh.PCFaces.save_repairHair(fileInfo): balt.showOk(self.window,_('Hair repaired.')) else: balt.showOk(self.window,_('No repair necessary.'),fileName.s)
def Execute(self,event): debug = False message = _('This will (mostly) repair faction membership errors due to Wrye Bash v 105 bug and/or faction changes in underlying mods.\n\nWARNING! This repair is NOT perfect! Do not use it unless you have to!') if not balt.askContinue(self.window,message,'bash.repairFactions.continue',_('Update NPC Levels')): return question = _("Restore dropped factions too? WARNING: This may involve clicking through a LOT of yes/no dialogs.") restoreDropped = balt.askYes(self.window, question, _('Repair Factions'),default=False) progress = balt.Progress(_('Repair Factions')) legitNullSpells = bush.repairFactions_legitNullSpells legitNullFactions = bush.repairFactions_legitNullFactions legitDroppedFactions = bush.repairFactions_legitDroppedFactions try: #--Loop over active mods log = bolt.LogFile(cStringIO.StringIO()) offsetFlag = 0x80 npc_info = {} fact_eid = {} loadFactory = bosh.LoadFactory(False,bosh.MreNpc,bosh.MreFact) ordered = list(bosh.modInfos.ordered) subProgress = SubProgress(progress,0,0.4,len(ordered)) for index,modName in enumerate(ordered): subProgress(index,_("Scanning ") + modName.s) modInfo = bosh.modInfos[modName] modFile = bosh.ModFile(modInfo,loadFactory) modFile.load(True) #--Loop over mod NPCs mapToOrdered = bosh.MasterMap(modFile.tes4.masters+[modName], ordered) for npc in modFile.NPC_.getActiveRecords(): fid = mapToOrdered(npc.fid,None) if not fid: continue factions = [] for entry in npc.factions: faction = mapToOrdered(entry.faction,None) if not faction: continue factions.append((faction,entry.rank)) npc_info[fid] = (npc.eid,factions) #--Loop over mod factions for fact in modFile.FACT.getActiveRecords(): fid = mapToOrdered(fact.fid,None) if not fid: continue fact_eid[fid] = fact.eid #--Loop over savefiles subProgress = SubProgress(progress,0.4,1.0,len(self.data)) message = _("NPC Factions Restored/UnNulled:") for index,saveName in enumerate(self.data): log.setHeader('== '+saveName.s,True) subProgress(index,_("Updating ") + saveName.s) saveInfo = self.window.data[saveName] saveFile = bosh.SaveFile(saveInfo) saveFile.load() records = saveFile.records mapToOrdered = bosh.MasterMap(saveFile.masters, ordered) mapToSave = bosh.MasterMap(ordered,saveFile.masters) refactionedCount = unNulledCount = 0 for recNum in xrange(len(records)): unFactioned = unSpelled = unModified = refactioned = False (recId,recType,recFlags,version,data) = records[recNum] if recType != 35: continue orderedRecId = mapToOrdered(recId,None) eid = npc_info.get(orderedRecId,('',))[0] npc = bosh.SreNPC(recFlags,data) recFlags = bosh.SreNPC.flags(recFlags) #--Fix Bash v 105 null array bugs if recFlags.factions and not npc.factions and recId not in legitNullFactions: log('. %08X %s -- Factions' % (recId,eid)) npc.factions = None unFactioned = True if recFlags.modifiers and not npc.modifiers: log('. %08X %s -- Modifiers' % (recId,eid)) npc.modifiers = None unModified = True if recFlags.spells and not npc.spells and recId not in legitNullSpells: log('. %08X %s -- Spells' % (recId,eid)) npc.spells = None unSpelled = True unNulled = (unFactioned or unSpelled or unModified) unNulledCount += (0,1)[unNulled] #--Player, player faction if recId == 7: playerStartSpell = saveFile.getIref(0x00000136) if npc.spells != None and playerStartSpell not in npc.spells: log('. %08X %s -- **DefaultPlayerSpell**' % (recId,eid)) npc.spells.append(playerStartSpell) refactioned = True #--I'm lying, but... close enough. playerFactionIref = saveFile.getIref(0x0001dbcd) if (npc.factions != None and playerFactionIref not in [iref for iref,level in npc.factions] ): log('. %08X %s -- **PlayerFaction, 0**' % (recId,eid)) npc.factions.append((playerFactionIref,0)) refactioned = True #--Compare to mod data elif orderedRecId in npc_info and restoreDropped: (npcEid,factions) = npc_info[orderedRecId] #--Refaction? if npc.factions and factions: curFactions = set([iref for iref,level in npc.factions]) for orderedId,level in factions: fid = mapToSave(orderedId,None) if not fid: continue iref = saveFile.getIref(fid) if iref not in curFactions and (recId,fid) not in legitDroppedFactions: factEid = fact_eid.get(orderedId,'------') question = _('Restore %s to %s faction?') % (npcEid,factEid) if debug: print 'refactioned %08X %08X %s %s' % (recId,fid,npcEid,factEid) elif not balt.askYes(self.window, question, saveName.s,default=False): continue log('. %08X %s -- **%s, %d**' % (recId,eid,factEid,level)) npc.factions.append((iref,level)) refactioned = True refactionedCount += (0,1)[refactioned] #--Save record changes? if unNulled or refactioned: saveFile.records[recNum] = (recId,recType,npc.getFlags(),version,npc.getData()) #--Save changes? subProgress(index+0.5,_("Updating ") + saveName.s) if unNulledCount or refactionedCount: saveFile.safeSave() message += '\n%d %d %s' % (refactionedCount,unNulledCount,saveName.s,) progress.Destroy() #balt.showOk(self.window,message,_('Repair Factions')) message = log.out.getvalue() balt.showWryeLog(self.window,message,_('Repair Factions'),icons=bashBlue) finally: if progress: progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Changes weight of all player potions to specified value.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Reweigh Potions...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): result = balt.askText(self.window, _("Set weight of all player potions to..."), _("Reweigh Potions"), '%0.2f' % (settings.get('bash.reweighPotions.newWeight',0.2),)) if not result: return newWeight = float(result.strip()) if newWeight < 0 or newWeight > 100: balt.showOk(self.window,_('Invalid weight: %f') % (newWeight,)) return settings['bash.reweighPotions.newWeight'] = newWeight fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] progress = balt.Progress(_("Reweigh Potions")) try: saveFile = bosh.SaveFile(fileInfo) saveFile.load(SubProgress(progress,0,0.5)) count = 0 progress(0.5,_("Processing.")) for index,record in enumerate(saveFile.created): if record.recType == 'ALCH': record = record.getTypeCopy() record.weight = newWeight record.getSize() saveFile.created[index] = record count += 1 if count: saveFile.safeSave(SubProgress(progress,0.6,1.0)) progress.Destroy() balt.showOk(self.window,_('Potions reweighed: %d.') % (count,),fileName.s) else: progress.Destroy() balt.showOk(self.window,_('No potions to reweigh!'),fileName.s) finally: if progress: progress.Destroy()
"""Changes weight of all player potions to specified value.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Reweigh Potions...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) == 1) def Execute(self,event): result = balt.askText(self.window, _("Set weight of all player potions to..."), _("Reweigh Potions"), '%0.2f' % (settings.get('bash.reweighPotions.newWeight',0.2),)) if not result: return newWeight = float(result.strip()) if newWeight < 0 or newWeight > 100: balt.showOk(self.window,_('Invalid weight: %f') % (newWeight,)) return settings['bash.reweighPotions.newWeight'] = newWeight fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] progress = balt.Progress(_("Reweigh Potions")) try: saveFile = bosh.SaveFile(fileInfo) saveFile.load(SubProgress(progress,0,0.5)) count = 0 progress(0.5,_("Processing.")) for index,record in enumerate(saveFile.created): if record.recType == 'ALCH': record = record.getTypeCopy() record.weight = newWeight record.getSize() saveFile.created[index] = record count += 1 if count: saveFile.safeSave(SubProgress(progress,0.6,1.0)) progress.Destroy() balt.showOk(self.window,_('Potions reweighed: %d.') % (count,),fileName.s) else: progress.Destroy() balt.showOk(self.window,_('No potions to reweigh!'),fileName.s) finally: if progress: progress.Destroy()
def Execute(self,event): #--File Info fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] if bosh.PCFaces.save_repairHair(fileInfo): balt.showOk(self.window,_('Hair repaired.')) else: balt.showOk(self.window,_('No repair necessary.'),fileName.s)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Show savefile statistics.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Statistics')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] saveFile = bosh.SaveFile(fileInfo) progress = balt.Progress(_("Statistics")) try: saveFile.load(SubProgress(progress,0,0.9)) log = bolt.LogFile(cStringIO.StringIO()) progress(0.9,_("Calculating statistics.")) saveFile.logStats(log) progress.Destroy() text = log.out.getvalue() balt.showLog(self.window,text,fileName.s,asDialog=False,fixedFont=False,icons=bashBlue) finally: progress.Destroy()
"""Show savefile statistics.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Statistics')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] saveFile = bosh.SaveFile(fileInfo) progress = balt.Progress(_("Statistics")) try: saveFile.load(SubProgress(progress,0,0.9)) log = bolt.LogFile(cStringIO.StringIO()) progress(0.9,_("Calculating statistics.")) saveFile.logStats(log) progress.Destroy() text = log.out.getvalue() balt.showLog(self.window,text,fileName.s,asDialog=False,fixedFont=False,icons=bashBlue) finally: progress.Destroy()
def Execute(self,event): #--Query value result = balt.askText(self.window, _("Set weight of all player potions to..."), _("Reweigh Potions"), '%0.2f' % (settings.get('bash.reweighPotions.newWeight',0.2),)) if not result: return newWeight = float(result.strip()) if newWeight < 0 or newWeight > 100: balt.showOk(self.window,_('Invalid weight: %f') % (newWeight,)) return settings['bash.reweighPotions.newWeight'] = newWeight #--Do it fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] progress = balt.Progress(_("Reweigh Potions")) try: saveFile = bosh.SaveFile(fileInfo) saveFile.load(SubProgress(progress,0,0.5)) count = 0 progress(0.5,_("Processing.")) for index,record in enumerate(saveFile.created): if record.recType == 'ALCH': record = record.getTypeCopy() record.weight = newWeight record.getSize() saveFile.created[index] = record count += 1 if count: saveFile.safeSave(SubProgress(progress,0.6,1.0)) progress.Destroy() balt.showOk(self.window,_('Potions reweighed: %d.') % (count,),fileName.s) else: progress.Destroy() balt.showOk(self.window,_('No potions to reweigh!'),fileName.s) finally: if progress: progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Unbloats savegame.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Remove Bloat...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): saveName = GPath(self.data[0]) saveInfo = self.window.data[saveName] progress = balt.Progress(_("Scanning for Bloat")) delObjRefs = 0 try: saveFile = bosh.SaveFile(saveInfo) saveFile.load(SubProgress(progress,0,0.8)) createdCounts,nullRefCount = saveFile.findBloating(SubProgress(progress,0.8,1.0)) progress.Destroy() if not createdCounts and not nullRefCount: balt.showOk(self.window,_("No bloating found."),saveName.s) return message = '' if createdCounts: for type,name in sorted(createdCounts): message += ' %s %s: %s\n' % (type,name,formatInteger(createdCounts[(type,name)])) if nullRefCount: message += _(' Null Ref Objects: %s\n') % (formatInteger(nullRefCount),) message = _("Remove savegame bloating?\n%s\nWARNING: This is a risky procedure that may corrupt your savegame! Use only if necessary!") % (message,) if not balt.askYes(self.window,message,_("Remove bloating?")): return progress = balt.Progress(_("Removing Bloat")) nums = saveFile.removeBloating(createdCounts.keys(),True,SubProgress(progress,0,0.9)) progress(0.9,_("Saving...")) saveFile.safeSave() progress.Destroy() balt.showOk(self.window, _("Uncreated Objects: %d\nUncreated Refs: %d\nUnNulled Refs: %d") % nums, saveName.s) self.window.RefreshUI(saveName) finally: progress.Destroy()
"""Unbloats savegame.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Remove Bloat...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): saveName = GPath(self.data[0]) saveInfo = self.window.data[saveName] progress = balt.Progress(_("Scanning for Bloat")) delObjRefs = 0 try: saveFile = bosh.SaveFile(saveInfo) saveFile.load(SubProgress(progress,0,0.8)) createdCounts,nullRefCount = saveFile.findBloating(SubProgress(progress,0.8,1.0)) progress.Destroy() if not createdCounts and not nullRefCount: balt.showOk(self.window,_("No bloating found."),saveName.s) return message = '' if createdCounts: for type,name in sorted(createdCounts): message += ' %s %s: %s\n' % (type,name,formatInteger(createdCounts[(type,name)])) if nullRefCount: message += _(' Null Ref Objects: %s\n') % (formatInteger(nullRefCount),) message = _("Remove savegame bloating?\n%s\nWARNING: This is a risky procedure that may corrupt your savegame! Use only if necessary!") % (message,) if not balt.askYes(self.window,message,_("Remove bloating?")): return progress = balt.Progress(_("Removing Bloat")) nums = saveFile.removeBloating(createdCounts.keys(),True,SubProgress(progress,0,0.9)) progress(0.9,_("Saving...")) saveFile.safeSave() progress.Destroy() balt.showOk(self.window, _("Uncreated Objects: %d\nUncreated Refs: %d\nUnNulled Refs: %d") % nums, saveName.s) self.window.RefreshUI(saveName) finally: progress.Destroy()
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] saveFile = bosh.SaveFile(fileInfo) progress = balt.Progress(_("Statistics")) try: saveFile.load(SubProgress(progress,0,0.9)) log = bolt.LogFile(cStringIO.StringIO()) progress(0.9,_("Calculating statistics.")) saveFile.logStats(log) progress.Destroy() text = log.out.getvalue() balt.showLog(self.window,text,fileName.s,asDialog=False,fixedFont=False,icons=bashBlue) finally: progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Update NPC levels from active mods.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Update NPC Levels...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): debug = True message = _('This will relevel the NPCs in the selected save game(s) according to the npc levels in the currently active mods. This supercedes the older "Import NPC Levels" command.') if not balt.askContinue(self.window,message,'bash.updateNpcLevels.continue',_('Update NPC Levels')): return progress = balt.Progress(_('Update NPC Levels')) try: offsetFlag = 0x80 npc_info = {} loadFactory = bosh.LoadFactory(False,bosh.MreNpc) ordered = list(bosh.modInfos.ordered) subProgress = SubProgress(progress,0,0.4,len(ordered)) modErrors = [] for index,modName in enumerate(ordered): subProgress(index,_("Scanning ") + modName.s) modInfo = bosh.modInfos[modName] modFile = bosh.ModFile(modInfo,loadFactory) try: modFile.load(True) except bosh.ModError, x: modErrors.append(str(x)) continue if 'NPC_' not in modFile.tops: continue mapToOrdered = bosh.MasterMap(modFile.tes4.masters+[modName], ordered) for npc in modFile.NPC_.getActiveRecords(): fid = mapToOrdered(npc.fid,None) if not fid: continue npc_info[fid] = (npc.eid, npc.level, npc.calcMin, npc.calcMax, npc.flags.pcLevelOffset) subProgress = SubProgress(progress,0.4,1.0,len(self.data)) message = _("NPCs Releveled:") for index,saveName in enumerate(self.data): subProgress(index,_("Updating ") + saveName.s) saveInfo = self.window.data[saveName] saveFile = bosh.SaveFile(saveInfo) saveFile.load() records = saveFile.records mapToOrdered = bosh.MasterMap(saveFile.masters, ordered) releveledCount = 0 for recNum in xrange(len(records)): releveled = False (recId,recType,recFlags,version,data) = records[recNum] orderedRecId = mapToOrdered(recId,None) if recType != 35 or recId == 7 or orderedRecId not in npc_info: continue (eid,level,calcMin,calcMax,pcLevelOffset) = npc_info[orderedRecId] npc = bosh.SreNPC(recFlags,data) acbs = npc.acbs if acbs and ( (acbs.level != level) or (acbs.calcMin != calcMin) or (acbs.calcMax != calcMax) or (acbs.flags.pcLevelOffset != pcLevelOffset) ): acbs.flags.pcLevelOffset = pcLevelOffset acbs.level = level acbs.calcMin = calcMin acbs.calcMax = calcMax (recId,recType,recFlags,version,data) = saveFile.records[recNum] records[recNum] = (recId,recType,npc.getFlags(),version,npc.getData()) releveledCount += 1 saveFile.records[recNum] = npc.getTuple(recId,version) subProgress(index+0.5,_("Updating ") + saveName.s) if releveledCount: saveFile.safeSave() message += '\n%d %s' % (releveledCount,saveName.s,) progress.Destroy() if modErrors: message += _("\n\nSome mods had load errors and were skipped:\n* ") message += '\n* '.join(modErrors) balt.showOk(self.window,message,_('Update NPC Levels')) finally: if progress: progress.Destroy()
"""Update NPC levels from active mods.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Update NPC Levels...')) menu.AppendItem(menuItem) menuItem.Enable(False) def Execute(self,event): debug = True message = _('This will relevel the NPCs in the selected save game(s) according to the npc levels in the currently active mods. This supercedes the older "Import NPC Levels" command.') if not balt.askContinue(self.window,message,'bash.updateNpcLevels.continue',_('Update NPC Levels')): return progress = balt.Progress(_('Update NPC Levels')) try: offsetFlag = 0x80 npc_info = {} loadFactory = bosh.LoadFactory(False,bosh.MreNpc) ordered = list(bosh.modInfos.ordered) subProgress = SubProgress(progress,0,0.4,len(ordered)) modErrors = [] for index,modName in enumerate(ordered): subProgress(index,_("Scanning ") + modName.s) modInfo = bosh.modInfos[modName] modFile = bosh.ModFile(modInfo,loadFactory) try: modFile.load(True) except bosh.ModError, x: modErrors.append(str(x)) continue if 'NPC_' not in modFile.tops: continue mapToOrdered = bosh.MasterMap(modFile.tes4.masters+[modName], ordered) for npc in modFile.NPC_.getActiveRecords(): fid = mapToOrdered(npc.fid,None) if not fid: continue npc_info[fid] = (npc.eid, npc.level, npc.calcMin, npc.calcMax, npc.flags.pcLevelOffset) subProgress = SubProgress(progress,0.4,1.0,len(self.data)) message = _("NPCs Releveled:") for index,saveName in enumerate(self.data): subProgress(index,_("Updating ") + saveName.s) saveInfo = self.window.data[saveName] saveFile = bosh.SaveFile(saveInfo) saveFile.load() records = saveFile.records mapToOrdered = bosh.MasterMap(saveFile.masters, ordered) releveledCount = 0 for recNum in xrange(len(records)): releveled = False (recId,recType,recFlags,version,data) = records[recNum] orderedRecId = mapToOrdered(recId,None) if recType != 35 or recId == 7 or orderedRecId not in npc_info: continue (eid,level,calcMin,calcMax,pcLevelOffset) = npc_info[orderedRecId] npc = bosh.SreNPC(recFlags,data) acbs = npc.acbs if acbs and ( (acbs.level != level) or (acbs.calcMin != calcMin) or (acbs.calcMax != calcMax) or (acbs.flags.pcLevelOffset != pcLevelOffset) ): acbs.flags.pcLevelOffset = pcLevelOffset acbs.level = level acbs.calcMin = calcMin acbs.calcMax = calcMax (recId,recType,recFlags,version,data) = saveFile.records[recNum] records[recNum] = (recId,recType,npc.getFlags(),version,npc.getData()) releveledCount += 1 saveFile.records[recNum] = npc.getTuple(recId,version) subProgress(index+0.5,_("Updating ") + saveName.s) if releveledCount: saveFile.safeSave() message += '\n%d %s' % (releveledCount,saveName.s,) progress.Destroy() if modErrors: message += _("\n\nSome mods had load errors and were skipped:\n* ") message += '\n* '.join(modErrors) balt.showOk(self.window,message,_('Update NPC Levels')) finally: if progress: progress.Destroy()
def Execute(self,event): #--File Info saveName = GPath(self.data[0]) saveInfo = self.window.data[saveName] progress = balt.Progress(_("Scanning for Bloat")) delObjRefs = 0 try: #--Scan and report saveFile = bosh.SaveFile(saveInfo) saveFile.load(SubProgress(progress,0,0.8)) createdCounts,nullRefCount = saveFile.findBloating(SubProgress(progress,0.8,1.0)) progress.Destroy() #--Dialog if not createdCounts and not nullRefCount: balt.showOk(self.window,_("No bloating found."),saveName.s) return message = '' if createdCounts: #message += _('Excess Created Objects\n') for type,name in sorted(createdCounts): message += ' %s %s: %s\n' % (type,name,formatInteger(createdCounts[(type,name)])) if nullRefCount: message += _(' Null Ref Objects: %s\n') % (formatInteger(nullRefCount),) message = _("Remove savegame bloating?\n%s\nWARNING: This is a risky procedure that may corrupt your savegame! Use only if necessary!") % (message,) if not balt.askYes(self.window,message,_("Remove bloating?")): return #--Remove bloating progress = balt.Progress(_("Removing Bloat")) nums = saveFile.removeBloating(createdCounts.keys(),True,SubProgress(progress,0,0.9)) progress(0.9,_("Saving...")) saveFile.safeSave() progress.Destroy() balt.showOk(self.window, _("Uncreated Objects: %d\nUncreated Refs: %d\nUnNulled Refs: %d") % nums, saveName.s) self.window.RefreshUI(saveName) finally: progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Sets screenshot base name and number.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Next Shot...')) menu.AppendItem(menuItem) def Execute(self,event): fallout3Ini = bosh.fallout3Ini base = fallout3Ini.getSetting('Display','sScreenShotBaseName','ScreenShot') next = fallout3Ini.getSetting('Display','iScreenShotIndex','0') rePattern = re.compile(r'^(.+?)(\d*)$',re.I) pattern = balt.askText(self.window,_("Screenshot base name, optionally with next screenshot number.\nE.g. ScreenShot or ScreenShot_101 or Subdir\\ScreenShot_201."),_("Next Shot..."),base+next) if not pattern: return maPattern = rePattern.match(pattern) newBase,newNext = maPattern.groups() settings = {LString('Display'):{ LString('SScreenShotBaseName'): newBase, LString('iScreenShotIndex'): (newNext or next), LString('bAllowScreenShot'): '1', }} screensDir = GPath(newBase).head if screensDir: if not screensDir.isabs(): screensDir = bosh.dirs['app'].join(screensDir) screensDir.makedirs() fallout3Ini.saveSettings(settings) bosh.screensData.refresh() self.window.RefreshUI()
"""Sets screenshot base name and number.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Next Shot...')) menu.AppendItem(menuItem) def Execute(self,event): fallout3Ini = bosh.fallout3Ini base = fallout3Ini.getSetting('Display','sScreenShotBaseName','ScreenShot') next = fallout3Ini.getSetting('Display','iScreenShotIndex','0') rePattern = re.compile(r'^(.+?)(\d*)$',re.I) pattern = balt.askText(self.window,_("Screenshot base name, optionally with next screenshot number.\nE.g. ScreenShot or ScreenShot_101 or Subdir\\ScreenShot_201."),_("Next Shot..."),base+next) if not pattern: return maPattern = rePattern.match(pattern) newBase,newNext = maPattern.groups() settings = {LString('Display'):{ LString('SScreenShotBaseName'): newBase, LString('iScreenShotIndex'): (newNext or next), LString('bAllowScreenShot'): '1', }} screensDir = GPath(newBase).head if screensDir: if not screensDir.isabs(): screensDir = bosh.dirs['app'].join(screensDir) screensDir.makedirs() fallout3Ini.saveSettings(settings) bosh.screensData.refresh() self.window.RefreshUI()
def Execute(self,event): debug = True message = _('This will relevel the NPCs in the selected save game(s) according to the npc levels in the currently active mods. This supercedes the older "Import NPC Levels" command.') if not balt.askContinue(self.window,message,'bash.updateNpcLevels.continue',_('Update NPC Levels')): return progress = balt.Progress(_('Update NPC Levels')) try: #--Loop over active mods offsetFlag = 0x80 npc_info = {} loadFactory = bosh.LoadFactory(False,bosh.MreNpc) ordered = list(bosh.modInfos.ordered) subProgress = SubProgress(progress,0,0.4,len(ordered)) modErrors = [] for index,modName in enumerate(ordered): subProgress(index,_("Scanning ") + modName.s) modInfo = bosh.modInfos[modName] modFile = bosh.ModFile(modInfo,loadFactory) try: modFile.load(True) except bosh.ModError, x: modErrors.append(str(x)) continue if 'NPC_' not in modFile.tops: continue #--Loop over mod NPCs mapToOrdered = bosh.MasterMap(modFile.tes4.masters+[modName], ordered) for npc in modFile.NPC_.getActiveRecords(): fid = mapToOrdered(npc.fid,None) if not fid: continue npc_info[fid] = (npc.eid, npc.level, npc.calcMin, npc.calcMax, npc.flags.pcLevelOffset) #--Loop over savefiles subProgress = SubProgress(progress,0.4,1.0,len(self.data)) message = _("NPCs Releveled:") for index,saveName in enumerate(self.data): #deprint(saveName, '==============================') subProgress(index,_("Updating ") + saveName.s) saveInfo = self.window.data[saveName] saveFile = bosh.SaveFile(saveInfo) saveFile.load() records = saveFile.records mapToOrdered = bosh.MasterMap(saveFile.masters, ordered) releveledCount = 0 #--Loop over change records for recNum in xrange(len(records)): releveled = False (recId,recType,recFlags,version,data) = records[recNum] orderedRecId = mapToOrdered(recId,None) if recType != 35 or recId == 7 or orderedRecId not in npc_info: continue (eid,level,calcMin,calcMax,pcLevelOffset) = npc_info[orderedRecId] npc = bosh.SreNPC(recFlags,data) acbs = npc.acbs if acbs and ( (acbs.level != level) or (acbs.calcMin != calcMin) or (acbs.calcMax != calcMax) or (acbs.flags.pcLevelOffset != pcLevelOffset) ): acbs.flags.pcLevelOffset = pcLevelOffset acbs.level = level acbs.calcMin = calcMin acbs.calcMax = calcMax (recId,recType,recFlags,version,data) = saveFile.records[recNum] records[recNum] = (recId,recType,npc.getFlags(),version,npc.getData()) releveledCount += 1 saveFile.records[recNum] = npc.getTuple(recId,version) #deprint(hex(recId), eid, acbs.level, acbs.calcMin, acbs.calcMax, acbs.flags.getTrueAttrs()) #--Save changes? subProgress(index+0.5,_("Updating ") + saveName.s) if releveledCount: saveFile.safeSave() message += '\n%d %s' % (releveledCount,saveName.s,) progress.Destroy() if modErrors: message += _("\n\nSome mods had load errors and were skipped:\n* ") message += '\n* '.join(modErrors) balt.showOk(self.window,message,_('Update NPC Levels')) finally: if progress: progress.Destroy()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Converts selected images to jpg files.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Convert to jpg')) menu.AppendItem(menuItem) convertable = [name for name in self.data if GPath(name).cext != '.jpg'] menuItem.Enable(len(convertable) > 0) def Execute(self,event): srcDir = self.window.data.dir progress = balt.Progress(_("Converting to Jpg")) try: progress.setFull(len(self.data)) srcDir = bosh.screensData.dir for index,fileName in enumerate(self.data): progress(index,fileName.s) srcPath = srcDir.join(fileName) destPath = srcPath.root+'.jpg' if srcPath == destPath or destPath.exists(): continue bitmap = wx.Bitmap(srcPath.s) result = bitmap.SaveFile(destPath.s,wx.BITMAP_TYPE_JPEG) if not result: continue srcPath.remove() finally: if progress: progress.Destroy() bosh.screensData.refresh() self.window.RefreshUI()
"""Converts selected images to jpg files.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Convert to jpg')) menu.AppendItem(menuItem) convertable = [name for name in self.data if GPath(name).cext != '.jpg'] menuItem.Enable(len(convertable) > 0) def Execute(self,event): srcDir = self.window.data.dir progress = balt.Progress(_("Converting to Jpg")) try: progress.setFull(len(self.data)) srcDir = bosh.screensData.dir for index,fileName in enumerate(self.data): progress(index,fileName.s) srcPath = srcDir.join(fileName) destPath = srcPath.root+'.jpg' if srcPath == destPath or destPath.exists(): continue bitmap = wx.Bitmap(srcPath.s) result = bitmap.SaveFile(destPath.s,wx.BITMAP_TYPE_JPEG) if not result: continue srcPath.remove() finally: if progress: progress.Destroy() bosh.screensData.refresh() self.window.RefreshUI()
def Execute(self,event): fallout3Ini = bosh.fallout3Ini base = fallout3Ini.getSetting('Display','sScreenShotBaseName','ScreenShot') next = fallout3Ini.getSetting('Display','iScreenShotIndex','0') rePattern = re.compile(r'^(.+?)(\d*)$',re.I) pattern = balt.askText(self.window,_("Screenshot base name, optionally with next screenshot number.\nE.g. ScreenShot or ScreenShot_101 or Subdir\\ScreenShot_201."),_("Next Shot..."),base+next) if not pattern: return maPattern = rePattern.match(pattern) newBase,newNext = maPattern.groups() settings = {LString('Display'):{ LString('SScreenShotBaseName'): newBase, LString('iScreenShotIndex'): (newNext or next), LString('bAllowScreenShot'): '1', }} screensDir = GPath(newBase).head if screensDir: if not screensDir.isabs(): screensDir = bosh.dirs['app'].join(screensDir) screensDir.makedirs() fallout3Ini.saveSettings(settings) bosh.screensData.refresh() self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Renames files by pattern.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Rename...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) > 0) def Execute(self,event): rePattern = re.compile(r'^([^\\/]+?)(\d*)(\.(jpg|bmp))$',re.I) fileName0 = self.data[0] pattern = balt.askText(self.window,_("Enter new name. E.g. Screenshot 123.bmp"), _("Rename Files"),fileName0.s) if not pattern: return maPattern = rePattern.match(pattern) if not maPattern: balt.showError(self.window,_("Bad extension or file root: ")+pattern) return root,numStr,ext = maPattern.groups()[:3] numLen = len(numStr) num = int(numStr or 0) screensDir = bosh.screensData.dir for oldName in map(GPath,self.data): newName = GPath(root)+numStr+oldName.ext if newName != oldName: oldPath = screensDir.join(oldName) newPath = screensDir.join(newName) if not newPath.exists(): oldPath.moveTo(newPath) num += 1 numStr = `num` numStr = '0'*(numLen-len(numStr))+numStr bosh.screensData.refresh() self.window.RefreshUI()
"""Renames files by pattern.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Rename...')) menu.AppendItem(menuItem) menuItem.Enable(len(data) > 0) def Execute(self,event): rePattern = re.compile(r'^([^\\/]+?)(\d*)(\.(jpg|bmp))$',re.I) fileName0 = self.data[0] pattern = balt.askText(self.window,_("Enter new name. E.g. Screenshot 123.bmp"), _("Rename Files"),fileName0.s) if not pattern: return maPattern = rePattern.match(pattern) if not maPattern: balt.showError(self.window,_("Bad extension or file root: ")+pattern) return root,numStr,ext = maPattern.groups()[:3] numLen = len(numStr) num = int(numStr or 0) screensDir = bosh.screensData.dir for oldName in map(GPath,self.data): newName = GPath(root)+numStr+oldName.ext if newName != oldName: oldPath = screensDir.join(oldName) newPath = screensDir.join(newName) if not newPath.exists(): oldPath.moveTo(newPath) num += 1 numStr = `num` numStr = '0'*(numLen-len(numStr))+numStr bosh.screensData.refresh() self.window.RefreshUI()
def Execute(self,event): #--File Info srcDir = self.window.data.dir progress = balt.Progress(_("Converting to Jpg")) try: progress.setFull(len(self.data)) srcDir = bosh.screensData.dir for index,fileName in enumerate(self.data): progress(index,fileName.s) srcPath = srcDir.join(fileName) destPath = srcPath.root+'.jpg' if srcPath == destPath or destPath.exists(): continue bitmap = wx.Bitmap(srcPath.s) result = bitmap.SaveFile(destPath.s,wx.BITMAP_TYPE_JPEG) if not result: continue srcPath.remove() finally: if progress: progress.Destroy() bosh.screensData.refresh() self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Import messages from html message archive.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Import Archives...')) menu.AppendItem(menuItem) def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) paths = balt.askOpenMulti(self.window,_('Import message archive(s):'),textDir, '', '*.html') if not paths: return settings['bash.workDir'] = paths[0].head for path in paths: bosh.messages.importArchive(path) self.window.RefreshUI()
"""Import messages from html message archive.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Import Archives...')) menu.AppendItem(menuItem) def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) paths = balt.askOpenMulti(self.window,_('Import message archive(s):'),textDir, '', '*.html') if not paths: return settings['bash.workDir'] = paths[0].head for path in paths: bosh.messages.importArchive(path) self.window.RefreshUI()
def Execute(self,event): #--File Info rePattern = re.compile(r'^([^\\/]+?)(\d*)(\.(jpg|bmp))$',re.I) fileName0 = self.data[0] pattern = balt.askText(self.window,_("Enter new name. E.g. Screenshot 123.bmp"), _("Rename Files"),fileName0.s) if not pattern: return maPattern = rePattern.match(pattern) if not maPattern: balt.showError(self.window,_("Bad extension or file root: ")+pattern) return root,numStr,ext = maPattern.groups()[:3] numLen = len(numStr) num = int(numStr or 0) screensDir = bosh.screensData.dir for oldName in map(GPath,self.data): newName = GPath(root)+numStr+oldName.ext if newName != oldName: oldPath = screensDir.join(oldName) newPath = screensDir.join(newName) if not newPath.exists(): oldPath.moveTo(newPath) num += 1 numStr = `num` numStr = '0'*(numLen-len(numStr))+numStr bosh.screensData.refresh() self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Delete the file and all backups.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menu.AppendItem(wx.MenuItem(menu,self.id,_('Delete'))) def Execute(self,event): message = _(r'Delete these %d message(s)? This operation cannot be undone.') % (len(self.data),) if not balt.askYes(self.window,message,_('Delete Messages')): return for message in self.data: self.window.data.delete(message) self.window.RefreshUI()
"""Delete the file and all backups.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menu.AppendItem(wx.MenuItem(menu,self.id,_('Delete'))) def Execute(self,event): message = _(r'Delete these %d message(s)? This operation cannot be undone.') % (len(self.data),) if not balt.askYes(self.window,message,_('Delete Messages')): return for message in self.data: self.window.data.delete(message) self.window.RefreshUI()
def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) #--File dialog paths = balt.askOpenMulti(self.window,_('Import message archive(s):'),textDir, '', '*.html') if not paths: return settings['bash.workDir'] = paths[0].head for path in paths: bosh.messages.importArchive(path) self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Add a new record.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Add...')) menu.AppendItem(menuItem) self.title = _('Add New Person') def Execute(self,event): name = balt.askText(self.gTank,_("Add new person:"),self.title) if not name: return if name in self.data: return balt.showInfo(self.gTank,name+_(" already exists."),self.title) self.data[name] = (time.time(),0,'') self.gTank.RefreshUI(details=name) self.gTank.gList.EnsureVisible(self.gTank.GetIndex(name)) self.data.setChanged()
"""Add a new record.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Add...')) menu.AppendItem(menuItem) self.title = _('Add New Person') def Execute(self,event): name = balt.askText(self.gTank,_("Add new person:"),self.title) if not name: return if name in self.data: return balt.showInfo(self.gTank,name+_(" already exists."),self.title) self.data[name] = (time.time(),0,'') self.gTank.RefreshUI(details=name) self.gTank.gList.EnsureVisible(self.gTank.GetIndex(name)) self.data.setChanged()
def Execute(self,event): message = _(r'Delete these %d message(s)? This operation cannot be undone.') % (len(self.data),) if not balt.askYes(self.window,message,_('Delete Messages')): return #--Do it for message in self.data: self.window.data.delete(message) #--Refresh stuff self.window.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Export people to text archive.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Export...')) menu.AppendItem(menuItem) self.title = _("Export People") def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) path = balt.askSave(self.gTank,_('Export people to text file:'),textDir, 'People.txt', '*.txt') if not path: return settings['bash.workDir'] = path.head self.data.dumpText(path,self.selected) balt.showInfo(self.gTank,_('Records exported: %d.') % (len(self.selected),),self.title)
"""Export people to text archive.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Export...')) menu.AppendItem(menuItem) self.title = _("Export People") def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) path = balt.askSave(self.gTank,_('Export people to text file:'),textDir, 'People.txt', '*.txt') if not path: return settings['bash.workDir'] = path.head self.data.dumpText(path,self.selected) balt.showInfo(self.gTank,_('Records exported: %d.') % (len(self.selected),),self.title)
def Execute(self,event): name = balt.askText(self.gTank,_("Add new person:"),self.title) if not name: return if name in self.data: return balt.showInfo(self.gTank,name+_(" already exists."),self.title) self.data[name] = (time.time(),0,'') self.gTank.RefreshUI(details=name) self.gTank.gList.EnsureVisible(self.gTank.GetIndex(name)) self.data.setChanged()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Import people from text archive.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Import...')) menu.AppendItem(menuItem) self.title = _("Import People") def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) path = balt.askOpen(self.gTank,_('Import people from text file:'),textDir, '', '*.txt') if not path: return settings['bash.workDir'] = path.head newNames = self.data.loadText(path) balt.showInfo(self.gTank,_("People imported: %d") % (len(newNames),),self.title) self.gTank.RefreshUI()
"""Import people from text archive.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Import...')) menu.AppendItem(menuItem) self.title = _("Import People") def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) path = balt.askOpen(self.gTank,_('Import people from text file:'),textDir, '', '*.txt') if not path: return settings['bash.workDir'] = path.head newNames = self.data.loadText(path) balt.showInfo(self.gTank,_("People imported: %d") % (len(newNames),),self.title) self.gTank.RefreshUI()
def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) #--File dialog path = balt.askSave(self.gTank,_('Export people to text file:'),textDir, 'People.txt', '*.txt') if not path: return settings['bash.workDir'] = path.head self.data.dumpText(path,self.selected) balt.showInfo(self.gTank,_('Records exported: %d.') % (len(self.selected),),self.title)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Add Karma setting links.""" def AppendToMenu(self,menu,window,data): """Append Karma item submenu.""" Link.AppendToMenu(self,menu,window,data) idList = ID_GROUPS labels = ['%+d' % (x,) for x in range(5,-6,-1)] subMenu = wx.Menu() for id,item in zip(idList,labels): subMenu.Append(id,item) wx.EVT_MENU_RANGE(window,idList.BASE,idList.MAX,self.DoList) menu.AppendMenu(-1,'Karma',subMenu) def DoList(self,event): """Handle selection of label.""" idList = ID_GROUPS karma = range(5,-6,-1)[event.GetId()-idList.BASE] for item in self.selected: text = self.data[item][2] self.data[item] = (time.time(),karma,text) self.gTank.RefreshUI() self.data.setChanged()
"""Add Karma setting links.""" def AppendToMenu(self,menu,window,data): """Append Karma item submenu.""" Link.AppendToMenu(self,menu,window,data) idList = ID_GROUPS labels = ['%+d' % (x,) for x in range(5,-6,-1)] subMenu = wx.Menu() for id,item in zip(idList,labels): subMenu.Append(id,item) wx.EVT_MENU_RANGE(window,idList.BASE,idList.MAX,self.DoList) menu.AppendMenu(-1,'Karma',subMenu) def DoList(self,event): """Handle selection of label.""" idList = ID_GROUPS karma = range(5,-6,-1)[event.GetId()-idList.BASE] for item in self.selected: text = self.data[item][2] self.data[item] = (time.time(),karma,text) self.gTank.RefreshUI() self.data.setChanged()
def Execute(self,event): textDir = settings.get('bash.workDir',bosh.dirs['app']) #--File dialog path = balt.askOpen(self.gTank,_('Import people from text file:'),textDir, '', '*.txt') if not path: return settings['bash.workDir'] = path.head newNames = self.data.loadText(path) balt.showInfo(self.gTank,_("People imported: %d") % (len(newNames),),self.title) self.gTank.RefreshUI()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Rename/replace master through file dialog.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Change to...")) menu.AppendItem(menuItem) menuItem.Enable(self.window.edited) def Execute(self,event): itemId = self.data[0] masterInfo = self.window.data[itemId] masterName = masterInfo.name wildcard = _('Fallout3 Mod Files')+' (*.esp;*.esm)|*.esp;*.esm' newPath = balt.askOpen(self.window,_('Change master name to:'), bosh.modInfos.dir, masterName, wildcard) if not newPath: return (newDir,newName) = newPath.headTail if newDir != bosh.modInfos.dir: balt.showError(self.window, _("File must be selected from Fallout3 Data Files directory.")) return elif newName == masterName: return masterInfo.setName(newName) self.window.ReList() self.window.PopulateItems() settings.getChanged('bash.mods.renames')[masterName] = newName
"""Rename/replace master through file dialog.""" def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Change to...")) menu.AppendItem(menuItem) menuItem.Enable(self.window.edited) def Execute(self,event): itemId = self.data[0] masterInfo = self.window.data[itemId] masterName = masterInfo.name wildcard = _('Fallout3 Mod Files')+' (*.esp;*.esm)|*.esp;*.esm' newPath = balt.askOpen(self.window,_('Change master name to:'), bosh.modInfos.dir, masterName, wildcard) if not newPath: return (newDir,newName) = newPath.headTail if newDir != bosh.modInfos.dir: balt.showError(self.window, _("File must be selected from Fallout3 Data Files directory.")) return elif newName == masterName: return masterInfo.setName(newName) self.window.ReList() self.window.PopulateItems() settings.getChanged('bash.mods.renames')[masterName] = newName
def DoList(self,event): """Handle selection of label.""" idList = ID_GROUPS karma = range(5,-6,-1)[event.GetId()-idList.BASE] for item in self.selected: text = self.data[item][2] self.data[item] = (time.time(),karma,text) self.gTank.RefreshUI() self.data.setChanged()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Rename/replace master through file dialog.""" def AppendToMenu(self,menu,window,data): if window.fileInfo.isMod(): return Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Disable")) menu.AppendItem(menuItem) menuItem.Enable(self.window.edited) def Execute(self,event): itemId = self.data[0] masterInfo = self.window.data[itemId] masterName = masterInfo.name newName = GPath(re.sub('[mM]$','p','XX'+masterName.s)) masterInfo.setName(newName) self.window.ReList() self.window.PopulateItems()
"""Rename/replace master through file dialog.""" def AppendToMenu(self,menu,window,data): if window.fileInfo.isMod(): return Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_("Disable")) menu.AppendItem(menuItem) menuItem.Enable(self.window.edited) def Execute(self,event): itemId = self.data[0] masterInfo = self.window.data[itemId] masterName = masterInfo.name newName = GPath(re.sub('[mM]$','p','XX'+masterName.s)) masterInfo.setName(newName) self.window.ReList() self.window.PopulateItems()
def Execute(self,event): itemId = self.data[0] masterInfo = self.window.data[itemId] masterName = masterInfo.name #--File Dialog wildcard = _('Fallout3 Mod Files')+' (*.esp;*.esm)|*.esp;*.esm' newPath = balt.askOpen(self.window,_('Change master name to:'), bosh.modInfos.dir, masterName, wildcard) if not newPath: return (newDir,newName) = newPath.headTail #--Valid directory? if newDir != bosh.modInfos.dir: balt.showError(self.window, _("File must be selected from Fallout3 Data Files directory.")) return elif newName == masterName: return #--Save Name masterInfo.setName(newName) self.window.ReList() self.window.PopulateItems() settings.getChanged('bash.mods.renames')[masterName] = newName
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Launch an application.""" foseButtons = [] def __init__(self,exePathArgs,image,tip,foseTip=None,foseArg=None): """Initialize exePathArgs (string): exePath exePathArgs (tuple): (exePath,*exeArgs)""" Link.__init__(self) self.gButton = None if isinstance(exePathArgs,tuple): self.exePath = exePathArgs[0] self.exeArgs = exePathArgs[1:] else: self.exePath = exePathArgs self.exeArgs = tuple() self.image = image self.tip = tip self.foseTip = foseTip self.foseArg = foseArg exeFose = bosh.dirs['app'].join('fose_loader.exe') def IsPresent(self): return self.exePath.exists() def GetBitmapButton(self,window,style=0): if self.IsPresent(): self.gButton = bitmapButton(window,self.image.GetBitmap(),style=style, onClick=self.Execute,tip=self.tip) if self.foseArg != None: App_Button.foseButtons.append(self) exeFose = bosh.dirs['app'].join('fose_loader.exe') if settings.get('bash.fose.on',False) and exeFose.exists(): self.gButton.SetToolTip(tooltip(self.foseTip)) return self.gButton else: return None def Execute(self,event,extraArgs=None): exeFose = bosh.dirs['app'].join('fose_loader.exe') exeArgs = self.exeArgs if self.foseArg != None and settings.get('bash.fose.on',False) and exeFose.exists(): exePath = exeFose if self.foseArg != '': exeArgs += (self.foseArg,) else: exePath = self.exePath exeArgs = (exePath.stail,)+exeArgs if extraArgs: exeArgs += extraArgs statusBar.SetStatusText(' '.join(exeArgs),1) cwd = bolt.Path.getcwd() exePath.head.setcwd() os.spawnv(os.P_NOWAIT,exePath.s,exeArgs) cwd.setcwd()
"""Launch an application.""" foseButtons = [] def __init__(self,exePathArgs,image,tip,foseTip=None,foseArg=None): """Initialize exePathArgs (string): exePath exePathArgs (tuple): (exePath,*exeArgs)""" Link.__init__(self) self.gButton = None if isinstance(exePathArgs,tuple): self.exePath = exePathArgs[0] self.exeArgs = exePathArgs[1:] else: self.exePath = exePathArgs self.exeArgs = tuple() self.image = image self.tip = tip self.foseTip = foseTip self.foseArg = foseArg exeFose = bosh.dirs['app'].join('fose_loader.exe') def IsPresent(self): return self.exePath.exists() def GetBitmapButton(self,window,style=0): if self.IsPresent(): self.gButton = bitmapButton(window,self.image.GetBitmap(),style=style, onClick=self.Execute,tip=self.tip) if self.foseArg != None: App_Button.foseButtons.append(self) exeFose = bosh.dirs['app'].join('fose_loader.exe') if settings.get('bash.fose.on',False) and exeFose.exists(): self.gButton.SetToolTip(tooltip(self.foseTip)) return self.gButton else: return None def Execute(self,event,extraArgs=None): exeFose = bosh.dirs['app'].join('fose_loader.exe') exeArgs = self.exeArgs if self.foseArg != None and settings.get('bash.fose.on',False) and exeFose.exists(): exePath = exeFose if self.foseArg != '': exeArgs += (self.foseArg,) else: exePath = self.exePath exeArgs = (exePath.stail,)+exeArgs if extraArgs: exeArgs += extraArgs statusBar.SetStatusText(' '.join(exeArgs),1) cwd = bolt.Path.getcwd() exePath.head.setcwd() os.spawnv(os.P_NOWAIT,exePath.s,exeArgs) cwd.setcwd()
def Execute(self,event): itemId = self.data[0] masterInfo = self.window.data[itemId] masterName = masterInfo.name newName = GPath(re.sub('[mM]$','p','XX'+masterName.s)) #--Save Name masterInfo.setName(newName) self.window.ReList() self.window.PopulateItems()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Start Tes4Gecko.""" def __init__(self,exePathArgs,image,tip): """Initialize""" App_Button.__init__(self,exePathArgs,image,tip) self.java = GPath(os.environ['SYSTEMROOT']).join('system32','javaw.exe') self.jar = bosh.dirs['app'].join('Tes4Gecko.jar') self.javaArg = '-Xmx1024m' if GPath('bash.ini').exists(): bashIni = ConfigParser.ConfigParser() bashIni.read('bash.ini') if bashIni.has_option('General','sTes4GeckoJavaArg'): self.javaArg = bashIni.get('General','sTes4GeckoJavaArg').strip() def IsPresent(self): return self.java.exists() and self.jar.exists() def Execute(self,event): """Handle menu selection.""" cwd = bolt.Path.getcwd() self.jar.head.setcwd() os.spawnv(os.P_NOWAIT,self.java.s,(self.java.stail,self.javaArg,'-jar',self.jar.stail)) cwd.setcwd()
"""Start Tes4Gecko.""" def __init__(self,exePathArgs,image,tip): """Initialize""" App_Button.__init__(self,exePathArgs,image,tip) self.java = GPath(os.environ['SYSTEMROOT']).join('system32','javaw.exe') self.jar = bosh.dirs['app'].join('Tes4Gecko.jar') self.javaArg = '-Xmx1024m' if GPath('bash.ini').exists(): bashIni = ConfigParser.ConfigParser() bashIni.read('bash.ini') if bashIni.has_option('General','sTes4GeckoJavaArg'): self.javaArg = bashIni.get('General','sTes4GeckoJavaArg').strip() def IsPresent(self): return self.java.exists() and self.jar.exists() def Execute(self,event): """Handle menu selection.""" cwd = bolt.Path.getcwd() self.jar.head.setcwd() os.spawnv(os.P_NOWAIT,self.java.s,(self.java.stail,self.javaArg,'-jar',self.jar.stail)) cwd.setcwd()
def Execute(self,event,extraArgs=None): exeFose = bosh.dirs['app'].join('fose_loader.exe') exeArgs = self.exeArgs if self.foseArg != None and settings.get('bash.fose.on',False) and exeFose.exists(): exePath = exeFose if self.foseArg != '': exeArgs += (self.foseArg,) else: exePath = self.exePath exeArgs = (exePath.stail,)+exeArgs if extraArgs: exeArgs += extraArgs statusBar.SetStatusText(' '.join(exeArgs),1) cwd = bolt.Path.getcwd() exePath.head.setcwd() os.spawnv(os.P_NOWAIT,exePath.s,exeArgs) cwd.setcwd()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Allow some extra args for FO3Edit.""" def Execute(self,event): extraArgs = [] if wx.GetKeyState(wx.WXK_CONTROL): extraArgs.append('-FixupPGRD') if settings['fo3Edit.iKnowWhatImDoing']: extraArgs.append('-IKnowWhatImDoing') App_Button.Execute(self,event,tuple(extraArgs))
"""Allow some extra args for FO3Edit.""" def Execute(self,event): extraArgs = [] if wx.GetKeyState(wx.WXK_CONTROL): extraArgs.append('-FixupPGRD') if settings['fo3Edit.iKnowWhatImDoing']: extraArgs.append('-IKnowWhatImDoing') App_Button.Execute(self,event,tuple(extraArgs))
def Execute(self,event): """Handle menu selection.""" cwd = bolt.Path.getcwd() self.jar.head.setcwd() os.spawnv(os.P_NOWAIT,self.java.s,(self.java.stail,self.javaArg,'-jar',self.jar.stail)) cwd.setcwd()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""loads BOSS""" def Execute(self,event): App_Button.Execute(self,event)
"""loads BOSS""" def Execute(self,event): App_Button.Execute(self,event)
def Execute(self,event): extraArgs = [] if wx.GetKeyState(wx.WXK_CONTROL): extraArgs.append('-FixupPGRD') if settings['fo3Edit.iKnowWhatImDoing']: extraArgs.append('-IKnowWhatImDoing') App_Button.Execute(self,event,tuple(extraArgs))
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Will close app on execute if autoquit is on.""" def Execute(self,event): App_Button.Execute(self,event) if settings.get('bash.autoQuit.on',False): bashFrame.Close()
"""Will close app on execute if autoquit is on.""" def Execute(self,event): App_Button.Execute(self,event) if settings.get('bash.autoQuit.on',False): bashFrame.Close()
def Execute(self,event): App_Button.Execute(self,event)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Fose on/off state button.""" def __init__(self): Link.__init__(self) self.gButton = None def SetState(self,state=None): """Sets state related info. If newState != none, sets to new state first. For convenience, returns state when done.""" if state == None: state = settings.get('bash.fose.on',False) elif state == -1: state = not settings.get('bash.fose.on',False) settings['bash.fose.on'] = state image = images[('checkbox.green.off','checkbox.green.on')[state]] tip = (_("FOSE Disabled"),_("FOSE Enabled"))[state] self.gButton.SetBitmapLabel(image.GetBitmap()) self.gButton.SetToolTip(tooltip(tip)) tipAttr = ('tip','foseTip')[state] for button in App_Button.foseButtons: button.gButton.SetToolTip(tooltip(getattr(button,tipAttr,''))) def GetBitmapButton(self,window,style=0): exeFose = bosh.dirs['app'].join('fose_loader.exe') if exeFose.exists(): bitmap = images['checkbox.green.off'].GetBitmap() self.gButton = bitmapButton(window,bitmap,style=style,onClick=self.Execute) self.gButton.SetSize((16,16)) self.SetState() return self.gButton else: return None def Execute(self,event): """Invert state.""" self.SetState(-1)
"""Fose on/off state button.""" def __init__(self): Link.__init__(self) self.gButton = None def SetState(self,state=None): """Sets state related info. If newState != none, sets to new state first. For convenience, returns state when done.""" if state == None: state = settings.get('bash.fose.on',False) elif state == -1: state = not settings.get('bash.fose.on',False) settings['bash.fose.on'] = state image = images[('checkbox.green.off','checkbox.green.on')[state]] tip = (_("FOSE Disabled"),_("FOSE Enabled"))[state] self.gButton.SetBitmapLabel(image.GetBitmap()) self.gButton.SetToolTip(tooltip(tip)) tipAttr = ('tip','foseTip')[state] for button in App_Button.foseButtons: button.gButton.SetToolTip(tooltip(getattr(button,tipAttr,''))) def GetBitmapButton(self,window,style=0): exeFose = bosh.dirs['app'].join('fose_loader.exe') if exeFose.exists(): bitmap = images['checkbox.green.off'].GetBitmap() self.gButton = bitmapButton(window,bitmap,style=style,onClick=self.Execute) self.gButton.SetSize((16,16)) self.SetState() return self.gButton else: return None def Execute(self,event): """Invert state.""" self.SetState(-1)
def Execute(self,event): App_Button.Execute(self,event) if settings.get('bash.autoQuit.on',False): bashFrame.Close()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Button toggling application closure when launching Fallout3.""" def __init__(self): Link.__init__(self) self.gButton = None def SetState(self,state=None): """Sets state related info. If newState != none, sets to new state first. For convenience, returns state when done.""" if state == None: state = settings.get('bash.autoQuit.on',False) elif state == -1: state = not settings.get('bash.autoQuit.on',False) settings['bash.autoQuit.on'] = state image = images[('checkbox.red.off','checkbox.red.x')[state]] tip = (_("Auto-Quit Disabled"),_("Auto-Quit Enabled"))[state] self.gButton.SetBitmapLabel(image.GetBitmap()) self.gButton.SetToolTip(tooltip(tip)) def GetBitmapButton(self,window,style=0): bitmap = images['checkbox.red.off'].GetBitmap() self.gButton = bitmapButton(window,bitmap,style=style,onClick=self.Execute) self.gButton.SetSize((16,16)) self.SetState() return self.gButton def Execute(self,event): """Invert state.""" self.SetState(-1)
"""Button toggling application closure when launching Fallout3.""" def __init__(self): Link.__init__(self) self.gButton = None def SetState(self,state=None): """Sets state related info. If newState != none, sets to new state first. For convenience, returns state when done.""" if state == None: state = settings.get('bash.autoQuit.on',False) elif state == -1: state = not settings.get('bash.autoQuit.on',False) settings['bash.autoQuit.on'] = state image = images[('checkbox.red.off','checkbox.red.x')[state]] tip = (_("Auto-Quit Disabled"),_("Auto-Quit Enabled"))[state] self.gButton.SetBitmapLabel(image.GetBitmap()) self.gButton.SetToolTip(tooltip(tip)) def GetBitmapButton(self,window,style=0): bitmap = images['checkbox.red.off'].GetBitmap() self.gButton = bitmapButton(window,bitmap,style=style,onClick=self.Execute) self.gButton.SetSize((16,16)) self.SetState() return self.gButton def Execute(self,event): """Invert state.""" self.SetState(-1)
def Execute(self,event): """Invert state.""" self.SetState(-1)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Show help browser.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['help'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Help File")) return gButton def Execute(self,event): """Handle menu selection.""" bolt.Path.getcwd().join('Wrye Bash.html').start()
"""Show help browser.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['help'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Help File")) return gButton def Execute(self,event): """Handle menu selection.""" bolt.Path.getcwd().join('Wrye Bash.html').start()
def Execute(self,event): """Invert state.""" self.SetState(-1)
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Show doc browser.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['doc.on'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Doc Browser")) return gButton def Execute(self,event): """Handle menu selection.""" if not docBrowser: DocBrowser().Show() settings['bash.modDocs.show'] = True docBrowser.Raise()
"""Show doc browser.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['doc.on'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Doc Browser")) return gButton def Execute(self,event): """Handle menu selection.""" if not docBrowser: DocBrowser().Show() settings['bash.modDocs.show'] = True docBrowser.Raise()
def Execute(self,event): """Handle menu selection.""" bolt.Path.getcwd().join('Wrye Bash.html').start()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Show mod checker.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['modChecker'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Mod Checker")) return gButton def Execute(self,event): """Handle menu selection.""" if not modChecker: ModChecker().Show() modChecker.Raise()
"""Show mod checker.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['modChecker'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Mod Checker")) return gButton def Execute(self,event): """Handle menu selection.""" if not modChecker: ModChecker().Show() modChecker.Raise()
def Execute(self,event): """Handle menu selection.""" if not docBrowser: DocBrowser().Show() settings['bash.modDocs.show'] = True #balt.ensureDisplayed(docBrowser) docBrowser.Raise()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Start bashmon.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['bashmon'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Launch BashMon")) return gButton def Execute(self,event): """Handle menu selection.""" bolt.Path.getcwd().join('bashmon.py').start()
"""Start bashmon.""" def GetBitmapButton(self,window,style=0): if not self.id: self.id = wx.NewId() gButton = bitmapButton(window,images['bashmon'].GetBitmap(),style=style, onClick=self.Execute,tip=_("Launch BashMon")) return gButton def Execute(self,event): """Handle menu selection.""" bolt.Path.getcwd().join('bashmon.py').start()
def Execute(self,event): """Handle menu selection.""" if not modChecker: ModChecker().Show() #balt.ensureDisplayed(docBrowser) modChecker.Raise()
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Initializes settings dictionary for bosh and basher.""" bosh.initSettings() global settings balt._settings = bosh.settings balt.sizes = bosh.settings.getChanged('bash.window.sizes',{}) settings = bosh.settings settings.loadDefaults(settingDefaults) settings['balt.WryeLog.temp'] = bosh.dirs['saveBase'].join('WryeLogTemp.html') settings['balt.WryeLog.cssDir'] = bosh.dirs['mods'].join('Docs')
"""Initializes settings dictionary for bosh and basher.""" bosh.initSettings() global settings balt._settings = bosh.settings balt.sizes = bosh.settings.getChanged('bash.window.sizes',{}) settings = bosh.settings settings.loadDefaults(settingDefaults) settings['balt.WryeLog.temp'] = bosh.dirs['saveBase'].join('WryeLogTemp.html') settings['balt.WryeLog.cssDir'] = bosh.dirs['mods'].join('Docs')
def InitSettings(): """Initializes settings dictionary for bosh and basher.""" bosh.initSettings() global settings balt._settings = bosh.settings balt.sizes = bosh.settings.getChanged('bash.window.sizes',{}) settings = bosh.settings settings.loadDefaults(settingDefaults) #--Wrye Balt settings['balt.WryeLog.temp'] = bosh.dirs['saveBase'].join('WryeLogTemp.html') settings['balt.WryeLog.cssDir'] = bosh.dirs['mods'].join('Docs')
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Initialize color and image collections.""" colors['bash.esm'] = (220,220,255) colors['bash.doubleTime.not'] = 'WHITE' colors['bash.doubleTime.exists'] = (255,220,220) colors['bash.doubleTime.load'] = (255,100,100) colors['bash.exOverLoaded'] = (0xFF,0x99,0) colors['bash.masters.remapped'] = (100,255,100) colors['bash.masters.changed'] = (220,255,220) colors['bash.mods.isMergeable'] = (0x00,0x99,0x00) colors['bash.mods.groupHeader'] = (0xD8,0xD8,0xD8) colors['bash.mods.isGhost'] = (0xe8,0xe8,0xe8) colors['bash.installers.skipped'] = (0xe0,0xe0,0xe0) colors['bash.installers.outOfOrder'] = (0xDF,0xDF,0xC5) colors['bash.installers.dirty'] = (0xFF,0xBB,0x33) images['save.on'] = Image(r'images/save_on.png',wx.BITMAP_TYPE_PNG) images['save.off'] = Image(r'images/save_off.png',wx.BITMAP_TYPE_PNG) images['help'] = Image(r'images/help.png',wx.BITMAP_TYPE_PNG) images['doc.on'] = Image(r'images/page_find.png',wx.BITMAP_TYPE_PNG) images['bashmon'] = Image(r'images/group_gear.png',wx.BITMAP_TYPE_PNG) images['modChecker'] = Image(r'images/table_error.png',wx.BITMAP_TYPE_PNG) images['checkbox.red.x'] = Image(r'images/checkbox_red_x.png',wx.BITMAP_TYPE_PNG) images['checkbox.green.on.32'] = (Image(r'images/checkbox_green_on_32.png',wx.BITMAP_TYPE_PNG)) images['checkbox.blue.on.32'] = (Image(r'images/checkbox_blue_on_32.png',wx.BITMAP_TYPE_PNG)) images['bash.16'] = Image(r'images/bash_16.png',wx.BITMAP_TYPE_PNG) images['bash.32'] = Image(r'images/bash_32.png',wx.BITMAP_TYPE_PNG) images['bash.16.blue'] = Image(r'images/bash_16_blue.png',wx.BITMAP_TYPE_PNG) images['bash.32.blue'] = Image(r'images/bash_32_blue.png',wx.BITMAP_TYPE_PNG) global bashRed bashRed = balt.ImageBundle() bashRed.Add(images['bash.16']) bashRed.Add(images['bash.32']) global bashBlue bashBlue = balt.ImageBundle() bashBlue.Add(images['bash.16.blue']) bashBlue.Add(images['bash.32.blue'])
"""Initialize color and image collections.""" colors['bash.esm'] = (220,220,255) colors['bash.doubleTime.not'] = 'WHITE' colors['bash.doubleTime.exists'] = (255,220,220) colors['bash.doubleTime.load'] = (255,100,100) colors['bash.exOverLoaded'] = (0xFF,0x99,0) colors['bash.masters.remapped'] = (100,255,100) colors['bash.masters.changed'] = (220,255,220) colors['bash.mods.isMergeable'] = (0x00,0x99,0x00) colors['bash.mods.groupHeader'] = (0xD8,0xD8,0xD8) colors['bash.mods.isGhost'] = (0xe8,0xe8,0xe8) colors['bash.installers.skipped'] = (0xe0,0xe0,0xe0) colors['bash.installers.outOfOrder'] = (0xDF,0xDF,0xC5) colors['bash.installers.dirty'] = (0xFF,0xBB,0x33) images['save.on'] = Image(r'images/save_on.png',wx.BITMAP_TYPE_PNG) images['save.off'] = Image(r'images/save_off.png',wx.BITMAP_TYPE_PNG) images['help'] = Image(r'images/help.png',wx.BITMAP_TYPE_PNG) images['doc.on'] = Image(r'images/page_find.png',wx.BITMAP_TYPE_PNG) images['bashmon'] = Image(r'images/group_gear.png',wx.BITMAP_TYPE_PNG) images['modChecker'] = Image(r'images/table_error.png',wx.BITMAP_TYPE_PNG) images['checkbox.red.x'] = Image(r'images/checkbox_red_x.png',wx.BITMAP_TYPE_PNG) images['checkbox.green.on.32'] = (Image(r'images/checkbox_green_on_32.png',wx.BITMAP_TYPE_PNG)) images['checkbox.blue.on.32'] = (Image(r'images/checkbox_blue_on_32.png',wx.BITMAP_TYPE_PNG)) images['bash.16'] = Image(r'images/bash_16.png',wx.BITMAP_TYPE_PNG) images['bash.32'] = Image(r'images/bash_32.png',wx.BITMAP_TYPE_PNG) images['bash.16.blue'] = Image(r'images/bash_16_blue.png',wx.BITMAP_TYPE_PNG) images['bash.32.blue'] = Image(r'images/bash_32_blue.png',wx.BITMAP_TYPE_PNG) global bashRed bashRed = balt.ImageBundle() bashRed.Add(images['bash.16']) bashRed.Add(images['bash.32']) global bashBlue bashBlue = balt.ImageBundle() bashBlue.Add(images['bash.16.blue']) bashBlue.Add(images['bash.32.blue'])
def InitImages(): """Initialize color and image collections.""" #--Colors colors['bash.esm'] = (220,220,255) colors['bash.doubleTime.not'] = 'WHITE' colors['bash.doubleTime.exists'] = (255,220,220) colors['bash.doubleTime.load'] = (255,100,100) colors['bash.exOverLoaded'] = (0xFF,0x99,0) colors['bash.masters.remapped'] = (100,255,100) colors['bash.masters.changed'] = (220,255,220) colors['bash.mods.isMergeable'] = (0x00,0x99,0x00) colors['bash.mods.groupHeader'] = (0xD8,0xD8,0xD8) colors['bash.mods.isGhost'] = (0xe8,0xe8,0xe8) colors['bash.installers.skipped'] = (0xe0,0xe0,0xe0) colors['bash.installers.outOfOrder'] = (0xDF,0xDF,0xC5) colors['bash.installers.dirty'] = (0xFF,0xBB,0x33) #--Standard images['save.on'] = Image(r'images/save_on.png',wx.BITMAP_TYPE_PNG) images['save.off'] = Image(r'images/save_off.png',wx.BITMAP_TYPE_PNG) #--Misc #images['fallout3'] = Image(r'images/fallout3.png',wx.BITMAP_TYPE_PNG) images['help'] = Image(r'images/help.png',wx.BITMAP_TYPE_PNG) #--Tools images['doc.on'] = Image(r'images/page_find.png',wx.BITMAP_TYPE_PNG) images['bashmon'] = Image(r'images/group_gear.png',wx.BITMAP_TYPE_PNG) images['modChecker'] = Image(r'images/table_error.png',wx.BITMAP_TYPE_PNG) #--ColorChecks images['checkbox.red.x'] = Image(r'images/checkbox_red_x.png',wx.BITMAP_TYPE_PNG) images['checkbox.green.on.32'] = (Image(r'images/checkbox_green_on_32.png',wx.BITMAP_TYPE_PNG)) images['checkbox.blue.on.32'] = (Image(r'images/checkbox_blue_on_32.png',wx.BITMAP_TYPE_PNG)) #--Bash images['bash.16'] = Image(r'images/bash_16.png',wx.BITMAP_TYPE_PNG) images['bash.32'] = Image(r'images/bash_32.png',wx.BITMAP_TYPE_PNG) images['bash.16.blue'] = Image(r'images/bash_16_blue.png',wx.BITMAP_TYPE_PNG) images['bash.32.blue'] = Image(r'images/bash_32_blue.png',wx.BITMAP_TYPE_PNG) #--Applications Icons global bashRed bashRed = balt.ImageBundle() bashRed.Add(images['bash.16']) bashRed.Add(images['bash.32']) #--Application Subwindow Icons global bashBlue bashBlue = balt.ImageBundle() bashBlue.Add(images['bash.16.blue']) bashBlue.Add(images['bash.32.blue'])
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
"""Initialize status bar links.""" BashStatusBar.buttons.append(Fose_Button()) BashStatusBar.buttons.append(AutoQuit_Button()) BashStatusBar.buttons.append( Fallout3_Button( bosh.dirs['app'].join('Fallout3.exe'), Image(r'images/fallout3.png'), _("Launch Fallout3"), _("Launch Fallout3 + FOSE"), '')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('GECK.exe'), Image(r'images/geck.png'), _("Launch GECK"), _("Launch GECK + FOSE"), '-editor')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('fomm\\fomm.exe'), Image(r'images/database_connect.png'), _("Launch FOMM"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath'], '-view'), Image(r'images/brick_edit.png'), _("Launch FO3View"))) BashStatusBar.buttons.append( App_FO3Edit( dirs['FO3EditPath']), Image(r'images/brick.png'), _("Launch FO3Edit"))) BashStatusBar.buttons.append( App_FO3Edit( (dirs['FO3EditPath'],'-translate'), Image(r'images/brick_error.png'), _("Launch FO3Trans"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/Boss1.png'), _("Launch BOSS"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/boss2.png'), _("Launch BOSS")))
"""Initialize status bar links.""" BashStatusBar.buttons.append(Fose_Button()) BashStatusBar.buttons.append(AutoQuit_Button()) BashStatusBar.buttons.append( Fallout3_Button( bosh.dirs['app'].join('Fallout3.exe'), Image(r'images/fallout3.png'), _("Launch Fallout3"), _("Launch Fallout3 + FOSE"), '')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('GECK.exe'), Image(r'images/geck.png'), _("Launch GECK"), _("Launch GECK + FOSE"), '-editor')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('fomm\\fomm.exe'), Image(r'images/database_connect.png'), _("Launch FOMM"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath'], '-view'), Image(r'images/brick_edit.png'), _("Launch FO3View"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath']), Image(r'images/brick.png'), _("Launch FO3Edit"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath'],'-translate'), Image(r'images/brick_error.png'), _("Launch FO3Trans"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/Boss1.png'), _("Launch BOSS"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/boss2.png'), _("Launch BOSS")))
def InitStatusBar(): """Initialize status bar links.""" #--Bash Status/LinkBar #BashStatusBar.buttons.append(App_Fallout3()) BashStatusBar.buttons.append(Fose_Button()) BashStatusBar.buttons.append(AutoQuit_Button()) BashStatusBar.buttons.append( Fallout3_Button( bosh.dirs['app'].join('Fallout3.exe'), Image(r'images/fallout3.png'), _("Launch Fallout3"), _("Launch Fallout3 + FOSE"), '')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('GECK.exe'), Image(r'images/geck.png'), _("Launch GECK"), _("Launch GECK + FOSE"), '-editor')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('fomm\\fomm.exe'), Image(r'images/database_connect.png'), _("Launch FOMM"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath'], '-view'), Image(r'images/brick_edit.png'), _("Launch FO3View"))) BashStatusBar.buttons.append( App_FO3Edit( dirs['FO3EditPath']), Image(r'images/brick.png'), _("Launch FO3Edit"))) BashStatusBar.buttons.append( App_FO3Edit( (dirs['FO3EditPath'],'-translate'), Image(r'images/brick_error.png'), _("Launch FO3Trans"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/Boss1.png'), _("Launch BOSS"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/boss2.png'), _("Launch BOSS"))) if bosh.inisettings['showmodelingtoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['BlenderPath'], Image(r'images/blender.png'), _("Launch Blender"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['GmaxPath'], Image(r'images/gmax.png'), _("Launch Gmax"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['MayaPath'], Image(r'images/maya.png'), _("Launch Maya"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['MaxPath'], Image(r'images/max.png'), _("Launch 3dsMax"))) if bosh.inisettings['showmodelingtoollaunchers'] or bosh.inisettings['showtexturetoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['NifskopePath'], Image(r'images/nifskope.png'), _("Launch Nifskope"))) if bosh.inisettings['showtexturetoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['GIMP'], Image(r'images/gimp.png'), _("Launch GIMP"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Photoshop'], Image(r'images/photoshop.png'), _("Launch Photoshop"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Artweaver'], Image(r'images/artweaver.png'), _("Launch Artweaver"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['PaintNET'], Image(r'images/paint.net.png'), _("Launch Paint.NET"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['DDSConverter'], Image(r'images/ddsconverter.png'), _("Launch DDSConverter"))) if bosh.inisettings['showaudiotoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['Audacity'], Image(r'images/audacity.png'), _("Launch Audacity"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Fraps'], Image(r'images/fraps.png'), _("Launch Fraps"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['NPP'], Image(r'images/notepad++.png'), _("Launch Notepad++"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom1'], Image(r'images/custom1.png'), _(bosh.inisettings['custom1txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom2'], Image(r'images/custom2.png'), _(bosh.inisettings['custom2txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom3'], Image(r'images/custom3.png'), _(bosh.inisettings['custom3txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom4'], Image(r'images/custom4.png'), _(bosh.inisettings['custom4txt']))) BashStatusBar.buttons.append(App_BashMon()) BashStatusBar.buttons.append(App_DocBrowser()) BashStatusBar.buttons.append(App_ModChecker()) BashStatusBar.buttons.append(App_Help())
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
App_Button( bosh.dirs['BlenderPath'], Image(r'images/blender.png'), _("Launch Blender")))
App_Button( bosh.dirs['BlenderPath'], Image(r'images/blender.png'), _("Launch Blender")))
def InitStatusBar(): """Initialize status bar links.""" #--Bash Status/LinkBar #BashStatusBar.buttons.append(App_Fallout3()) BashStatusBar.buttons.append(Fose_Button()) BashStatusBar.buttons.append(AutoQuit_Button()) BashStatusBar.buttons.append( Fallout3_Button( bosh.dirs['app'].join('Fallout3.exe'), Image(r'images/fallout3.png'), _("Launch Fallout3"), _("Launch Fallout3 + FOSE"), '')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('GECK.exe'), Image(r'images/geck.png'), _("Launch GECK"), _("Launch GECK + FOSE"), '-editor')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('fomm\\fomm.exe'), Image(r'images/database_connect.png'), _("Launch FOMM"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath'], '-view'), Image(r'images/brick_edit.png'), _("Launch FO3View"))) BashStatusBar.buttons.append( App_FO3Edit( dirs['FO3EditPath']), Image(r'images/brick.png'), _("Launch FO3Edit"))) BashStatusBar.buttons.append( App_FO3Edit( (dirs['FO3EditPath'],'-translate'), Image(r'images/brick_error.png'), _("Launch FO3Trans"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/Boss1.png'), _("Launch BOSS"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/boss2.png'), _("Launch BOSS"))) if bosh.inisettings['showmodelingtoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['BlenderPath'], Image(r'images/blender.png'), _("Launch Blender"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['GmaxPath'], Image(r'images/gmax.png'), _("Launch Gmax"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['MayaPath'], Image(r'images/maya.png'), _("Launch Maya"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['MaxPath'], Image(r'images/max.png'), _("Launch 3dsMax"))) if bosh.inisettings['showmodelingtoollaunchers'] or bosh.inisettings['showtexturetoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['NifskopePath'], Image(r'images/nifskope.png'), _("Launch Nifskope"))) if bosh.inisettings['showtexturetoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['GIMP'], Image(r'images/gimp.png'), _("Launch GIMP"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Photoshop'], Image(r'images/photoshop.png'), _("Launch Photoshop"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Artweaver'], Image(r'images/artweaver.png'), _("Launch Artweaver"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['PaintNET'], Image(r'images/paint.net.png'), _("Launch Paint.NET"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['DDSConverter'], Image(r'images/ddsconverter.png'), _("Launch DDSConverter"))) if bosh.inisettings['showaudiotoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['Audacity'], Image(r'images/audacity.png'), _("Launch Audacity"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Fraps'], Image(r'images/fraps.png'), _("Launch Fraps"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['NPP'], Image(r'images/notepad++.png'), _("Launch Notepad++"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom1'], Image(r'images/custom1.png'), _(bosh.inisettings['custom1txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom2'], Image(r'images/custom2.png'), _(bosh.inisettings['custom2txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom3'], Image(r'images/custom3.png'), _(bosh.inisettings['custom3txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom4'], Image(r'images/custom4.png'), _(bosh.inisettings['custom4txt']))) BashStatusBar.buttons.append(App_BashMon()) BashStatusBar.buttons.append(App_DocBrowser()) BashStatusBar.buttons.append(App_ModChecker()) BashStatusBar.buttons.append(App_Help())
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py
App_Button( bosh.dirs['GmaxPath'], Image(r'images/gmax.png'), _("Launch Gmax")))
App_Button( bosh.dirs['GmaxPath'], Image(r'images/gmax.png'), _("Launch Gmax")))
def InitStatusBar(): """Initialize status bar links.""" #--Bash Status/LinkBar #BashStatusBar.buttons.append(App_Fallout3()) BashStatusBar.buttons.append(Fose_Button()) BashStatusBar.buttons.append(AutoQuit_Button()) BashStatusBar.buttons.append( Fallout3_Button( bosh.dirs['app'].join('Fallout3.exe'), Image(r'images/fallout3.png'), _("Launch Fallout3"), _("Launch Fallout3 + FOSE"), '')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('GECK.exe'), Image(r'images/geck.png'), _("Launch GECK"), _("Launch GECK + FOSE"), '-editor')) BashStatusBar.buttons.append( App_Button( bosh.dirs['app'].join('fomm\\fomm.exe'), Image(r'images/database_connect.png'), _("Launch FOMM"))) BashStatusBar.buttons.append( App_FO3Edit( (bosh.dirs['FO3EditPath'], '-view'), Image(r'images/brick_edit.png'), _("Launch FO3View"))) BashStatusBar.buttons.append( App_FO3Edit( dirs['FO3EditPath']), Image(r'images/brick.png'), _("Launch FO3Edit"))) BashStatusBar.buttons.append( App_FO3Edit( (dirs['FO3EditPath'],'-translate'), Image(r'images/brick_error.png'), _("Launch FO3Trans"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/Boss1.png'), _("Launch BOSS"))) BashStatusBar.buttons.append( App_BOSS( bosh.dirs['app'].join('Data\\BOSS-F.bat'), Image(r'images/boss2.png'), _("Launch BOSS"))) if bosh.inisettings['showmodelingtoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['BlenderPath'], Image(r'images/blender.png'), _("Launch Blender"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['GmaxPath'], Image(r'images/gmax.png'), _("Launch Gmax"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['MayaPath'], Image(r'images/maya.png'), _("Launch Maya"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['MaxPath'], Image(r'images/max.png'), _("Launch 3dsMax"))) if bosh.inisettings['showmodelingtoollaunchers'] or bosh.inisettings['showtexturetoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['NifskopePath'], Image(r'images/nifskope.png'), _("Launch Nifskope"))) if bosh.inisettings['showtexturetoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['GIMP'], Image(r'images/gimp.png'), _("Launch GIMP"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Photoshop'], Image(r'images/photoshop.png'), _("Launch Photoshop"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Artweaver'], Image(r'images/artweaver.png'), _("Launch Artweaver"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['PaintNET'], Image(r'images/paint.net.png'), _("Launch Paint.NET"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['DDSConverter'], Image(r'images/ddsconverter.png'), _("Launch DDSConverter"))) if bosh.inisettings['showaudiotoollaunchers']: BashStatusBar.buttons.append( App_Button( bosh.dirs['Audacity'], Image(r'images/audacity.png'), _("Launch Audacity"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Fraps'], Image(r'images/fraps.png'), _("Launch Fraps"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['NPP'], Image(r'images/notepad++.png'), _("Launch Notepad++"))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom1'], Image(r'images/custom1.png'), _(bosh.inisettings['custom1txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom2'], Image(r'images/custom2.png'), _(bosh.inisettings['custom2txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom3'], Image(r'images/custom3.png'), _(bosh.inisettings['custom3txt']))) BashStatusBar.buttons.append( App_Button( bosh.dirs['Custom4'], Image(r'images/custom4.png'), _(bosh.inisettings['custom4txt']))) BashStatusBar.buttons.append(App_BashMon()) BashStatusBar.buttons.append(App_DocBrowser()) BashStatusBar.buttons.append(App_ModChecker()) BashStatusBar.buttons.append(App_Help())
3ac43907fa076fea1e8d682219e2b28fc7419f7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3ac43907fa076fea1e8d682219e2b28fc7419f7b/basher.py