def __init__(self): self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.targetResists = None self.character = Character.getInstance().all5() self.booster = False self.dirtyFitIDs = set() serviceFittingDefaultOptions = { "useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False, "colorFitBySlot": False, "rackSlots": True, "rackLabels": True, "compactSkills": True, "showTooltip": True, "showMarketShortcuts": False, "enableGaugeAnimation": True, "exportCharges": True } self.serviceFittingOptions = SettingsProvider.getInstance( ).getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def getText(self, callingWindow, itmContext): sDP = DmgPatternSvc.getInstance() sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() self.fit = sFit.getFit(fitID) builtinPatterns = sDP.getBuiltinDamagePatternList() userPatterns = sorted(sDP.getUserDamagePatternList(), key=lambda p: smartSort(p.fullName)) # Order here is important: patterns with duplicate names from the latter will overwrite # patterns from the former self.patterns = sorted( chain(builtinPatterns, userPatterns), key=lambda p: p.fullName not in ["Uniform", "Selected Ammo"]) self.patternEventMap = {} self.items = (OrderedDict(), OrderedDict()) for pattern in self.patterns: container = self.items for categoryName in pattern.hierarchy: categoryName = _t( categoryName) if pattern.builtin else categoryName container = container[1].setdefault( categoryName, (OrderedDict(), OrderedDict())) shortName = _t( pattern.shortName) if pattern.builtin else pattern.shortName container[0][shortName] = pattern return list(self.items[0].keys()) + list(self.items[1].keys())
def getText(self, itmContext, selection): sDP = import_DamagePattern.getInstance() sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() self.fit = sFit.getFit(fitID) self.patterns = sDP.getDamagePatternList() self.patterns.sort(key=lambda p: (p.name not in ["Uniform", "Selected Ammo"], p.name)) self.patternIds = {} self.subMenus = OrderedDict() self.singles = [] # iterate and separate damage patterns based on "[Parent] Child" for pattern in self.patterns: start, end = pattern.name.find('['), pattern.name.find(']') if start is not -1 and end is not -1: currBase = pattern.name[start + 1:end] # set helper attr setattr(pattern, "_name", pattern.name[end + 1:].strip()) if currBase not in self.subMenus: self.subMenus[currBase] = [] self.subMenus[currBase].append(pattern) else: self.singles.append(pattern) # return list of names, with singles first followed by submenu names self.m = map(lambda p: p.name, self.singles) + self.subMenus.keys() return self.m
def __init__(self): pyfalog.debug("Initialize Fit class") self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.targetResists = None self.character = saveddata_Character.getAll5() self.booster = False self.dirtyFitIDs = set() serviceFittingDefaultOptions = { "useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False, "colorFitBySlot": False, "rackSlots": True, "rackLabels": True, "compactSkills": True, "showTooltip": True, "showMarketShortcuts": False, "enableGaugeAnimation": True, "exportCharges": True, "openFitInNew": False, "priceSystem": "Jita", "priceSource": "eve-marketdata.com", "showShipBrowserTooltip": True, "marketSearchDelay": 250 } self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( "pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def __init__(self): pyfalog.debug("Initialize Fit class") self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.targetResists = None self.character = saveddata_Character.getAll5() self.booster = False self.dirtyFitIDs = set() serviceFittingDefaultOptions = { "useGlobalCharacter": False, "useCharacterImplantsByDefault": True, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False, "colorFitBySlot": False, "rackSlots": True, "rackLabels": True, "compactSkills": True, "showTooltip": True, "showMarketShortcuts": False, "enableGaugeAnimation": True, "exportCharges": True, "openFitInNew": False, "priceSystem": "Jita", "priceSource": "eve-marketdata.com", "showShipBrowserTooltip": True, "marketSearchDelay": 250 } self.serviceFittingOptions = SettingsProvider.getInstance( ).getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def __init__(self): self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.targetResists = None self.character = Character.getInstance().all5() self.booster = False self.dirtyFitIDs = set() serviceFittingDefaultOptions = { "useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False, "colorFitBySlot": False, "rackSlots": True, "rackLabels": True, "compactSkills": True, "showTooltip": True, "showMarketShortcuts": False, "enableGaugeAnimation": True, "exportCharges": True, "openFitInNew":False } self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( "pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def getText(self, itmContext, selection): sDP = import_DamagePattern.getInstance() sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() self.fit = sFit.getFit(fitID) self.patterns = sDP.getDamagePatternList() self.patterns.sort( key=lambda p: (p.name not in ["Uniform", "Selected Ammo"], p.name)) self.patternIds = {} self.subMenus = OrderedDict() self.singles = [] # iterate and separate damage patterns based on "[Parent] Child" for pattern in self.patterns: start, end = pattern.name.find('['), pattern.name.find(']') if start is not -1 and end is not -1: currBase = pattern.name[start + 1:end] # set helper attr setattr(pattern, "_name", pattern.name[end + 1:].strip()) if currBase not in self.subMenus: self.subMenus[currBase] = [] self.subMenus[currBase].append(pattern) else: self.singles.append(pattern) # return list of names, with singles first followed by submenu names self.m = [p.name for p in self.singles] + list(self.subMenus.keys()) return self.m
def __init__(self): self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.character = Character.getInstance().all5() self.dirtyFitIDs = set() serviceFittingDefaultOptions = {"useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False} self.serviceFittingOptions = SettingsProvider.getInstance().getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def OnInputTimer(self, event): event.Skip() if self.block: return p = self.entityEditor.getActiveEntity() total = sum([ getattr(self, "%sEdit" % attr).GetValueFloat() for attr in self.DAMAGE_TYPES ]) for type_ in self.DAMAGE_TYPES: editBox = getattr(self, "%sEdit" % type_) percLabel = getattr(self, "%sPerc" % type_) setattr(p, "%sAmount" % type_, editBox.GetValueFloat()) percLabel.SetLabel("%.1f%%" % (float(editBox.GetValueFloat()) * 100 / total if total > 0 else 0)) self.totSizer.Layout() DamagePattern.getInstance().saveChanges(p)
def ValuesUpdated(self, event=None): if self.block: return p = self.entityEditor.getActiveEntity() total = sum([getattr(self, "%sEdit" % attr).GetValue() for attr in self.DAMAGE_TYPES]) for type_ in self.DAMAGE_TYPES: editObj = getattr(self, "%sEdit" % type_) percObj = getattr(self, "%sPerc" % type_) setattr(p, "%sAmount" % type_, editObj.GetValue()) percObj.SetLabel("%.1f%%" % (float(editObj.GetValue()) * 100 / total if total > 0 else 0)) self.totSizer.Layout() if event is not None: event.Skip() DamagePattern.getInstance().saveChanges(p)
def _getPatterns(self): sDP = DmgPatternSvc.getInstance() builtinPatterns = sDP.getBuiltinDamagePatternList() userPatterns = sorted(sDP.getUserDamagePatternList(), key=lambda p: smartSort(p.fullName)) # Order here is important: patterns with duplicate names from the latter will overwrite # patterns from the former patterns = sorted( chain(builtinPatterns, userPatterns), key=lambda p: p.fullName not in ["Uniform", "Selected Ammo"]) return patterns
def setAsPattern(self, fitID, ammo): if fitID is None: return sDP = DamagePattern.getInstance() dp = sDP.getDamagePattern("Selected Ammo") if dp is None: dp = eos.types.DamagePattern() dp.name = "Selected Ammo" fit = eos.db.getFit(fitID) for attr in ("em", "thermal", "kinetic", "explosive"): setattr(dp, "%sAmount" % attr, ammo.getAttribute("%sDamage" % attr)) fit.damagePattern = dp self.recalc(fit)
def setAsPattern(self, fitID, ammo): pyfalog.debug("Set as pattern for fit ID: {0}", fitID) if fitID is None: return sDP = DamagePattern.getInstance() dp = sDP.getDamagePattern("Selected Ammo") if dp is None: dp = es_DamagePattern() dp.rawName = "Selected Ammo" fit = eos.db.getFit(fitID) for attr in ("em", "thermal", "kinetic", "explosive"): setattr(dp, "%sAmount" % attr, ammo.getAttribute("%sDamage" % attr) or 0) fit.damagePattern = dp self.recalc(fit)
def __init__(self): self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.character = Character.getInstance().all5() self.booster = False self.dirtyFitIDs = set() serviceFittingDefaultOptions = { "useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False, "colorFitBySlot": False, "rackSlots": True, "rackLabels": True, "compactSkills": True} self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( "pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def importPatterns(self, event): text = fromClipboard() if text: sDP = DamagePattern.getInstance() try: sDP.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") except ImportError as e: pyfalog.error(e) self.stNotice.SetLabel(str(e)) except Exception as e: msg = "Could not import from clipboard: unknown errors" pyfalog.warning(msg) pyfalog.error(e) self.stNotice.SetLabel(msg) finally: self.entityEditor.refreshEntityList() else: self.stNotice.SetLabel("Could not import from clipboard")
def __init__(self): self.pattern = DamagePattern.getInstance().getDamagePattern("Uniform") self.character = Character.getInstance().all5() self.booster = False self.dirtyFitIDs = set() serviceFittingDefaultOptions = { "useGlobalCharacter": False, "useGlobalDamagePattern": False, "defaultCharacter": self.character.ID, "useGlobalForceReload": False, "colorFitBySlot": False, "rackSlots": True, "rackLabels": True, "compactSkills": True } self.serviceFittingOptions = SettingsProvider.getInstance( ).getSettings("pyfaServiceFittingOptions", serviceFittingDefaultOptions)
def exportPatterns(self, event): sDP = DamagePattern.getInstance() toClipboard(sDP.exportPatterns()) self.stNotice.SetLabel("Patterns exported to clipboard")
def DoDelete(self, entity): sDP = DamagePattern.getInstance() sDP.deletePattern(entity)
def DoCopy(self, entity, name): sDP = DamagePattern.getInstance() copy = sDP.copyPattern(entity) sDP.renamePattern(copy, name) return copy
def DoRename(self, entity, name): sDP = DamagePattern.getInstance() sDP.renamePattern(entity, name)
def DoNew(self, name): sDP = DamagePattern.getInstance() return sDP.newPattern(name)
def getEntitiesFromContext(self): sDP = DamagePattern.getInstance() choices = sorted(sDP.getDamagePatternList(), key=lambda p: p.name) return [c for c in choices if c.name != "Selected Ammo"]
def getEntitiesFromContext(self): sDP = DamagePattern.getInstance() choices = sorted(sDP.getUserDamagePatternList(), key=lambda p: p.rawName) return [c for c in choices if c.rawName != "Selected Ammo"]