py2to3 automatic conversion. Woot!

This commit is contained in:
Ryan Holmes
2017-06-12 16:12:45 -04:00
parent ad535ccc78
commit 828b18d0fd
147 changed files with 1017 additions and 783 deletions

View File

@@ -28,7 +28,7 @@ def DBInMemory_test():
gamedataCache = True
saveddataCache = True
gamedata_version = ""
gamedata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(unicode(__file__))), "..", "eve.db"))
gamedata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(str(__file__))), "..", "eve.db"))
saveddata_connectionstring = 'sqlite:///:memory:'
class ReadOnlyException(Exception):
@@ -100,8 +100,8 @@ def DBInMemory():
import eos.db
# Output debug info to help us troubleshoot Travis
print(eos.db.saveddata_engine)
print(eos.db.gamedata_engine)
print((eos.db.saveddata_engine))
print((eos.db.gamedata_engine))
helper = {
'config': eos.config,

View File

@@ -41,7 +41,7 @@ def CurseFit(DB, Gamedata, Saveddata):
mod.state = Saveddata['State'].ONLINE
# Add 5 neuts
for _ in xrange(5):
for _ in range(5):
fit.modules.append(mod)
return fit
@@ -60,7 +60,7 @@ def HeronFit(DB, Gamedata, Saveddata):
mod.state = Saveddata['State'].ONLINE
# Add 5 neuts
for _ in xrange(4):
for _ in range(4):
fit.modules.append(mod)
return fit

View File

@@ -94,8 +94,8 @@ def GetUnicodePath(root, file=None, codec=None):
path = os.path.join(path, file)
if codec:
path = unicode(path, codec)
path = str(path, codec)
else:
path = unicode(path)
path = str(path)
return path

View File

@@ -47,12 +47,12 @@ def __createDirs(path):
def getPyfaRoot():
base = getattr(sys.modules['__main__'], "__file__", sys.executable) if isFrozen() else sys.argv[0]
root = os.path.dirname(os.path.realpath(os.path.abspath(base)))
root = unicode(root, sys.getfilesystemencoding())
root = str(root, sys.getfilesystemencoding())
return root
def getDefaultSave():
return unicode(os.path.expanduser(os.path.join("~", ".pyfa")), sys.getfilesystemencoding())
return str(os.path.expanduser(os.path.join("~", ".pyfa")), sys.getfilesystemencoding())
def defPaths(customSavePath):

View File

@@ -1,6 +1,7 @@
import heapq
import time
from math import sqrt, exp
from functools import reduce
DAY = 24 * 60 * 60 * 1000
@@ -87,7 +88,7 @@ class CapSimulator(object):
mods[(duration, capNeed, clipSize, disableStagger)] = 1
# Loop over grouped modules, configure staggering and push to the simulation state
for (duration, capNeed, clipSize, disableStagger), amount in mods.iteritems():
for (duration, capNeed, clipSize, disableStagger), amount in mods.items():
if self.stagger and not disableStagger:
if clipSize == 0:
duration = int(duration / amount)
@@ -192,7 +193,7 @@ class CapSimulator(object):
# calculate EVE's stability value
try:
avgDrain = reduce(float.__add__, map(lambda x: x[2] / x[1], self.state), 0.0)
avgDrain = reduce(float.__add__, [x[2] / x[1] for x in self.state], 0.0)
self.cap_stable_eve = 0.25 * (1.0 + sqrt(-(2.0 * avgDrain * tau - capCapacity) / capCapacity)) ** 2
except ValueError:
self.cap_stable_eve = 0.0

View File

@@ -11,14 +11,14 @@ debug = False
gamedataCache = True
saveddataCache = True
gamedata_version = ""
gamedata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath(__file__)), "..", "eve.db")), sys.getfilesystemencoding())
gamedata_connectionstring = 'sqlite:///' + str(realpath(join(dirname(abspath(__file__)), "..", "eve.db")), sys.getfilesystemencoding())
pyfalog.debug("Gamedata connection string: {0}", gamedata_connectionstring)
if istravis is True or hasattr(sys, '_called_from_test'):
# Running in Travis. Run saveddata database in memory.
saveddata_connectionstring = 'sqlite:///:memory:'
else:
saveddata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath(__file__)), "..", "saveddata", "saveddata.db")), sys.getfilesystemencoding())
saveddata_connectionstring = 'sqlite:///' + str(realpath(join(dirname(abspath(__file__)), "..", "saveddata", "saveddata.db")), sys.getfilesystemencoding())
pyfalog.debug("Saveddata connection string: {0}", saveddata_connectionstring)
@@ -28,4 +28,4 @@ settings = {
}
# Autodetect path, only change if the autodetection bugs out.
path = dirname(unicode(__file__, sys.getfilesystemencoding()))
path = dirname(str(__file__, sys.getfilesystemencoding()))

View File

@@ -22,7 +22,7 @@ import threading
from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker
import migration
from . import migration
from eos import config
from logbook import Logger

View File

@@ -81,7 +81,7 @@ def getItem(lookfor, eager=None):
item = gamedata_session.query(Item).get(lookfor)
else:
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
if lookfor in itemNameMap:
id = itemNameMap[lookfor]
if eager is None:
@@ -154,7 +154,7 @@ def getGroup(lookfor, eager=None):
group = gamedata_session.query(Group).get(lookfor)
else:
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
if lookfor in groupNameMap:
id = groupNameMap[lookfor]
if eager is None:
@@ -181,7 +181,7 @@ def getCategory(lookfor, eager=None):
else:
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
Category.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
if lookfor in categoryNameMap:
id = categoryNameMap[lookfor]
if eager is None:
@@ -210,7 +210,7 @@ def getMetaGroup(lookfor, eager=None):
else:
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
if lookfor in metaGroupNameMap:
id = metaGroupNameMap[lookfor]
if eager is None:
@@ -245,7 +245,7 @@ def getMarketGroup(lookfor, eager=None):
def getItemsByCategory(filter, where=None, eager=None):
if isinstance(filter, int):
filter = Category.ID == filter
elif isinstance(filter, basestring):
elif isinstance(filter, str):
filter = Category.name == filter
else:
raise TypeError("Need integer or string as argument")
@@ -257,7 +257,7 @@ def getItemsByCategory(filter, where=None, eager=None):
@cachedQuery(3, "where", "nameLike", "join")
def searchItems(nameLike, where=None, join=None, eager=None):
if not isinstance(nameLike, basestring):
if not isinstance(nameLike, str):
raise TypeError("Need string as argument")
if join is None:
@@ -268,7 +268,7 @@ def searchItems(nameLike, where=None, join=None, eager=None):
items = gamedata_session.query(Item).options(*processEager(eager)).join(*join)
for token in nameLike.split(' '):
token_safe = u"%{0}%".format(sqlizeString(token))
token_safe = "%{0}%".format(sqlizeString(token))
if where is not None:
items = items.filter(and_(Item.name.like(token_safe, escape="\\"), where))
else:
@@ -279,12 +279,12 @@ def searchItems(nameLike, where=None, join=None, eager=None):
@cachedQuery(3, "where", "nameLike", "join")
def searchSkills(nameLike, where=None, eager=None):
if not isinstance(nameLike, basestring):
if not isinstance(nameLike, str):
raise TypeError("Need string as argument")
items = gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category)
for token in nameLike.split(' '):
token_safe = u"%{0}%".format(sqlizeString(token))
token_safe = "%{0}%".format(sqlizeString(token))
if where is not None:
items = items.filter(and_(Item.name.like(token_safe, escape="\\"), Category.ID == 16, where))
else:
@@ -322,7 +322,7 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None):
@cachedQuery(1, "attr")
def getAttributeInfo(attr, eager=None):
if isinstance(attr, basestring):
if isinstance(attr, str):
filter = AttributeInfo.name == attr
elif isinstance(attr, int):
filter = AttributeInfo.ID == attr
@@ -337,7 +337,7 @@ def getAttributeInfo(attr, eager=None):
@cachedQuery(1, "field")
def getMetaData(field):
if isinstance(field, basestring):
if isinstance(field, str):
data = gamedata_session.query(MetaData).get(field)
else:
raise TypeError("Need string as argument")
@@ -367,7 +367,7 @@ def getRequiredFor(itemID, attrMapping):
skillToLevelClauses = []
for attrSkill, attrLevel in attrMapping.iteritems():
for attrSkill, attrLevel in attrMapping.items():
skillToLevelClauses.append(and_(Attribute1.attributeID == attrSkill, Attribute2.attributeID == attrLevel))
queryOr = or_(*skillToLevelClauses)

View File

@@ -3,7 +3,7 @@ import shutil
import time
import config
import migrations
from . import migrations
pyfalog = Logger(__name__)
@@ -34,7 +34,7 @@ def update(saveddata_engine):
shutil.copyfile(config.saveDB, toFile)
for version in xrange(dbVersion, appVersion):
for version in range(dbVersion, appVersion):
func = migrations.updates[version + 1]
if func:
pyfalog.info("Applying database update: {0}", version + 1)

View File

@@ -91,7 +91,7 @@ def upgrade(saveddata_engine):
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN targetResistsID INTEGER;")
# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -108,7 +108,7 @@ CONVERSIONS = {
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -332,7 +332,7 @@ CONVERSIONS = {
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -60,7 +60,7 @@ CONVERSIONS = {
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -29,7 +29,7 @@ def upgrade(saveddata_engine):
"targetResists": 2
}
for table in tables.keys():
for table in list(tables.keys()):
# midnight brain, there's probably a much more simple way to do this, but fuck it
if tables[table] > 0:

View File

@@ -133,7 +133,7 @@ CONVERSIONS = {
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -17,7 +17,7 @@ CONVERSIONS = {
def upgrade(saveddata_engine):
# Convert ships
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "fits" SET "shipID" = ? WHERE "shipID" = ?',
(replacement_item, retired_item))

View File

@@ -77,7 +77,7 @@ CONVERSIONS = {
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -109,9 +109,9 @@ if configVal is True:
if type not in queryCache:
return
functionCache = queryCache[type]
for _, localCache in functionCache.iteritems():
for _, localCache in functionCache.items():
toDelete = set()
for cacheKey, info in localCache.iteritems():
for cacheKey, info in localCache.items():
IDs = info[1]
if ID in IDs:
toDelete.add(cacheKey)
@@ -156,7 +156,7 @@ def getUser(lookfor, eager=None):
eager = processEager(eager)
with sd_lock:
user = saveddata_session.query(User).options(*eager).filter(User.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
user = saveddata_session.query(User).options(*eager).filter(User.username == lookfor).first()
@@ -175,7 +175,7 @@ def getCharacter(lookfor, eager=None):
eager = processEager(eager)
with sd_lock:
character = saveddata_session.query(Character).options(*eager).filter(Character.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
character = saveddata_session.query(Character).options(*eager).filter(
@@ -337,7 +337,7 @@ def clearPrices():
def getMiscData(field):
if isinstance(field, basestring):
if isinstance(field, str):
with sd_lock:
data = saveddata_session.query(MiscData).get(field)
else:
@@ -391,7 +391,7 @@ def getDamagePattern(lookfor, eager=None):
with sd_lock:
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(
DamagePattern.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(
@@ -412,7 +412,7 @@ def getTargetResists(lookfor, eager=None):
with sd_lock:
pattern = saveddata_session.query(TargetResists).options(*eager).filter(
TargetResists.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(TargetResists).options(*eager).filter(
@@ -433,7 +433,7 @@ def getImplantSet(lookfor, eager=None):
with sd_lock:
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(
TargetResists.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(TargetResists.name == lookfor).first()
@@ -443,10 +443,10 @@ def getImplantSet(lookfor, eager=None):
def searchFits(nameLike, where=None, eager=None):
if not isinstance(nameLike, basestring):
if not isinstance(nameLike, str):
raise TypeError("Need string as argument")
# Prepare our string for request
nameLike = u"%{0}%".format(sqlizeString(nameLike))
nameLike = "%{0}%".format(sqlizeString(nameLike))
# Add any extra components to the search to our where clause
filter = processWhere(Fit.name.like(nameLike, escape="\\"), where)
@@ -484,7 +484,7 @@ def getCrestCharacter(lookfor, eager=None):
eager = processEager(eager)
with sd_lock:
character = saveddata_session.query(CrestChar).options(*eager).filter(CrestChar.ID == lookfor).first()
elif isinstance(lookfor, basestring):
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
character = saveddata_session.query(CrestChar).options(*eager).filter(CrestChar.name == lookfor).first()
@@ -515,8 +515,8 @@ def removeInvalid(fits):
invalids = [f for f in fits if f.isInvalid]
if invalids:
map(fits.remove, invalids)
map(saveddata_session.delete, invalids)
list(map(fits.remove, invalids))
list(map(saveddata_session.delete, invalids))
saveddata_session.commit()
return fits
@@ -547,4 +547,4 @@ def commit():
except Exception:
saveddata_session.rollback()
exc_info = sys.exc_info()
raise exc_info[0], exc_info[1], exc_info[2]
raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])

View File

@@ -39,7 +39,7 @@ def processEager(eager):
return tuple()
else:
l = []
if isinstance(eager, basestring):
if isinstance(eager, str):
eager = (eager,)
for e in eager:
@@ -50,7 +50,7 @@ def processEager(eager):
def _replacements(eagerString):
splitEager = eagerString.split(".")
for i in xrange(len(splitEager)):
for i in range(len(splitEager)):
part = splitEager[i]
replacement = replace.get(part)
if replacement:

View File

@@ -26,7 +26,7 @@ class HandledList(list):
def filteredItemPreAssign(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.preAssignItemAttr(*args, **kwargs)
except AttributeError:
pass
@@ -34,7 +34,7 @@ class HandledList(list):
def filteredItemIncrease(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.increaseItemAttr(*args, **kwargs)
except AttributeError:
pass
@@ -42,7 +42,7 @@ class HandledList(list):
def filteredItemMultiply(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.multiplyItemAttr(*args, **kwargs)
except AttributeError:
pass
@@ -50,7 +50,7 @@ class HandledList(list):
def filteredItemBoost(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.boostItemAttr(*args, **kwargs)
except AttributeError:
pass
@@ -58,7 +58,7 @@ class HandledList(list):
def filteredItemForce(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.forceItemAttr(*args, **kwargs)
except AttributeError:
pass
@@ -66,7 +66,7 @@ class HandledList(list):
def filteredChargePreAssign(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.preAssignChargeAttr(*args, **kwargs)
except AttributeError:
pass
@@ -74,7 +74,7 @@ class HandledList(list):
def filteredChargeIncrease(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.increaseChargeAttr(*args, **kwargs)
except AttributeError:
pass
@@ -82,7 +82,7 @@ class HandledList(list):
def filteredChargeMultiply(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.multiplyChargeAttr(*args, **kwargs)
except AttributeError:
pass
@@ -90,7 +90,7 @@ class HandledList(list):
def filteredChargeBoost(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.boostChargeAttr(*args, **kwargs)
except AttributeError:
pass
@@ -98,7 +98,7 @@ class HandledList(list):
def filteredChargeForce(self, filter, *args, **kwargs):
for element in self:
try:
if filter(element):
if list(filter(element)):
element.forceChargeAttr(*args, **kwargs)
except AttributeError:
pass
@@ -115,7 +115,7 @@ class HandledList(list):
class HandledModuleList(HandledList):
def append(self, mod):
emptyPosition = float("Inf")
for i in xrange(len(self)):
for i in range(len(self)):
currMod = self[i]
if currMod.isEmpty and not mod.isEmpty and currMod.slot == mod.slot:
currPos = mod.position or i
@@ -149,7 +149,7 @@ class HandledModuleList(HandledList):
oldPos = mod.position
mod.position = None
for i in xrange(oldPos, len(self)):
for i in range(oldPos, len(self)):
self[i].position -= 1
def toDummy(self, index):

View File

@@ -6,6 +6,6 @@ type = "active"
def handler(fit, module, context):
for x in xrange(1, 4):
for x in range(1, 4):
value = module.getModifiedChargeAttr("warfareBuff{}Multiplier".format(x))
module.multiplyItemAttr("warfareBuff{}Value".format(x), value)

View File

@@ -8,7 +8,7 @@ type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
for i in xrange(5):
for i in range(5):
attr = "boosterEffectChance{0}".format(i + 1)
fit.boosters.filteredItemBoost(lambda booster: attr in booster.itemModifiedAttributes,
attr, container.getModifiedItemAttr("boosterChanceBonus") * level)

View File

@@ -16,7 +16,7 @@ type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
for x in range(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
value = module.getModifiedItemAttr("warfareBuff{}Value".format(x))
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))

View File

@@ -7,7 +7,7 @@ type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
for x in range(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
value = module.getModifiedItemAttr("warfareBuff{}Value".format(x))
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))

View File

@@ -7,7 +7,7 @@ type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
for x in range(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
value = module.getModifiedItemAttr("warfareBuff{}Value".format(x))
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))

View File

@@ -7,7 +7,7 @@ type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
for x in range(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
value = module.getModifiedItemAttr("warfareBuff{}Value".format(x))
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))

View File

@@ -7,7 +7,7 @@ type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
for x in range(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
value = module.getModifiedItemAttr("warfareBuff{}Value".format(x))
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))

View File

@@ -6,7 +6,7 @@ type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
for x in range(1, 5):
if module.getModifiedItemAttr("warfareBuff{}ID".format(x)):
value = module.getModifiedItemAttr("warfareBuff{}Value".format(x))
id = module.getModifiedItemAttr("warfareBuff{}ID".format(x))

View File

@@ -4,5 +4,5 @@ runTime = "late"
def handler(fit, module, context):
for x in xrange(1, 4):
for x in range(1, 4):
module.boostChargeAttr("warfareBuff{}Multiplier".format(x), module.getModifiedItemAttr("commandBurstStrengthBonus"))

View File

@@ -58,7 +58,7 @@ def rel_listener(target, value, initiator):
if not target or (isinstance(value, Module) and value.isEmpty):
return
print "{} has had a relationship change :D".format(target)
print("{} has had a relationship change :D".format(target))
target.modified = datetime.datetime.now()

View File

@@ -22,7 +22,7 @@ import re
from sqlalchemy.orm import reconstructor
import eos.db
from eqBase import EqBase
from .eqBase import EqBase
from eos.saveddata.price import Price as types_Price
try:
@@ -259,7 +259,7 @@ class Item(EqBase):
return default
def isType(self, type):
for effect in self.effects.itervalues():
for effect in self.effects.values():
if effect.isType(type):
return True
@@ -300,7 +300,7 @@ class Item(EqBase):
self.__requiredSkills = requiredSkills
# Map containing attribute IDs we may need for required skills
# { requiredSkillX : requiredSkillXLevel }
combinedAttrIDs = set(self.srqIDMap.iterkeys()).union(set(self.srqIDMap.itervalues()))
combinedAttrIDs = set(self.srqIDMap.keys()).union(set(self.srqIDMap.values()))
# Map containing result of the request
# { attributeID : attributeValue }
skillAttrs = {}
@@ -310,7 +310,7 @@ class Item(EqBase):
attrVal = attrInfo[2]
skillAttrs[attrID] = attrVal
# Go through all attributeID pairs
for srqIDAtrr, srqLvlAttr in self.srqIDMap.iteritems():
for srqIDAtrr, srqLvlAttr in self.srqIDMap.items():
# Check if we have both in returned result
if srqIDAtrr in skillAttrs and srqLvlAttr in skillAttrs:
skillID = int(skillAttrs[srqIDAtrr])
@@ -384,7 +384,7 @@ class Item(EqBase):
race = None
# Check primary and secondary required skills' races
if race is None:
skillRaces = tuple(filter(lambda rid: rid, (s.raceID for s in tuple(self.requiredSkills.keys()))))
skillRaces = tuple([rid for rid in (s.raceID for s in tuple(self.requiredSkills.keys())) if rid])
if sum(skillRaces) in map:
race = map[sum(skillRaces)]
if race == "angelserp":
@@ -406,7 +406,7 @@ class Item(EqBase):
if self.__assistive is None:
assistive = False
# Go through all effects and find first assistive
for effect in self.effects.itervalues():
for effect in self.effects.values():
if effect.isAssistance is True:
# If we find one, stop and mark item as assistive
assistive = True
@@ -421,7 +421,7 @@ class Item(EqBase):
if self.__offensive is None:
offensive = False
# Go through all effects and find first offensive
for effect in self.effects.itervalues():
for effect in self.effects.values():
if effect.isOffensive is True:
# If we find one, stop and mark item as offensive
offensive = True
@@ -430,8 +430,8 @@ class Item(EqBase):
return self.__offensive
def requiresSkill(self, skill, level=None):
for s, l in self.requiredSkills.iteritems():
if isinstance(skill, basestring):
for s, l in self.requiredSkills.items():
if isinstance(skill, str):
if s.name == skill and (level is None or l == level):
return True
@@ -469,7 +469,7 @@ class Item(EqBase):
return self.__price
def __repr__(self):
return u"Item(ID={}, name={}) at {}".format(
return "Item(ID={}, name={}) at {}".format(
self.ID, self.name, hex(id(self))
)
@@ -523,7 +523,7 @@ class Icon(EqBase):
class MarketGroup(EqBase):
def __repr__(self):
return u"MarketGroup(ID={}, name={}, parent={}) at {}".format(
return "MarketGroup(ID={}, name={}, parent={}) at {}".format(
self.ID, self.name, getattr(self.parent, "name", None), self.name, hex(id(self))
).encode('utf8')

View File

@@ -25,7 +25,7 @@ class Graph(object):
self.fit = fit
self.data = {}
if data is not None:
for name, d in data.iteritems():
for name, d in data.items():
self.setData(Data(name, d))
self.function = function
@@ -39,7 +39,7 @@ class Graph(object):
def getIterator(self):
pointNames = []
pointIterators = []
for data in self.data.itervalues():
for data in self.data.values():
pointNames.append(data.name)
pointIterators.append(data)
@@ -48,7 +48,7 @@ class Graph(object):
def _iterator(self, pointNames, pointIterators):
for pointValues in itertools.product(*pointIterators):
point = {}
for i in xrange(len(pointValues)):
for i in range(len(pointValues)):
point[pointNames[i]] = pointValues[i]
yield point, self.function(point)
@@ -61,12 +61,12 @@ class Data(object):
self.data = self.parseString(dataString)
def parseString(self, dataString):
if not isinstance(dataString, basestring):
if not isinstance(dataString, str):
return Constant(dataString),
dataList = []
for data in dataString.split(";"):
if isinstance(data, basestring) and "-" in data:
if isinstance(data, str) and "-" in data:
# Dealing with a range
dataList.append(Range(data, self.step))
else:
@@ -85,7 +85,7 @@ class Data(object):
class Constant(object):
def __init__(self, const):
if isinstance(const, basestring):
if isinstance(const, str):
self.value = None if const == "" else float(const)
else:
self.value = const

View File

@@ -63,10 +63,10 @@ class FitDpsGraph(Graph):
ew['signatureRadius'].sort(key=abssort)
ew['velocity'].sort(key=abssort)
for attr, values in ew.iteritems():
for attr, values in ew.items():
val = data[attr]
try:
for i in xrange(len(values)):
for i in range(len(values)):
bonus = values[i]
val *= 1 + (bonus - 1) * exp(- i ** 2 / 7.1289)
data[attr] = val

View File

@@ -162,9 +162,9 @@ class ModifiedAttributeDict(collections.MutableMapping):
def __len__(self):
keys = set()
keys.update(self.original.iterkeys())
keys.update(self.__modified.iterkeys())
keys.update(self.__intermediary.iterkeys())
keys.update(iter(self.original.keys()))
keys.update(iter(self.__modified.keys()))
keys.update(iter(self.__intermediary.keys()))
return len(keys)
def __calculateValue(self, key):
@@ -228,11 +228,11 @@ class ModifiedAttributeDict(collections.MutableMapping):
val *= multiplier
# Each group is penalized independently
# Things in different groups will not be stack penalized between each other
for penalizedMultipliers in penalizedMultiplierGroups.itervalues():
for penalizedMultipliers in penalizedMultiplierGroups.values():
# A quick explanation of how this works:
# 1: Bonuses and penalties are calculated seperately, so we'll have to filter each of them
l1 = filter(lambda _val: _val > 1, penalizedMultipliers)
l2 = filter(lambda _val: _val < 1, penalizedMultipliers)
l1 = [_val for _val in penalizedMultipliers if _val > 1]
l2 = [_val for _val in penalizedMultipliers if _val < 1]
# 2: The most significant bonuses take the smallest penalty,
# This means we'll have to sort
abssort = lambda _val: -abs(_val - 1)
@@ -242,7 +242,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
# Any module after the first takes penalties according to:
# 1 + (multiplier - 1) * math.exp(- math.pow(i, 2) / 7.1289)
for l in (l1, l2):
for i in xrange(len(l)):
for i in range(len(l)):
bonus = l[i]
val *= 1 + (bonus - 1) * exp(- i ** 2 / 7.1289)
val += postIncrease
@@ -380,7 +380,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
"""Force value to attribute and prohibit any changes to it"""
self.__forced[attributeName] = value
self.__placehold(attributeName)
self.__afflict(attributeName, u"\u2263", value)
self.__afflict(attributeName, "\u2263", value)
@staticmethod
def getResistance(fit, effect):

View File

@@ -118,7 +118,7 @@ class Booster(HandledItem, ItemAttrShortcut):
return
if not self.active:
return
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and \
(effect.isType("passive") or effect.isType("boosterSideEffect")) and \
effect.activeByDefault:

View File

@@ -77,8 +77,8 @@ class Cargo(HandledItem, ItemAttrShortcut):
"amount": lambda _val: isinstance(_val, int)
}
if key == "amount" and val > sys.maxint:
val = sys.maxint
if key == "amount" and val > sys.maxsize:
val = sys.maxsize
if not map[key](val):
raise ValueError(str(val) + " is not a valid value for " + key)

View File

@@ -160,7 +160,7 @@ class Character(object):
if self.alphaCloneID:
clone = eos.db.getAlphaClone(self.alphaCloneID)
type = clone.alphaCloneName.split()[1]
name += u' (\u03B1{})'.format(type[0].upper())
name += ' (\u03B1{})'.format(type[0].upper())
return name
@@ -197,7 +197,7 @@ class Character(object):
del self.__skillIdMap[skill.itemID]
def getSkill(self, item):
if isinstance(item, basestring):
if isinstance(item, str):
item = self.getSkillNameMap()[item]
elif isinstance(item, int):
item = self.getSkillIDMap()[item]
@@ -236,17 +236,17 @@ class Character(object):
def filteredSkillIncrease(self, filter, *args, **kwargs):
for element in self.skills:
if filter(element):
if list(filter(element)):
element.increaseItemAttr(*args, **kwargs)
def filteredSkillMultiply(self, filter, *args, **kwargs):
for element in self.skills:
if filter(element):
if list(filter(element)):
element.multiplyItemAttr(*args, **kwargs)
def filteredSkillBoost(self, filter, *args, **kwargs):
for element in self.skills:
if filter(element):
if list(filter(element)):
element.boostItemAttr(*args, **kwargs)
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False):
@@ -280,7 +280,7 @@ class Character(object):
map = {
"ID" : lambda _val: isinstance(_val, int),
"name" : lambda _val: True,
"apiKey" : lambda _val: _val is None or (isinstance(_val, basestring) and len(_val) > 0),
"apiKey" : lambda _val: _val is None or (isinstance(_val, str) and len(_val) > 0),
"ownerID": lambda _val: isinstance(_val, int) or _val is None
}
@@ -355,7 +355,7 @@ class Skill(HandledItem):
if eos.config.settings['strictSkillLevels']:
start = time.time()
for item, rlevel in self.item.requiredFor.iteritems():
for item, rlevel in self.item.requiredFor.items():
if item.group.category.ID == 16: # Skill category
if level < rlevel:
skill = self.character.getSkill(item.ID)
@@ -395,7 +395,7 @@ class Skill(HandledItem):
if item is None:
return
for effect in item.effects.itervalues():
for effect in item.effects.values():
if effect.runTime == runTime and \
effect.isType("passive") and \
(not fit.isStructure or effect.isType("structure")) and \

View File

@@ -138,8 +138,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
cycleTime = self.getModifiedItemAttr(attr)
volley = sum(
map(lambda d: (getter("%sDamage" % d) or 0) * (1 - getattr(targetResists, "%sAmount" % d, 0)),
self.DAMAGE_TYPES))
[(getter("%sDamage" % d) or 0) * (1 - getattr(targetResists, "%sAmount" % d, 0)) for d in self.DAMAGE_TYPES])
volley *= self.amountActive
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
self.__volley = volley
@@ -155,7 +154,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
getter = self.getModifiedItemAttr
cycleTime = self.getModifiedItemAttr(attr)
volley = sum(map(lambda d: getter(d), self.MINING_ATTRIBUTES)) * self.amountActive
volley = sum([getter(d) for d in self.MINING_ATTRIBUTES]) * self.amountActive
self.__miningyield = volley / (cycleTime / 1000.0)
else:
self.__miningyield = 0
@@ -236,7 +235,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
context = ("drone",)
projected = False
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and \
effect.activeByDefault and \
((projected is True and effect.isType("projected")) or
@@ -251,7 +250,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
i += 1
if self.charge:
for effect in self.charge.effects.itervalues():
for effect in self.charge.effects.values():
if effect.runTime == runTime and effect.activeByDefault:
effect.handler(fit, self, ("droneCharge",))
@@ -263,7 +262,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def fits(self, fit):
fitDroneGroupLimits = set()
for i in xrange(1, 3):
for i in range(1, 3):
groneGrp = fit.ship.getModifiedItemAttr("allowedDroneGroup%d" % i)
if groneGrp is not None:
fitDroneGroupLimits.add(int(groneGrp))

View File

@@ -98,7 +98,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def __getAbilities(self):
"""Returns list of FighterAbilities that are loaded with data"""
return [FighterAbility(effect) for effect in self.item.effects.values()]
return [FighterAbility(effect) for effect in list(self.item.effects.values())]
def __calculateSlot(self, item):
types = {
@@ -107,7 +107,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"Heavy" : Slot.F_HEAVY
}
for t, slot in types.iteritems():
for t, slot in types.items():
if self.getModifiedItemAttr("fighterSquadronIs{}".format(t)):
return slot

View File

@@ -57,7 +57,7 @@ class FighterAbility(object):
self.__effect = None
if self.effectID:
self.__effect = next((x for x in self.fighter.item.effects.itervalues() if x.ID == self.effectID), None)
self.__effect = next((x for x in self.fighter.item.effects.values() if x.ID == self.effectID), None)
if self.__effect is None:
pyfalog.error("Effect (id: {0}) does not exist", self.effectID)
return
@@ -127,8 +127,8 @@ class FighterAbility(object):
if self.attrPrefix == "fighterAbilityLaunchBomb":
# bomb calcs
volley = sum(map(lambda attr: (self.fighter.getModifiedChargeAttr("%sDamage" % attr) or 0) * (
1 - getattr(targetResists, "%sAmount" % attr, 0)), self.DAMAGE_TYPES))
volley = sum([(self.fighter.getModifiedChargeAttr("%sDamage" % attr) or 0) * (
1 - getattr(targetResists, "%sAmount" % attr, 0)) for attr in self.DAMAGE_TYPES])
else:
volley = sum(map(lambda d2, d:
(self.fighter.getModifiedItemAttr(

View File

@@ -258,11 +258,11 @@ class Fit(object):
def projectedFits(self):
# only in extreme edge cases will the fit be invalid, but to be sure do
# not return them.
return [fit for fit in self.__projectedFits.values() if not fit.isInvalid]
return [fit for fit in list(self.__projectedFits.values()) if not fit.isInvalid]
@property
def commandFits(self):
return [fit for fit in self.__commandFits.values() if not fit.isInvalid]
return [fit for fit in list(self.__commandFits.values()) if not fit.isInvalid]
def getProjectionInfo(self, fitID):
return self.projectedOnto.get(fitID, None)
@@ -492,7 +492,7 @@ class Fit(object):
def __runCommandBoosts(self, runTime="normal"):
pyfalog.debug("Applying gang boosts for {0}", repr(self))
for warfareBuffID in self.commandBonuses.keys():
for warfareBuffID in list(self.commandBonuses.keys()):
# Unpack all data required to run effect properly
effect_runTime, value, thing, effect = self.commandBonuses[warfareBuffID]
@@ -676,7 +676,7 @@ class Fit(object):
def __resetDependentCalcs(self):
self.calculated = False
for value in self.projectedOnto.values():
for value in list(self.projectedOnto.values()):
if value.victim_fit: # removing a self-projected fit causes victim fit to be None. @todo: look into why. :3
value.victim_fit.calculated = False
@@ -707,14 +707,14 @@ class Fit(object):
self.__resetDependentCalcs()
# For fits that are under local's Command, we do the same thing
for value in self.boostedOnto.values():
for value in list(self.boostedOnto.values()):
# apparently this is a thing that happens when removing a command fit from a fit and then switching to
# that command fit. Same as projected clears, figure out why.
if value.boosted_fit:
value.boosted_fit.__resetDependentCalcs()
if targetFit and type == CalcType.PROJECTED:
pyfalog.debug(u"Calculating projections from {0} to target {1}", repr(self), repr(targetFit))
pyfalog.debug("Calculating projections from {0} to target {1}", repr(self), repr(targetFit))
projectionInfo = self.getProjectionInfo(targetFit.ID)
# Start applying any command fits that we may have.
@@ -838,7 +838,7 @@ class Fit(object):
for item in c:
if item is not None:
# apply effects onto target fit x amount of times
for _ in xrange(projectionInfo.amount):
for _ in range(projectionInfo.amount):
targetFit.register(item, origin=self)
item.calculateModifiedAttributes(targetFit, runTime, True)
@@ -854,7 +854,7 @@ class Fit(object):
for slotType in (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE):
amount = self.getSlotsFree(slotType, True)
if amount > 0:
for _ in xrange(int(amount)):
for _ in range(int(amount)):
self.modules.append(Module.buildEmpty(slotType))
if amount < 0:
@@ -870,7 +870,7 @@ class Fit(object):
self.modules.remove(mod)
def unfill(self):
for i in xrange(len(self.modules) - 1, -1, -1):
for i in range(len(self.modules) - 1, -1, -1):
mod = self.modules[i]
if mod.isEmpty:
del self.modules[i]
@@ -878,7 +878,7 @@ class Fit(object):
@property
def modCount(self):
x = 0
for i in xrange(len(self.modules) - 1, -1, -1):
for i in range(len(self.modules) - 1, -1, -1):
mod = self.modules[i]
if not mod.isEmpty:
x += 1
@@ -1486,11 +1486,11 @@ class Fit(object):
return copy_ship
def __repr__(self):
return u"Fit(ID={}, ship={}, name={}) at {}".format(
return "Fit(ID={}, ship={}, name={}) at {}".format(
self.ID, self.ship.item.name, self.name, hex(id(self))
).encode('utf8')
def __str__(self):
return u"{} ({})".format(
return "{} ({})".format(
self.name, self.ship.item.name
).encode('utf8')

View File

@@ -93,7 +93,7 @@ class Implant(HandledItem, ItemAttrShortcut):
return
if not self.active:
return
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and effect.isType("passive") and effect.activeByDefault:
effect.handler(fit, self, ("implant",))

View File

@@ -50,6 +50,6 @@ class Mode(ItemAttrShortcut, HandledItem):
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False):
if self.item:
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and effect.activeByDefault:
effect.handler(fit, self, context=("module",))

View File

@@ -329,9 +329,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
else:
func = self.getModifiedItemAttr
volley = sum(map(
lambda attr: (func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)),
self.DAMAGE_TYPES))
volley = sum([(func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)) for attr in self.DAMAGE_TYPES])
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
if volley:
cycleTime = self.cycleTime
@@ -415,13 +413,13 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if shipType is not None:
fitsOnType.add(shipType)
for attr in self.itemModifiedAttributes.keys():
for attr in list(self.itemModifiedAttributes.keys()):
if attr.startswith("canFitShipType"):
shipType = self.getModifiedItemAttr(attr)
if shipType is not None:
fitsOnType.add(shipType)
for attr in self.itemModifiedAttributes.keys():
for attr in list(self.itemModifiedAttributes.keys()):
if attr.startswith("canFitShipGroup"):
shipGroup = self.getModifiedItemAttr(attr)
if shipGroup is not None:
@@ -582,7 +580,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if item is None:
return Hardpoint.NONE
for effectName, slot in effectHardpointMap.iteritems():
for effectName, slot in effectHardpointMap.items():
if effectName in item.effects:
return slot
@@ -600,7 +598,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
}
if item is None:
return None
for effectName, slot in effectSlotMap.iteritems():
for effectName, slot in effectSlotMap.items():
if effectName in item.effects:
return slot
if item.group.name == "Effect Beacon":
@@ -654,7 +652,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if self.charge is not None:
# fix for #82 and it's regression #106
if not projected or (self.projected and not forceProjected) or gang:
for effect in self.charge.effects.itervalues():
for effect in self.charge.effects.values():
if effect.runTime == runTime and \
effect.activeByDefault and \
(effect.isType("offline") or
@@ -673,7 +671,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if self.item:
if self.state >= State.OVERHEATED:
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and \
effect.isType("overheat") \
and not forceProjected \
@@ -681,7 +679,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
and ((gang and effect.isType("gang")) or not gang):
effect.handler(fit, self, context)
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and \
effect.activeByDefault and \
(effect.isType("offline") or
@@ -781,7 +779,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def __repr__(self):
if self.item:
return u"Module(ID={}, name={}) at {}".format(
return "Module(ID={}, name={}) at {}".format(
self.item.ID, self.item.name, hex(id(self))
)
else:

View File

@@ -87,7 +87,7 @@ class Ship(ItemAttrShortcut, HandledItem):
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False):
if forceProjected:
return
for effect in self.item.effects.itervalues():
for effect in self.item.effects.values():
if effect.runTime == runTime and \
effect.isType("passive") and \
effect.activeByDefault:

View File

@@ -33,7 +33,7 @@ class User(object):
def encodeAndSetPassword(self, pw):
h = hashlib.new("sha256")
salt = "".join([random.choice(string.letters) for _ in xrange(32)])
salt = "".join([random.choice(string.letters) for _ in range(32)])
h.update(pw)
h.update(salt)
self.password = ("%s%s" % (h.hexdigest(), salt))
@@ -45,14 +45,14 @@ class User(object):
h = hashlib.new("sha256")
h.update(pw)
h.update(salt)
return self.password == (u"%s%s" % (h.hexdigest(), salt))
return self.password == ("%s%s" % (h.hexdigest(), salt))
@validates("ID", "username", "password", "admin")
def validator(self, key, val):
map = {
"ID" : lambda _val: isinstance(_val, int),
"username": lambda _val: isinstance(_val, basestring),
"password": lambda _val: isinstance(_val, basestring) and len(_val) == 96,
"username": lambda _val: isinstance(_val, str),
"password": lambda _val: isinstance(_val, str) and len(_val) == 96,
"admin" : lambda _val: isinstance(_val, bool)
}

View File

@@ -17,7 +17,7 @@
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import cStringIO
import io
import os.path
import zipfile
@@ -32,7 +32,7 @@ logging = Logger(__name__)
try:
from collections import OrderedDict
except ImportError:
from utils.compat import OrderedDict
from .utils.compat import OrderedDict
class BitmapLoader(object):
@@ -88,14 +88,14 @@ class BitmapLoader(object):
try:
img_data = cls.archive.read(path)
sbuf = cStringIO.StringIO(img_data)
sbuf = io.StringIO(img_data)
return wx.ImageFromStream(sbuf)
except KeyError:
print("Missing icon file from zip: {0}".format(path))
print(("Missing icon file from zip: {0}".format(path)))
else:
path = os.path.join(config.pyfaPath, 'imgs' + os.sep + location + os.sep + filename)
if os.path.exists(path):
return wx.Image(path)
else:
print("Missing icon file: {0}".format(path))
print(("Missing icon file: {0}".format(path)))

View File

@@ -46,7 +46,7 @@ class AmountChanger(wx.Dialog):
bSizer1.Add(self.input, 1, wx.ALL, 5)
self.input.Bind(wx.EVT_CHAR, self.onChar)
self.input.Bind(wx.EVT_TEXT_ENTER, self.change)
self.button = wx.Button(self, wx.ID_OK, u"Done")
self.button = wx.Button(self, wx.ID_OK, "Done")
bSizer1.Add(self.button, 0, wx.ALL, 5)
self.SetSizer(bSizer1)

View File

@@ -49,7 +49,7 @@ class ChangeAffectingSkills(ContextMenu):
if cont[attrName] == 0:
continue
for fit, afflictors in cont.getAfflictions(attrName).iteritems():
for fit, afflictors in cont.getAfflictions(attrName).items():
for afflictor, modifier, amount, used in afflictors:
# only add Skills
if not isinstance(afflictor, Skill):
@@ -89,7 +89,7 @@ class ChangeAffectingSkills(ContextMenu):
if bitmap is not None:
skillItem.SetBitmap(bitmap)
for i in xrange(-1, 6):
for i in range(-1, 6):
levelItem = self.addSkill(rootMenu if msw else grandSub, skill, i)
grandSub.AppendItem(levelItem)
if (not skill.learned and i == -1) or (skill.learned and skill.level == i):

View File

@@ -46,7 +46,7 @@ class CommandFits(ContextMenu):
return "Command Fits"
def addFit(self, menu, fit, includeShip=False):
label = fit.name if not includeShip else u"({}) {}".format(fit.ship.item.name, fit.name)
label = fit.name if not includeShip else "({}) {}".format(fit.ship.item.name, fit.name)
id = ContextMenu.nextID()
self.fitMenuItemIds[id] = fit
menuItem = wx.MenuItem(menu, id, label)
@@ -62,7 +62,7 @@ class CommandFits(ContextMenu):
if len(self.__class__.commandFits) < 15:
for fit in sorted(self.__class__.commandFits, key=lambda x: x.name):
print fit
print(fit)
menuItem = self.addFit(rootMenu if msw else sub, fit, True)
sub.AppendItem(menuItem)
else:

View File

@@ -52,7 +52,7 @@ class DamagePattern(ContextMenu):
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()
self.m = [p.name for p in self.singles] + list(self.subMenus.keys())
return self.m
def addPattern(self, rootMenu, pattern):

View File

@@ -45,7 +45,7 @@ class DroneSpinner(wx.Dialog):
bSizer1.Add(self.spinner, 1, wx.ALL, 5)
self.button = wx.Button(self, wx.ID_OK, u"Split")
self.button = wx.Button(self, wx.ID_OK, "Split")
bSizer1.Add(self.button, 0, wx.ALL, 5)
self.SetSizer(bSizer1)

View File

@@ -89,7 +89,7 @@ class MetaSwap(ContextMenu):
# Sort items by metalevel, and group within that metalevel
items = list(self.variations)
print context
print(context)
if "implantItem" in context:
# sort implants based on name
items.sort(key=lambda x: x.name)
@@ -112,7 +112,7 @@ class MetaSwap(ContextMenu):
if thisgroup != group and context not in ("implantItem", "boosterItem"):
group = thisgroup
id = ContextMenu.nextID()
m.Append(id, u'%s' % group)
m.Append(id, '%s' % group)
m.Enable(id, False)
id = ContextMenu.nextID()

View File

@@ -50,7 +50,7 @@ class ModuleAmmoPicker(ContextMenu):
return False
self.modules = modules
self.charges = list(filter(lambda charge: Market.getInstance().getPublicityByItem(charge), validCharges))
self.charges = list([charge for charge in validCharges if Market.getInstance().getPublicityByItem(charge)])
return len(self.charges) > 0
def getText(self, itmContext, selection):
@@ -108,7 +108,7 @@ class ModuleAmmoPicker(ContextMenu):
def nameSorter(self, charge):
parts = charge.name.split(" ")
return map(self.numericConverter, parts)
return list(map(self.numericConverter, parts))
def addCharge(self, menu, charge):
id_ = ContextMenu.nextID()
@@ -127,7 +127,7 @@ class ModuleAmmoPicker(ContextMenu):
@staticmethod
def addSeperator(m, text):
id_ = ContextMenu.nextID()
m.Append(id_, u'%s' % text)
m.Append(id_, '%s' % text)
m.Enable(id_, False)
def getSubMenu(self, context, selection, rootMenu, i, pitem):

View File

@@ -43,7 +43,7 @@ class TabbedFits(ContextMenu):
continue
fit = sFit.getFit(page.activeFitID, basic=True)
id = ContextMenu.nextID()
mitem = wx.MenuItem(rootMenu, id, u"{}: {}".format(fit.ship.item.name, fit.name))
mitem = wx.MenuItem(rootMenu, id, "{}: {}".format(fit.ship.item.name, fit.name))
bindmenu.Bind(wx.EVT_MENU, self.handleSelection, mitem)
self.fitLookup[id] = fit
m.AppendItem(mitem)

View File

@@ -95,7 +95,7 @@ class TargetResists(ContextMenu):
sub.AppendItem(self.addPattern(rootMenu if msw else sub, pattern))
# Items that have a parent
for menuName, patterns in self.subMenus.items():
for menuName, patterns in list(self.subMenus.items()):
# Create parent item for root menu that is simply name of parent
item = wx.MenuItem(rootMenu, ContextMenu.nextID(), menuName)

View File

@@ -54,7 +54,7 @@ class FitDpsGraph(Graph):
def getIcons(self):
icons = {}
sAttr = Attribute.getInstance()
for key, attrName in self.propertyAttributeMap.iteritems():
for key, attrName in self.propertyAttributeMap.items():
iconFile = sAttr.getAttributeInfo(attrName).icon.iconFile
bitmap = BitmapLoader.getBitmap(iconFile, "icons")
if bitmap:
@@ -69,7 +69,7 @@ class FitDpsGraph(Graph):
fitDps.clearData()
variable = None
for fieldName, value in fields.iteritems():
for fieldName, value in fields.items():
d = Data(fieldName, value)
if not d.isConstant():
if variable is None:

View File

@@ -205,7 +205,7 @@ class ItemView(Display):
mktgrpid = sMkt.getMarketGroupByItem(item).ID
except AttributeError:
mktgrpid = None
print("unable to find market group for", item.name)
print(("unable to find market group for", item.name))
parentname = sMkt.getParentItemByItem(item).name
# Get position of market group
metagrpid = sMkt.getMetaGroupIdByItem(item)
@@ -266,7 +266,7 @@ class ItemView(Display):
"""
revmap = {}
i = 0
for mgids in self.sMkt.META_MAP.itervalues():
for mgids in self.sMkt.META_MAP.values():
for mgid in mgids:
revmap[mgid] = i
i += 1

View File

@@ -1,5 +1,5 @@
from gui.bitmapLoader import BitmapLoader
from pfSearchBox import PFSearchBox
from .pfSearchBox import PFSearchBox
class SearchBox(PFSearchBox):

View File

@@ -50,7 +50,7 @@ class DummyView(PreferenceView):
def initHeader(self, panel):
headerSizer = wx.BoxSizer(wx.VERTICAL)
self.stTitle = wx.StaticText(panel, wx.ID_ANY, u"Dummy", wx.DefaultPosition, wx.DefaultSize, 0)
self.stTitle = wx.StaticText(panel, wx.ID_ANY, "Dummy", wx.DefaultPosition, wx.DefaultSize, 0)
self.stTitle.Wrap(-1)
self.stTitle.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString))
headerSizer.Add(self.stTitle, 0, wx.ALL, 5)
@@ -60,10 +60,10 @@ class DummyView(PreferenceView):
def initContent(self, panel):
contentSizer = wx.BoxSizer(wx.VERTICAL)
self.m_checkBox2 = wx.CheckBox(panel, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_checkBox2 = wx.CheckBox(panel, wx.ID_ANY, "Check Me!", wx.DefaultPosition, wx.DefaultSize, 0)
contentSizer.Add(self.m_checkBox2, 0, wx.ALL, 5)
self.m_radioBtn2 = wx.RadioButton(panel, wx.ID_ANY, u"RadioBtn", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_radioBtn2 = wx.RadioButton(panel, wx.ID_ANY, "RadioBtn", wx.DefaultPosition, wx.DefaultSize, 0)
contentSizer.Add(self.m_radioBtn2, 0, wx.ALL, 5)
self.m_slider2 = wx.Slider(panel, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL)
@@ -82,12 +82,12 @@ class DummyView(PreferenceView):
footerSizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
self.btnRestore = wx.Button(panel, wx.ID_ANY, u"Restore", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnRestore = wx.Button(panel, wx.ID_ANY, "Restore", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnRestore.Enable(False)
footerSizer.Add(self.btnRestore, 0, wx.ALL, 5)
self.btnApply = wx.Button(panel, wx.ID_ANY, u"Apply", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnApply = wx.Button(panel, wx.ID_ANY, "Apply", wx.DefaultPosition, wx.DefaultSize, 0)
footerSizer.Add(self.btnApply, 0, wx.ALL, 5)
return footerSizer

View File

@@ -23,7 +23,7 @@ class PFContextMenuPref(PreferenceView):
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY,
u"Disabling context menus can improve responsiveness.",
"Disabling context menus can improve responsiveness.",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stSubTitle.Wrap(-1)
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 5)

View File

@@ -36,7 +36,7 @@ class PFCrestPref(PreferenceView):
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
self.stInfo = wx.StaticText(panel, wx.ID_ANY,
u"Please see the pyfa wiki on GitHub for information regarding these options.",
"Please see the pyfa wiki on GitHub for information regarding these options.",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stInfo.Wrap(dlgWidth - 50)
mainSizer.Add(self.stInfo, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
@@ -60,7 +60,7 @@ class PFCrestPref(PreferenceView):
timeoutSizer = wx.BoxSizer(wx.HORIZONTAL)
self.stTimout = wx.StaticText(panel, wx.ID_ANY, u"Timeout (seconds):", wx.DefaultPosition, wx.DefaultSize, 0)
self.stTimout = wx.StaticText(panel, wx.ID_ANY, "Timeout (seconds):", wx.DefaultPosition, wx.DefaultSize, 0)
self.stTimout.Wrap(-1)
timeoutSizer.Add(self.stTimout, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -84,7 +84,7 @@ class PFCrestPref(PreferenceView):
fgAddrSizer.SetFlexibleDirection(wx.BOTH)
fgAddrSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
self.stSetID = wx.StaticText(panel, wx.ID_ANY, u"Client ID:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stSetID = wx.StaticText(panel, wx.ID_ANY, "Client ID:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stSetID.Wrap(-1)
fgAddrSizer.Add(self.stSetID, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -93,7 +93,7 @@ class PFCrestPref(PreferenceView):
fgAddrSizer.Add(self.inputClientID, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
self.stSetSecret = wx.StaticText(panel, wx.ID_ANY, u"Client Secret:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stSetSecret = wx.StaticText(panel, wx.ID_ANY, "Client Secret:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stSetSecret.Wrap(-1)
fgAddrSizer.Add(self.stSetSecret, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -103,7 +103,7 @@ class PFCrestPref(PreferenceView):
fgAddrSizer.Add(self.inputClientSecret, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
self.btnApply = wx.Button(panel, wx.ID_ANY, u"Save Client Settings", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnApply = wx.Button(panel, wx.ID_ANY, "Save Client Settings", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnApply.Bind(wx.EVT_BUTTON, self.OnBtnApply)
mainSizer.Add(fgAddrSizer, 0, wx.EXPAND, 5)

View File

@@ -24,7 +24,7 @@ class PFGeneralPref(PreferenceView):
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY, u"(Cannot be changed while pyfa is running. Set via command line switches.)",
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY, "(Cannot be changed while pyfa is running. Set via command line switches.)",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stSubTitle.Wrap(-1)
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 3)
@@ -33,11 +33,11 @@ class PFGeneralPref(PreferenceView):
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
# Save in Root
self.cbsaveInRoot = wx.CheckBox(panel, wx.ID_ANY, u"Using Executable Path for Saved Fit Database and Settings", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbsaveInRoot = wx.CheckBox(panel, wx.ID_ANY, "Using Executable Path for Saved Fit Database and Settings", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbsaveInRoot, 0, wx.ALL | wx.EXPAND, 5)
# Database path
self.stSetUserPath = wx.StaticText(panel, wx.ID_ANY, u"pyfa User Path:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stSetUserPath = wx.StaticText(panel, wx.ID_ANY, "pyfa User Path:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stSetUserPath.Wrap(-1)
mainSizer.Add(self.stSetUserPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.inputUserPath = wx.TextCtrl(panel, wx.ID_ANY, config.savePath, wx.DefaultPosition, wx.DefaultSize, 0)
@@ -46,7 +46,7 @@ class PFGeneralPref(PreferenceView):
mainSizer.Add(self.inputUserPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
# Save DB
self.stFitDB = wx.StaticText(panel, wx.ID_ANY, u"Fitting Database:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stFitDB = wx.StaticText(panel, wx.ID_ANY, "Fitting Database:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stFitDB.Wrap(-1)
mainSizer.Add(self.stFitDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -56,7 +56,7 @@ class PFGeneralPref(PreferenceView):
mainSizer.Add(self.inputFitDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
# Game Data DB
self.stGameDB = wx.StaticText(panel, wx.ID_ANY, u"Game Database:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stGameDB = wx.StaticText(panel, wx.ID_ANY, "Game Database:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stGameDB.Wrap(-1)
mainSizer.Add(self.stGameDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -78,13 +78,13 @@ class PFGeneralPref(PreferenceView):
btnSizer = wx.BoxSizer(wx.VERTICAL)
btnSizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
self.btnDeleteDamagePatterns = wx.Button(panel, wx.ID_ANY, u"Delete All Damage Pattern Profiles", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnDeleteDamagePatterns = wx.Button(panel, wx.ID_ANY, "Delete All Damage Pattern Profiles", wx.DefaultPosition, wx.DefaultSize, 0)
btnSizer.Add(self.btnDeleteDamagePatterns, 0, wx.ALL, 5)
self.btnDeleteTargetResists = wx.Button(panel, wx.ID_ANY, u"Delete All Target Resist Profiles", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnDeleteTargetResists = wx.Button(panel, wx.ID_ANY, "Delete All Target Resist Profiles", wx.DefaultPosition, wx.DefaultSize, 0)
btnSizer.Add(self.btnDeleteTargetResists, 0, wx.ALL, 5)
self.btnPrices = wx.Button(panel, wx.ID_ANY, u"Delete All Prices", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnPrices = wx.Button(panel, wx.ID_ANY, "Delete All Prices", wx.DefaultPosition, wx.DefaultSize, 0)
btnSizer.Add(self.btnPrices, 0, wx.ALL, 5)
mainSizer.Add(btnSizer, 0, wx.EXPAND, 5)
@@ -97,17 +97,17 @@ class PFGeneralPref(PreferenceView):
panel.Layout()
def DeleteDamagePatterns(self, event):
question = u"This is a destructive action that will delete all damage pattern profiles.\nAre you sure you want to do this?"
question = "This is a destructive action that will delete all damage pattern profiles.\nAre you sure you want to do this?"
if wxHelpers.YesNoDialog(question, "Confirm"):
clearDamagePatterns()
def DeleteTargetResists(self, event):
question = u"This is a destructive action that will delete all target resist profiles.\nAre you sure you want to do this?"
question = "This is a destructive action that will delete all target resist profiles.\nAre you sure you want to do this?"
if wxHelpers.YesNoDialog(question, "Confirm"):
clearTargetResists()
def DeletePrices(self, event):
question = u"This is a destructive action that will delete all cached prices out of the database.\nAre you sure you want to do this?"
question = "This is a destructive action that will delete all cached prices out of the database.\nAre you sure you want to do this?"
if wxHelpers.YesNoDialog(question, "Confirm"):
clearPrices()

View File

@@ -36,25 +36,25 @@ class PFFittingEnginePref(PreferenceView):
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, u"Factor in reload time when calculating capacitor usage, damage, and tank.",
self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, "Factor in reload time when calculating capacitor usage, damage, and tank.",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5)
self.cbStrictSkillLevels = wx.CheckBox(panel, wx.ID_ANY,
u"Enforce strict skill level requirements",
"Enforce strict skill level requirements",
wx.DefaultPosition, wx.DefaultSize, 0)
self.cbStrictSkillLevels.SetCursor(helpCursor)
self.cbStrictSkillLevels.SetToolTip(wx.ToolTip(
u'When enabled, skills will check their dependencies\' requirements when their levels change and reset ' +
u'skills that no longer meet the requirement.\neg: Setting Drones from level V to IV will reset the Heavy ' +
u'Drone Operation skill, as that requires Drones V'))
'When enabled, skills will check their dependencies\' requirements when their levels change and reset ' +
'skills that no longer meet the requirement.\neg: Setting Drones from level V to IV will reset the Heavy ' +
'Drone Operation skill, as that requires Drones V'))
mainSizer.Add(self.cbStrictSkillLevels, 0, wx.ALL | wx.EXPAND, 5)
self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY,
u"When damage profile is Uniform, set Reactive Armor " +
u"Hardener to match (old behavior).",
"When damage profile is Uniform, set Reactive Armor " +
"Hardener to match (old behavior).",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbUniversalAdaptiveArmorHardener, 0, wx.ALL | wx.EXPAND, 5)

View File

@@ -160,7 +160,7 @@ class PFGaugePref(PreferenceView):
gSizer1 = wx.BoxSizer(wx.HORIZONTAL)
self.st0100 = wx.StaticText(panel, wx.ID_ANY, u"0 - 100", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT)
self.st0100 = wx.StaticText(panel, wx.ID_ANY, "0 - 100", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT)
self.st0100.Wrap(-1)
gSizer1.Add(self.st0100, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -185,7 +185,7 @@ class PFGaugePref(PreferenceView):
gSizer2 = wx.BoxSizer(wx.HORIZONTAL)
self.st100101 = wx.StaticText(panel, wx.ID_ANY, u"100 - 101", wx.DefaultPosition, wx.DefaultSize,
self.st100101 = wx.StaticText(panel, wx.ID_ANY, "100 - 101", wx.DefaultPosition, wx.DefaultSize,
wx.ALIGN_RIGHT)
self.st100101.Wrap(-1)
gSizer2.Add(self.st100101, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -211,7 +211,7 @@ class PFGaugePref(PreferenceView):
gSizer3 = wx.BoxSizer(wx.HORIZONTAL)
self.st101103 = wx.StaticText(panel, wx.ID_ANY, u"101 - 103", wx.DefaultPosition, wx.DefaultSize,
self.st101103 = wx.StaticText(panel, wx.ID_ANY, "101 - 103", wx.DefaultPosition, wx.DefaultSize,
wx.ALIGN_RIGHT)
self.st101103.Wrap(-1)
gSizer3.Add(self.st101103, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -237,7 +237,7 @@ class PFGaugePref(PreferenceView):
gSizer4 = wx.BoxSizer(wx.HORIZONTAL)
self.st103105 = wx.StaticText(panel, wx.ID_ANY, u"103 - 105", wx.DefaultPosition, wx.DefaultSize,
self.st103105 = wx.StaticText(panel, wx.ID_ANY, "103 - 105", wx.DefaultPosition, wx.DefaultSize,
wx.ALIGN_RIGHT)
self.st103105.Wrap(-1)
gSizer4.Add(self.st103105, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -284,20 +284,20 @@ class PFGaugePref(PreferenceView):
buttonsSizer = wx.BoxSizer(wx.HORIZONTAL)
self.cbLink = wx.CheckBox(panel, wx.ID_ANY, u"Link Colors", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbLink = wx.CheckBox(panel, wx.ID_ANY, "Link Colors", wx.DefaultPosition, wx.DefaultSize, 0)
buttonsSizer.Add(self.cbLink, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.LEFT, 5)
self.sliderGradientStart = wx.Slider(panel, wx.ID_ANY, self.gradientStart, -100, 100, wx.DefaultPosition,
(127, -1), wx.SL_HORIZONTAL | wx.SL_LABELS)
buttonsSizer.Add(self.sliderGradientStart, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.btnRestore = wx.Button(panel, wx.ID_ANY, u"Restore Defaults", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnRestore = wx.Button(panel, wx.ID_ANY, "Restore Defaults", wx.DefaultPosition, wx.DefaultSize, 0)
buttonsSizer.Add(self.btnRestore, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.btnDump = wx.Button(panel, wx.ID_ANY, u"Dump Colors", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnDump = wx.Button(panel, wx.ID_ANY, "Dump Colors", wx.DefaultPosition, wx.DefaultSize, 0)
buttonsSizer.Add(self.btnDump, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.btnOk = wx.Button(panel, wx.ID_ANY, u"Apply", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnOk = wx.Button(panel, wx.ID_ANY, "Apply", wx.DefaultPosition, wx.DefaultSize, 0)
buttonsSizer.Add(self.btnOk, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
footerSizer.Add(buttonsSizer, 1, wx.ALIGN_RIGHT, 5)
@@ -432,11 +432,11 @@ class PFGaugePref(PreferenceView):
event.Skip()
def DumpColours(self, event):
print("Gradient start: %d" % self.sliderGradientStart.GetValue())
print(" 0 <-> 100 Start: ", self.c0100S, " End: ", self.c0100E)
print("100 <-> 101 Start: ", self.c100101S, " End: ", self.c100101E)
print("101 <-> 103 Start: ", self.c101103S, " End: ", self.c101103E)
print("103 <-> 105 Start: ", self.c103105S, " End: ", self.c103105E)
print(("Gradient start: %d" % self.sliderGradientStart.GetValue()))
print((" 0 <-> 100 Start: ", self.c0100S, " End: ", self.c0100E))
print(("100 <-> 101 Start: ", self.c100101S, " End: ", self.c100101E))
print(("101 <-> 103 Start: ", self.c101103S, " End: ", self.c101103E))
print(("103 <-> 105 Start: ", self.c103105S, " End: ", self.c103105E))
event.Skip()

View File

@@ -34,70 +34,70 @@ class PFGeneralPref(PreferenceView):
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
self.cbGlobalChar = wx.CheckBox(panel, wx.ID_ANY, u"Use global character", wx.DefaultPosition, wx.DefaultSize,
self.cbGlobalChar = wx.CheckBox(panel, wx.ID_ANY, "Use global character", wx.DefaultPosition, wx.DefaultSize,
0)
mainSizer.Add(self.cbGlobalChar, 0, wx.ALL | wx.EXPAND, 5)
self.cbGlobalDmgPattern = wx.CheckBox(panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition,
self.cbGlobalDmgPattern = wx.CheckBox(panel, wx.ID_ANY, "Use global damage pattern", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbGlobalDmgPattern, 0, wx.ALL | wx.EXPAND, 5)
self.cbCompactSkills = wx.CheckBox(panel, wx.ID_ANY, u"Compact skills needed tooltip", wx.DefaultPosition,
self.cbCompactSkills = wx.CheckBox(panel, wx.ID_ANY, "Compact skills needed tooltip", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbCompactSkills, 0, wx.ALL | wx.EXPAND, 5)
self.cbFitColorSlots = wx.CheckBox(panel, wx.ID_ANY, u"Color fitting view by slot", wx.DefaultPosition,
self.cbFitColorSlots = wx.CheckBox(panel, wx.ID_ANY, "Color fitting view by slot", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbFitColorSlots, 0, wx.ALL | wx.EXPAND, 5)
self.cbReopenFits = wx.CheckBox(panel, wx.ID_ANY, u"Reopen previous fits on startup", wx.DefaultPosition,
self.cbReopenFits = wx.CheckBox(panel, wx.ID_ANY, "Reopen previous fits on startup", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbReopenFits, 0, wx.ALL | wx.EXPAND, 5)
self.cbRackSlots = wx.CheckBox(panel, wx.ID_ANY, u"Separate Racks", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbRackSlots = wx.CheckBox(panel, wx.ID_ANY, "Separate Racks", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbRackSlots, 0, wx.ALL | wx.EXPAND, 5)
labelSizer = wx.BoxSizer(wx.VERTICAL)
self.cbRackLabels = wx.CheckBox(panel, wx.ID_ANY, u"Show Rack Labels", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbRackLabels = wx.CheckBox(panel, wx.ID_ANY, "Show Rack Labels", wx.DefaultPosition, wx.DefaultSize, 0)
labelSizer.Add(self.cbRackLabels, 0, wx.ALL | wx.EXPAND, 5)
mainSizer.Add(labelSizer, 0, wx.LEFT | wx.EXPAND, 30)
self.cbShowTooltip = wx.CheckBox(panel, wx.ID_ANY, u"Show tab tooltips", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbShowTooltip = wx.CheckBox(panel, wx.ID_ANY, "Show tab tooltips", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbShowTooltip, 0, wx.ALL | wx.EXPAND, 5)
self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, u"Show market shortcuts", wx.DefaultPosition,
self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5)
self.cbGaugeAnimation = wx.CheckBox(panel, wx.ID_ANY, u"Animate gauges", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbGaugeAnimation = wx.CheckBox(panel, wx.ID_ANY, "Animate gauges", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbGaugeAnimation, 0, wx.ALL | wx.EXPAND, 5)
self.cbExportCharges = wx.CheckBox(panel, wx.ID_ANY, u"Export loaded charges", wx.DefaultPosition,
self.cbExportCharges = wx.CheckBox(panel, wx.ID_ANY, "Export loaded charges", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbExportCharges, 0, wx.ALL | wx.EXPAND, 5)
self.cbOpenFitInNew = wx.CheckBox(panel, wx.ID_ANY, u"Open fittings in a new page by default",
self.cbOpenFitInNew = wx.CheckBox(panel, wx.ID_ANY, "Open fittings in a new page by default",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbOpenFitInNew, 0, wx.ALL | wx.EXPAND, 5)
self.cbShowShipBrowserTooltip = wx.CheckBox(panel, wx.ID_ANY, u"Show ship browser tooltip",
self.cbShowShipBrowserTooltip = wx.CheckBox(panel, wx.ID_ANY, "Show ship browser tooltip",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbShowShipBrowserTooltip, 0, wx.ALL | wx.EXPAND, 5)
priceSizer = wx.BoxSizer(wx.HORIZONTAL)
self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, u"Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stDefaultSystem.Wrap(-1)
priceSizer.Add(self.stDefaultSystem, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.chPriceSystem = wx.Choice(panel, choices=Price.systemsList.keys())
self.chPriceSystem = wx.Choice(panel, choices=list(Price.systemsList.keys()))
priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5)
mainSizer.Add(priceSizer, 0, wx.ALL | wx.EXPAND, 0)
delayTimer = wx.BoxSizer(wx.HORIZONTAL)
self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, u"Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0)
self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0)
self.stMarketDelay.Wrap(-1)
self.stMarketDelay.SetCursor(helpCursor)
self.stMarketDelay.SetToolTip(

View File

@@ -38,7 +38,7 @@ class PFHTMLExportPref(PreferenceView):
mainSizer.Add(self.stDesc, 0, wx.ALL, 5)
self.PathLinkCtrl = wx.HyperlinkCtrl(panel, wx.ID_ANY, self.HTMLExportSettings.getPath(),
u'file:///{}'.format(self.HTMLExportSettings.getPath()),
'file:///{}'.format(self.HTMLExportSettings.getPath()),
wx.DefaultPosition, wx.DefaultSize,
wx.HL_ALIGN_LEFT | wx.NO_BORDER | wx.HL_CONTEXTMENU)
mainSizer.Add(self.PathLinkCtrl, 0, wx.ALL | wx.EXPAND, 5)
@@ -56,7 +56,7 @@ class PFHTMLExportPref(PreferenceView):
self.stDesc4.Wrap(dlgWidth - 50)
mainSizer.Add(self.stDesc4, 0, wx.ALL, 5)
self.exportMinimal = wx.CheckBox(panel, wx.ID_ANY, u"Enable minimal format", wx.DefaultPosition,
self.exportMinimal = wx.CheckBox(panel, wx.ID_ANY, "Enable minimal format", wx.DefaultPosition,
wx.DefaultSize, 0)
self.exportMinimal.SetValue(self.HTMLExportSettings.getMinimalEnabled())
self.exportMinimal.Bind(wx.EVT_CHECKBOX, self.OnMinimalEnabledChange)
@@ -67,7 +67,7 @@ class PFHTMLExportPref(PreferenceView):
def setPathLinkCtrlValues(self, path):
self.PathLinkCtrl.SetLabel(self.HTMLExportSettings.getPath())
self.PathLinkCtrl.SetURL(u'file:///{}'.format(self.HTMLExportSettings.getPath()))
self.PathLinkCtrl.SetURL('file:///{}'.format(self.HTMLExportSettings.getPath()))
self.PathLinkCtrl.SetSize(wx.DefaultSize)
self.PathLinkCtrl.Refresh()

View File

@@ -25,7 +25,7 @@ class PFGeneralPref(PreferenceView):
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY, u"(Cannot be changed while pyfa is running. Set via command line switches.)",
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY, "(Cannot be changed while pyfa is running. Set via command line switches.)",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stSubTitle.Wrap(-1)
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 3)
@@ -34,7 +34,7 @@ class PFGeneralPref(PreferenceView):
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
# Database path
self.stLogPath = wx.StaticText(panel, wx.ID_ANY, u"Log file location:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stLogPath = wx.StaticText(panel, wx.ID_ANY, "Log file location:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stLogPath.Wrap(-1)
mainSizer.Add(self.stLogPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.inputLogPath = wx.TextCtrl(panel, wx.ID_ANY, config.logPath, wx.DefaultPosition, wx.DefaultSize, 0)
@@ -43,13 +43,13 @@ class PFGeneralPref(PreferenceView):
mainSizer.Add(self.inputLogPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
# Debug Logging
self.cbdebugLogging = wx.CheckBox(panel, wx.ID_ANY, u"Debug Logging Enabled", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbdebugLogging = wx.CheckBox(panel, wx.ID_ANY, "Debug Logging Enabled", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbdebugLogging, 0, wx.ALL | wx.EXPAND, 5)
self.stDumpLogs = wx.StaticText(panel, wx.ID_ANY, u"Pressing this button will cause all logs in memory to write to the log file:",
self.stDumpLogs = wx.StaticText(panel, wx.ID_ANY, "Pressing this button will cause all logs in memory to write to the log file:",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.stDumpLogs, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.btnDumpLogs = wx.Button(panel, wx.ID_ANY, u"Dump All Logs", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnDumpLogs = wx.Button(panel, wx.ID_ANY, "Dump All Logs", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnDumpLogs.Bind(wx.EVT_BUTTON, OnDumpLogs)
mainSizer.Add(self.btnDumpLogs, 0, wx.ALIGN_LEFT, 5)

View File

@@ -30,18 +30,18 @@ class PFNetworkPref(PreferenceView):
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
self.cbEnableNetwork = wx.CheckBox(panel, wx.ID_ANY, u"Enable Network", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbEnableNetwork = wx.CheckBox(panel, wx.ID_ANY, "Enable Network", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbEnableNetwork, 0, wx.ALL | wx.EXPAND, 5)
subSizer = wx.BoxSizer(wx.VERTICAL)
self.cbEve = wx.CheckBox(panel, wx.ID_ANY, u"EVE Servers (API && CREST import)", wx.DefaultPosition,
self.cbEve = wx.CheckBox(panel, wx.ID_ANY, "EVE Servers (API && CREST import)", wx.DefaultPosition,
wx.DefaultSize, 0)
subSizer.Add(self.cbEve, 0, wx.ALL | wx.EXPAND, 5)
self.cbPricing = wx.CheckBox(panel, wx.ID_ANY, u"Pricing updates", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbPricing = wx.CheckBox(panel, wx.ID_ANY, "Pricing updates", wx.DefaultPosition, wx.DefaultSize, 0)
subSizer.Add(self.cbPricing, 0, wx.ALL | wx.EXPAND, 5)
self.cbPyfaUpdate = wx.CheckBox(panel, wx.ID_ANY, u"Pyfa Update checks", wx.DefaultPosition, wx.DefaultSize, 0)
self.cbPyfaUpdate = wx.CheckBox(panel, wx.ID_ANY, "Pyfa Update checks", wx.DefaultPosition, wx.DefaultSize, 0)
subSizer.Add(self.cbPyfaUpdate, 0, wx.ALL | wx.EXPAND, 5)
mainSizer.Add(subSizer, 0, wx.LEFT | wx.EXPAND, 30)
@@ -80,11 +80,11 @@ class PFNetworkPref(PreferenceView):
ptypeSizer = wx.BoxSizer(wx.HORIZONTAL)
self.stPType = wx.StaticText(panel, wx.ID_ANY, u"Mode:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPType = wx.StaticText(panel, wx.ID_ANY, "Mode:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPType.Wrap(-1)
ptypeSizer.Add(self.stPType, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.chProxyTypeChoices = [u"No proxy", u"Auto-detected proxy settings", u"Manual proxy settings"]
self.chProxyTypeChoices = ["No proxy", "Auto-detected proxy settings", "Manual proxy settings"]
self.chProxyType = wx.Choice(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, self.chProxyTypeChoices, 0)
self.chProxyType.SetSelection(self.nMode)
@@ -98,7 +98,7 @@ class PFNetworkPref(PreferenceView):
fgAddrSizer.SetFlexibleDirection(wx.BOTH)
fgAddrSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
self.stPSetAddr = wx.StaticText(panel, wx.ID_ANY, u"Addr:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetAddr = wx.StaticText(panel, wx.ID_ANY, "Addr:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetAddr.Wrap(-1)
fgAddrSizer.Add(self.stPSetAddr, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -106,7 +106,7 @@ class PFNetworkPref(PreferenceView):
fgAddrSizer.Add(self.editProxySettingsAddr, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
self.stPSetPort = wx.StaticText(panel, wx.ID_ANY, u"Port:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetPort = wx.StaticText(panel, wx.ID_ANY, "Port:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetPort.Wrap(-1)
fgAddrSizer.Add(self.stPSetPort, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -118,11 +118,11 @@ class PFNetworkPref(PreferenceView):
mainSizer.Add(fgAddrSizer, 0, wx.EXPAND, 5)
# proxy auth information: login and pass
self.stPSetLogin = wx.StaticText(panel, wx.ID_ANY, u"Username:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetLogin = wx.StaticText(panel, wx.ID_ANY, "Username:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetLogin.Wrap(-1)
self.editProxySettingsLogin = wx.TextCtrl(panel, wx.ID_ANY, self.nAuth[0], wx.DefaultPosition, wx.DefaultSize,
0)
self.stPSetPassword = wx.StaticText(panel, wx.ID_ANY, u"Password:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetPassword = wx.StaticText(panel, wx.ID_ANY, "Password:", wx.DefaultPosition, wx.DefaultSize, 0)
self.stPSetPassword.Wrap(-1)
self.editProxySettingsPassword = wx.TextCtrl(panel, wx.ID_ANY, self.nAuth[1], wx.DefaultPosition,
wx.DefaultSize, wx.TE_PASSWORD)
@@ -133,7 +133,7 @@ class PFNetworkPref(PreferenceView):
pAuthSizer.Add(self.editProxySettingsPassword, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
mainSizer.Add(pAuthSizer, 0, wx.EXPAND, 5)
self.stPSAutoDetected = wx.StaticText(panel, wx.ID_ANY, u"Auto-detected: ", wx.DefaultPosition, wx.DefaultSize,
self.stPSAutoDetected = wx.StaticText(panel, wx.ID_ANY, "Auto-detected: ", wx.DefaultPosition, wx.DefaultSize,
0)
self.stPSAutoDetected.Wrap(-1)
mainSizer.Add(self.stPSAutoDetected, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -141,7 +141,7 @@ class PFNetworkPref(PreferenceView):
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
self.btnApply = wx.Button(panel, wx.ID_ANY, u"Apply Proxy Settings", wx.DefaultPosition, wx.DefaultSize, 0)
self.btnApply = wx.Button(panel, wx.ID_ANY, "Apply Proxy Settings", wx.DefaultPosition, wx.DefaultSize, 0)
btnSizer.Add(self.btnApply, 0, wx.ALL, 5)

View File

@@ -27,7 +27,7 @@ class PFStatViewPref(PreferenceView):
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY,
u"Changes require restart of pyfa to take effect.",
"Changes require restart of pyfa to take effect.",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stSubTitle.Wrap(-1)
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 3)

View File

@@ -33,7 +33,7 @@ class PFUpdatePref(PreferenceView):
self.stDesc.Wrap(dlgWidth - 50)
mainSizer.Add(self.stDesc, 0, wx.ALL, 5)
self.suppressPrerelease = wx.CheckBox(panel, wx.ID_ANY, u"Allow pre-release notifications", wx.DefaultPosition,
self.suppressPrerelease = wx.CheckBox(panel, wx.ID_ANY, "Allow pre-release notifications", wx.DefaultPosition,
wx.DefaultSize, 0)
self.suppressPrerelease.Bind(wx.EVT_CHECKBOX, self.OnPrereleaseStateChange)
self.suppressPrerelease.SetValue(not self.UpdateSettings.get('prerelease'))

View File

@@ -12,7 +12,7 @@ import gui.mainFrame
import gui.utils.colorUtils as colorUtils
import gui.utils.drawUtils as drawUtils
import gui.utils.fonts as fonts
from events import *
from .events import *
from gui.bitmapLoader import BitmapLoader
from gui.builtinShipBrowser.pfBitmapFrame import PFBitmapFrame
from service.fit import Fit
@@ -154,8 +154,8 @@ class FitItem(SFItem.SFBrowserItem):
if self.shipTrait and sFit.serviceFittingOptions["showShipBrowserTooltip"]:
notes = ""
if self.notes:
notes = u'' * 20 + u"\nNotes: {}\n".format(self.notes[:197] + '...' if len(self.notes) > 200 else self.notes)
self.SetToolTip(wx.ToolTip(u'{}\n{}{}\n{}'.format(self.shipName, notes, u'' * 20, self.shipTrait)))
notes = '' * 20 + "\nNotes: {}\n".format(self.notes[:197] + '...' if len(self.notes) > 200 else self.notes)
self.SetToolTip(wx.ToolTip('{}\n{}{}\n{}'.format(self.shipName, notes, '' * 20, self.shipTrait)))
def OnKeyUp(self, event):
if event.GetKeyCode() in (32, 13): # space and enter

View File

@@ -8,7 +8,7 @@ import gui.mainFrame
import gui.utils.colorUtils as colorUtils
import gui.utils.drawUtils as drawUtils
import gui.utils.fonts as fonts
from events import *
from .events import *
from gui.bitmapLoader import BitmapLoader
from service.fit import Fit

View File

@@ -127,7 +127,7 @@ class PFListPane(wx.ScrolledWindow):
maxy = 0
selected = None
for i in xrange(len(self._wList)):
for i in range(len(self._wList)):
iwidth, iheight = self._wList[i].GetSize()
xa, ya = self.CalcScrolledPosition((0, maxy))
self._wList[i].SetPosition((xa, ya))
@@ -144,7 +144,7 @@ class PFListPane(wx.ScrolledWindow):
elif doFocus:
self.SetFocus()
for i in xrange(len(self._wList)):
for i in range(len(self._wList)):
iwidth, iheight = self._wList[i].GetSize()
self._wList[i].SetSize((cwidth, iheight))
if doRefresh is True:

View File

@@ -6,7 +6,7 @@ from logbook import Logger
import gui.utils.animEffects as animEffects
import gui.utils.colorUtils as colorUtils
import gui.utils.drawUtils as drawUtils
from events import *
from .events import *
from gui.bitmapLoader import BitmapLoader
pyfalog = Logger(__name__)

View File

@@ -8,7 +8,7 @@ import gui.mainFrame
import gui.utils.colorUtils as colorUtils
import gui.utils.drawUtils as drawUtils
import gui.utils.fonts as fonts
from events import *
from .events import *
from gui.bitmapLoader import BitmapLoader
from gui.contextMenu import ContextMenu
from service.fit import Fit

View File

@@ -124,7 +124,7 @@ class CapacitorViewFull(StatsView):
label = getattr(self, labelName % panel)
value = value() if fit is not None else 0
value = value if value is not None else 0
if isinstance(value, basestring):
if isinstance(value, str):
label.SetLabel(value)
label.SetToolTip(wx.ToolTip(value))
else:

View File

@@ -69,7 +69,7 @@ class MiningYieldViewFull(StatsView):
hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 1, wx.ALIGN_CENTER)
lbl = wx.StaticText(parent, wx.ID_ANY, u"0.0 m\u00B3/s")
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 m\u00B3/s")
setattr(self, "label%sminingyield%s" % (panel.capitalize(), miningType.capitalize()), lbl)
hbox.Add(lbl, 0, wx.ALIGN_CENTER)
@@ -90,7 +90,7 @@ class MiningYieldViewFull(StatsView):
hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 1, wx.EXPAND)
lbl = wx.StaticText(parent, wx.ID_ANY, u"0.0 m\u00B3/s")
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 m\u00B3/s")
setattr(self, "label%sminingyieldTotal" % panel.capitalize(), lbl)
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
@@ -128,9 +128,9 @@ class MiningYieldViewFull(StatsView):
def refreshPanel(self, fit):
# If we did anything intresting, we'd update our labels to reflect the new fit's stats here
stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s", None),
("labelFullminingyieldDrone", lambda: fit.droneYield, 3, 0, 0, u"%s m\u00B3/s", None),
("labelFullminingyieldTotal", lambda: fit.totalYield, 3, 0, 0, u"%s m\u00B3/s", None))
stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, "%s m\u00B3/s", None),
("labelFullminingyieldDrone", lambda: fit.droneYield, 3, 0, 0, "%s m\u00B3/s", None),
("labelFullminingyieldTotal", lambda: fit.totalYield, 3, 0, 0, "%s m\u00B3/s", None))
counter = 0
for labelName, value, prec, lowest, highest, valueFormat, altFormat in stats:

View File

@@ -63,9 +63,9 @@ class OutgoingViewFull(StatsView):
baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)
if "Capacitor" in outgoingType:
lbl = wx.StaticText(parent, wx.ID_ANY, u"0 GJ/s")
lbl = wx.StaticText(parent, wx.ID_ANY, "0 GJ/s")
else:
lbl = wx.StaticText(parent, wx.ID_ANY, u"0 HP/s")
lbl = wx.StaticText(parent, wx.ID_ANY, "0 HP/s")
lbl.SetToolTip(wx.ToolTip(tooltip))
@@ -81,10 +81,10 @@ class OutgoingViewFull(StatsView):
# If we did anything intresting, we'd update our labels to reflect the new fit's stats here
stats = [
("labelRemoteArmor", lambda: fit.remoteReps["Armor"], 3, 0, 0, u"%s HP/s", None),
("labelRemoteShield", lambda: fit.remoteReps["Shield"], 3, 0, 0, u"%s HP/s", None),
("labelRemoteHull", lambda: fit.remoteReps["Hull"], 3, 0, 0, u"%s HP/s", None),
("labelRemoteCapacitor", lambda: fit.remoteReps["Capacitor"], 3, 0, 0, u"%s GJ/s", None),
("labelRemoteArmor", lambda: fit.remoteReps["Armor"], 3, 0, 0, "%s HP/s", None),
("labelRemoteShield", lambda: fit.remoteReps["Shield"], 3, 0, 0, "%s HP/s", None),
("labelRemoteHull", lambda: fit.remoteReps["Hull"], 3, 0, 0, "%s HP/s", None),
("labelRemoteCapacitor", lambda: fit.remoteReps["Capacitor"], 3, 0, 0, "%s GJ/s", None),
]
counter = 0

View File

@@ -62,9 +62,9 @@ class OutgoingViewMinimal(StatsView):
baseBox.Add(wx.StaticText(contentPanel, wx.ID_ANY, label), 0, wx.ALIGN_CENTER)
if "Capacitor" in outgoingType:
lbl = wx.StaticText(parent, wx.ID_ANY, u"0 GJ/s")
lbl = wx.StaticText(parent, wx.ID_ANY, "0 GJ/s")
else:
lbl = wx.StaticText(parent, wx.ID_ANY, u"0 HP/s")
lbl = wx.StaticText(parent, wx.ID_ANY, "0 HP/s")
lbl.SetToolTip(wx.ToolTip(tooltip))
@@ -80,10 +80,10 @@ class OutgoingViewMinimal(StatsView):
# If we did anything intresting, we'd update our labels to reflect the new fit's stats here
stats = [
("labelRemoteArmor", lambda: fit.remoteReps["Armor"], 3, 0, 0, u"%s HP/s", None),
("labelRemoteShield", lambda: fit.remoteReps["Shield"], 3, 0, 0, u"%s HP/s", None),
("labelRemoteHull", lambda: fit.remoteReps["Hull"], 3, 0, 0, u"%s HP/s", None),
("labelRemoteCapacitor", lambda: fit.remoteReps["Capacitor"], 3, 0, 0, u"%s GJ/s", None),
("labelRemoteArmor", lambda: fit.remoteReps["Armor"], 3, 0, 0, "%s HP/s", None),
("labelRemoteShield", lambda: fit.remoteReps["Shield"], 3, 0, 0, "%s HP/s", None),
("labelRemoteHull", lambda: fit.remoteReps["Hull"], 3, 0, 0, "%s HP/s", None),
("labelRemoteCapacitor", lambda: fit.remoteReps["Capacitor"], 3, 0, 0, "%s GJ/s", None),
]
counter = 0

View File

@@ -93,7 +93,7 @@ class ResistancesViewFull(StatsView):
self.stEHPs.Bind(wx.EVT_BUTTON, self.toggleEHP)
for i in xrange(4):
for i in range(4):
sizerResistances.AddGrowableCol(i + 1)
sizerResistances.Add(self.stEHPs, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER)

View File

@@ -169,8 +169,8 @@ class ResourcesViewFull(StatsView):
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
units = {"cpu": " tf", "pg": " MW", "droneBandwidth": " mbit/s", "droneBay": u" m\u00B3",
"fighterBay": u" m\u00B3", "cargoBay": u" m\u00B3"}
units = {"cpu": " tf", "pg": " MW", "droneBandwidth": " mbit/s", "droneBay": " m\u00B3",
"fighterBay": " m\u00B3", "cargoBay": " m\u00B3"}
lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type_])
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
@@ -275,7 +275,7 @@ class ResourcesViewFull(StatsView):
totalCalibrationPoints = value
labelTCP = label
if isinstance(value, basestring):
if isinstance(value, str):
label.SetLabel(value)
label.SetToolTip(wx.ToolTip(value))
else:

View File

@@ -87,7 +87,7 @@ class TargetingMiscViewFull(StatsView):
("Align time", "AlignTime", "s"),
("Signature", "SigRadius", "m"),
("Warp Speed", "WarpSpeed", "AU/s"),
("Cargo", "Cargo", u"m\u00B3"))
("Cargo", "Cargo", "m\u00B3"))
for header, labelShort, unit in labels:
gridMisc.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT)
@@ -157,7 +157,7 @@ class TargetingMiscViewFull(StatsView):
("labelFullAlignTime", {"main": lambda: fit.alignTime}, 3, 0, 0, "s"),
("labelFullSigRadius", {"main": lambda: fit.ship.getModifiedItemAttr("signatureRadius")}, 3, 0, 9, ""),
("labelFullWarpSpeed", {"main": lambda: fit.warpSpeed}, 3, 0, 0, "AU/s"),
("labelFullCargo", cargoValues, 4, 0, 9, u"m\u00B3"))
("labelFullCargo", cargoValues, 4, 0, 9, "m\u00B3"))
counter = 0
RADII = [("Pod", 25), ("Interceptor", 33), ("Frigate", 38),
@@ -167,13 +167,13 @@ class TargetingMiscViewFull(StatsView):
for labelName, valueDict, prec, lowest, highest, unit in stats:
label = getattr(self, labelName)
newValues = {}
for valueAlias, value in valueDict.items():
for valueAlias, value in list(valueDict.items()):
value = value() if fit is not None else 0
value = value if value is not None else 0
newValues[valueAlias] = value
if self._cachedValues[counter] != newValues:
mainValue = newValues["main"]
otherValues = dict((k, newValues[k]) for k in filter(lambda k: k != "main", newValues))
otherValues = dict((k, newValues[k]) for k in [k for k in newValues if k != "main"])
if labelName == "labelFullCargo":
# Get sum of all cargoholds except for maintenance bay
additionalCargo = sum(otherValues.values())
@@ -210,11 +210,11 @@ class TargetingMiscViewFull(StatsView):
agility = "Agility:\t%.3fx" % (fit.ship.getModifiedItemAttr("agility") or 0)
label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility)))
elif labelName == "labelFullCargo":
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
for attrName, tipAlias in cargoNamesOrder.items():
tipLines = ["Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
for attrName, tipAlias in list(cargoNamesOrder.items()):
if newValues[attrName] > 0:
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
label.SetToolTip(wx.ToolTip(u"\n".join(tipLines)))
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
label.SetToolTip(wx.ToolTip("\n".join(tipLines)))
else:
label.SetToolTip(wx.ToolTip("%.1f" % mainValue))
else:
@@ -238,11 +238,11 @@ class TargetingMiscViewFull(StatsView):
cachedCargo = self._cachedValues[counter]
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
# This assures us that we force refresh of cargo tooltip
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
for attrName, tipAlias in cargoNamesOrder.items():
tipLines = ["Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
for attrName, tipAlias in list(cargoNamesOrder.items()):
if cachedCargo[attrName] > 0:
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
label.SetToolTip(wx.ToolTip(u"\n".join(tipLines)))
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
label.SetToolTip(wx.ToolTip("\n".join(tipLines)))
else:
label.SetToolTip(wx.ToolTip(""))

View File

@@ -87,7 +87,7 @@ class TargetingMiscViewMinimal(StatsView):
("Align time", "AlignTime", "s"),
("Signature", "SigRadius", "m"),
("Warp Speed", "WarpSpeed", "AU/s"),
("Cargo", "Cargo", u"m\u00B3"))
("Cargo", "Cargo", "m\u00B3"))
for header, labelShort, unit in labels:
gridMisc.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT)
@@ -154,7 +154,7 @@ class TargetingMiscViewMinimal(StatsView):
("labelFullAlignTime", {"main": lambda: fit.alignTime}, 3, 0, 0, "s"),
("labelFullSigRadius", {"main": lambda: fit.ship.getModifiedItemAttr("signatureRadius")}, 3, 0, 9, ""),
("labelFullWarpSpeed", {"main": lambda: fit.warpSpeed}, 3, 0, 0, "AU/s"),
("labelFullCargo", cargoValues, 4, 0, 9, u"m\u00B3"))
("labelFullCargo", cargoValues, 4, 0, 9, "m\u00B3"))
counter = 0
RADII = [("Pod", 25), ("Interceptor", 33), ("Frigate", 38),
@@ -164,13 +164,13 @@ class TargetingMiscViewMinimal(StatsView):
for labelName, valueDict, prec, lowest, highest, unit in stats:
label = getattr(self, labelName)
newValues = {}
for valueAlias, value in valueDict.items():
for valueAlias, value in list(valueDict.items()):
value = value() if fit is not None else 0
value = value if value is not None else 0
newValues[valueAlias] = value
if self._cachedValues[counter] != newValues:
mainValue = newValues["main"]
otherValues = dict((k, newValues[k]) for k in filter(lambda k: k != "main", newValues))
otherValues = dict((k, newValues[k]) for k in [k for k in newValues if k != "main"])
if labelName == "labelFullCargo":
# Get sum of all cargoholds except for maintenance bay
additionalCargo = sum(otherValues.values())
@@ -204,11 +204,11 @@ class TargetingMiscViewMinimal(StatsView):
agility = "Agility:\t%.3fx" % (fit.ship.getModifiedItemAttr("agility") or 0)
label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility)))
elif labelName == "labelFullCargo":
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
for attrName, tipAlias in cargoNamesOrder.items():
tipLines = ["Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
for attrName, tipAlias in list(cargoNamesOrder.items()):
if newValues[attrName] > 0:
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
label.SetToolTip(wx.ToolTip(u"\n".join(tipLines)))
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
label.SetToolTip(wx.ToolTip("\n".join(tipLines)))
else:
label.SetToolTip(wx.ToolTip("%.1f" % mainValue))
else:
@@ -232,11 +232,11 @@ class TargetingMiscViewMinimal(StatsView):
cachedCargo = self._cachedValues[counter]
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
# This assures us that we force refresh of cargo tooltip
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
for attrName, tipAlias in cargoNamesOrder.items():
tipLines = ["Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
for attrName, tipAlias in list(cargoNamesOrder.items()):
if cachedCargo[attrName] > 0:
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
label.SetToolTip(wx.ToolTip(u"\n".join(tipLines)))
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
label.SetToolTip(wx.ToolTip("\n".join(tipLines)))
else:
label.SetToolTip(wx.ToolTip(""))

View File

@@ -83,7 +83,7 @@ class AttributeDisplay(ViewColumn):
if self.info.name == "volume":
str_ = (formatAmount(attr, 3, 0, 3))
if hasattr(mod, "amount"):
str_ += u"m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3))
str_ += "m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3))
attr = str_
if isinstance(attr, (float, int)):

View File

@@ -71,9 +71,9 @@ class BaseName(ViewColumn):
elif isinstance(stuff, Rack):
if FitSvc.getInstance().serviceFittingOptions["rackLabels"]:
if stuff.slot == Slot.MODE:
return u'─ Tactical Mode ─'
return '─ Tactical Mode ─'
else:
return u'{} Slots ─'.format(Slot.getName(stuff.slot).capitalize())
return '{} Slots ─'.format(Slot.getName(stuff.slot).capitalize())
else:
return ""
elif isinstance(stuff, Module):
@@ -91,7 +91,7 @@ class BaseName(ViewColumn):
if marketShortcut:
# use unicode subscript to display shortcut value
shortcut = unichr(marketShortcut + 8320) + u" "
shortcut = chr(marketShortcut + 8320) + " "
del item.marketShortcut
return shortcut + item.name

View File

@@ -171,7 +171,7 @@ class Miscellanea(ViewColumn):
"falloff range": falloffRangeBonus,
"tracking speed": trackingSpeedBonus}
isTrackingDisruptor = any(map(lambda x: x is not None and x != 0, trackingDisruptorAttributes.values()))
isTrackingDisruptor = any([x is not None and x != 0 for x in list(trackingDisruptorAttributes.values())])
# Then get the attributes for guidance disruptors
explosionVelocityBonus = stuff.getModifiedItemAttr("aoeVelocityBonus")
@@ -186,7 +186,7 @@ class Miscellanea(ViewColumn):
"flight time": flightTimeBonus,
"missile velocity": missileVelocityBonus}
isGuidanceDisruptor = any(map(lambda x: x is not None and x != 0, guidanceDisruptorAttributes.values()))
isGuidanceDisruptor = any([x is not None and x != 0 for x in list(guidanceDisruptorAttributes.values())])
if isTrackingDisruptor:
attributes = trackingDisruptorAttributes
@@ -195,12 +195,12 @@ class Miscellanea(ViewColumn):
else:
return "", None
display = max(attributes.values(), key=lambda x: abs(x))
display = max(list(attributes.values()), key=lambda x: abs(x))
text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True))
ttEntries = []
for attributeName, attributeValue in attributes.items():
for attributeName, attributeValue in list(attributes.items()):
if attributeValue == display:
ttEntries.append(attributeName)

View File

@@ -42,7 +42,7 @@ class EntityEditor(wx.Panel):
self.choices = []
self.choices.sort(key=lambda p: p.name)
self.entityChoices = wx.Choice(self, choices=map(lambda p: p.name, self.choices))
self.entityChoices = wx.Choice(self, choices=[p.name for p in self.choices])
self.navSizer.Add(self.entityChoices, 1, wx.ALL, 5)
buttons = (("new", wx.ART_NEW, self.OnNew),
@@ -96,8 +96,8 @@ class EntityEditor(wx.Panel):
def OnNew(self, event):
dlg = TextEntryValidatedDialog(self, self.validator,
u"Enter a name for your new {}:".format(self.entityName),
u"New {}".format(self.entityName))
"Enter a name for your new {}:".format(self.entityName),
"New {}".format(self.entityName))
dlg.CenterOnParent()
if dlg.ShowModal() == wx.ID_OK:
@@ -110,10 +110,10 @@ class EntityEditor(wx.Panel):
def OnCopy(self, event):
dlg = TextEntryValidatedDialog(self, self.validator,
u"Enter a name for your {} copy:".format(self.entityName),
u"Copy {}".format(self.entityName))
"Enter a name for your {} copy:".format(self.entityName),
"Copy {}".format(self.entityName))
active = self.getActiveEntity()
dlg.SetValue(u"{} Copy".format(active.name))
dlg.SetValue("{} Copy".format(active.name))
dlg.txtctrl.SetInsertionPointEnd()
dlg.CenterOnParent()
@@ -124,8 +124,8 @@ class EntityEditor(wx.Panel):
def OnRename(self, event):
dlg = TextEntryValidatedDialog(self, self.validator,
u"Enter a new name for your {}:".format(self.entityName),
u"Rename {}".format(self.entityName))
"Enter a new name for your {}:".format(self.entityName),
"Rename {}".format(self.entityName))
active = self.getActiveEntity()
dlg.SetValue(active.name)
dlg.txtctrl.SetInsertionPointEnd()
@@ -138,9 +138,9 @@ class EntityEditor(wx.Panel):
def OnDelete(self, event):
dlg = wx.MessageDialog(self,
u"Do you really want to delete the {} {}?".format(self.getActiveEntity().name,
"Do you really want to delete the {} {}?".format(self.getActiveEntity().name,
self.entityName),
u"Confirm Delete", wx.YES | wx.NO | wx.ICON_QUESTION)
"Confirm Delete", wx.YES | wx.NO | wx.ICON_QUESTION)
dlg.CenterOnParent()
if dlg.ShowModal() == wx.ID_YES:
@@ -152,7 +152,7 @@ class EntityEditor(wx.Panel):
self.choices = self.getEntitiesFromContext()
self.entityChoices.Clear()
self.entityChoices.AppendItems(map(lambda p: p.name, self.choices))
self.entityChoices.AppendItems([p.name for p in self.choices])
if selected:
idx = self.choices.index(selected)
self.entityChoices.SetSelection(idx)

View File

@@ -321,7 +321,7 @@ class FittingView(d.Display):
fit = sFit.getFit(self.getActiveFit(), basic=True)
bitmap = BitmapLoader.getImage("race_%s_small" % fit.ship.item.race, "gui")
text = u"%s: %s" % (fit.ship.item.name, fit.name)
text = "%s: %s" % (fit.ship.item.name, fit.name)
pageIndex = self.parent.GetPageIndex(self)
if pageIndex is not None:
@@ -731,7 +731,7 @@ class FittingView(d.Display):
break
name = col.getText(st)
if not isinstance(name, basestring):
if not isinstance(name, str):
name = ""
nx, ny = tdc.GetTextExtent(name)
@@ -761,7 +761,7 @@ class FittingView(d.Display):
name = col.columnText
imgId = col.imageId
if not isinstance(name, basestring):
if not isinstance(name, str):
name = ""
opts = wx.HeaderButtonParams()
@@ -804,7 +804,7 @@ class FittingView(d.Display):
name = col.columnText
imgId = col.imageId
if not isinstance(name, basestring):
if not isinstance(name, str):
name = ""
opts = wx.HeaderButtonParams()
@@ -838,7 +838,7 @@ class FittingView(d.Display):
break
name = col.getText(st)
if not isinstance(name, basestring):
if not isinstance(name, str):
name = ""
imgId = col.getImageId(st)

View File

@@ -20,7 +20,7 @@
# noinspection PyPackageRequirements
import wx
from utils.floatspin import FloatSpin
from .utils.floatspin import FloatSpin
# noinspection PyPackageRequirements
import wx.lib.newevent
# noinspection PyPackageRequirements
@@ -57,9 +57,9 @@ class CharacterTextValidor(BaseValidator):
raise ValueError("Character name already in use, please choose another.")
return True
except ValueError, e:
except ValueError as e:
pyfalog.error(e)
wx.MessageBox(u"{}".format(e), "Error")
wx.MessageBox("{}".format(e), "Error")
textCtrl.SetFocus()
return False
@@ -128,7 +128,7 @@ class CharacterEntityEditor(EntityEditor):
class CharacterEditor(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition,
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title="pyfa: Character Editor", pos=wx.DefaultPosition,
size=wx.Size(640, 600), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
i = wx.IconFromBitmap(BitmapLoader.getBitmap("character_small", "gui"))
@@ -351,7 +351,7 @@ class SkillTreeView(wx.Panel):
self.levelIds[idUnlearned] = "Not learned"
self.levelChangeMenu.Append(idUnlearned, "Unlearn")
for level in xrange(6):
for level in range(6):
id = wx.NewId()
self.levelIds[id] = level
self.levelChangeMenu.Append(id, "Level %d" % level)
@@ -514,7 +514,7 @@ class SkillTreeView(wx.Panel):
def _setTreeSkillLevel(treeItem, skillID):
lvl, dirty = sChar.getSkillLevel(char.ID, skillID)
self.skillTreeListCtrl.SetItemText(treeItem,
"Level {}".format(int(lvl)) if not isinstance(lvl, basestring) else lvl,
"Level {}".format(int(lvl)) if not isinstance(lvl, str) else lvl,
1)
if not dirty:
self.skillTreeListCtrl.SetItemTextColour(treeItem, None)
@@ -611,16 +611,16 @@ class APIView(wx.Panel):
self.charEditor = self.Parent.Parent # first parent is Notebook, second is Character Editor
self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
self.apiUrlCreatePredefined = u"https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=8"
self.apiUrlKeyList = u"https://community.eveonline.com/support/api-key/"
self.apiUrlCreatePredefined = "https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=8"
self.apiUrlKeyList = "https://community.eveonline.com/support/api-key/"
pmainSizer = wx.BoxSizer(wx.VERTICAL)
hintSizer = wx.BoxSizer(wx.HORIZONTAL)
hintSizer.AddStretchSpacer()
self.stDisabledTip = wx.StaticText(self, wx.ID_ANY,
u"You cannot add API Details for All 0 and All 5 characters.\n"
u"Please select another character or make a new one.", style=wx.ALIGN_CENTER)
"You cannot add API Details for All 0 and All 5 characters.\n"
"Please select another character or make a new one.", style=wx.ALIGN_CENTER)
self.stDisabledTip.Wrap(-1)
hintSizer.Add(self.stDisabledTip, 0, wx.TOP | wx.BOTTOM, 10)
self.stDisabledTip.Hide()
@@ -632,21 +632,21 @@ class APIView(wx.Panel):
fgSizerInput.SetFlexibleDirection(wx.BOTH)
fgSizerInput.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
self.m_staticIDText = wx.StaticText(self, wx.ID_ANY, u"keyID:", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticIDText = wx.StaticText(self, wx.ID_ANY, "keyID:", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticIDText.Wrap(-1)
fgSizerInput.Add(self.m_staticIDText, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.inputID = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
fgSizerInput.Add(self.inputID, 1, wx.ALL | wx.EXPAND, 5)
self.m_staticKeyText = wx.StaticText(self, wx.ID_ANY, u"vCode:", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticKeyText = wx.StaticText(self, wx.ID_ANY, "vCode:", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticKeyText.Wrap(-1)
fgSizerInput.Add(self.m_staticKeyText, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.inputKey = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
fgSizerInput.Add(self.inputKey, 0, wx.ALL | wx.EXPAND, 5)
self.m_staticCharText = wx.StaticText(self, wx.ID_ANY, u"Character:", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticCharText = wx.StaticText(self, wx.ID_ANY, "Character:", wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticCharText.Wrap(-1)
fgSizerInput.Add(self.m_staticCharText, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
@@ -661,11 +661,11 @@ class APIView(wx.Panel):
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.AddStretchSpacer()
self.btnFetchCharList = wx.Button(self, wx.ID_ANY, u"Get Characters")
self.btnFetchCharList = wx.Button(self, wx.ID_ANY, "Get Characters")
btnSizer.Add(self.btnFetchCharList, 0, wx.ALL, 2)
self.btnFetchCharList.Bind(wx.EVT_BUTTON, self.fetchCharList)
self.btnFetchSkills = wx.Button(self, wx.ID_ANY, u"Fetch Skills")
self.btnFetchSkills = wx.Button(self, wx.ID_ANY, "Fetch Skills")
btnSizer.Add(self.btnFetchSkills, 0, wx.ALL, 2)
self.btnFetchSkills.Bind(wx.EVT_BUTTON, self.fetchSkills)
self.btnFetchSkills.Enable(False)
@@ -678,7 +678,7 @@ class APIView(wx.Panel):
pmainSizer.AddStretchSpacer()
self.stAPITip = wx.StaticText(self, wx.ID_ANY,
u"You can create a pre-defined key here (only CharacterSheet is required):",
"You can create a pre-defined key here (only CharacterSheet is required):",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stAPITip.Wrap(-1)
@@ -688,7 +688,7 @@ class APIView(wx.Panel):
wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE)
pmainSizer.Add(self.hlEveAPI, 0, wx.ALL, 2)
self.stAPITip2 = wx.StaticText(self, wx.ID_ANY, u"Or, you can choose an existing key from:", wx.DefaultPosition,
self.stAPITip2 = wx.StaticText(self, wx.ID_ANY, "Or, you can choose an existing key from:", wx.DefaultPosition,
wx.DefaultSize, 0)
self.stAPITip2.Wrap(-1)
pmainSizer.Add(self.stAPITip2, 0, wx.ALL, 2)
@@ -747,15 +747,15 @@ class APIView(wx.Panel):
try:
activeChar = self.charEditor.entityEditor.getActiveEntity()
list = sChar.apiCharList(activeChar.ID, self.inputID.GetLineText(0), self.inputKey.GetLineText(0))
except AuthenticationError, e:
except AuthenticationError as e:
msg = "Authentication failure. Please check keyID and vCode combination."
pyfalog.info(msg)
self.stStatus.SetLabel(msg)
except TimeoutError, e:
except TimeoutError as e:
msg = "Request timed out. Please check network connectivity and/or proxy settings."
pyfalog.info(msg)
self.stStatus.SetLabel(msg)
except Exception, e:
except Exception as e:
pyfalog.error(e)
self.stStatus.SetLabel("Error:\n%s" % e.message)
else:
@@ -801,7 +801,7 @@ class SaveCharacterAs(wx.Dialog):
bSizer1.Add(self.input, 1, wx.ALL, 5)
self.input.Bind(wx.EVT_TEXT_ENTER, self.change)
self.button = wx.Button(self, wx.ID_OK, u"Save")
self.button = wx.Button(self, wx.ID_OK, "Save")
bSizer1.Add(self.button, 0, wx.ALL, 5)
self.SetSizer(bSizer1)
@@ -828,7 +828,7 @@ class SecStatusDialog(wx.Dialog):
bSizer1 = wx.BoxSizer(wx.VERTICAL)
self.m_staticText1 = wx.StaticText(self, wx.ID_ANY,
u"Security Status is used in some CONCORD hull calculations; you can set the characters security status here",
"Security Status is used in some CONCORD hull calculations; you can set the characters security status here",
wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticText1.Wrap(-1)
bSizer1.Add(self.m_staticText1, 1, wx.ALL | wx.EXPAND, 5)

View File

@@ -103,14 +103,14 @@ class CharacterSelection(wx.Panel):
sChar = Character.getInstance()
skillsMap = {}
for item, stuff in self.reqs.iteritems():
for things in stuff.values():
for item, stuff in self.reqs.items():
for things in list(stuff.values()):
if things[1] not in skillsMap:
skillsMap[things[1]] = things[0]
elif things[0] > skillsMap[things[1]]:
skillsMap[things[1]] = things[0]
for skillID, level in skillsMap.iteritems():
for skillID, level in skillsMap.items():
sChar.changeLevel(charID, skillID, level, ifHigher=True)
self.refreshCharacterList()
@@ -142,7 +142,7 @@ class CharacterSelection(wx.Panel):
sFit = Fit.getInstance()
sFit.changeChar(fitID, charID)
choice.Append(u"\u2015 Open Character Editor \u2015", -1)
choice.Append("\u2015 Open Character Editor \u2015", -1)
self.charCache = self.charChoice.GetCurrentSelection()
if event is not None:
@@ -251,11 +251,11 @@ class CharacterSelection(wx.Panel):
sCharacter = Character.getInstance()
if tabulationLevel == 0:
for item, subReqs in reqs.iteritems():
for item, subReqs in reqs.items():
tip += "%s:\n" % item.name
tip += self._buildSkillsTooltip(subReqs, item.name, 1)
else:
for name, info in reqs.iteritems():
for name, info in reqs.items():
level, ID, more = info
sCharacter.skillReqsDict['skills'].append({
'item': currItem,
@@ -277,11 +277,11 @@ class CharacterSelection(wx.Panel):
sCharacter = Character.getInstance()
if tabulationLevel == 0:
for item, subReqs in reqs.iteritems():
for item, subReqs in reqs.items():
skillsMap = self._buildSkillsTooltipCondensed(subReqs, item.name, 1, skillsMap)
sorted(skillsMap, key=skillsMap.get)
else:
for name, info in reqs.iteritems():
for name, info in reqs.items():
level, ID, more = info
sCharacter.skillReqsDict['skills'].append({
'item': currItem,

View File

@@ -72,7 +72,7 @@ class ContextMenu(object):
display_amount += 1
texts = m.getText(itemContext, selection)
if isinstance(texts, basestring):
if isinstance(texts, str):
texts = (texts,)
bitmap = m.getBitmap(srcContext, selection)

View File

@@ -31,21 +31,21 @@ class CopySelectDialog(wx.Dialog):
copyFormatMultiBuy = 5
def __init__(self, parent):
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Select a format", size=(-1, -1),
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Select a format", size=(-1, -1),
style=wx.DEFAULT_DIALOG_STYLE)
mainSizer = wx.BoxSizer(wx.VERTICAL)
copyFormats = [u"EFT", u"EFT (Implants)", u"XML", u"DNA", u"CREST", u"MultiBuy"]
copyFormatTooltips = {CopySelectDialog.copyFormatEft: u"EFT text format",
CopySelectDialog.copyFormatEftImps: u"EFT text format",
CopySelectDialog.copyFormatXml: u"EVE native XML format",
CopySelectDialog.copyFormatDna: u"A one-line text format",
CopySelectDialog.copyFormatCrest: u"A JSON format used for EVE CREST",
CopySelectDialog.copyFormatMultiBuy: u"MultiBuy text format"}
selector = wx.RadioBox(self, wx.ID_ANY, label=u"Copy to the clipboard using:", choices=copyFormats,
copyFormats = ["EFT", "EFT (Implants)", "XML", "DNA", "CREST", "MultiBuy"]
copyFormatTooltips = {CopySelectDialog.copyFormatEft: "EFT text format",
CopySelectDialog.copyFormatEftImps: "EFT text format",
CopySelectDialog.copyFormatXml: "EVE native XML format",
CopySelectDialog.copyFormatDna: "A one-line text format",
CopySelectDialog.copyFormatCrest: "A JSON format used for EVE CREST",
CopySelectDialog.copyFormatMultiBuy: "MultiBuy text format"}
selector = wx.RadioBox(self, wx.ID_ANY, label="Copy to the clipboard using:", choices=copyFormats,
style=wx.RA_SPECIFY_ROWS)
selector.Bind(wx.EVT_RADIOBOX, self.Selected)
for format, tooltip in copyFormatTooltips.iteritems():
for format, tooltip in copyFormatTooltips.items():
selector.SetItemToolTip(format, tooltip)
self.copyFormat = CopySelectDialog.copyFormatEft

View File

@@ -45,7 +45,7 @@ class CrestFittings(wx.Frame):
characterSelectSizer.Add(self.charChoice, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
self.updateCharList()
self.fetchBtn = wx.Button(self, wx.ID_ANY, u"Fetch Fits", wx.DefaultPosition, wx.DefaultSize, 5)
self.fetchBtn = wx.Button(self, wx.ID_ANY, "Fetch Fits", wx.DefaultPosition, wx.DefaultSize, 5)
characterSelectSizer.Add(self.fetchBtn, 0, wx.ALL, 5)
mainSizer.Add(characterSelectSizer, 0, wx.EXPAND, 5)
@@ -64,8 +64,8 @@ class CrestFittings(wx.Frame):
fitSizer.Add(self.fitView, 1, wx.ALL | wx.EXPAND, 5)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
self.importBtn = wx.Button(self, wx.ID_ANY, u"Import to pyfa", wx.DefaultPosition, wx.DefaultSize, 5)
self.deleteBtn = wx.Button(self, wx.ID_ANY, u"Delete from EVE", wx.DefaultPosition, wx.DefaultSize, 5)
self.importBtn = wx.Button(self, wx.ID_ANY, "Import to pyfa", wx.DefaultPosition, wx.DefaultSize, 5)
self.deleteBtn = wx.Button(self, wx.ID_ANY, "Delete from EVE", wx.DefaultPosition, wx.DefaultSize, 5)
btnSizer.Add(self.importBtn, 1, wx.ALL, 5)
btnSizer.Add(self.deleteBtn, 1, wx.ALL, 5)
fitSizer.Add(btnSizer, 0, wx.EXPAND)
@@ -207,7 +207,7 @@ class ExportToEve(wx.Frame):
self.updateCharList()
self.charChoice.SetSelection(0)
self.exportBtn = wx.Button(self, wx.ID_ANY, u"Export Fit", wx.DefaultPosition, wx.DefaultSize, 5)
self.exportBtn = wx.Button(self, wx.ID_ANY, "Export Fit", wx.DefaultPosition, wx.DefaultSize, 5)
hSizer.Add(self.exportBtn, 0, wx.ALL, 5)
mainSizer.Add(hSizer, 0, wx.EXPAND, 5)
@@ -314,10 +314,10 @@ class CrestMgmt(wx.Dialog):
btnSizer = wx.BoxSizer(wx.VERTICAL)
self.addBtn = wx.Button(self, wx.ID_ANY, u"Add Character", wx.DefaultPosition, wx.DefaultSize, 0)
self.addBtn = wx.Button(self, wx.ID_ANY, "Add Character", wx.DefaultPosition, wx.DefaultSize, 0)
btnSizer.Add(self.addBtn, 0, wx.ALL | wx.EXPAND, 5)
self.deleteBtn = wx.Button(self, wx.ID_ANY, u"Revoke Character", wx.DefaultPosition, wx.DefaultSize, 0)
self.deleteBtn = wx.Button(self, wx.ID_ANY, "Revoke Character", wx.DefaultPosition, wx.DefaultSize, 0)
btnSizer.Add(self.deleteBtn, 0, wx.ALL | wx.EXPAND, 5)
mainSizer.Add(btnSizer, 0, wx.EXPAND, 5)
@@ -397,7 +397,7 @@ class FittingsTreeView(wx.Panel):
dict[fit['ship']['name']] = []
dict[fit['ship']['name']].append(fit)
for name, fits in dict.iteritems():
for name, fits in dict.items():
shipID = tree.AppendItem(root, name)
for fit in fits:
fitId = tree.AppendItem(shipID, fit['name'])

View File

@@ -55,7 +55,7 @@ class Display(wx.ListCtrl):
name, type, defaultValue = param
value = params[x] if len(params) > x else defaultValue
value = value if value != "" else defaultValue
if type == bool and isinstance(value, basestring):
if type == bool and isinstance(value, str):
value = bool(value) if value.lower() != "false" and value != "0" else False
paramDict[name] = value
col = colClass(self, paramDict)
@@ -219,13 +219,13 @@ class Display(wx.ListCtrl):
if listItemCount < stuffItemCount:
for i in range(stuffItemCount - listItemCount):
self.InsertStringItem(sys.maxint, "")
self.InsertStringItem(sys.maxsize, "")
if listItemCount > stuffItemCount:
if listItemCount - stuffItemCount > 20 > stuffItemCount:
self.DeleteAllItems()
for i in range(stuffItemCount):
self.InsertStringItem(sys.maxint, "")
self.InsertStringItem(sys.maxsize, "")
else:
for i in range(listItemCount - stuffItemCount):
self.DeleteItem(self.getLastItem())
@@ -247,7 +247,7 @@ class Display(wx.ListCtrl):
newText = col.getText(st)
if newText is False:
col.delayedText(st, self, colItem)
newText = u"\u21bb"
newText = "\u21bb"
newImageId = col.getImageId(st)

View File

@@ -93,13 +93,13 @@ class GraphFrame(wx.Frame):
graphFrame_enabled = True
if int(mpl.__version__[0]) < 1:
print("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds")
print(("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds"))
print("pyfa: Recommended minimum matplotlib version is 1.0.0")
self.legendFix = True
mplImported = True
wx.Frame.__init__(self, parent, title=u"pyfa: Graph Generator", style=style, size=(520, 390))
wx.Frame.__init__(self, parent, title="pyfa: Graph Generator", style=style, size=(520, 390))
i = wx.IconFromBitmap(BitmapLoader.getBitmap("graphs_small", "gui"))
self.SetIcon(i)
@@ -179,7 +179,7 @@ class GraphFrame(wx.Frame):
def getValues(self):
values = {}
for fieldName, field in self.fields.iteritems():
for fieldName, field in self.fields.items():
values[fieldName] = field.GetValue()
return values
@@ -193,14 +193,14 @@ class GraphFrame(wx.Frame):
self.fields.clear()
# Setup textboxes
for field, defaultVal in view.getFields().iteritems():
for field, defaultVal in view.getFields().items():
textBox = wx.TextCtrl(self.gridPanel, wx.ID_ANY, style=0)
self.fields[field] = textBox
textBox.Bind(wx.EVT_TEXT, self.onFieldChanged)
sizer.Add(textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
if defaultVal is not None:
if not isinstance(defaultVal, basestring):
if not isinstance(defaultVal, str):
defaultVal = ("%f" % defaultVal).rstrip("0")
if defaultVal[-1:] == ".":
defaultVal += "0"
@@ -248,8 +248,8 @@ class GraphFrame(wx.Frame):
self.subplot.plot(x, y)
legend.append(fit.name)
except:
pyfalog.warning(u"Invalid values in '{0}'", fit.name)
self.SetStatusText(u"Invalid values in '%s'" % fit.name)
pyfalog.warning("Invalid values in '{0}'", fit.name)
self.SetStatusText("Invalid values in '%s'" % fit.name)
self.canvas.draw()
return

View File

@@ -113,7 +113,7 @@ class ItemStatsDialog(wx.Dialog):
self.mainSizer.Add(self.container, 1, wx.EXPAND)
if "wxGTK" in wx.PlatformInfo:
self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0)
self.closeBtn = wx.Button(self, wx.ID_ANY, "Close", wx.DefaultPosition, wx.DefaultSize, 0)
self.mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5)
self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent)
@@ -294,19 +294,19 @@ class ItemParams(wx.Panel):
mainSizer.Add(self.m_staticline, 0, wx.EXPAND)
bSizer = wx.BoxSizer(wx.HORIZONTAL)
self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0)
self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, " ", wx.DefaultPosition, wx.DefaultSize, 0)
bSizer.Add(self.totalAttrsLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, u"Toggle view mode", wx.DefaultPosition, wx.DefaultSize,
self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, "Toggle view mode", wx.DefaultPosition, wx.DefaultSize,
0)
bSizer.Add(self.toggleViewBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.exportStatsBtn = wx.ToggleButton(self, wx.ID_ANY, u"Export Item Stats", wx.DefaultPosition, wx.DefaultSize,
self.exportStatsBtn = wx.ToggleButton(self, wx.ID_ANY, "Export Item Stats", wx.DefaultPosition, wx.DefaultSize,
0)
bSizer.Add(self.exportStatsBtn, 0, wx.ALIGN_CENTER_VERTICAL)
if stuff is not None:
self.refreshBtn = wx.Button(self, wx.ID_ANY, u"Refresh", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT)
self.refreshBtn = wx.Button(self, wx.ID_ANY, "Refresh", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT)
bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshValues)
@@ -426,7 +426,7 @@ class ItemParams(wx.Panel):
self.imageList = wx.ImageList(16, 16)
self.paramList.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL)
names = list(self.attrValues.iterkeys())
names = list(self.attrValues.keys())
names.sort()
idNameMap = {}
@@ -463,7 +463,7 @@ class ItemParams(wx.Panel):
else:
attrIcon = self.imageList.Add(BitmapLoader.getBitmap("7_15", "icons"))
index = self.paramList.InsertImageStringItem(sys.maxint, attrName, attrIcon)
index = self.paramList.InsertImageStringItem(sys.maxsize, attrName, attrIcon)
idNameMap[idCount] = attrName
self.paramList.SetItemData(index, idCount)
idCount += 1
@@ -510,7 +510,7 @@ class ItemParams(wx.Panel):
"Inversed Modifier Percent": (lambda: (1 - value) * 100, unitName),
"Modifier Percent" : (
lambda: ("%+.2f" if ((value - 1) * 100) % 1 else "%+d") % ((value - 1) * 100), unitName),
"Volume" : (lambda: value, u"m\u00B3"),
"Volume" : (lambda: value, "m\u00B3"),
"Sizeclass" : (lambda: value, ""),
"Absolute Percent" : (lambda: (value * 100), unitName),
"Milliseconds" : (lambda: value / 1000.0, unitName),
@@ -524,7 +524,7 @@ class ItemParams(wx.Panel):
v = override[0]()
if isinstance(v, str):
fvalue = v
elif isinstance(v, (int, float, long)):
elif isinstance(v, (int, float)):
fvalue = formatAmount(v, 3, 0, 0)
else:
fvalue = v
@@ -558,12 +558,12 @@ class ItemCompare(wx.Panel):
# get a dict of attrName: attrInfo of all unique attributes across all items
for item in self.items:
for attr in item.attributes.keys():
for attr in list(item.attributes.keys()):
if item.attributes[attr].info.displayName:
self.attrs[attr] = item.attributes[attr].info
# Process attributes for items and find ones that differ
for attr in self.attrs.keys():
for attr in list(self.attrs.keys()):
value = None
for item in self.items:
@@ -588,14 +588,14 @@ class ItemCompare(wx.Panel):
mainSizer.Add(self.m_staticline, 0, wx.EXPAND)
bSizer = wx.BoxSizer(wx.HORIZONTAL)
self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0)
self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, " ", wx.DefaultPosition, wx.DefaultSize, 0)
bSizer.Add(self.totalAttrsLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, u"Toggle view mode", wx.DefaultPosition,
self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, "Toggle view mode", wx.DefaultPosition,
wx.DefaultSize, 0)
bSizer.Add(self.toggleViewBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.refreshBtn = wx.Button(self, wx.ID_ANY, u"Refresh", wx.DefaultPosition, wx.DefaultSize,
self.refreshBtn = wx.Button(self, wx.ID_ANY, "Refresh", wx.DefaultPosition, wx.DefaultSize,
wx.BU_EXACTFIT)
bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshValues)
@@ -649,7 +649,7 @@ class ItemCompare(wx.Panel):
try:
# Remember to reduce by 1, because the attrs array
# starts at 0 while the list has the item name as column 0.
attr = str(self.attrs.keys()[sort - 1])
attr = str(list(self.attrs.keys())[sort - 1])
func = lambda _val: _val.attributes[attr].value if attr in _val.attributes else None
except IndexError:
# Clicked on a column that's not part of our array (price most likely)
@@ -670,7 +670,7 @@ class ItemCompare(wx.Panel):
self.paramList.SetColumnWidth(len(self.attrs) + 1, 60)
for item in self.items:
i = self.paramList.InsertStringItem(sys.maxint, item.name)
i = self.paramList.InsertStringItem(sys.maxsize, item.name)
for x, attr in enumerate(self.attrs.keys()):
if attr in item.attributes:
info = self.attrs[attr]
@@ -708,7 +708,7 @@ class ItemCompare(wx.Panel):
"Inverse Absolute Percent" : (lambda: (1 - value) * 100, unitName),
"Inversed Modifier Percent": (lambda: (1 - value) * 100, unitName),
"Modifier Percent" : (lambda: ("%+.2f" if ((value - 1) * 100) % 1 else "%+d") % ((value - 1) * 100), unitName),
"Volume" : (lambda: value, u"m\u00B3"),
"Volume" : (lambda: value, "m\u00B3"),
"Sizeclass" : (lambda: value, ""),
"Absolute Percent" : (lambda: (value * 100), unitName),
"Milliseconds" : (lambda: value / 1000.0, unitName),
@@ -722,7 +722,7 @@ class ItemCompare(wx.Panel):
v = override[0]()
if isinstance(v, str):
fvalue = v
elif isinstance(v, (int, float, long)):
elif isinstance(v, (int, float)):
fvalue = formatAmount(v, 3, 0, 0)
else:
fvalue = v
@@ -759,7 +759,7 @@ class ItemRequirements(wx.Panel):
self.Layout()
def getFullSkillTree(self, parentSkill, parent, sbIconId):
for skill, level in parentSkill.requiredSkills.iteritems():
for skill, level in parentSkill.requiredSkills.items():
child = self.reqTree.AppendItem(parent, "%s %s" % (skill.name, self.romanNb[int(level)]), sbIconId)
if skill.ID not in self.skillIdHistory:
self.getFullSkillTree(skill, child, sbIconId)
@@ -794,7 +794,7 @@ class ItemDependents(wx.Panel):
def getFullSkillTree(self, parentSkill, parent, sbIconId):
levelToItems = {}
for item, level in parentSkill.requiredFor.iteritems():
for item, level in parentSkill.requiredFor.items():
if level not in levelToItems:
levelToItems[level] = []
levelToItems[level].append(item)
@@ -853,11 +853,11 @@ class ItemEffects(wx.Panel):
item = self.item
effects = item.effects
names = list(effects.iterkeys())
names = list(effects.keys())
names.sort()
for name in names:
index = self.effectList.InsertStringItem(sys.maxint, name)
index = self.effectList.InsertStringItem(sys.maxsize, name)
if effects[name].isImplemented:
if effects[name].activeByDefault:
@@ -962,17 +962,17 @@ class ItemAffectedBy(wx.Panel):
mainSizer.Add(self.m_staticline, 0, wx.EXPAND)
bSizer = wx.BoxSizer(wx.HORIZONTAL)
self.toggleExpandBtn = wx.ToggleButton(self, wx.ID_ANY, u"Expand All", wx.DefaultPosition, wx.DefaultSize, 0)
self.toggleExpandBtn = wx.ToggleButton(self, wx.ID_ANY, "Expand All", wx.DefaultPosition, wx.DefaultSize, 0)
bSizer.Add(self.toggleExpandBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.toggleNameBtn = wx.ToggleButton(self, wx.ID_ANY, u"Toggle Names", wx.DefaultPosition, wx.DefaultSize, 0)
self.toggleNameBtn = wx.ToggleButton(self, wx.ID_ANY, "Toggle Names", wx.DefaultPosition, wx.DefaultSize, 0)
bSizer.Add(self.toggleNameBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, u"Toggle View", wx.DefaultPosition, wx.DefaultSize, 0)
self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, "Toggle View", wx.DefaultPosition, wx.DefaultSize, 0)
bSizer.Add(self.toggleViewBtn, 0, wx.ALIGN_CENTER_VERTICAL)
if stuff is not None:
self.refreshBtn = wx.Button(self, wx.ID_ANY, u"Refresh", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT)
self.refreshBtn = wx.Button(self, wx.ID_ANY, "Refresh", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT)
bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshTree)
@@ -995,7 +995,7 @@ class ItemAffectedBy(wx.Panel):
stuff = self.affectedBy.GetPyData(item)
# String is set as data when we are dealing with attributes, not stuff containers
if stuff is None or isinstance(stuff, basestring):
if stuff is None or isinstance(stuff, str):
return
contexts = []
@@ -1104,7 +1104,7 @@ class ItemAffectedBy(wx.Panel):
if attributes[attrName] == (attributes.getOriginal(attrName, 0)):
continue
for fit, afflictors in attributes.getAfflictions(attrName).iteritems():
for fit, afflictors in attributes.getAfflictions(attrName).items():
for afflictor, modifier, amount, used in afflictors:
if not used or afflictor.item is None:
@@ -1135,7 +1135,7 @@ class ItemAffectedBy(wx.Panel):
(type(afflictor), afflictor, item, modifier, amount, getattr(afflictor, "projected", False)))
# Make sure projected fits are on top
rootOrder = container.keys()
rootOrder = list(container.keys())
rootOrder.sort(key=lambda x: self.ORDER.index(type(x)))
# Now, we take our created dictionary and start adding stuff to our tree
@@ -1149,7 +1149,7 @@ class ItemAffectedBy(wx.Panel):
parent = child
attributes = container[thing]
attrOrder = sorted(attributes.keys(), key=self.sortAttrDisplayName)
attrOrder = sorted(list(attributes.keys()), key=self.sortAttrDisplayName)
for attrName in attrOrder:
attrInfo = self.stuff.item.attributes.get(attrName)
@@ -1233,7 +1233,7 @@ class ItemAffectedBy(wx.Panel):
if attributes[attrName] == (attributes.getOriginal(attrName, 0)):
continue
for fit, afflictors in attributes.getAfflictions(attrName).iteritems():
for fit, afflictors in attributes.getAfflictions(attrName).items():
for afflictor, modifier, amount, used in afflictors:
if not used or getattr(afflictor, 'item', None) is None:
continue
@@ -1269,7 +1269,7 @@ class ItemAffectedBy(wx.Panel):
info[2].append((attrName, modifier, amount))
# Make sure projected fits are on top
rootOrder = container.keys()
rootOrder = list(container.keys())
rootOrder.sort(key=lambda x: self.ORDER.index(type(x)))
# Now, we take our created dictionary and start adding stuff to our tree
@@ -1283,7 +1283,7 @@ class ItemAffectedBy(wx.Panel):
parent = child
items = container[thing]
order = items.keys()
order = list(items.keys())
order.sort(key=lambda x: (self.ORDER.index(items[x][0]), x))
for itemName in order:
@@ -1387,7 +1387,7 @@ class ItemProperties(wx.Panel):
mainSizer.Add(self.m_staticline, 0, wx.EXPAND)
bSizer = wx.BoxSizer(wx.HORIZONTAL)
self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0)
self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, " ", wx.DefaultPosition, wx.DefaultSize, 0)
bSizer.Add(self.totalAttrsLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT)
mainSizer.Add(bSizer, 0, wx.ALIGN_RIGHT)
@@ -1439,7 +1439,7 @@ class ItemProperties(wx.Panel):
attrName = name.title()
value = getattr(self.item, name)
index = self.paramList.InsertStringItem(sys.maxint, attrName)
index = self.paramList.InsertStringItem(sys.maxsize, attrName)
# index = self.paramList.InsertImageStringItem(sys.maxint, attrName)
idNameMap[idCount] = attrName
self.paramList.SetItemData(index, idCount)

View File

@@ -93,7 +93,7 @@ try:
from gui.propertyEditor import AttributeEditor
except ImportError as e:
AttributeEditor = None
print("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message)
print(("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message))
disableOverrideEditor = True
pyfalog = Logger(__name__)
@@ -413,7 +413,7 @@ class MainFrame(wx.Frame, IPortUser):
""" Export active fit """
sFit = Fit.getInstance()
fit = sFit.getFit(self.getActiveFit())
defaultFile = u"%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None
defaultFile = "%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None
dlg = wx.FileDialog(self, "Save Fitting As...",
wildcard="EVE XML fitting files (*.xml)|*.xml",
@@ -427,7 +427,7 @@ class MainFrame(wx.Frame, IPortUser):
if '.' not in os.path.basename(path):
path += ".xml"
else:
print("oops, invalid fit format %d" % format_)
print(("oops, invalid fit format %d" % format_))
try:
dlg.Destroy()
except PyDeadObjectError:

View File

@@ -65,7 +65,7 @@ class MarketBrowser(wx.Panel):
vbox.Add(p, 0, wx.EXPAND)
self.metaButtons = []
btn = None
for name in self.sMkt.META_MAP.keys():
for name in list(self.sMkt.META_MAP.keys()):
btn = MetaButton(p, wx.ID_ANY, name.capitalize(), style=wx.BU_EXACTFIT)
setattr(self, name, btn)
box.Add(btn, 1, wx.ALIGN_CENTER)

View File

@@ -51,7 +51,7 @@ class DmgPatternTextValidor(BaseValidator):
return True
except ValueError as e:
pyfalog.error(e)
wx.MessageBox(u"{}".format(e), "Error")
wx.MessageBox("{}".format(e), "Error")
textCtrl.SetFocus()
return False
@@ -89,7 +89,7 @@ class DmgPatternEditorDlg(wx.Dialog):
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
def __init__(self, parent):
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Damage Pattern Editor", size=wx.Size(400, 240))
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Damage Pattern Editor", size=wx.Size(400, 240))
self.block = False
self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
@@ -128,7 +128,7 @@ class DmgPatternEditorDlg(wx.Dialog):
# set text edit
setattr(self, "%sEdit" % type_, IntCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize))
setattr(self, "%sPerc" % type_, wx.StaticText(self, wx.ID_ANY, u"0%"))
setattr(self, "%sPerc" % type_, wx.StaticText(self, wx.ID_ANY, "0%"))
editObj = getattr(self, "%sEdit" % type_)
dmgeditSizer.Add(bmp, 0, style, border)
@@ -147,7 +147,7 @@ class DmgPatternEditorDlg(wx.Dialog):
footerSizer = wx.BoxSizer(wx.HORIZONTAL)
perSizer = wx.BoxSizer(wx.VERTICAL)
self.stNotice = wx.StaticText(self, wx.ID_ANY, u"")
self.stNotice = wx.StaticText(self, wx.ID_ANY, "")
self.stNotice.Wrap(-1)
perSizer.Add(self.stNotice, 0, wx.BOTTOM | wx.TOP | wx.LEFT, 5)
@@ -160,7 +160,7 @@ class DmgPatternEditorDlg(wx.Dialog):
mainSizer.Add(contentSizer, 1, wx.EXPAND, 0)
if "wxGTK" in wx.PlatformInfo:
self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0)
self.closeBtn = wx.Button(self, wx.ID_ANY, "Close", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5)
self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent)
@@ -200,7 +200,7 @@ class DmgPatternEditorDlg(wx.Dialog):
return
p = self.entityEditor.getActiveEntity()
total = sum(map(lambda attr: getattr(self, "%sEdit" % attr).GetValue(), self.DAMAGE_TYPES))
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_)

Some files were not shown because too many files have changed in this diff Show More