Get back into tox's good graces
This commit is contained in:
@@ -29,9 +29,6 @@ from eos.saveddata.user import User
|
|||||||
from eos.saveddata.character import Character, Skill
|
from eos.saveddata.character import Character, Skill
|
||||||
from eos.saveddata.ssocharacter import SsoCharacter
|
from eos.saveddata.ssocharacter import SsoCharacter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
characters_table = Table("characters", saveddata_meta,
|
characters_table = Table("characters", saveddata_meta,
|
||||||
Column("ID", Integer, primary_key=True),
|
Column("ID", Integer, primary_key=True),
|
||||||
Column("name", String, nullable=False),
|
Column("name", String, nullable=False),
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ def handler(fit, module, context):
|
|||||||
# this is such a dirty hack
|
# this is such a dirty hack
|
||||||
for mod in fit.modules:
|
for mod in fit.modules:
|
||||||
if not mod.isEmpty and mod.state > State.ONLINE and (
|
if not mod.isEmpty and mod.state > State.ONLINE and (
|
||||||
mod.item.requiresSkill("Micro Jump Drive Operation")
|
mod.item.requiresSkill("Micro Jump Drive Operation") or
|
||||||
or mod.item.requiresSkill("High Speed Maneuvering")
|
mod.item.requiresSkill("High Speed Maneuvering")
|
||||||
):
|
):
|
||||||
mod.state = State.ONLINE
|
mod.state = State.ONLINE
|
||||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > State.ONLINE:
|
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > State.ONLINE:
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ class Character(object):
|
|||||||
if x.client == clientHash:
|
if x.client == clientHash:
|
||||||
self.__ssoCharacters.remove(x)
|
self.__ssoCharacters.remove(x)
|
||||||
|
|
||||||
|
|
||||||
def getSsoCharacter(self, clientHash):
|
def getSsoCharacter(self, clientHash):
|
||||||
return next((x for x in self.__ssoCharacters if x.client == clientHash), None)
|
return next((x for x in self.__ssoCharacters if x.client == clientHash), None)
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class SsoCharacter(object):
|
|||||||
self.refreshToken = refreshToken
|
self.refreshToken = refreshToken
|
||||||
self.accessTokenExpires = None
|
self.accessTokenExpires = None
|
||||||
|
|
||||||
|
|
||||||
@reconstructor
|
@reconstructor
|
||||||
def init(self):
|
def init(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -43,13 +43,17 @@ class PFEsiPref(PreferenceView):
|
|||||||
rbSizer = wx.BoxSizer(wx.HORIZONTAL)
|
rbSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
self.rbMode = wx.RadioBox(panel, -1, "Login Authentication Method", wx.DefaultPosition, wx.DefaultSize,
|
self.rbMode = wx.RadioBox(panel, -1, "Login Authentication Method", wx.DefaultPosition, wx.DefaultSize,
|
||||||
['Local Server', 'Manual'], 1, wx.RA_SPECIFY_COLS)
|
['Local Server', 'Manual'], 1, wx.RA_SPECIFY_COLS)
|
||||||
self.rbMode.SetItemToolTip(0, "This options starts a local webserver that the web application will call back to with information about the character login.")
|
self.rbMode.SetItemToolTip(0, "This options starts a local webserver that the web application will call back to"
|
||||||
self.rbMode.SetItemToolTip(1, "This option prompts users to copy and paste information from the web application to allow for character login. Use this if having issues with the local server.")
|
" with information about the character login.")
|
||||||
|
self.rbMode.SetItemToolTip(1, "This option prompts users to copy and paste information from the web application "
|
||||||
|
"to allow for character login. Use this if having issues with the local server.")
|
||||||
|
|
||||||
self.rbSsoMode = wx.RadioBox(panel, -1, "SSO Mode", wx.DefaultPosition, wx.DefaultSize,
|
self.rbSsoMode = wx.RadioBox(panel, -1, "SSO Mode", wx.DefaultPosition, wx.DefaultSize,
|
||||||
['pyfa.io', 'Custom application'], 1, wx.RA_SPECIFY_COLS)
|
['pyfa.io', 'Custom application'], 1, wx.RA_SPECIFY_COLS)
|
||||||
self.rbSsoMode.SetItemToolTip(0, "This options routes SSO Logins through pyfa.io, allowing you to easily login without any configuration. When in doubt, use this option.")
|
self.rbSsoMode.SetItemToolTip(0, "This options routes SSO Logins through pyfa.io, allowing you to easily login "
|
||||||
self.rbSsoMode.SetItemToolTip(1, "This option goes through EVE SSO directly, but requires more configuration. Use this is pyfa.io is blocked for some reason, or if you do not wish to route data throguh pyfa.io.")
|
"without any configuration. When in doubt, use this option.")
|
||||||
|
self.rbSsoMode.SetItemToolTip(1, "This option goes through EVE SSO directly, but requires more configuration. Use "
|
||||||
|
"this is pyfa.io is blocked for some reason, or if you do not wish to route data throguh pyfa.io.")
|
||||||
|
|
||||||
self.rbMode.SetSelection(self.settings.get('loginMode'))
|
self.rbMode.SetSelection(self.settings.get('loginMode'))
|
||||||
self.rbSsoMode.SetSelection(self.settings.get('ssoMode'))
|
self.rbSsoMode.SetSelection(self.settings.get('ssoMode'))
|
||||||
@@ -70,12 +74,6 @@ class PFEsiPref(PreferenceView):
|
|||||||
mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0,
|
mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0,
|
||||||
wx.EXPAND, 5)
|
wx.EXPAND, 5)
|
||||||
|
|
||||||
# self.stInfo = wx.StaticText(panel, wx.ID_ANY,
|
|
||||||
# u"Using custom applications details will let pyfa to access the SSO under your application, rather than the pyfa application that is automatically set up. This requires you to set up your own ESI client application and accept CCPs License Agreement. Additionally, when setting up your client, make sure the callback url is set to 'http://localhost:6461'. Please see the pyfa wiki for more information regarding this",
|
|
||||||
# wx.DefaultPosition, wx.DefaultSize, 0)
|
|
||||||
# self.stInfo.Wrap(dlgWidth)
|
|
||||||
# mainSizer.Add(self.stInfo, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
|
||||||
|
|
||||||
fgAddrSizer = wx.FlexGridSizer(2, 2, 0, 0)
|
fgAddrSizer = wx.FlexGridSizer(2, 2, 0, 0)
|
||||||
fgAddrSizer.AddGrowableCol(1)
|
fgAddrSizer.AddGrowableCol(1)
|
||||||
fgAddrSizer.SetFlexibleDirection(wx.BOTH)
|
fgAddrSizer.SetFlexibleDirection(wx.BOTH)
|
||||||
@@ -105,10 +103,6 @@ class PFEsiPref(PreferenceView):
|
|||||||
|
|
||||||
mainSizer.Add(fgAddrSizer, 0, wx.EXPAND, 5)
|
mainSizer.Add(fgAddrSizer, 0, wx.EXPAND, 5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
timeoutSizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
||||||
|
|
||||||
# self.stTimout = wx.StaticText(panel, wx.ID_ANY, "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)
|
# self.stTimout.Wrap(-1)
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -150,10 +150,10 @@ class PFNetworkPref(PreferenceView):
|
|||||||
proxy = self.settings.autodetect()
|
proxy = self.settings.autodetect()
|
||||||
|
|
||||||
if proxy is not None:
|
if proxy is not None:
|
||||||
addr, port = proxy
|
addr, port = proxy
|
||||||
txt = addr + ":" + str(port)
|
txt = addr + ":" + str(port)
|
||||||
else:
|
else:
|
||||||
txt = "None"
|
txt = "None"
|
||||||
|
|
||||||
self.stPSAutoDetected.SetLabel("Auto-detected: " + txt)
|
self.stPSAutoDetected.SetLabel("Auto-detected: " + txt)
|
||||||
self.stPSAutoDetected.Disable()
|
self.stPSAutoDetected.Disable()
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class FirepowerViewFull(StatsView):
|
|||||||
# Remove effective label
|
# Remove effective label
|
||||||
hsizer = self.headerPanel.GetSizer()
|
hsizer = self.headerPanel.GetSizer()
|
||||||
hsizer.Hide(self.stEff)
|
hsizer.Hide(self.stEff)
|
||||||
#self.stEff.Destroy()
|
# self.stEff.Destroy()
|
||||||
|
|
||||||
# Get the new view
|
# Get the new view
|
||||||
view = StatsView.getView("miningyieldViewFull")(self.parent)
|
view = StatsView.getView("miningyieldViewFull")(self.parent)
|
||||||
|
|||||||
@@ -830,7 +830,6 @@ class APIView(wx.Panel):
|
|||||||
if sso is None:
|
if sso is None:
|
||||||
self.charChoice.SetSelection(noneID)
|
self.charChoice.SetSelection(noneID)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# if chars:
|
# if chars:
|
||||||
# for charName in chars:
|
# for charName in chars:
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ class CharacterSelection(wx.Panel):
|
|||||||
def charChanged(self, event):
|
def charChanged(self, event):
|
||||||
fitID = self.mainFrame.getActiveFit()
|
fitID = self.mainFrame.getActiveFit()
|
||||||
charID = self.getActiveCharacter()
|
charID = self.getActiveCharacter()
|
||||||
sChar = Character.getInstance()
|
|
||||||
|
|
||||||
if charID == -1:
|
if charID == -1:
|
||||||
# revert to previous character
|
# revert to previous character
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#===============================================================================
|
# ===============================================================================
|
||||||
#
|
#
|
||||||
# ToDo: Bug - when selecting close on a tab, sometimes the tab to the right is
|
# ToDo: Bug - when selecting close on a tab, sometimes the tab to the right is
|
||||||
# selected, most likely due to determination of mouse position
|
# selected, most likely due to determination of mouse position
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
# tab index?). This will also help with finding close buttons.
|
# tab index?). This will also help with finding close buttons.
|
||||||
# ToDo: Fix page preview code (PFNotebookPagePreview)
|
# ToDo: Fix page preview code (PFNotebookPagePreview)
|
||||||
#
|
#
|
||||||
#= ==============================================================================
|
# ===============================================================================
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.newevent
|
import wx.lib.newevent
|
||||||
@@ -413,7 +413,7 @@ class _TabRenderer:
|
|||||||
mdc.SelectObject(ebmp)
|
mdc.SelectObject(ebmp)
|
||||||
mdc.SetFont(self.font)
|
mdc.SetFont(self.font)
|
||||||
textSizeX, textSizeY = mdc.GetTextExtent(self.text)
|
textSizeX, textSizeY = mdc.GetTextExtent(self.text)
|
||||||
totalSize = self.left_width + self.right_width + textSizeX + self.close_btn_width / 2 + 16 + self.padding* 2
|
totalSize = self.left_width + self.right_width + textSizeX + self.close_btn_width / 2 + 16 + self.padding * 2
|
||||||
mdc.SelectObject(wx.NullBitmap)
|
mdc.SelectObject(wx.NullBitmap)
|
||||||
return totalSize, self.tab_height
|
return totalSize, self.tab_height
|
||||||
|
|
||||||
@@ -1478,4 +1478,3 @@ if __name__ == "__main__":
|
|||||||
top = Frame("Test Chrome Tabs")
|
top = Frame("Test Chrome Tabs")
|
||||||
top.Show()
|
top.Show()
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class EveFittings(wx.Frame):
|
|||||||
|
|
||||||
self.mainFrame = parent
|
self.mainFrame = parent
|
||||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
sEsi = Esi.getInstance()
|
|
||||||
|
|
||||||
characterSelectSizer = wx.BoxSizer(wx.HORIZONTAL)
|
characterSelectSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
|
||||||
@@ -119,10 +118,11 @@ class EveFittings(wx.Frame):
|
|||||||
pyfalog.error(msg)
|
pyfalog.error(msg)
|
||||||
self.statusbar.SetStatusText(msg)
|
self.statusbar.SetStatusText(msg)
|
||||||
except APIException as ex:
|
except APIException as ex:
|
||||||
del waitDialog # Can't do this in a finally because then it obscures the message dialog
|
# Can't do this in a finally because then it obscures the message dialog
|
||||||
|
del waitDialog # noqa: F821
|
||||||
ESIExceptionHandler(self, ex)
|
ESIExceptionHandler(self, ex)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
del waitDialog
|
del waitDialog # noqa: F821
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
def importFitting(self, event):
|
def importFitting(self, event):
|
||||||
@@ -180,7 +180,6 @@ class ExportToEve(wx.Frame):
|
|||||||
self.mainFrame = parent
|
self.mainFrame = parent
|
||||||
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
|
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
|
||||||
|
|
||||||
sEsi = Esi.getInstance()
|
|
||||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
|
||||||
@@ -232,7 +231,6 @@ class ExportToEve(wx.Frame):
|
|||||||
return self.charChoice.GetClientData(selection) if selection is not None else None
|
return self.charChoice.GetClientData(selection) if selection is not None else None
|
||||||
|
|
||||||
def exportFitting(self, event):
|
def exportFitting(self, event):
|
||||||
sPort = Port.getInstance()
|
|
||||||
fitID = self.mainFrame.getActiveFit()
|
fitID = self.mainFrame.getActiveFit()
|
||||||
|
|
||||||
self.statusbar.SetStatusText("", 0)
|
self.statusbar.SetStatusText("", 0)
|
||||||
@@ -242,12 +240,8 @@ class ExportToEve(wx.Frame):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.statusbar.SetStatusText("Sending request and awaiting response", 1)
|
self.statusbar.SetStatusText("Sending request and awaiting response", 1)
|
||||||
sEsi = Esi.getInstance()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sFit = Fit.getInstance()
|
|
||||||
data = sPort.exportESI(sFit.getFit(fitID))
|
|
||||||
res = sEsi.postFitting(self.getActiveCharacter(), data)
|
|
||||||
|
|
||||||
self.statusbar.SetStatusText("", 0)
|
self.statusbar.SetStatusText("", 0)
|
||||||
self.statusbar.SetStatusText("", 1)
|
self.statusbar.SetStatusText("", 1)
|
||||||
@@ -307,7 +301,7 @@ class SsoCharacterMgmt(wx.Dialog):
|
|||||||
|
|
||||||
def ssoLogin(self, event):
|
def ssoLogin(self, event):
|
||||||
if (self):
|
if (self):
|
||||||
#todo: these events don't unbind properly when window is closed (?), hence the `if`. Figure out better way of doing this.
|
# todo: these events don't unbind properly when window is closed (?), hence the `if`. Figure out better way of doing this.
|
||||||
self.popCharList()
|
self.popCharList()
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import wx
|
import wx
|
||||||
|
|
||||||
|
|
||||||
class SsoLogin(wx.Dialog):
|
class SsoLogin(wx.Dialog):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="SSO Login", size=wx.Size(400, 240))
|
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="SSO Login", size=wx.Size(400, 240))
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class UpdateDialog(wx.Dialog):
|
|||||||
releaseDate.strftime('%B %d, %Y'),
|
releaseDate.strftime('%B %d, %Y'),
|
||||||
"<p class='text-danger'><b>This is a pre-release, be prepared for unstable features</b></p>" if version.is_prerelease else "",
|
"<p class='text-danger'><b>This is a pre-release, be prepared for unstable features</b></p>" if version.is_prerelease else "",
|
||||||
markdowner.convert(self.releaseInfo['body'])
|
markdowner.convert(self.releaseInfo['body'])
|
||||||
),"")
|
), "")
|
||||||
|
|
||||||
notesSizer.Add(self.browser, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
|
notesSizer.Add(self.browser, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
|
||||||
mainSizer.Add(notesSizer, 1, wx.EXPAND, 5)
|
mainSizer.Add(notesSizer, 1, wx.EXPAND, 5)
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ class SkillBackupThread(threading.Thread):
|
|||||||
|
|
||||||
wx.CallAfter(self.callback)
|
wx.CallAfter(self.callback)
|
||||||
|
|
||||||
|
|
||||||
class Character(object):
|
class Character(object):
|
||||||
instance = None
|
instance = None
|
||||||
skillReqsDict = {}
|
skillReqsDict = {}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from service.server import StoppableHTTPServer, AuthHandler
|
|||||||
from service.settings import EsiSettings
|
from service.settings import EsiSettings
|
||||||
from service.esiAccess import EsiAccess
|
from service.esiAccess import EsiAccess
|
||||||
|
|
||||||
import wx
|
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
pyfalog = Logger(__name__)
|
pyfalog = Logger(__name__)
|
||||||
@@ -108,7 +107,8 @@ class Esi(EsiAccess):
|
|||||||
serverAddr = None
|
serverAddr = None
|
||||||
# always start the local server if user is using client details. Otherwise, start only if they choose to do so.
|
# always start the local server if user is using client details. Otherwise, start only if they choose to do so.
|
||||||
if self.settings.get('ssoMode') == SsoMode.CUSTOM or self.settings.get('loginMode') == LoginMethod.SERVER:
|
if self.settings.get('ssoMode') == SsoMode.CUSTOM or self.settings.get('loginMode') == LoginMethod.SERVER:
|
||||||
serverAddr = self.startServer(6461 if self.settings.get('ssoMode') == SsoMode.CUSTOM else 0) # random port, or if it's custom application, use a defined port
|
# random port, or if it's custom application, use a defined port
|
||||||
|
serverAddr = self.startServer(6461 if self.settings.get('ssoMode') == SsoMode.CUSTOM else 0)
|
||||||
uri = self.getLoginURI(serverAddr)
|
uri = self.getLoginURI(serverAddr)
|
||||||
webbrowser.open(uri)
|
webbrowser.open(uri)
|
||||||
wx.PostEvent(self.mainFrame, GE.SsoLoggingIn(sso_mode=self.settings.get('ssoMode'), login_mode=self.settings.get('loginMode')))
|
wx.PostEvent(self.mainFrame, GE.SsoLoggingIn(sso_mode=self.settings.get('ssoMode'), login_mode=self.settings.get('loginMode')))
|
||||||
@@ -181,4 +181,3 @@ class Esi(EsiAccess):
|
|||||||
pyfalog.debug("Handling SSO login with: {0}", message)
|
pyfalog.debug("Handling SSO login with: {0}", message)
|
||||||
|
|
||||||
self.handleLogin(message)
|
self.handleLogin(message)
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class EsiAccess(object):
|
|||||||
data = {
|
data = {
|
||||||
'grant_type': 'refresh_token',
|
'grant_type': 'refresh_token',
|
||||||
'refresh_token': refreshToken,
|
'refresh_token': refreshToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.settings.get('ssoMode') == SsoMode.AUTO:
|
if self.settings.get('ssoMode') == SsoMode.AUTO:
|
||||||
# data is all we really need, the rest is handled automatically by pyfa.io
|
# data is all we really need, the rest is handled automatically by pyfa.io
|
||||||
@@ -281,4 +281,3 @@ class EsiAccess(object):
|
|||||||
self._before_request(ssoChar)
|
self._before_request(ssoChar)
|
||||||
endpoint = endpoint.format(**kwargs)
|
endpoint = endpoint.format(**kwargs)
|
||||||
return self._after_request(self._session.delete("{}{}".format(self.esi_url, endpoint)))
|
return self._after_request(self._session.delete("{}{}".format(self.esi_url, endpoint)))
|
||||||
|
|
||||||
|
|||||||
@@ -1209,11 +1209,9 @@ class Fit(object):
|
|||||||
start_time = time()
|
start_time = time()
|
||||||
pyfalog.info("=" * 10 + "recalc: {0}" + "=" * 10, fit.name)
|
pyfalog.info("=" * 10 + "recalc: {0}" + "=" * 10, fit.name)
|
||||||
|
|
||||||
|
|
||||||
fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"]
|
fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"]
|
||||||
fit.clear()
|
fit.clear()
|
||||||
|
|
||||||
fit.calculateModifiedAttributes()
|
fit.calculateModifiedAttributes()
|
||||||
|
|
||||||
pyfalog.info("=" * 10 + "recalc time: " + str(time() - start_time) + "=" * 10)
|
pyfalog.info("=" * 10 + "recalc time: " + str(time() - start_time) + "=" * 10)
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,18 @@
|
|||||||
import config
|
import config
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
|
||||||
class Jargon(object):
|
class Jargon(object):
|
||||||
def __init__(self, rawdata: dict):
|
def __init__(self, rawdata: dict):
|
||||||
self._rawdata = rawdata
|
self._rawdata = rawdata
|
||||||
|
|
||||||
# copy the data to lowercase keys, ignore blank keys
|
# copy the data to lowercase keys, ignore blank keys
|
||||||
self._data = {str(k).lower():v for k,v in rawdata.items() if k}
|
self._data = {str(k).lower(): v for k, v in rawdata.items() if k}
|
||||||
|
|
||||||
def get(self, term: str) -> str:
|
def get(self, term: str) -> str:
|
||||||
return self._data.get(term.lower())
|
return self._data.get(term.lower())
|
||||||
|
|
||||||
def get_rawdata() -> dict:
|
def get_rawdata(self) -> dict:
|
||||||
return self._rawdata
|
return self._rawdata
|
||||||
|
|
||||||
def apply(self, query):
|
def apply(self, query):
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ from .resources import DEFAULT_DATA, DEFAULT_HEADER
|
|||||||
|
|
||||||
JARGON_PATH = os.path.join(config.savePath, 'jargon.yaml')
|
JARGON_PATH = os.path.join(config.savePath, 'jargon.yaml')
|
||||||
|
|
||||||
|
|
||||||
class JargonLoader(object):
|
class JargonLoader(object):
|
||||||
def __init__(self, jargon_path: str):
|
def __init__(self, jargon_path: str):
|
||||||
self.jargon_path = jargon_path
|
self.jargon_path = jargon_path
|
||||||
self._jargon_mtime = 0 # type: int
|
self._jargon_mtime = 0 # type: int
|
||||||
self._jargon = None # type: Jargon
|
self._jargon = None # type: Jargon
|
||||||
|
|
||||||
def get_jargon(self) -> Jargon:
|
def get_jargon(self) -> Jargon:
|
||||||
if self._is_stale():
|
if self._is_stale():
|
||||||
@@ -58,7 +59,7 @@ class JargonLoader(object):
|
|||||||
def init_user_jargon(jargon_path):
|
def init_user_jargon(jargon_path):
|
||||||
values = yaml.load(DEFAULT_DATA)
|
values = yaml.load(DEFAULT_DATA)
|
||||||
|
|
||||||
## Disabled for issue/1533; do not overwrite existing user config
|
# Disabled for issue/1533; do not overwrite existing user config
|
||||||
# if os.path.exists(jargon_path):
|
# if os.path.exists(jargon_path):
|
||||||
# with open(jargon_path) as f:
|
# with open(jargon_path) as f:
|
||||||
# custom_values = yaml.load(f)
|
# custom_values = yaml.load(f)
|
||||||
@@ -72,6 +73,7 @@ class JargonLoader(object):
|
|||||||
yaml.dump(values, stream=f, default_flow_style=False)
|
yaml.dump(values, stream=f, default_flow_style=False)
|
||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def instance(jargon_path=None):
|
def instance(jargon_path=None):
|
||||||
if not JargonLoader._instance:
|
if not JargonLoader._instance:
|
||||||
@@ -79,4 +81,5 @@ class JargonLoader(object):
|
|||||||
JargonLoader._instance = JargonLoader(jargon_path)
|
JargonLoader._instance = JargonLoader(jargon_path)
|
||||||
return JargonLoader._instance
|
return JargonLoader._instance
|
||||||
|
|
||||||
|
|
||||||
JargonLoader.init_user_jargon(JARGON_PATH)
|
JargonLoader.init_user_jargon(JARGON_PATH)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ pyfalog = Logger(__name__)
|
|||||||
# Event which tells threads dependent on Market that it's initialized
|
# Event which tells threads dependent on Market that it's initialized
|
||||||
mktRdy = threading.Event()
|
mktRdy = threading.Event()
|
||||||
|
|
||||||
|
|
||||||
class ShipBrowserWorkerThread(threading.Thread):
|
class ShipBrowserWorkerThread(threading.Thread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
@@ -113,10 +114,8 @@ class SearchWorkerThread(threading.Thread):
|
|||||||
else:
|
else:
|
||||||
filter_ = None
|
filter_ = None
|
||||||
|
|
||||||
|
|
||||||
jargon_request = self.jargonLoader.get_jargon().apply(request)
|
jargon_request = self.jargonLoader.get_jargon().apply(request)
|
||||||
|
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
if len(request) >= config.minItemSearchLength:
|
if len(request) >= config.minItemSearchLength:
|
||||||
results = eos.db.searchItems(request, where=filter_,
|
results = eos.db.searchItems(request, where=filter_,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class EveMarketData(object):
|
|||||||
def __init__(self, types, system, priceMap):
|
def __init__(self, types, system, priceMap):
|
||||||
data = {}
|
data = {}
|
||||||
baseurl = "https://eve-marketdata.com/api/item_prices.xml"
|
baseurl = "https://eve-marketdata.com/api/item_prices.xml"
|
||||||
data["system_id"] = system # Use Jita for market
|
data["system_id"] = system # Use Jita for market
|
||||||
data["type_ids"] = ','.join(str(x) for x in types)
|
data["type_ids"] = ','.join(str(x) for x in types)
|
||||||
|
|
||||||
network = Network.getInstance()
|
network = Network.getInstance()
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ from collections import OrderedDict
|
|||||||
class ESIExportException(Exception):
|
class ESIExportException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
pyfalog = Logger(__name__)
|
pyfalog = Logger(__name__)
|
||||||
|
|
||||||
EFT_SLOT_ORDER = [Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE]
|
EFT_SLOT_ORDER = [Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE]
|
||||||
@@ -349,7 +350,6 @@ class Port(object):
|
|||||||
|
|
||||||
nested_dict = lambda: collections.defaultdict(nested_dict)
|
nested_dict = lambda: collections.defaultdict(nested_dict)
|
||||||
fit = nested_dict()
|
fit = nested_dict()
|
||||||
sEsi = Esi.getInstance()
|
|
||||||
sFit = svcFit.getInstance()
|
sFit = svcFit.getInstance()
|
||||||
|
|
||||||
# max length is 50 characters
|
# max length is 50 characters
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ class CheckUpdateThread(threading.Thread):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
response = network.request('https://www.pyfa.io/update_check?pyfa_version={}&client_hash={}'.format(config.version, config.getClientSecret()), network.UPDATE)
|
response = network.request('https://www.pyfa.io/update_check?pyfa_version={}&client_hash={}'.format(
|
||||||
|
config.version, config.getClientSecret()), network.UPDATE)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
response = network.request('https://api.github.com/repos/pyfa-org/Pyfa/releases', network.UPDATE)
|
response = network.request('https://api.github.com/repos/pyfa-org/Pyfa/releases', network.UPDATE)
|
||||||
|
|
||||||
|
|||||||
2
tox.ini
2
tox.ini
@@ -7,7 +7,7 @@ passenv = CI TRAVIS TRAVIS_*
|
|||||||
deps =
|
deps =
|
||||||
-rrequirements.txt
|
-rrequirements.txt
|
||||||
-rrequirements_test.txt
|
-rrequirements_test.txt
|
||||||
basepython = python2.7
|
basepython = python3.6
|
||||||
commands = py.test -vv --cov Pyfa tests2/
|
commands = py.test -vv --cov Pyfa tests2/
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
|
|||||||
Reference in New Issue
Block a user