bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} spell = (GPath('Oblivion.esm'), 0x02B54E) keep = patchFile.getKeeper() for record in patchFile.CREA.records: if not record.full: continue #for unnamed creatures else next if crashes. if 'boar' in record.full.lower() or 'boar' in record.model.modPath.lower() or 'boar' in record.eid.lower(): if spell not in record.spells: record.spells.append(spell) keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log.setHeader(_('===As Intended: Boars')) log(_('* %d Boars Tweaked') % (sum(count.values()),)) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} spell = (GPath('Oblivion.esm'), 0x02B54E) keep = patchFile.getKeeper() for record in patchFile.CREA.records: if not record.full: continue #for unnamed creatures else next if crashes. if 'boar' in record.full.lower() or 'boar' in record.model.modPath.lower() or 'boar' in record.eid.lower(): if spell not in record.spells: record.spells.append(spell) keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log.setHeader(_('===As Intended: Boars')) log(_('* %d Boars Tweaked') % (sum(count.values()),)) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
478,600
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} spell = (GPath('Oblivion.esm'), 0x02B54E) keep = patchFile.getKeeper() for record in patchFile.CREA.records: if not record.full: continue #for unnamed creatures else next if crashes. if 'boar' in record.full.lower() or 'boar' in record.model.modPath.lower() or 'boar' in record.eid.lower(): if spell not in record.spells: record.spells.append(spell) keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log.setHeader(_('===As Intended: Boars')) log(_('* %d Boars Tweaked') % (sum(count.values()),)) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} spell = (GPath('Oblivion.esm'), 0x02B54E) keep = patchFile.getKeeper() for record in patchFile.CREA.records: if not record.full: continue #for unnamed creatures else next if crashes. if 'boar' in record.full.lower() or 'boar' in record.model.modPath.lower() or 'boar' in record.eid.lower(): if spell not in record.spells: record.spells.append(spell) keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log.setHeader(_('===As Intended: Boars')) log(_('* %d Boars Tweaked') % (sum(count.values()),)) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
478,601
def Get(self,status,on): self.GetImageList() if on == 3: if status <= -20: shortKey = 'purple.imp' elif status <= -10: shortKey = 'blue.imp' elif status <= 0: shortKey = 'green.imp' elif status <=10: shortKey = 'yellow.imp' elif status <=20: shortKey = 'orange.imp' else: shortKey = 'red.imp' elif on == 2: if status <= -20: shortKey = 'purple.inc' elif status <= -10: shortKey = 'blue.inc' elif status <= 0: shortKey = 'green.inc' elif status <=10: shortKey = 'yellow.inc' elif status <=20: shortKey = 'orange.inc' else: shortKey = 'red.inc' elif on: if status <= -20: shortKey = 'purple.on' elif status <= -10: shortKey = 'blue.on' elif status <= 0: shortKey = 'green.on' elif status <=10: shortKey = 'yellow.on' elif status <=20: shortKey = 'orange.on' else: shortKey = 'red.on' else: if status <= -20: shortKey = 'purple.off' elif status <= -10: shortKey = 'blue.off' elif status == 0: shortKey = 'green.off' elif status <=10: shortKey = 'yellow.off' elif status <=20: shortKey = 'orange.off' else: shortKey = 'red.off' return self.indices[shortKey]
def Get(self,status,on): self.GetImageList() if on == 3: if status <= -20: shortKey = 'purple.imp' elif status <= -10: shortKey = 'blue.imp' elif status <= 0: shortKey = 'green.imp' elif status <=10: shortKey = 'yellow.imp' elif status <=20: shortKey = 'orange.imp' else: shortKey = 'red.imp' elif on == 2: if status <= -20: shortKey = 'purple.inc' elif status <= -10: shortKey = 'blue.inc' elif status <= 0: shortKey = 'green.inc' elif status <=10: shortKey = 'yellow.inc' elif status <=20: shortKey = 'orange.inc' else: shortKey = 'red.inc' elif on: if status <= -20: shortKey = 'purple.on' elif status <= -10: shortKey = 'blue.on' elif status <= 0: shortKey = 'green.on' elif status <=10: shortKey = 'yellow.on' elif status <=20: shortKey = 'orange.on' else: shortKey = 'red.on' else: if status <= -20: shortKey = 'purple.off' elif status <= -10: shortKey = 'blue.off' elif status == 0: shortKey = 'green.off' elif status <=10: shortKey = 'yellow.off' elif status <=20: shortKey = 'orange.off' else: shortKey = 'red.off' return self.indices[shortKey]
478,602
def Get(self,status,on): self.GetImageList() if on == 3: if status <= -20: shortKey = 'purple.imp' elif status <= -10: shortKey = 'blue.imp' elif status <= 0: shortKey = 'green.imp' elif status <=10: shortKey = 'yellow.imp' elif status <=20: shortKey = 'orange.imp' else: shortKey = 'red.imp' elif on == 2: if status <= -20: shortKey = 'purple.inc' elif status <= -10: shortKey = 'blue.inc' elif status <= 0: shortKey = 'green.inc' elif status <=10: shortKey = 'yellow.inc' elif status <=20: shortKey = 'orange.inc' else: shortKey = 'red.inc' elif on: if status <= -20: shortKey = 'purple.on' elif status <= -10: shortKey = 'blue.on' elif status <= 0: shortKey = 'green.on' elif status <=10: shortKey = 'yellow.on' elif status <=20: shortKey = 'orange.on' else: shortKey = 'red.on' else: if status <= -20: shortKey = 'purple.off' elif status <= -10: shortKey = 'blue.off' elif status == 0: shortKey = 'green.off' elif status <=10: shortKey = 'yellow.off' elif status <=20: shortKey = 'orange.off' else: shortKey = 'red.off' return self.indices[shortKey]
def Get(self,status,on): self.GetImageList() if on == 3: if status <= -20: shortKey = 'purple.imp' elif status <= -10: shortKey = 'blue.imp' elif status <= 0: shortKey = 'green.imp' elif status <=10: shortKey = 'yellow.imp' elif status <=20: shortKey = 'orange.imp' else: shortKey = 'red.imp' elif on == 2: if status <= -20: shortKey = 'purple.inc' elif status <= -10: shortKey = 'blue.inc' elif status <= 0: shortKey = 'green.inc' elif status <=10: shortKey = 'yellow.inc' elif status <=20: shortKey = 'orange.inc' else: shortKey = 'red.inc' elif on: if status <= -20: shortKey = 'purple.on' elif status <= -10: shortKey = 'blue.on' elif status <= 0: shortKey = 'green.on' elif status <=10: shortKey = 'yellow.on' elif status <=20: shortKey = 'orange.on' else: shortKey = 'red.on' else: if status <= -20: shortKey = 'purple.off' elif status <= -10: shortKey = 'blue.off' elif status == 0: shortKey = 'green.off' elif status <=10: shortKey = 'yellow.off' elif status <=20: shortKey = 'orange.off' else: shortKey = 'red.off' return self.indices[shortKey]
478,603
def Get(self,status,on): self.GetImageList() if on == 3: if status <= -20: shortKey = 'purple.imp' elif status <= -10: shortKey = 'blue.imp' elif status <= 0: shortKey = 'green.imp' elif status <=10: shortKey = 'yellow.imp' elif status <=20: shortKey = 'orange.imp' else: shortKey = 'red.imp' elif on == 2: if status <= -20: shortKey = 'purple.inc' elif status <= -10: shortKey = 'blue.inc' elif status <= 0: shortKey = 'green.inc' elif status <=10: shortKey = 'yellow.inc' elif status <=20: shortKey = 'orange.inc' else: shortKey = 'red.inc' elif on: if status <= -20: shortKey = 'purple.on' elif status <= -10: shortKey = 'blue.on' elif status <= 0: shortKey = 'green.on' elif status <=10: shortKey = 'yellow.on' elif status <=20: shortKey = 'orange.on' else: shortKey = 'red.on' else: if status <= -20: shortKey = 'purple.off' elif status <= -10: shortKey = 'blue.off' elif status == 0: shortKey = 'green.off' elif status <=10: shortKey = 'yellow.off' elif status <=20: shortKey = 'orange.off' else: shortKey = 'red.off' return self.indices[shortKey]
def Get(self,status,on): self.GetImageList() if on == 3: if status <= -20: shortKey = 'purple.imp' elif status <= -10: shortKey = 'blue.imp' elif status <= 0: shortKey = 'green.imp' elif status <=10: shortKey = 'yellow.imp' elif status <=20: shortKey = 'orange.imp' else: shortKey = 'red.imp' elif on == 2: if status <= -20: shortKey = 'purple.inc' elif status <= -10: shortKey = 'blue.inc' elif status <= 0: shortKey = 'green.inc' elif status <=10: shortKey = 'yellow.inc' elif status <=20: shortKey = 'orange.inc' else: shortKey = 'red.inc' elif on: if status <= -20: shortKey = 'purple.on' elif status <= -10: shortKey = 'blue.on' elif status <= 0: shortKey = 'green.on' elif status <=10: shortKey = 'yellow.on' elif status <=20: shortKey = 'orange.on' else: shortKey = 'red.on' else: if status <= -20: shortKey = 'purple.off' elif status <= -10: shortKey = 'blue.off' elif status == 0: shortKey = 'green.off' elif status <=10: shortKey = 'yellow.off' elif status <=20: shortKey = 'orange.off' else: shortKey = 'red.off' return self.indices[shortKey]
478,604
def OnCloseWindow(self): """To be called when containing frame is closing. Use for saving data, scrollpos, etc.""" pass
def OnCloseWindow(self): """To be called when containing frame is closing. Use for saving data, scrollpos, etc.""" pass
478,605
def __init__(self, parent, ID, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, ID, pos, size, style=style) ListCtrlAutoWidthMixin.__init__(self)
def __init__(self, parent, ID, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, ID, pos, size, style=style) ListCtrlAutoWidthMixin.__init__(self)
478,606
def __init__(self,parent,id=-1,ctrlStyle=(wx.LC_REPORT | wx.LC_SINGLE_SEL)): wx.Panel.__init__(self,parent,id, style=wx.WANTS_CHARS) sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) self.SetSizeHints(-1,50) #--ListCtrl listId = self.listId = wx.NewId() self.list = ListCtrl(self, listId, style=ctrlStyle) self.checkboxes = colorChecks self.mouseItem = None self.mouseTexts = {} self.mouseTextPrev = '' self.vScrollPos = 0 #--Columns self.PopulateColumns() #--Items self.sortDirty = 0 self.PopulateItems() #--Events wx.EVT_SIZE(self, self.OnSize) #--Events: Items self.hitIcon = 0 wx.EVT_LEFT_DOWN(self.list,self.OnLeftDown) wx.EVT_COMMAND_RIGHT_CLICK(self.list, listId, self.DoItemMenu) #--Events: Columns wx.EVT_LIST_COL_CLICK(self, listId, self.DoItemSort) wx.EVT_LIST_COL_RIGHT_CLICK(self, listId, self.DoColumnMenu) wx.EVT_LIST_COL_END_DRAG(self,listId, self.OnColumnResize) #--Mouse movement self.list.Bind(wx.EVT_MOTION,self.OnMouse) self.list.Bind(wx.EVT_LEAVE_WINDOW,self.OnMouse) self.list.Bind(wx.EVT_SCROLLWIN,self.OnScroll)
def __init__(self,parent,id=-1,ctrlStyle=(wx.LC_REPORT | wx.LC_SINGLE_SEL)): wx.Panel.__init__(self,parent,id, style=wx.WANTS_CHARS) sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) self.SetSizeHints(-1,50) #--ListCtrl listId = self.listId = wx.NewId() self.list = ListCtrl(self, listId, style=ctrlStyle) self.checkboxes = colorChecks self.mouseItem = None self.mouseTexts = {} self.mouseTextPrev = '' self.vScrollPos = 0 #--Columns self.PopulateColumns() #--Items self.sortDirty = 0 self.PopulateItems() #--Events wx.EVT_SIZE(self, self.OnSize) #--Events: Items self.hitIcon = 0 wx.EVT_LEFT_DOWN(self.list,self.OnLeftDown) wx.EVT_COMMAND_RIGHT_CLICK(self.list, listId, self.DoItemMenu) #--Events: Columns wx.EVT_LIST_COL_CLICK(self, listId, self.DoItemSort) wx.EVT_LIST_COL_RIGHT_CLICK(self, listId, self.DoColumnMenu) wx.EVT_LIST_COL_END_DRAG(self,listId, self.OnColumnResize) #--Mouse movement self.list.Bind(wx.EVT_MOTION,self.OnMouse) self.list.Bind(wx.EVT_LEAVE_WINDOW,self.OnMouse) self.list.Bind(wx.EVT_SCROLLWIN,self.OnScroll)
478,607
def OnScroll(self,event): """Event: List was scrolled. Save so can be accessed later.""" if event.GetOrientation() == wx.VERTICAL: self.vScrollPos = event.GetPosition() event.Skip()
def OnScroll(self,event): """Event: List was scrolled. Save so can be accessed later.""" if event.GetOrientation() == wx.VERTICAL: self.vScrollPos = event.GetPosition() event.Skip()
478,608
def GetNewMasters(self): """Returns new master list.""" return [self.data[item].name for item in self.fileOrderItems]
def GetNewMasters(self): """Returns new master list.""" return [self.data[item].name for item in self.fileOrderItems]
478,609
def OnItemSelected(self,event): """Item Selected: Set mod details.""" modName = self.items[event.m_itemIndex] self.details.SetFile(modName) if docBrowser: docBrowser.SetMod(modName)
def OnItemSelected(self,event): """Item Selected: Set mod details.""" modName = self.items[event.m_itemIndex] self.details.SetFile(modName) if docBrowser: docBrowser.SetMod(modName)
478,610
def __init__(self,parent): wx.Panel.__init__(self, parent, -1) global modList modList = ModList(self) self.modDetails = ModDetails(self) modList.details = self.modDetails #--Events wx.EVT_SIZE(self,self.OnSize) #--Layout sizer = hSizer( (modList,1,wx.GROW), ((4,-1),0), (self.modDetails,0,wx.EXPAND)) self.SetSizer(sizer) self.modDetails.Fit()
def __init__(self,parent): wx.Panel.__init__(self, parent, -1) global modList modList = ModList(self) self.modDetails = ModDetails(self) modList.details = self.modDetails #--Events wx.EVT_SIZE(self,self.OnSize) #--Layout sizer = hSizer( (modList,1,wx.GROW), ((4,-1),0), (self.modDetails,0,wx.EXPAND)) self.SetSizer(sizer) self.modDetails.Fit()
478,611
def OnCloseWindow(self): """To be called when containing frame is closing. Use for saving data, scrollpos, etc.""" bosh.modInfos.table.save() settings['bash.mods.scrollPos'] = modList.vScrollPos
def OnCloseWindow(self): """To be called when containing frame is closing. Use for saving data, scrollpos, etc.""" bosh.modInfos.table.save() settings['bash.mods.scrollPos'] = modList.vScrollPos
478,612
def OnItemSelected(self,event=None): saveName = self.items[event.m_itemIndex] self.details.SetFile(saveName)
def OnItemSelected(self,event=None): saveName = self.items[event.m_itemIndex] self.details.SetFile(saveName)
478,613
def DoCancel(self,event): """Event: Clicked cancel button.""" self.SetFile(self.saveInfo.name)
def DoCancel(self,event): """Event: Clicked cancel button.""" self.SetFile(self.saveInfo.name)
478,614
def __init__(self,parent,data,icons=None,mainMenu=None,itemMenu=None, details=None,id=-1,style=(wx.LC_REPORT | wx.LC_SINGLE_SEL)): balt.Tank.__init__(self,parent,data,icons,mainMenu,itemMenu, details,id,style) self.gList.Bind(wx.EVT_CHAR, self.OnChar)
def __init__(self,parent,data,icons=None,mainMenu=None,itemMenu=None, details=None,id=-1,style=(wx.LC_REPORT | wx.LC_SINGLE_SEL)): balt.Tank.__init__(self,parent,data,icons,mainMenu,itemMenu, details,id,style) self.gList.Bind(wx.EVT_CHAR, self.OnChar)
478,615
def OnChar(self,event): """Char event: Reorder.""" if ((event.ControlDown() and event.GetKeyCode() in (wx.WXK_UP,wx.WXK_DOWN))): orderKey = lambda x: self.data.data[x].order maxPos = max(self.data.data[x].order for x in self.data.data) moveMod = (-1,1)[event.GetKeyCode() == wx.WXK_DOWN] for thisFile in sorted(self.GetSelected(),key=orderKey,reverse=(moveMod != -1)): newPos = self.data.data[thisFile].order + moveMod if newPos < 0 or maxPos < newPos: break self.data.moveArchives([thisFile],newPos) self.data.refresh(what='N') self.RefreshUI() event.Skip()
def OnChar(self,event): """Char event: Reorder.""" if ((event.ControlDown() and event.GetKeyCode() in (wx.WXK_UP,wx.WXK_DOWN))): orderKey = lambda x: self.data.data[x].order maxPos = max(self.data.data[x].order for x in self.data.data) moveMod = (-1,1)[event.GetKeyCode() == wx.WXK_DOWN] for thisFile in sorted(self.GetSelected(),key=orderKey,reverse=(moveMod != -1)): newPos = self.data.data[thisFile].order + moveMod if newPos < 0 or maxPos < newPos: break self.data.moveArchives([thisFile],newPos) self.data.refresh(what='N') self.RefreshUI() event.Skip()
478,616
def OnCheckEspmItem(self,event): """Handle check/uncheck of item.""" installer = self.data[self.detailsItem] espmNots = installer.espmNots for index,espm in enumerate(self.espms): if self.gEspmList.IsChecked(index): espmNots.discard(espm) else: espmNots.add(espm) self.refreshCurrent(installer)
def OnCheckEspmItem(self,event): """Handle check/uncheck of item.""" installer = self.data[self.detailsItem] espmNots = installer.espmNots for index,espm in enumerate(self.espms): if self.gEspmList.IsChecked(index): espmNots.discard(espm) else: espmNots.add(espm) self.refreshCurrent(installer)
478,617
def OnLeftDown(self,event): (hitItem,hitFlag) = self.list.HitTest((event.GetX(),event.GetY())) if hitFlag == 32: item = GPath(self.items[hitItem]) replacer = self.data[item] #--Unselect? if replacer.isApplied(): try: wx.BeginBusyCursor() replacer.remove() finally: wx.EndBusyCursor() #--Select? else: progress = None try: progress = balt.Progress(item.s) replacer.apply(progress) finally: if progress != None: progress.Destroy() self.RefreshUI(item) bosh.modInfos.refresh() modList.RefreshUI() return True #--Pass Event onward event.Skip()
def OnLeftDown(self,event): (hitItem,hitFlag) = self.list.HitTest((event.GetX(),event.GetY())) if hitFlag == 32: item = GPath(self.items[hitItem]) replacer = self.data[item] #--Unselect? if replacer.isApplied(): try: wx.BeginBusyCursor() replacer.remove() finally: wx.EndBusyCursor() #--Select? else: progress = None try: progress = balt.Progress(item.s) replacer.apply(progress) finally: if progress != None: progress.Destroy() self.RefreshUI(item) bosh.modInfos.refresh() modList.RefreshUI() return True #--Pass Event onward event.Skip()
478,618
def OnResetTextures(self,event): """Invalid.""" if not self.ContinueEdit(): return bsaPath = bosh.modInfos.dir.join('Fallout - Textures.bsa') bsaFile = bosh.BsaFile(bsaPath) bsaFile.scan() resetCount = bsaFile.reset() balt.showOk(self,_("BSA Hashes reset: %d") % (resetCount,))
def OnResetTextures(self,event): """Invalid.""" if not self.ContinueEdit(): return bsaPath = bosh.modInfos.dir.join('Fallout - Textures.bsa') bsaFile = bosh.BsaFile(bsaPath) bsaFile.scan() resetCount = bsaFile.reset() balt.showOk(self,_("BSA Hashes reset: %d") % (resetCount,))
478,619
def OnItemSelected(self,event=None): fileName = self.items[event.m_itemIndex] filePath = bosh.screensData.dir.join(fileName) bitmap = (filePath.exists() and wx.Bitmap(filePath.s)) or None self.picture.SetBitmap(bitmap)
def OnItemSelected(self,event=None): fileName = self.items[event.m_itemIndex] filePath = bosh.screensData.dir.join(fileName) bitmap = (filePath.exists() and wx.Bitmap(filePath.s)) or None self.picture.SetBitmap(bitmap)
478,620
def OnShow(self): """Panel is shown. Update self.data.""" if bosh.screensData.refresh(): screensList.RefreshUI() #self.Refresh() self.SetStatusCount()
def OnShow(self): """Panel is shown. Update self.data.""" if bosh.screensData.refresh(): screensList.RefreshUI() #self.Refresh() self.SetStatusCount()
478,621
def OnItemSelected(self,event=None): keys = self.GetSelected() path = bosh.dirs['saveBase'].join('Messages.html') bosh.messages.writeText(path,*keys) self.gText.Navigate(path.s,0x2) #--0x2: Clear History #self.list.SetFocus()
def OnItemSelected(self,event=None): keys = self.GetSelected() path = bosh.dirs['saveBase'].join('Messages.html') bosh.messages.writeText(path,*keys) self.gText.Navigate(path.s,0x2) #--0x2: Clear History #self.list.SetFocus()
478,622
def OnCloseWindow(self): """To be called when containing frame is closing. Use for saving data, scrollpos, etc.""" if bosh.messages: bosh.messages.save() settings['bash.messages.scrollPos'] = gMessageList.vScrollPos
def OnCloseWindow(self): """To be called when containing frame is closing. Use for saving data, scrollpos, etc.""" if bosh.messages: bosh.messages.save() settings['bash.messages.scrollPos'] = gMessageList.vScrollPos
478,623
def RefreshDetails(self,item=None): """Refreshes detail view associated with data from item.""" item = item or self.detailsItem if item not in self.data: item = None self.SaveDetails() if item is None: self.gKarma.SetValue(0) self.gName.SetValue('') self.gText.Clear() else: karma,text = self.data[item][1:3] self.gName.SetValue(item) self.gKarma.SetValue(karma) self.gText.SetValue(text) self.detailsItem = item
def RefreshDetails(self,item=None): """Refreshes detail view associated with data from item.""" item = item or self.detailsItem if item not in self.data: item = None self.SaveDetails() if item is None: self.gKarma.SetValue(0) self.gName.SetValue('') self.gText.Clear() else: karma,text = self.data[item][1:3] self.gName.SetValue(item) self.gKarma.SetValue(karma) self.gText.SetValue(text) self.detailsItem = item
478,624
def __init__(self, parent, id): wx.Notebook.__init__(self, parent, id) #--Pages self.AddPage(InstallersPanel(self),_("Installers")) iInstallers = self.GetPageCount()-1 if settings['bash.replacers.show'] or bosh.dirs['mods'].join("Replacers").list(): self.AddPage(ReplacersPanel(self),_("Replacers")) self.AddPage(ModPanel(self),_("Mods")) iMods = self.GetPageCount()-1 self.AddPage(SavePanel(self),_("Saves")) self.AddPage(ScreensPanel(self),_("Screenshots")) if re.match('win',sys.platform): self.AddPage(MessagePanel(self),_("PM Archive")) self.AddPage(PeoplePanel(self),_("People")) #self.AddPage(ModBasePanel(self),_("ModBase")) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,self.OnShowPage) #--Selection pageIndex = min(settings['bash.page'],self.GetPageCount()-1) if settings['bash.installers.fastStart'] and pageIndex == iInstallers: pageIndex = iMods self.SetSelection(pageIndex)
def __init__(self, parent, id): wx.Notebook.__init__(self, parent, id) #--Pages self.AddPage(InstallersPanel(self),_("Installers")) iInstallers = self.GetPageCount()-1 if settings['bash.replacers.show'] or bosh.dirs['mods'].join("Replacers").list(): self.AddPage(ReplacersPanel(self),_("Replacers")) self.AddPage(ModPanel(self),_("Mods")) iMods = self.GetPageCount()-1 self.AddPage(SavePanel(self),_("Saves")) self.AddPage(ScreensPanel(self),_("Screenshots")) if re.match('win',sys.platform): self.AddPage(MessagePanel(self),_("PM Archive")) self.AddPage(PeoplePanel(self),_("People")) #self.AddPage(ModBasePanel(self),_("ModBase")) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,self.OnShowPage) #--Selection pageIndex = min(settings['bash.page'],self.GetPageCount()-1) if settings['bash.installers.fastStart'] and pageIndex == iInstallers: pageIndex = iMods self.SetSelection(pageIndex)
478,625
def OnShowPage(self,event): """Call page's OnShow command.""" if event.GetId() == self.GetId(): self.GetPage(event.GetSelection()).OnShow() event.Skip()
def OnShowPage(self,event): """Call page's OnShow command.""" if event.GetId() == self.GetId(): self.GetPage(event.GetSelection()).OnShow() event.Skip()
478,626
def OnTimer(self,evt): """Clears display text as specified. Empty string clears the field.""" self.SetStatusText("",1)
def OnTimer(self,evt): """Clears display text as specified. Empty string clears the field.""" self.SetStatusText("",1)
478,627
def CleanSettings(self): """Cleans junk from settings before closing.""" #--Clean rename dictionary. modNames = set(bosh.modInfos.data.keys()) modNames.update(bosh.modInfos.table.data.keys()) renames = bosh.settings.getChanged('bash.mods.renames') for key,value in renames.items(): if value not in modNames: del renames[key] #--Clean backup for fileInfos in (bosh.modInfos,bosh.saveInfos): goodRoots = set(path.root for path in fileInfos.data.keys()) backupDir = fileInfos.bashDir.join('Backups') if not backupDir.isdir(): continue for name in backupDir.list(): path = backupDir.join(name) if name.root not in goodRoots and path.isfile(): path.remove()
def CleanSettings(self): """Cleans junk from settings before closing.""" #--Clean rename dictionary. modNames = set(bosh.modInfos.data.keys()) modNames.update(bosh.modInfos.table.data.keys()) renames = bosh.settings.getChanged('bash.mods.renames') for key,value in renames.items(): if value not in modNames: del renames[key] #--Clean backup for fileInfos in (bosh.modInfos,bosh.saveInfos): goodRoots = set(path.root for path in fileInfos.data.keys()) backupDir = fileInfos.bashDir.join('Backups') if not backupDir.isdir(): continue for name in backupDir.list(): path = backupDir.join(name) if name.root not in goodRoots and path.isfile(): path.remove()
478,628
def OnCloseWindow(self, event): """Handle window close event. Remember window size, position, etc.""" self.DoSave() settings['bash.modDocs.show'] = False if not self.IsIconized() and not self.IsMaximized(): settings['bash.modDocs.pos'] = self.GetPositionTuple() settings['bash.modDocs.size'] = self.GetSizeTuple() self.Destroy()
def OnCloseWindow(self, event): """Handle window close event. Remember window size, position, etc.""" self.DoSave() settings['bash.modDocs.show'] = False if not self.IsIconized() and not self.IsMaximized(): settings['bash.modDocs.pos'] = self.GetPositionTuple() settings['bash.modDocs.size'] = self.GetSizeTuple() self.Destroy()
478,629
def OnCloseWindow(self, event): """Handle window close event. Remember window size, position, etc.""" if not self.IsIconized() and not self.IsMaximized(): settings['bash.modChecker.pos'] = self.GetPositionTuple() settings['bash.modChecker.size'] = self.GetSizeTuple() self.Destroy()
def OnCloseWindow(self, event): """Handle window close event. Remember window size, position, etc.""" if not self.IsIconized() and not self.IsMaximized(): settings['bash.modChecker.pos'] = self.GetPositionTuple() settings['bash.modChecker.size'] = self.GetSizeTuple() self.Destroy()
478,630
def InitVersion(self): """Perform any version to version conversion. Called by OnInit().""" #--Renames dictionary: Strings to Paths. if settings['bash.version'] < 40: #--Renames array newRenames = {} for key,value in settings['bash.mods.renames'].items(): newRenames[GPath(key)] = GPath(value) settings['bash.mods.renames'] = newRenames #--Mod table data modTableData = bosh.modInfos.table.data for key in modTableData.keys(): if not isinstance(key,bolt.Path): modTableData[GPath(key)] = modTableData[key] del modTableData[key] #--Window sizes by class name rather than by class if settings['bash.version'] < 43: for key,value in balt.sizes.items(): if isinstance(key,ClassType): balt.sizes[key.__name__] = value del balt.sizes[key] #--Current Version settings['bash.version'] = 43 #--Version from readme readme = bosh.dirs['app'].join('Mopy','Gary Bash.txt') if readme.exists() and readme.mtime != settings['bash.readme'][0]: reVersion = re.compile("^=== ([\.\d]+) \[") for line in readme.open(): maVersion = reVersion.match(line) if maVersion: settings['bash.readme'] = (readme.mtime,maVersion.group(1)) break
def InitVersion(self): """Perform any version to version conversion. Called by OnInit().""" #--Renames dictionary: Strings to Paths. if settings['bash.version'] < 40: #--Renames array newRenames = {} for key,value in settings['bash.mods.renames'].items(): newRenames[GPath(key)] = GPath(value) settings['bash.mods.renames'] = newRenames #--Mod table data modTableData = bosh.modInfos.table.data for key in modTableData.keys(): if not isinstance(key,bolt.Path): modTableData[GPath(key)] = modTableData[key] del modTableData[key] #--Window sizes by class name rather than by class if settings['bash.version'] < 43: for key,value in balt.sizes.items(): if isinstance(key,ClassType): balt.sizes[key.__name__] = value del balt.sizes[key] #--Current Version settings['bash.version'] = 43 #--Version from readme readme = bosh.dirs['app'].join('Mopy','Gary Bash.txt') if readme.exists() and readme.mtime != settings['bash.readme'][0]: reVersion = re.compile("^=== ([\.\d]+) \[") for line in readme.open(): maVersion = reVersion.match(line) if maVersion: settings['bash.readme'] = (readme.mtime,maVersion.group(1)) break
478,631
def OnCloseWindow(self, event): """Handle window close event. Remember window size, position, etc.""" balt.sizes['ImportFaceDialog'] = self.GetSizeTuple() self.Destroy()
def OnCloseWindow(self, event): """Handle window close event. Remember window size, position, etc.""" balt.sizes['ImportFaceDialog'] = self.GetSizeTuple() self.Destroy()
478,632
def MouseEnteredItem(self,item): """Show tip text when changing item.""" #--Following isn't displaying correctly. if item < len(self.patchers): patcherClass = self.patchers[item].__class__ tip = patcherClass.tip or re.sub(r'\..*','.',patcherClass.text.split('\n')[0]) self.gTipText.SetLabel(tip) else: self.gTipText.SetLabel('')
def MouseEnteredItem(self,item): """Show tip text when changing item.""" #--Following isn't displaying correctly. if item < len(self.patchers): patcherClass = self.patchers[item].__class__ tip = patcherClass.tip or re.sub(r'\..*','.',patcherClass.text.split('\n')[0]) self.gTipText.SetLabel(tip) else: self.gTipText.SetLabel('')
478,633
def Layout(self): """Layout control components.""" if self.gConfigPanel: self.gConfigPanel.Layout()
def Layout(self): """Layout control components.""" if self.gConfigPanel: self.gConfigPanel.Layout()
478,634
def OnEditAliases(self,event): text = self.gAliases.GetValue() self.aliases.clear() for line in text.split('\n'): fields = map(string.strip,line.split('>>')) if len(fields) != 2 or not fields[0] or not fields[1]: continue self.aliases[GPath(fields[0])] = GPath(fields[1]) self.SetAliasText()
def OnEditAliases(self,event): text = self.gAliases.GetValue() self.aliases.clear() for line in text.split('\n'): fields = map(string.strip,line.split('>>')) if len(fields) != 2 or not fields[0] or not fields[1]: continue self.aliases[GPath(fields[0])] = GPath(fields[1]) self.SetAliasText()
478,635
def OnItemChoice(self,event): """Handle choice menu selection.""" itemIndex = self.rightClickItemIndex item =self.items[itemIndex] choice = self.choiceMenu[event.GetId()] choiceSet = self.configChoices[item] choiceSet ^= set((choice,)) if choice != 'Auto': choiceSet.discard('Auto') elif 'Auto' in self.configChoices[item]: self.getChoice(item) self.gList.SetString(itemIndex,self.getItemLabel(item))
def OnItemChoice(self,event): """Handle choice menu selection.""" itemIndex = self.rightClickItemIndex item =self.items[itemIndex] choice = self.choiceMenu[event.GetId()] choiceSet = self.configChoices[item] choiceSet ^= set((choice,)) if choice != 'Auto': choiceSet.discard('Auto') elif 'Auto' in self.configChoices[item]: self.getChoice(item) self.gList.SetString(itemIndex,self.getItemLabel(item))
478,636
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
478,637
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
478,638
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
478,639
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
478,640
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
478,641
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
def OnTweakChoice(self,event): """Handle choice menu selection.""" tweakIndex = self.rightClickTweakIndex self.tweaks[tweakIndex].chosen = event.GetId() self.gList.SetString(tweakIndex,self.tweaks[tweakIndex].getListLabel())
478,642
def Execute(self,event): """Handle selection.""" dir = self.window.data.dir dir.makedirs() dir.start()
def Execute(self,event): """Handle selection.""" dir = self.window.data.dir dir.makedirs() dir.start()
478,643
def Execute(self,event): self.window.PopulateItems(self.sortCol,-1)
def Execute(self,event): self.window.PopulateItems(self.sortCol,-1)
478,644
def Execute(self,event): destDir = self.window.data.dir srcDir = self.window.data.bashDir.join('Hidden') isSave = (destDir == bosh.saveInfos.dir) if self.type == 'mod': wildcard = 'Fallout3 Mod Files (*.esp;*.esm)|*.esp;*.esm' elif self.type == 'save': wildcard = 'Fallout3 Save files (*.fos)|*.fos' else: wildcard = '*.*' #--File dialog srcDir.makedirs() srcPaths = balt.askOpenMulti(self.window,_('Unhide files:'),srcDir, '', wildcard) if not srcPaths: return #--Iterate over Paths for srcPath in srcPaths: #--Copy from dest directory? (newSrcDir,srcFileName) = srcPath.headTail if newSrcDir == destDir: balt.showError(self.window,_("You can't unhide files from this directory.")) return #--File already unhidden? destPath = destDir.join(srcFileName) if destPath.exists(): balt.showWarning(self.window,_("File skipped: %s. File is already present.") % (srcFileName.s,)) #--Move it? else: srcPath.moveTo(destPath) if isSave: bosh.CoSaves(srcPath).move(destPath) #--Repopulate bashFrame.RefreshData()
def Execute(self,event): destDir = self.window.data.dir srcDir = self.window.data.bashDir.join('Hidden') isSave = (destDir == bosh.saveInfos.dir) if self.type == 'mod': wildcard = 'Fallout3 Mod Files (*.esp;*.esm)|*.esp;*.esm' elif self.type == 'save': wildcard = 'Fallout3 Save files (*.fos)|*.fos' else: wildcard = '*.*' #--File dialog srcDir.makedirs() srcPaths = balt.askOpenMulti(self.window,_('Unhide files:'),srcDir, '', wildcard) if not srcPaths: return #--Iterate over Paths for srcPath in srcPaths: #--Copy from dest directory? (newSrcDir,srcFileName) = srcPath.headTail if newSrcDir == destDir: balt.showError(self.window,_("You can't unhide files from this directory.")) return #--File already unhidden? destPath = destDir.join(srcFileName) if destPath.exists(): balt.showWarning(self.window,_("File skipped: %s. File is already present.") % (srcFileName.s,)) #--Move it? else: srcPath.moveTo(destPath) if isSave: bosh.CoSaves(srcPath).move(destPath) #--Repopulate bashFrame.RefreshData()
478,645
def Execute(self,event): message = _(r'Delete these files? This operation cannot be undone.') message += '\n* ' + '\n* '.join(sorted(x.s for x in self.data)) if not balt.askYes(self.window,message,_('Delete Files')): return #--Do it for fileName in self.data: self.window.data.delete(fileName) #--Refresh stuff self.window.RefreshUI()
def Execute(self,event): message = _(r'Delete these files? This operation cannot be undone.') message += '\n* ' + '\n* '.join(sorted(x.s for x in self.data)) if not balt.askYes(self.window,message,_('Delete Files')): return #--Do it for fileName in self.data: self.window.data.delete(fileName) #--Refresh stuff self.window.RefreshUI()
478,646
def Execute(self,event): data = self.data for item in data: fileName = GPath(item) fileInfos = self.window.data fileInfo = fileInfos[fileName] #--Mod with resources? #--Warn on rename if file has bsa and/or dialog if fileInfo.isMod() and tuple(fileInfo.hasResources()) != (False,False): hasBsa, hasVoices = fileInfo.hasResources() modName = fileInfo.name if hasBsa and hasVoices: message = _("This mod has an associated archive (%s.bsa) and an associated voice directory (Sound\\Voices\\%s), which will not be attached to the duplicate mod.\n\nNote that the BSA archive may also contain a voice directory (Sound\\Voices\\%s), which would remain detached even if a duplicate archive were also created.") % (modName.sroot,modName.s,modName.s) elif hasBsa: message = _("This mod has an associated archive (%s.bsa), which will not be attached to the duplicate mod.\n\nNote that this BSA archive may contain a voice directory (Sound\\Voices\\%s), which would remain detached even if a duplicate archive were also created.") % (modName.sroot,modName.s) else: #hasVoices message = _("This mod has an associated voice directory (Sound\\Voice\\%s), which will not be attached to the duplicate mod.") % (modName.s,) if not balt.askWarning(self.window,message,_("Duplicate ")+fileName.s): continue #--Continue copy (root,ext) = fileName.rootExt if ext.lower() == '.bak': ext = '.ess' (destDir,destName,wildcard) = (fileInfo.dir, root+' Copy'+ext,'*'+ext) destDir.makedirs() if len(data) == 1: destPath = balt.askSave(self.window,_('Duplicate as:'), destDir,destName,wildcard) if not destPath: return destDir,destName = destPath.headTail if (destDir == fileInfo.dir) and (destName == fileName): balt.showError(self.window,_("Files cannot be duplicated to themselves!")) continue fileInfos.copy(fileName,destDir,destName,mtime='+1') if destDir == fileInfo.dir: fileInfos.table.copyRow(fileName,destName) if fileInfos.table.getItem(fileName,'mtime'): destInfo = fileInfos[destName] fileInfos.table.setItem(destName,'mtime',destInfo.mtime) if fileInfo.isMod(): fileInfos.autoSort() self.window.RefreshUI()
def Execute(self,event): data = self.data for item in data: fileName = GPath(item) fileInfos = self.window.data fileInfo = fileInfos[fileName] #--Mod with resources? #--Warn on rename if file has bsa and/or dialog if fileInfo.isMod() and tuple(fileInfo.hasResources()) != (False,False): hasBsa, hasVoices = fileInfo.hasResources() modName = fileInfo.name if hasBsa and hasVoices: message = _("This mod has an associated archive (%s.bsa) and an associated voice directory (Sound\\Voices\\%s), which will not be attached to the duplicate mod.\n\nNote that the BSA archive may also contain a voice directory (Sound\\Voices\\%s), which would remain detached even if a duplicate archive were also created.") % (modName.sroot,modName.s,modName.s) elif hasBsa: message = _("This mod has an associated archive (%s.bsa), which will not be attached to the duplicate mod.\n\nNote that this BSA archive may contain a voice directory (Sound\\Voices\\%s), which would remain detached even if a duplicate archive were also created.") % (modName.sroot,modName.s) else: #hasVoices message = _("This mod has an associated voice directory (Sound\\Voice\\%s), which will not be attached to the duplicate mod.") % (modName.s,) if not balt.askWarning(self.window,message,_("Duplicate ")+fileName.s): continue #--Continue copy (root,ext) = fileName.rootExt if ext.lower() == '.bak': ext = '.ess' (destDir,destName,wildcard) = (fileInfo.dir, root+' Copy'+ext,'*'+ext) destDir.makedirs() if len(data) == 1: destPath = balt.askSave(self.window,_('Duplicate as:'), destDir,destName,wildcard) if not destPath: return destDir,destName = destPath.headTail if (destDir == fileInfo.dir) and (destName == fileName): balt.showError(self.window,_("Files cannot be duplicated to themselves!")) continue fileInfos.copy(fileName,destDir,destName,mtime='+1') if destDir == fileInfo.dir: fileInfos.table.copyRow(fileName,destName) if fileInfos.table.getItem(fileName,'mtime'): destInfo = fileInfos[destName] fileInfos.table.setItem(destName,'mtime',destInfo.mtime) if fileInfo.isMod(): fileInfos.autoSort() self.window.RefreshUI()
478,647
def Execute(self,event): message = _(r'Hide these files? Note that hidden files are simply moved to the Bash\Hidden subdirectory.') if not balt.askYes(self.window,message,_('Hide Files')): return #--Do it destRoot = self.window.data.bashDir.join('Hidden') fileInfos = self.window.data fileGroups = fileInfos.table.getColumn('group') for fileName in self.data: destDir = destRoot #--Use author subdirectory instead? author = getattr(fileInfos[fileName].header,'author','NOAUTHOR') #--Hack for save files. authorDir = destRoot.join(author) if author and authorDir.isdir(): destDir = authorDir #--Use group subdirectory instead? elif fileName in fileGroups: groupDir = destRoot.join(fileGroups[fileName]) if groupDir.isdir(): destDir = groupDir if not self.window.data.moveIsSafe(fileName,destDir): message = (_('A file named %s already exists in the hidden files directory. Overwrite it?') % (fileName.s,)) if not balt.askYes(self.window,message,_('Hide Files')): continue #--Do it self.window.data.move(fileName,destDir,False) #--Refresh stuff bashFrame.RefreshData()
def Execute(self,event): message = _(r'Hide these files? Note that hidden files are simply moved to the Bash\Hidden subdirectory.') if not balt.askYes(self.window,message,_('Hide Files')): return #--Do it destRoot = self.window.data.bashDir.join('Hidden') fileInfos = self.window.data fileGroups = fileInfos.table.getColumn('group') for fileName in self.data: destDir = destRoot #--Use author subdirectory instead? author = getattr(fileInfos[fileName].header,'author','NOAUTHOR') #--Hack for save files. authorDir = destRoot.join(author) if author and authorDir.isdir(): destDir = authorDir #--Use group subdirectory instead? elif fileName in fileGroups: groupDir = destRoot.join(fileGroups[fileName]) if groupDir.isdir(): destDir = groupDir if not self.window.data.moveIsSafe(fileName,destDir): message = (_('A file named %s already exists in the hidden files directory. Overwrite it?') % (fileName.s,)) if not balt.askYes(self.window,message,_('Hide Files')): continue #--Do it self.window.data.move(fileName,destDir,False) #--Refresh stuff bashFrame.RefreshData()
478,648
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] text = bosh.modInfos.getModList(fileInfo) if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.window,text,fileName.s,asDialog=False,fixedFont=False,icons=bashBlue)
def Execute(self,event): fileName = GPath(self.data[0]) fileInfo = self.window.data[fileName] text = bosh.modInfos.getModList(fileInfo) if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.window,text,fileName.s,asDialog=False,fixedFont=False,icons=bashBlue)
478,649
def Execute(self,event): #--Get current start time. modInfos = self.window.data fileNames = [mod for mod in self.data if mod not in modInfos.autoSorted] if not fileNames: return #--Ask user for revised time. newTimeStr = balt.askText(self.window,_('Redate selected mods starting at...'), _('Redate Mods'),formatDate(int(time.time()))) if not newTimeStr: return try: newTimeTup = bosh.unformatDate(newTimeStr,'%c') newTime = int(time.mktime(newTimeTup)) except ValueError: balt.showError(self.window,_('Unrecognized date: ')+newTimeStr) return except OverflowError: balt.showError(self,_('Bash cannot handle dates greater than January 19, 2038.)')) return #--Do it selInfos = [modInfos[fileName] for fileName in fileNames] selInfos.sort(key=attrgetter('mtime')) for fileInfo in selInfos: fileInfo.setmtime(newTime) newTime += 60 #--Refresh modInfos.refresh(doInfos=False) modInfos.refreshInfoLists() self.window.RefreshUI()
def Execute(self,event): #--Get current start time. modInfos = self.window.data fileNames = [mod for mod in self.data if mod not in modInfos.autoSorted] if not fileNames: return #--Ask user for revised time. newTimeStr = balt.askText(self.window,_('Redate selected mods starting at...'), _('Redate Mods'),formatDate(int(time.time()))) if not newTimeStr: return try: newTimeTup = bosh.unformatDate(newTimeStr,'%c') newTime = int(time.mktime(newTimeTup)) except ValueError: balt.showError(self.window,_('Unrecognized date: ')+newTimeStr) return except OverflowError: balt.showError(self,_('Bash cannot handle dates greater than January 19, 2038.)')) return #--Do it selInfos = [modInfos[fileName] for fileName in fileNames] selInfos.sort(key=attrgetter('mtime')) for fileInfo in selInfos: fileInfo.setmtime(newTime) newTime += 60 #--Refresh modInfos.refresh(doInfos=False) modInfos.refreshInfoLists() self.window.RefreshUI()
478,650
def Execute(self,event): message = _("Reorder selected mods in alphabetical order? The first file will be given the date/time of the current earliest file in the group, with consecutive files following at 1 minute increments.\n\nNote that this operation cannot be undone. Note also that some mods need to be in a specific order to work correctly, and this sort operation may break that order.") if not balt.askContinue(self.window,message,'bash.sortMods.continue',_('Sort Mods')): return #--Get first time from first selected file. modInfos = self.window.data fileNames = [mod for mod in self.data if mod not in modInfos.autoSorted] if not fileNames: return dotTimes = [modInfos[fileName].mtime for fileName in fileNames if fileName.s[0] in '.=+'] if dotTimes: newTime = min(dotTimes) else: newTime = min(modInfos[fileName].mtime for fileName in self.data) #--Do it fileNames.sort(key=lambda a: a.s[:-4].lower()) fileNames.sort(key=lambda a: a.s[0] not in '.=') for fileName in fileNames: modInfos[fileName].setmtime(newTime) newTime += 60 #--Refresh modInfos.refresh(doInfos=False) modInfos.refreshInfoLists() self.window.RefreshUI()
def Execute(self,event): message = _("Reorder selected mods in alphabetical order? The first file will be given the date/time of the current earliest file in the group, with consecutive files following at 1 minute increments.\n\nNote that this operation cannot be undone. Note also that some mods need to be in a specific order to work correctly, and this sort operation may break that order.") if not balt.askContinue(self.window,message,'bash.sortMods.continue',_('Sort Mods')): return #--Get first time from first selected file. modInfos = self.window.data fileNames = [mod for mod in self.data if mod not in modInfos.autoSorted] if not fileNames: return dotTimes = [modInfos[fileName].mtime for fileName in fileNames if fileName.s[0] in '.=+'] if dotTimes: newTime = min(dotTimes) else: newTime = min(modInfos[fileName].mtime for fileName in self.data) #--Do it fileNames.sort(key=lambda a: a.s[:-4].lower()) fileNames.sort(key=lambda a: a.s[0] not in '.=') for fileName in fileNames: modInfos[fileName].setmtime(newTime) newTime += 60 #--Refresh modInfos.refresh(doInfos=False) modInfos.refreshInfoLists() self.window.RefreshUI()
478,651
def Execute(self,event): data = self.data for item in data: fileName = GPath(item) fileInfo = self.window.data[fileName] (destDir,destName,wildcard) = fileInfo.getNextSnapshot() destDir.makedirs() if len(data) == 1: destPath = balt.askSave(self.window,_('Save snapshot as:'), destDir,destName,wildcard) if not destPath: return (destDir,destName) = destPath.headTail #--Extract version number fileRoot = fileName.root destRoot = destName.root fileVersion = bolt.getMatch(re.search(r'[ _]+v?([\.0-9]+)$',fileRoot.s),1) snapVersion = bolt.getMatch(re.search(r'-[0-9\.]+$',destRoot.s)) fileHedr = fileInfo.header if fileInfo.isMod() and (fileVersion or snapVersion) and bosh.reVersion.search(fileHedr.description): if fileVersion and snapVersion: newVersion = fileVersion+snapVersion elif snapVersion: newVersion = snapVersion[1:] else: newVersion = fileVersion newDescription = bosh.reVersion.sub(r'\1 '+newVersion, fileHedr.description,1) fileInfo.writeDescription(newDescription) self.window.details.SetFile(fileName) #--Copy file self.window.data.copy(fileName,destDir,destName)
def Execute(self,event): data = self.data for item in data: fileName = GPath(item) fileInfo = self.window.data[fileName] (destDir,destName,wildcard) = fileInfo.getNextSnapshot() destDir.makedirs() if len(data) == 1: destPath = balt.askSave(self.window,_('Save snapshot as:'), destDir,destName,wildcard) if not destPath: return (destDir,destName) = destPath.headTail #--Extract version number fileRoot = fileName.root destRoot = destName.root fileVersion = bolt.getMatch(re.search(r'[ _]+v?([\.0-9]+)$',fileRoot.s),1) snapVersion = bolt.getMatch(re.search(r'-[0-9\.]+$',destRoot.s)) fileHedr = fileInfo.header if fileInfo.isMod() and (fileVersion or snapVersion) and bosh.reVersion.search(fileHedr.description): if fileVersion and snapVersion: newVersion = fileVersion+snapVersion elif snapVersion: newVersion = snapVersion[1:] else: newVersion = fileVersion newDescription = bosh.reVersion.sub(r'\1 '+newVersion, fileHedr.description,1) fileInfo.writeDescription(newDescription) self.window.details.SetFile(fileName) #--Copy file self.window.data.copy(fileName,destDir,destName)
478,652
def Execute(self,event): """Handle menu item selection.""" fileInfo = self.window.data[self.data[0]] fileName = fileInfo.name #--Snapshot finder destDir = self.window.data.dir srcDir = self.window.data.bashDir.join('Snapshots') wildcard = fileInfo.getNextSnapshot()[2] #--File dialog srcDir.makedirs() snapPath = balt.askOpen(self.window,_('Revert %s to snapshot:') % (fileName.s,), srcDir, '', wildcard) if not snapPath: return snapName = snapPath.tail #--Warning box message = (_("Revert %s to snapshot %s dated %s?") % (fileInfo.name.s, snapName.s, formatDate(snapPath.mtime))) if not balt.askYes(self.window,message,_('Revert to Snapshot')): return wx.BeginBusyCursor() destPath = fileInfo.getPath() snapPath.copyTo(destPath) fileInfo.setmtime() try: self.window.data.refreshFile(fileName) except bosh.FileError: balt.showError(self,_('Snapshot file is corrupt!')) self.window.details.SetFile(None) wx.EndBusyCursor() self.window.RefreshUI(fileName)
def Execute(self,event): """Handle menu item selection.""" fileInfo = self.window.data[self.data[0]] fileName = fileInfo.name #--Snapshot finder destDir = self.window.data.dir srcDir = self.window.data.bashDir.join('Snapshots') wildcard = fileInfo.getNextSnapshot()[2] #--File dialog srcDir.makedirs() snapPath = balt.askOpen(self.window,_('Revert %s to snapshot:') % (fileName.s,), srcDir, '', wildcard) if not snapPath: return snapName = snapPath.tail #--Warning box message = (_("Revert %s to snapshot %s dated %s?") % (fileInfo.name.s, snapName.s, formatDate(snapPath.mtime))) if not balt.askYes(self.window,message,_('Revert to Snapshot')): return wx.BeginBusyCursor() destPath = fileInfo.getPath() snapPath.copyTo(destPath) fileInfo.setmtime() try: self.window.data.refreshFile(fileName) except bosh.FileError: balt.showError(self,_('Snapshot file is corrupt!')) self.window.details.SetFile(None) wx.EndBusyCursor() self.window.RefreshUI(fileName)
478,653
def Execute(self,event): for item in self.data: fileInfo = self.window.data[item] fileInfo.makeBackup(True)
def Execute(self,event): for item in self.data: fileInfo = self.window.data[item] fileInfo.makeBackup(True)
478,654
def Execute(self,event): fileInfo = self.fileInfo fileName = fileInfo.name #--Backup/FirstBackup? if event.GetId() == ID_REVERT_BACKUP: backup = self.backup else: backup = self.firstBackup #--Warning box message = _("Revert %s to backup dated %s?") % (fileName.s, formatDate(backup.mtime)) if balt.askYes(self.window,message,_('Revert to Backup')): wx.BeginBusyCursor() dest = fileInfo.dir.join(fileName) backup.copyTo(dest) fileInfo.setmtime() if fileInfo.isEss(): #--Handle CoSave (.pluggy and .fose) files. bosh.CoSaves(backup).copy(dest) try: self.window.data.refreshFile(fileName) except bosh.FileError: balt.showError(self,_('Old file is corrupt!')) wx.EndBusyCursor() self.window.RefreshUI(fileName)
def Execute(self,event): fileInfo = self.fileInfo fileName = fileInfo.name #--Backup/FirstBackup? if event.GetId() == ID_REVERT_BACKUP: backup = self.backup else: backup = self.firstBackup #--Warning box message = _("Revert %s to backup dated %s?") % (fileName.s, formatDate(backup.mtime)) if balt.askYes(self.window,message,_('Revert to Backup')): wx.BeginBusyCursor() dest = fileInfo.dir.join(fileName) backup.copyTo(dest) fileInfo.setmtime() if fileInfo.isEss(): #--Handle CoSave (.pluggy and .fose) files. bosh.CoSaves(backup).copy(dest) try: self.window.data.refreshFile(fileName) except bosh.FileError: balt.showError(self,_('Old file is corrupt!')) wx.EndBusyCursor() self.window.RefreshUI(fileName)
478,655
def Execute(self,event): """Handle selection.""" dir = self.window.data.dir for file in self.data: dir.join(file).start()
def Execute(self,event): """Handle selection.""" dir = self.window.data.dir for file in self.data: dir.join(file).start()
478,656
def Execute(self,event): """Handle selection.""" progress = balt.Progress(_("Annealing..."),'\n'+' '*60) try: self.data.anneal(progress=progress) finally: progress.Destroy() self.data.refresh(what='NS') gInstallers.RefreshUIMods()
def Execute(self,event): """Handle selection.""" progress = balt.Progress(_("Annealing..."),'\n'+' '*60) try: self.data.anneal(progress=progress) finally: progress.Destroy() self.data.refresh(what='NS') gInstallers.RefreshUIMods()
478,657
def Execute(self,event): """Handle selection.""" settings['bash.installers.autoAnneal'] ^= True
def Execute(self,event): """Handle selection.""" settings['bash.installers.autoAnneal'] ^= True
478,658
def Execute(self,event): """Handle selection.""" settings['bash.installers.autoRefreshProjects'] ^= True
def Execute(self,event): """Handle selection.""" settings['bash.installers.autoRefreshProjects'] ^= True
478,659
def Execute(self,event): """Handle selection.""" enabled = settings['bash.installers.enabled'] message = _("Do you want to enable Installers? If you do, Bash will first need to initialize some data. If there are many new mods to process, then this may take on the order of five minutes.") if not enabled and not balt.askYes(self.gTank,fill(message,80),self.title): return enabled = settings['bash.installers.enabled'] = not enabled if enabled: gInstallers.refreshed = False gInstallers.OnShow() gInstallers.gList.RefreshUI() else: gInstallers.gList.gList.DeleteAllItems() gInstallers.RefreshDetails(None)
def Execute(self,event): """Handle selection.""" enabled = settings['bash.installers.enabled'] message = _("Do you want to enable Installers? If you do, Bash will first need to initialize some data. If there are many new mods to process, then this may take on the order of five minutes.") if not enabled and not balt.askYes(self.gTank,fill(message,80),self.title): return enabled = settings['bash.installers.enabled'] = not enabled if enabled: gInstallers.refreshed = False gInstallers.OnShow() gInstallers.gList.RefreshUI() else: gInstallers.gList.gList.DeleteAllItems() gInstallers.RefreshDetails(None)
478,660
def Execute(self,event): """Handle selection.""" settings['bash.bsaRedirection'] ^= True if settings['bash.bsaRedirection']: bsaPath = bosh.modInfos.dir.join('Fallout - Textures.bsa') bsaFile = bosh.BsaFile(bsaPath) bsaFile.scan() resetCount = bsaFile.reset() #balt.showOk(self,_("BSA Hashes reset: %d") % (resetCount,)) bosh.fallout3Ini.setBsaRedirection(settings['bash.bsaRedirection'])
def Execute(self,event): """Handle selection.""" settings['bash.bsaRedirection'] ^= True if settings['bash.bsaRedirection']: bsaPath = bosh.modInfos.dir.join('Fallout - Textures.bsa') bsaFile = bosh.BsaFile(bsaPath) bsaFile.scan() resetCount = bsaFile.reset() #balt.showOk(self,_("BSA Hashes reset: %d") % (resetCount,)) bosh.fallout3Ini.setBsaRedirection(settings['bash.bsaRedirection'])
478,661
def Execute(self,event): """Handle selection.""" settings['bash.installers.conflictsReport.showInactive'] ^= True self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" settings['bash.installers.conflictsReport.showInactive'] ^= True self.gTank.RefreshUI()
478,662
def Execute(self,event): """Handle selection.""" settings['bash.installers.conflictsReport.showLower'] ^= True self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" settings['bash.installers.conflictsReport.showLower'] ^= True self.gTank.RefreshUI()
478,663
def Execute(self,event): """Handle selection.""" settings['bash.installers.fastStart'] ^= True
def Execute(self,event): """Handle selection.""" settings['bash.installers.fastStart'] ^= True
478,664
def Execute(self,event): """Handle selection.""" if self.fullRefresh: message = balt.fill(_("Refresh ALL data from scratch? This may take five to ten minutes (or more) depending on the number of mods you have installed.")) if not balt.askWarning(self.gTank,fill(message,80),self.title): return gInstallers.refreshed = False gInstallers.fullRefresh = self.fullRefresh gInstallers.OnShow()
def Execute(self,event): """Handle selection.""" if self.fullRefresh: message = balt.fill(_("Refresh ALL data from scratch? This may take five to ten minutes (or more) depending on the number of mods you have installed.")) if not balt.askWarning(self.gTank,fill(message,80),self.title): return gInstallers.refreshed = False gInstallers.fullRefresh = self.fullRefresh gInstallers.OnShow()
478,665
def Execute(self,event): """Handle selection.""" settings['bash.installers.removeEmptyDirs'] ^= True
def Execute(self,event): """Handle selection.""" settings['bash.installers.removeEmptyDirs'] ^= True
478,666
def Execute(self,event): """Handle selection.""" settings['bash.replacers.show'] ^= True message = _("This option will take effect when Bash is restarted. Note that if any files are present in Data\\Replacers, then the Replacers tab will be shown regardless of this setting.") balt.showOk(self.gTank,message,self.title)
def Execute(self,event): """Handle selection.""" settings['bash.replacers.show'] ^= True message = _("This option will take effect when Bash is restarted. Note that if any files are present in Data\\Replacers, then the Replacers tab will be shown regardless of this setting.") balt.showOk(self.gTank,message,self.title)
478,667
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipScreenshots'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipScreenshots'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
478,668
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipImages'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipImages'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
478,669
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipDocs'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipDocs'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
478,670
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipDistantLOD'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='N') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" settings['bash.installers.skipDistantLOD'] ^= True for installer in self.data.itervalues(): installer.refreshDataSizeCrc() self.data.refresh(what='N') self.gTank.RefreshUI()
478,671
def Execute(self,event): settings['bash.installers.sortActive'] ^= True self.gTank.SortItems()
def Execute(self,event): settings['bash.installers.sortActive'] ^= True self.gTank.SortItems()
478,672
def Execute(self,event): settings['bash.installers.sortProjects'] ^= True self.gTank.SortItems()
def Execute(self,event): settings['bash.installers.sortProjects'] ^= True self.gTank.SortItems()
478,673
def Execute(self,event): settings['bash.installers.sortStructure'] ^= True self.gTank.SortItems()
def Execute(self,event): settings['bash.installers.sortStructure'] ^= True self.gTank.SortItems()
478,674
def projectExists(self): if not len(self.selected) == 1: return False return self.getProjectPath().exists()
def projectExists(self): if not len(self.selected) == 1: return False return self.getProjectPath().exists()
478,675
def Execute(self,event): """Handle selection.""" progress = balt.Progress(_("Annealing..."),'\n'+' '*60) try: self.data.anneal(self.selected,progress) finally: progress.Destroy() self.data.refresh(what='NS') gInstallers.RefreshUIMods()
def Execute(self,event): """Handle selection.""" progress = balt.Progress(_("Annealing..."),'\n'+' '*60) try: self.data.anneal(self.selected,progress) finally: progress.Destroy() self.data.refresh(what='NS') gInstallers.RefreshUIMods()
478,676
def Execute(self,event): balt.Tank_Delete.Execute(self,event) self.data.refreshOrder() self.data.refresh(what='N') self.gTank.RefreshUI()
def Execute(self,event): balt.Tank_Delete.Execute(self,event) self.data.refreshOrder() self.data.refresh(what='N') self.gTank.RefreshUI()
478,677
def Execute(self,event): """Handle selection.""" curName = self.selected[0] isdir = self.data.dir.join(curName).isdir() if isdir: root,ext = curName,'' else: root,ext = curName.rootExt newName = root+' Copy'+ext index = 0 while newName in self.data: newName = root + (_(' Copy (%d)') % index) + ext index += 1 result = balt.askText(self.gTank,_("Duplicate %s to:") % curName.s, self.title,newName.s) result = (result or '').strip() if not result: return #--Error checking newName = GPath(result).tail if not newName.s: balt.ShowWarning(self.gTank,_("%s is not a valid name.") % result) return if newName in self.data: balt.ShowWarning(self.gTank,_("%s already exists.") % newName.s) return if self.data.dir.join(curName).isfile() and curName.cext != newName.cext: balt.ShowWarning(self.gTank, _("%s does not have correct extension (%s).") % (newName.s,curName.ext)) return #--Duplicate try: wx.BeginBusyCursor() self.data.copy(curName,newName) finally: wx.EndBusyCursor() self.data.refresh(what='N') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" curName = self.selected[0] isdir = self.data.dir.join(curName).isdir() if isdir: root,ext = curName,'' else: root,ext = curName.rootExt newName = root+' Copy'+ext index = 0 while newName in self.data: newName = root + (_(' Copy (%d)') % index) + ext index += 1 result = balt.askText(self.gTank,_("Duplicate %s to:") % curName.s, self.title,newName.s) result = (result or '').strip() if not result: return #--Error checking newName = GPath(result).tail if not newName.s: balt.ShowWarning(self.gTank,_("%s is not a valid name.") % result) return if newName in self.data: balt.ShowWarning(self.gTank,_("%s already exists.") % newName.s) return if self.data.dir.join(curName).isfile() and curName.cext != newName.cext: balt.ShowWarning(self.gTank, _("%s does not have correct extension (%s).") % (newName.s,curName.ext)) return #--Duplicate try: wx.BeginBusyCursor() self.data.copy(curName,newName) finally: wx.EndBusyCursor() self.data.refresh(what='N') self.gTank.RefreshUI()
478,678
def Execute(self,event): """Handle selection.""" installer = self.data[self.selected[0]] installer.hasExtraData ^= True installer.refreshDataSizeCrc() installer.refreshStatus(self.data) self.data.refresh(what='N') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" installer = self.data[self.selected[0]] installer.hasExtraData ^= True installer.refreshDataSizeCrc() installer.refreshStatus(self.data) self.data.refresh(what='N') self.gTank.RefreshUI()
478,679
def Execute(self,event): """Handle selection.""" dir = self.data.dir progress = balt.Progress(_("Installing..."),'\n'+' '*60) try: last = (self.mode == 'LAST') override = (self.mode != 'MISSING') self.data.install(self.selected,progress,last,override) finally: progress.Destroy() self.data.refresh(what='N') gInstallers.RefreshUIMods()
def Execute(self,event): """Handle selection.""" dir = self.data.dir progress = balt.Progress(_("Installing..."),'\n'+' '*60) try: last = (self.mode == 'LAST') override = (self.mode != 'MISSING') self.data.install(self.selected,progress,last,override) finally: progress.Destroy() self.data.refresh(what='N') gInstallers.RefreshUIMods()
478,680
def Execute(self,event): #--Get masters list text = self.data.getPackageList() if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.gTank,text,_("BAIN Packages"),asDialog=False,fixedFont=False,icons=bashBlue)
def Execute(self,event): #--Get masters list text = self.data.getPackageList() if (wx.TheClipboard.Open()): wx.TheClipboard.SetData(wx.TextDataObject(text)) wx.TheClipboard.Close() balt.showLog(self.gTank,text,_("BAIN Packages"),asDialog=False,fixedFont=False,icons=bashBlue)
478,681
def Execute(self,event): """Handle selection.""" curPos = min(self.data[x].order for x in self.selected) message = _("Move selected archives to what position?\nEnter position number.\nLast: -1; First of Last: -2; Semi-Last: -3.") newPos = balt.askText(self.gTank,message,self.title,`curPos`) if not newPos: return newPos = newPos.strip() if not re.match('-?\d+',newPos): balt.showError(self.gTank,_("Position must be an integer.")) return newPos = int(newPos) if newPos == -3: newPos = self.data[self.data.lastKey].order elif newPos == -2: newPos = self.data[self.data.lastKey].order+1 elif newPos < 0: newPos = len(self.data.data) self.data.moveArchives(self.selected,newPos) self.data.refresh(what='N') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" curPos = min(self.data[x].order for x in self.selected) message = _("Move selected archives to what position?\nEnter position number.\nLast: -1; First of Last: -2; Semi-Last: -3.") newPos = balt.askText(self.gTank,message,self.title,`curPos`) if not newPos: return newPos = newPos.strip() if not re.match('-?\d+',newPos): balt.showError(self.gTank,_("Position must be an integer.")) return newPos = int(newPos) if newPos == -3: newPos = self.data[self.data.lastKey].order elif newPos == -2: newPos = self.data[self.data.lastKey].order+1 elif newPos < 0: newPos = len(self.data.data) self.data.moveArchives(self.selected,newPos) self.data.refresh(what='N') self.gTank.RefreshUI()
478,682
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Open...')) menu.AppendItem(menuItem) self.selected = [x for x in self.selected if x != self.data.lastKey] menuItem.Enable(bool(self.selected))
def AppendToMenu(self,menu,window,data): Link.AppendToMenu(self,menu,window,data) menuItem = wx.MenuItem(menu,self.id,_('Open...')) menu.AppendItem(menuItem) self.selected = [x for x in self.selected if x != self.data.lastKey] menuItem.Enable(bool(self.selected))
478,683
def Execute(self,event): """Handle selection.""" message = _("Attempt to open this as a mod at Fallout3Nexus? This assumes that the trailing digits in the package's name are actually the id number of the mod at Fallout3Nexus. If this assumption is wrong, you'll just get a random mod page (or error notice) at Fallout3Nexus.") if balt.askContinue(self.gTank,message,'bash.installers.openFallout3Nexus',_('Open at Fallout3Nexus')): id = bosh.reFallout3Nexus.search(self.selected[0].s).group(1) os.startfile('http://fallout3nexus.com/downloads/file.php?id='+id)
def Execute(self,event): """Handle selection.""" message = _("Attempt to open this as a mod at Fallout3Nexus? This assumes that the trailing digits in the package's name are actually the id number of the mod at Fallout3Nexus. If this assumption is wrong, you'll just get a random mod page (or error notice) at Fallout3Nexus.") if balt.askContinue(self.gTank,message,'bash.installers.openFallout3Nexus',_('Open at Fallout3Nexus')): id = bosh.reFallout3Nexus.search(self.selected[0].s).group(1) os.startfile('http://fallout3nexus.com/downloads/file.php?id='+id)
478,684
def Execute(self,event): """Handle selection.""" dir = self.data.dir progress = balt.Progress(_("Refreshing Packages..."),'\n'+' '*60) progress.setFull(len(self.selected)) try: for index,archive in enumerate(self.selected): progress(index,_("Refreshing Packages...\n")+archive.s) installer = self.data[archive] apath = bosh.dirs['installers'].join(archive) installer.refreshBasic(apath,SubProgress(progress,index,index+1),True) self.data.hasChanged = True finally: if progress != None: progress.Destroy() self.data.refresh(what='NSC') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" dir = self.data.dir progress = balt.Progress(_("Refreshing Packages..."),'\n'+' '*60) progress.setFull(len(self.selected)) try: for index,archive in enumerate(self.selected): progress(index,_("Refreshing Packages...\n")+archive.s) installer = self.data[archive] apath = bosh.dirs['installers'].join(archive) installer.refreshBasic(apath,SubProgress(progress,index,index+1),True) self.data.hasChanged = True finally: if progress != None: progress.Destroy() self.data.refresh(what='NSC') self.gTank.RefreshUI()
478,685
def Execute(self,event): """Handle selection.""" installer = self.data[self.selected[0]] installer.skipVoices ^= True installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
def Execute(self,event): """Handle selection.""" installer = self.data[self.selected[0]] installer.skipVoices ^= True installer.refreshDataSizeCrc() self.data.refresh(what='NS') self.gTank.RefreshUI()
478,686
def Execute(self,event): """Handle selection.""" dir = self.data.dir progress = balt.Progress(_("Uninstalling..."),'\n'+' '*60) try: self.data.uninstall(self.selected,progress) finally: progress.Destroy() self.data.refresh(what='NS') gInstallers.RefreshUIMods()
def Execute(self,event): """Handle selection.""" dir = self.data.dir progress = balt.Progress(_("Uninstalling..."),'\n'+' '*60) try: self.data.uninstall(self.selected,progress) finally: progress.Destroy() self.data.refresh(what='NS') gInstallers.RefreshUIMods()
478,687
def Execute(self,event): archive = self.selected[0] installer = self.data[archive] project = archive.root result = balt.askText(self.gTank,_("Unpack %s to Project:") % archive.s, self.title,project.s) result = (result or '').strip() if not result: return #--Error checking project = GPath(result).tail if not project.s or project.cext in bosh.readExts: balt.ShowWarning(self.gTank,_("%s is not a valid project name.") % result) return if self.data.dir.join(project).isfile(): balt.ShowWarning(self.gTank,_("%s is a file.") % project.s) return if project in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % project.s,self.title,False): return #--Copy to Build progress = balt.Progress(_("Unpacking to Project..."),'\n'+' '*60) try: installer.unpackToProject(archive,project,SubProgress(progress,0,0.8)) if project not in self.data: self.data[project] = bosh.InstallerProject(project) iProject = self.data[project] pProject = bosh.dirs['installers'].join(project) iProject.refreshed = False iProject.refreshBasic(pProject,SubProgress(progress,0.8,0.99),True) if iProject.order == -1: self.data.refreshOrder() self.data.moveArchives([project],installer.order+1) self.data.refresh(what='NS') self.gTank.RefreshUI() #pProject.start() finally: progress.Destroy()
def Execute(self,event): archive = self.selected[0] installer = self.data[archive] project = archive.root result = balt.askText(self.gTank,_("Unpack %s to Project:") % archive.s, self.title,project.s) result = (result or '').strip() if not result: return #--Error checking project = GPath(result).tail if not project.s or project.cext in bosh.readExts: balt.ShowWarning(self.gTank,_("%s is not a valid project name.") % result) return if self.data.dir.join(project).isfile(): balt.ShowWarning(self.gTank,_("%s is a file.") % project.s) return if project in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % project.s,self.title,False): return #--Copy to Build progress = balt.Progress(_("Unpacking to Project..."),'\n'+' '*60) try: installer.unpackToProject(archive,project,SubProgress(progress,0,0.8)) if project not in self.data: self.data[project] = bosh.InstallerProject(project) iProject = self.data[project] pProject = bosh.dirs['installers'].join(project) iProject.refreshed = False iProject.refreshBasic(pProject,SubProgress(progress,0.8,0.99),True) if iProject.order == -1: self.data.refreshOrder() self.data.moveArchives([project],installer.order+1) self.data.refresh(what='NS') self.gTank.RefreshUI() #pProject.start() finally: progress.Destroy()
478,688
def DoSave(self,event): """Handle save button.""" config = self.config #--Text fields config.name = self.gName.GetValue().strip() config.website = self.gWebsite.GetValue().strip() config.author = self.gAuthor.GetValue().strip() config.email = self.gEmail.GetValue().strip() config.abstract = self.gAbstract.GetValue().strip() #--Version maVersion = re.match(r'(\d+)\.(\d+)',self.gVersion.GetValue().strip()) if maVersion: config.vMajor,config.vMinor = map(int,maVersion.groups()) else: config.vMajor,config.vMinor = (0,0) #--Done self.data[self.project].writeFomodConfig(self.project,self.config) self.Destroy()
def DoSave(self,event): """Handle save button.""" config = self.config #--Text fields config.name = self.gName.GetValue().strip() config.website = self.gWebsite.GetValue().strip() config.author = self.gAuthor.GetValue().strip() config.email = self.gEmail.GetValue().strip() config.abstract = self.gAbstract.GetValue().strip() #--Version maVersion = re.match(r'(\d+)\.(\d+)',self.gVersion.GetValue().strip()) if maVersion: config.vMajor,config.vMinor = map(int,maVersion.groups()) else: config.vMajor,config.vMinor = (0,0) #--Done self.data[self.project].writeFomodConfig(self.project,self.config) self.Destroy()
478,689
def Execute(self,event): project = self.selected[0] dialog = InstallerProject_FomodConfigDialog(self.gTank,self.data,project) dialog.Show()
def Execute(self,event): project = self.selected[0] dialog = InstallerProject_FomodConfigDialog(self.gTank,self.data,project) dialog.Show()
478,690
def Execute(self,event): project = self.selected[0] installer = self.data[project] missing = installer.missingFiles mismatched = installer.mismatchedFiles message = _("Update %s according to data directory?\nFiles to delete: %d\nFiles to update: %d") % ( project.s,len(missing),len(mismatched)) if not balt.askWarning(self.gTank,message,self.title): return #--Sync it, baby! progress = balt.Progress(self.title,'\n'+' '*60) try: progress(0.1,_("Updating files.")) installer.syncToData(project,missing|mismatched) pProject = bosh.dirs['installers'].join(project) installer.refreshed = False installer.refreshBasic(pProject,SubProgress(progress,0.1,0.99),True) self.data.refresh(what='NS') self.gTank.RefreshUI() finally: progress.Destroy()
def Execute(self,event): project = self.selected[0] installer = self.data[project] missing = installer.missingFiles mismatched = installer.mismatchedFiles message = _("Update %s according to data directory?\nFiles to delete: %d\nFiles to update: %d") % ( project.s,len(missing),len(mismatched)) if not balt.askWarning(self.gTank,message,self.title): return #--Sync it, baby! progress = balt.Progress(self.title,'\n'+' '*60) try: progress(0.1,_("Updating files.")) installer.syncToData(project,missing|mismatched) pProject = bosh.dirs['installers'].join(project) installer.refreshed = False installer.refreshBasic(pProject,SubProgress(progress,0.1,0.99),True) self.data.refresh(what='NS') self.gTank.RefreshUI() finally: progress.Destroy()
478,691
def Execute(self,event): raise UncodedError
def Execute(self,event): raise UncodedError
478,692
def Execute(self,event): #--Generate default filename from the project name and the default extension project = self.selected[0] installer = self.data[project] archive = bosh.GPath(project.s + bosh.defaultExt) #--Confirm operation result = balt.askText(self.gTank,_("Pack %s to Archive:") % project.s, self.title,archive.s) result = (result or '').strip() if not result: return #--Error checking archive = GPath(result).tail if not archive.s: balt.ShowWarning(self.gTank,_("%s is not a valid archive name.") % result) return if self.data.dir.join(archive).isdir(): balt.ShowWarning(self.gTank,_("%s is a directory.") % archive.s) return if archive.cext not in bosh.writeExts: balt.showWarning(self.gTank,_("The %s extension is unsupported. Using %s instead.") % (archive.cext, bosh.defaultExt)) archive = GPath(archive.sroot + bosh.defaultExt).tail if archive in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % archive.s,self.title,False): return #--Archive configuration options if archive.cext in bosh.noSolidExts: isSolid = False else: isSolid = balt.askYes(self.gTank,_("Use solid compression for %s?") % archive.s,self.title,False) progress = balt.Progress(_("Packing to Archive..."),'\n'+' '*60) try: #--Pack installer.packToArchive(project,archive,isSolid,SubProgress(progress,0,0.8)) #--Add the new archive to Bash if archive not in self.data: self.data[archive] = bosh.InstallerArchive(archive) #--Refresh UI iArchive = self.data[archive] pArchive = bosh.dirs['installers'].join(archive) iArchive.refreshed = False iArchive.refreshBasic(pArchive,SubProgress(progress,0.8,0.99),True) if iArchive.order == -1: self.data.refreshOrder() self.data.moveArchives([archive],installer.order+1) #--Refresh UI self.data.refresh(what='NS') self.gTank.RefreshUI() finally: progress.Destroy()
def Execute(self,event): #--Generate default filename from the project name and the default extension project = self.selected[0] installer = self.data[project] archive = bosh.GPath(project.s + bosh.defaultExt) #--Confirm operation result = balt.askText(self.gTank,_("Pack %s to Archive:") % project.s, self.title,archive.s) result = (result or '').strip() if not result: return #--Error checking archive = GPath(result).tail if not archive.s: balt.ShowWarning(self.gTank,_("%s is not a valid archive name.") % result) return if self.data.dir.join(archive).isdir(): balt.ShowWarning(self.gTank,_("%s is a directory.") % archive.s) return if archive.cext not in bosh.writeExts: balt.showWarning(self.gTank,_("The %s extension is unsupported. Using %s instead.") % (archive.cext, bosh.defaultExt)) archive = GPath(archive.sroot + bosh.defaultExt).tail if archive in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % archive.s,self.title,False): return #--Archive configuration options if archive.cext in bosh.noSolidExts: isSolid = False else: isSolid = balt.askYes(self.gTank,_("Use solid compression for %s?") % archive.s,self.title,False) progress = balt.Progress(_("Packing to Archive..."),'\n'+' '*60) try: #--Pack installer.packToArchive(project,archive,isSolid,SubProgress(progress,0,0.8)) #--Add the new archive to Bash if archive not in self.data: self.data[archive] = bosh.InstallerArchive(archive) #--Refresh UI iArchive = self.data[archive] pArchive = bosh.dirs['installers'].join(archive) iArchive.refreshed = False iArchive.refreshBasic(pArchive,SubProgress(progress,0.8,0.99),True) if iArchive.order == -1: self.data.refreshOrder() self.data.moveArchives([archive],installer.order+1) #--Refresh UI self.data.refresh(what='NS') self.gTank.RefreshUI() finally: progress.Destroy()
478,693
def Execute(self,event): #--Generate default filename from the project name and the default extension project = self.selected[0] installer = self.data[project] archive = bosh.GPath(project.s + bosh.defaultExt) #--Confirm operation result = balt.askText(self.gTank,_("Pack %s to Archive:") % project.s, self.title,archive.s) result = (result or '').strip() if not result: return #--Error checking archive = GPath(result).tail if not archive.s: balt.ShowWarning(self.gTank,_("%s is not a valid archive name.") % result) return if self.data.dir.join(archive).isdir(): balt.ShowWarning(self.gTank,_("%s is a directory.") % archive.s) return if archive.cext not in bosh.writeExts: balt.showWarning(self.gTank,_("The %s extension is unsupported. Using %s instead.") % (archive.cext, bosh.defaultExt)) archive = GPath(archive.sroot + bosh.defaultExt).tail if archive in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % archive.s,self.title,False): return #--Archive configuration options if archive.cext in bosh.noSolidExts: isSolid = False else: isSolid = balt.askYes(self.gTank,_("Use solid compression for %s?") % archive.s,self.title,False) progress = balt.Progress(_("Packing to Archive..."),'\n'+' '*60) try: #--Pack installer.packToArchive(project,archive,isSolid,SubProgress(progress,0,0.8),release=True) #--Add the new archive to Bash if archive not in self.data: self.data[archive] = bosh.InstallerArchive(archive) #--Refresh UI iArchive = self.data[archive] pArchive = bosh.dirs['installers'].join(archive) iArchive.refreshed = False iArchive.refreshBasic(pArchive,SubProgress(progress,0.8,0.99),True) if iArchive.order == -1: self.data.refreshOrder() self.data.moveArchives([archive],installer.order+1) #--Refresh UI self.data.refresh(what='NS') self.gTank.RefreshUI() finally: progress.Destroy()
def Execute(self,event): #--Generate default filename from the project name and the default extension project = self.selected[0] installer = self.data[project] archive = bosh.GPath(project.s + bosh.defaultExt) #--Confirm operation result = balt.askText(self.gTank,_("Pack %s to Archive:") % project.s, self.title,archive.s) result = (result or '').strip() if not result: return #--Error checking archive = GPath(result).tail if not archive.s: balt.ShowWarning(self.gTank,_("%s is not a valid archive name.") % result) return if self.data.dir.join(archive).isdir(): balt.ShowWarning(self.gTank,_("%s is a directory.") % archive.s) return if archive.cext not in bosh.writeExts: balt.showWarning(self.gTank,_("The %s extension is unsupported. Using %s instead.") % (archive.cext, bosh.defaultExt)) archive = GPath(archive.sroot + bosh.defaultExt).tail if archive in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % archive.s,self.title,False): return #--Archive configuration options if archive.cext in bosh.noSolidExts: isSolid = False else: isSolid = balt.askYes(self.gTank,_("Use solid compression for %s?") % archive.s,self.title,False) progress = balt.Progress(_("Packing to Archive..."),'\n'+' '*60) try: #--Pack installer.packToArchive(project,archive,isSolid,SubProgress(progress,0,0.8),release=True) #--Add the new archive to Bash if archive not in self.data: self.data[archive] = bosh.InstallerArchive(archive) #--Refresh UI iArchive = self.data[archive] pArchive = bosh.dirs['installers'].join(archive) iArchive.refreshed = False iArchive.refreshBasic(pArchive,SubProgress(progress,0.8,0.99),True) if iArchive.order == -1: self.data.refreshOrder() self.data.moveArchives([archive],installer.order+1) #--Refresh UI self.data.refresh(what='NS') self.gTank.RefreshUI() finally: progress.Destroy()
478,694
def Execute(self,event): #--Generate default filename from BCF filename result = self.converter.fullPath.sbody[:-4] #--List source archives message = _("Using:\n* ") message += '\n* '.join(sorted("(%08X) - %s" % (x,self.data.crc_installer[x].archive) for x in self.converter.srcCRCs)) + '\n' #--Confirm operation result = balt.askText(self.gTank,message,self.title,result + bosh.defaultExt) result = (result or '').strip() if not result: return #--Error checking destArchive = GPath(result).tail if not destArchive.s: balt.showWarning(self.gTank,_("%s is not a valid archive name.") % result) return if destArchive.cext not in bosh.writeExts: balt.showWarning(self.gTank,_("The %s extension is unsupported. Using %s instead.") % (destArchive.cext, bosh.defaultExt)) destArchive = GPath(destArchive.sroot + bosh.defaultExt).tail if destArchive in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % destArchive.s,self.title,False): return progress = balt.Progress(_("Converting to Archive..."),'\n'+' '*60) try: #--Perform the conversion self.converter.apply(destArchive,self.data.crc_installer,SubProgress(progress,0.0,0.99)) #--Add the new archive to Bash if destArchive not in self.data: self.data[destArchive] = bosh.InstallerArchive(destArchive) #--Apply settings from the BCF to the new InstallerArchive iArchive = self.data[destArchive] self.converter.applySettings(iArchive) #--Refresh UI pArchive = bosh.dirs['installers'].join(destArchive) iArchive.refreshed = False iArchive.refreshBasic(pArchive,SubProgress(progress,0.99,1.0),True) if iArchive.order == -1: self.data.refreshOrder() lastInstaller = self.data[self.selected[-1]] self.data.moveArchives([destArchive],lastInstaller.order+1) self.data.refresh(what='NSC') self.gTank.RefreshUI() finally: progress.Destroy()
def Execute(self,event): #--Generate default filename from BCF filename result = self.converter.fullPath.sbody[:-4] #--List source archives message = _("Using:\n* ") message += '\n* '.join(sorted("(%08X) - %s" % (x,self.data.crc_installer[x].archive) for x in self.converter.srcCRCs)) + '\n' #--Confirm operation result = balt.askText(self.gTank,message,self.title,result + bosh.defaultExt) result = (result or '').strip() if not result: return #--Error checking destArchive = GPath(result).tail if not destArchive.s: balt.showWarning(self.gTank,_("%s is not a valid archive name.") % result) return if destArchive.cext not in bosh.writeExts: balt.showWarning(self.gTank,_("The %s extension is unsupported. Using %s instead.") % (destArchive.cext, bosh.defaultExt)) destArchive = GPath(destArchive.sroot + bosh.defaultExt).tail if destArchive in self.data: if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % destArchive.s,self.title,False): return progress = balt.Progress(_("Converting to Archive..."),'\n'+' '*60) try: #--Perform the conversion self.converter.apply(destArchive,self.data.crc_installer,SubProgress(progress,0.0,0.99)) #--Add the new archive to Bash if destArchive not in self.data: self.data[destArchive] = bosh.InstallerArchive(destArchive) #--Apply settings from the BCF to the new InstallerArchive iArchive = self.data[destArchive] self.converter.applySettings(iArchive) #--Refresh UI pArchive = bosh.dirs['installers'].join(destArchive) iArchive.refreshed = False iArchive.refreshBasic(pArchive,SubProgress(progress,0.99,1.0),True) if iArchive.order == -1: self.data.refreshOrder() lastInstaller = self.data[self.selected[-1]] self.data.moveArchives([destArchive],lastInstaller.order+1) self.data.refresh(what='NSC') self.gTank.RefreshUI() finally: progress.Destroy()
478,695
def AppendToMenu(self,menu,window,data): subMenu = wx.Menu() menu.AppendMenu(-1,self.name,subMenu) linkSet = set() #--Converters are linked by CRC, not archive name #--So, first get all the selected archive CRCs selectedCRCs = set(window.data[archive].crc for archive in window.GetSelected()) srcCRCs = set(window.data.srcCRC_converters) #--There is no point in testing each converter unless #--every selected archive has an associated converter if selectedCRCs <= srcCRCs: #--List comprehension is faster than unrolling the for loops, but readability suffers #--Test every converter for every selected archive #--Only add a link to the converter if it uses all selected archives, #--and all of its required archives are available (but not necessarily selected) linkSet = set([converter for installerCRC in selectedCRCs for converter in window.data.srcCRC_converters[installerCRC] if selectedCRCs <= converter.srcCRCs <= srcCRCs])
def AppendToMenu(self,menu,window,data): subMenu = wx.Menu() menu.AppendMenu(-1,self.name,subMenu) linkSet = set() #--Converters are linked by CRC, not archive name #--So, first get all the selected archive CRCs selectedCRCs = set(window.data[archive].crc for archive in window.GetSelected()) srcCRCs = set(window.data.srcCRC_converters) #--There is no point in testing each converter unless #--every selected archive has an associated converter if selectedCRCs <= srcCRCs: #--List comprehension is faster than unrolling the for loops, but readability suffers #--Test every converter for every selected archive #--Only add a link to the converter if it uses all selected archives, #--and all of its required archives are available (but not necessarily selected) linkSet = set([converter for installerCRC in selectedCRCs for converter in window.data.srcCRC_converters[installerCRC] if selectedCRCs <= converter.srcCRCs <= srcCRCs])
478,696
def Execute(self,event): #--Generate allowable targets readTypes = '*%s' % ';*'.join(bosh.readExts) #--Select target archive destArchive = balt.askOpen(self.gTank,_('Select the BAIN\'ed Archive:'),self.data.dir,'', readTypes) if not destArchive: return #--Error Checking BCFArchive = destArchive = destArchive.tail if not destArchive.s or destArchive.cext not in bosh.readExts: balt.showWarning(self.gTank,_("%s is not a valid archive name.") % destArchive.s) return if destArchive not in self.data: balt.showWarning(self.gTank,_("%s must be in the Bash Installers directory.") % destArchive.s) return if BCFArchive.csbody[-4:] != _('-bcf'): BCFArchive = GPath(BCFArchive.sbody + _('-BCF') + bosh.defaultExt).tail #--List source archives and target archive message = _("Convert:") message += '\n* ' + '\n* '.join(sorted("(%08X) - %s" % (self.data[x].crc,x.s) for x in self.selected)) message += _('\n\nTo:\n* (%08X) - %s') % (self.data[destArchive].crc,destArchive.s) + '\n' #--Confirm operation result = balt.askText(self.gTank,message,self.title,BCFArchive.s) result = (result or '').strip() if not result: return #--Error checking BCFArchive = GPath(result).tail if not BCFArchive.s: balt.showWarning(self.gTank,_("%s is not a valid archive name.") % result) return if BCFArchive.csbody[-4:] != _('-bcf'): BCFArchive = GPath(BCFArchive.sbody + _('-BCF') + BCFArchive.cext).tail if BCFArchive.cext != bosh.defaultExt: balt.showWarning(self.gTank,_("BCF's only support %s. The %s extension will be discarded.") % (bosh.defaultExt, BCFArchive.cext)) BCFArchive = GPath(BCFArchive.sbody + bosh.defaultExt).tail if bosh.dirs['converters'].join(BCFArchive).exists(): if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % BCFArchive.s,self.title,False): return #--It is safe to removeConverter, even if the converter isn't overwritten or removed #--It will be picked back up by the next refresh. self.data.removeConverter(BCFArchive) progress = balt.Progress(_("Creating %s...") % BCFArchive.s,'\n'+' '*60) log = None try: #--Create the converter converter = bosh.InstallerConverter(self.selected, self.data, destArchive, BCFArchive, progress) #--Add the converter to Bash self.data.addConverter(converter) #--Refresh UI self.data.refresh(what='C') #--Generate log log = bolt.LogFile(cStringIO.StringIO()) log.setHeader(_('== Overview\n'))
def Execute(self,event): #--Generate allowable targets readTypes = '*%s' % ';*'.join(bosh.readExts) #--Select target archive destArchive = balt.askOpen(self.gTank,_('Select the BAIN\'ed Archive:'),self.data.dir,'', readTypes) if not destArchive: return #--Error Checking BCFArchive = destArchive = destArchive.tail if not destArchive.s or destArchive.cext not in bosh.readExts: balt.showWarning(self.gTank,_("%s is not a valid archive name.") % destArchive.s) return if destArchive not in self.data: balt.showWarning(self.gTank,_("%s must be in the Bash Installers directory.") % destArchive.s) return if BCFArchive.csbody[-4:] != _('-bcf'): BCFArchive = GPath(BCFArchive.sbody + _('-BCF') + bosh.defaultExt).tail #--List source archives and target archive message = _("Convert:") message += '\n* ' + '\n* '.join(sorted("(%08X) - %s" % (self.data[x].crc,x.s) for x in self.selected)) message += _('\n\nTo:\n* (%08X) - %s') % (self.data[destArchive].crc,destArchive.s) + '\n' #--Confirm operation result = balt.askText(self.gTank,message,self.title,BCFArchive.s) result = (result or '').strip() if not result: return #--Error checking BCFArchive = GPath(result).tail if not BCFArchive.s: balt.showWarning(self.gTank,_("%s is not a valid archive name.") % result) return if BCFArchive.csbody[-4:] != _('-bcf'): BCFArchive = GPath(BCFArchive.sbody + _('-BCF') + BCFArchive.cext).tail if BCFArchive.cext != bosh.defaultExt: balt.showWarning(self.gTank,_("BCF's only support %s. The %s extension will be discarded.") % (bosh.defaultExt, BCFArchive.cext)) BCFArchive = GPath(BCFArchive.sbody + bosh.defaultExt).tail if bosh.dirs['converters'].join(BCFArchive).exists(): if not balt.askYes(self.gTank,_("%s already exists. Overwrite it?") % BCFArchive.s,self.title,False): return #--It is safe to removeConverter, even if the converter isn't overwritten or removed #--It will be picked back up by the next refresh. self.data.removeConverter(BCFArchive) progress = balt.Progress(_("Creating %s...") % BCFArchive.s,'\n'+' '*60) log = None try: #--Create the converter converter = bosh.InstallerConverter(self.selected, self.data, destArchive, BCFArchive, progress) #--Add the converter to Bash self.data.addConverter(converter) #--Refresh UI self.data.refresh(what='C') #--Generate log log = bolt.LogFile(cStringIO.StringIO()) log.setHeader(_('== Overview\n'))
478,697
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)
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)
478,698
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)
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)
478,699