Merge branch 'development' into LogBook_v2
Conflicts: config.py eos/saveddata/fit.py gui/bitmapLoader.py gui/graphFrame.py gui/utils/exportHtml.py pyfa.py service/crest.py service/price.py service/server.py
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
import cStringIO
|
||||
import os.path
|
||||
import zipfile
|
||||
from config import parsePath
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
@@ -38,7 +37,7 @@ except ImportError:
|
||||
|
||||
class BitmapLoader(object):
|
||||
try:
|
||||
archive = zipfile.ZipFile(config.getPyfaPath('imgs.zip'), 'r')
|
||||
archive = zipfile.ZipFile(os.path.join(config.pyfaPath, 'imgs.zip', 'r'))
|
||||
logging.info("Using zipped image files.")
|
||||
except IOError:
|
||||
logging.info("Using local image files.")
|
||||
@@ -83,7 +82,7 @@ class BitmapLoader(object):
|
||||
filename = "{0}.png".format(name)
|
||||
|
||||
if cls.archive:
|
||||
path = parsePath(location, filename)
|
||||
path = os.path.join(location, filename)
|
||||
if os.sep != "/" and os.sep in path:
|
||||
path = path.replace(os.sep, "/")
|
||||
|
||||
@@ -94,7 +93,7 @@ class BitmapLoader(object):
|
||||
except KeyError:
|
||||
print("Missing icon file from zip: {0}".format(path))
|
||||
else:
|
||||
path = config.getPyfaPath('imgs' + os.sep + location + os.sep + filename)
|
||||
path = os.path.join(config.pyfaPath, 'imgs' + os.sep + location + os.sep + filename)
|
||||
|
||||
if os.path.exists(path):
|
||||
return wx.Image(path)
|
||||
|
||||
@@ -52,6 +52,7 @@ class AmountChanger(wx.Dialog):
|
||||
def change(self, event):
|
||||
if self.input.GetLineText(0).strip() == '':
|
||||
event.Skip()
|
||||
self.Close()
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
@@ -68,6 +69,7 @@ class AmountChanger(wx.Dialog):
|
||||
wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
event.Skip()
|
||||
self.Close()
|
||||
|
||||
# checks to make sure it's valid number
|
||||
@staticmethod
|
||||
|
||||
@@ -197,7 +197,6 @@ class PFGeneralPref(PreferenceView):
|
||||
|
||||
def onPriceSelection(self, event):
|
||||
system = self.chPriceSystem.GetString(self.chPriceSystem.GetSelection())
|
||||
Price.currentSystemId = Price.systemsList.get(system)
|
||||
self.sFit.serviceFittingOptions["priceSystem"] = system
|
||||
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
@@ -180,27 +180,27 @@ class ContextMenu(object):
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||
ammoPattern,
|
||||
amount,
|
||||
cargo,
|
||||
changeAffectingSkills,
|
||||
damagePattern,
|
||||
droneRemoveStack,
|
||||
droneSplit,
|
||||
factorReload,
|
||||
fighterAbilities,
|
||||
implantSets,
|
||||
itemRemove,
|
||||
itemStats,
|
||||
marketJump,
|
||||
metaSwap,
|
||||
moduleAmmoPicker,
|
||||
moduleGlobalAmmoPicker,
|
||||
openFit,
|
||||
priceClear,
|
||||
# moduleGlobalAmmoPicker,
|
||||
moduleAmmoPicker,
|
||||
itemStats,
|
||||
damagePattern,
|
||||
marketJump,
|
||||
droneSplit,
|
||||
itemRemove,
|
||||
droneRemoveStack,
|
||||
ammoPattern,
|
||||
project,
|
||||
factorReload,
|
||||
whProjector,
|
||||
cargo,
|
||||
shipJump,
|
||||
changeAffectingSkills,
|
||||
tacticalMode,
|
||||
targetResists,
|
||||
whProjector
|
||||
priceClear,
|
||||
amount,
|
||||
metaSwap,
|
||||
implantSets,
|
||||
fighterAbilities,
|
||||
)
|
||||
|
||||
@@ -147,6 +147,7 @@ class DroneView(Display):
|
||||
def _merge(self, src, dst):
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
if sFit.mergeDrones(fitID, self.drones[src], self.drones[dst]):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
|
||||
91
gui/errorDialog.py
Normal file
91
gui/errorDialog.py
Normal file
@@ -0,0 +1,91 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
import sys
|
||||
import gui.utils.fonts as fonts
|
||||
import config
|
||||
|
||||
class ErrorFrame(wx.Frame):
|
||||
|
||||
def __init__(self, exception, tb):
|
||||
wx.Frame.__init__(self, None, id=wx.ID_ANY, title="pyfa error", pos=wx.DefaultPosition, size=wx.Size(500, 400), style=wx.DEFAULT_FRAME_STYLE^ wx.RESIZE_BORDER|wx.STAY_ON_TOP)
|
||||
|
||||
desc = "pyfa has experienced an unexpected error. Below is the " \
|
||||
"Traceback that contains crucial information about how this " \
|
||||
"error was triggered. Please contact the developers with " \
|
||||
"the information provided through the EVE Online forums " \
|
||||
"or file a GitHub issue."
|
||||
|
||||
self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
|
||||
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
|
||||
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
headSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.headingText = wx.StaticText(self, wx.ID_ANY, "Error!", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE)
|
||||
self.headingText.SetFont(wx.Font(14, 74, 90, 92, False))
|
||||
|
||||
headSizer.Add(self.headingText, 1, wx.ALL, 5)
|
||||
mainSizer.Add(headSizer, 0, wx.EXPAND, 5)
|
||||
|
||||
mainSizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND | wx.ALL, 5)
|
||||
|
||||
descSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.descText = wx.TextCtrl(self, wx.ID_ANY, desc, wx.DefaultPosition, wx.DefaultSize, wx.TE_AUTO_URL|wx.TE_MULTILINE|wx.TE_READONLY|wx.BORDER_NONE|wx.TRANSPARENT_WINDOW )
|
||||
self.descText.SetFont(wx.Font(fonts.BIG, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
descSizer.Add(self.descText, 1, wx.ALL, 5)
|
||||
mainSizer.Add(descSizer, 1, wx.EXPAND, 5)
|
||||
|
||||
self.eveForums = wx.HyperlinkCtrl(self, wx.ID_ANY, "EVE Forums Thread", "https://forums.eveonline.com/default.aspx?g=posts&t=466425",
|
||||
wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE)
|
||||
|
||||
mainSizer.Add(self.eveForums, 0, wx.ALL, 2)
|
||||
|
||||
self.eveForums = wx.HyperlinkCtrl(self, wx.ID_ANY, "Github Issues", "https://github.com/pyfa-org/Pyfa/issues",
|
||||
wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE)
|
||||
|
||||
mainSizer.Add(self.eveForums, 0, wx.ALL, 2)
|
||||
|
||||
#mainSizer.AddSpacer((0, 5), 0, wx.EXPAND, 5)
|
||||
|
||||
self.errorTextCtrl = wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_DONTWRAP)
|
||||
self.errorTextCtrl.SetFont(wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.NORMAL, wx.NORMAL))
|
||||
mainSizer.Add(self.errorTextCtrl, 0, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
|
||||
|
||||
self.errorTextCtrl.AppendText("pyfa root: ")
|
||||
self.errorTextCtrl.AppendText(config.pyfaPath or "Unknown")
|
||||
self.errorTextCtrl.AppendText('\n')
|
||||
self.errorTextCtrl.AppendText("save path: ")
|
||||
self.errorTextCtrl.AppendText(config.savePath or "Unknown")
|
||||
self.errorTextCtrl.AppendText('\n')
|
||||
self.errorTextCtrl.AppendText("fs encoding: ")
|
||||
self.errorTextCtrl.AppendText(sys.getfilesystemencoding())
|
||||
self.errorTextCtrl.AppendText('\n\n')
|
||||
self.errorTextCtrl.AppendText(tb)
|
||||
|
||||
self.SetSizer(mainSizer)
|
||||
mainSizer.Layout()
|
||||
self.Layout()
|
||||
|
||||
self.Centre(wx.BOTH)
|
||||
|
||||
self.Show()
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
import os
|
||||
from logbook import Logger
|
||||
import imp
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
@@ -30,10 +29,37 @@ import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from gui.graph import Graph
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from config import parsePath
|
||||
|
||||
# Don't actually import the thing, since it takes for fucking ever
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
try:
|
||||
import matplotlib as mpl
|
||||
|
||||
mpl_version = int(mpl.__version__[0])
|
||||
if mpl_version >= 2:
|
||||
mpl.use('wxagg')
|
||||
mplImported = True
|
||||
else:
|
||||
mplImported = False
|
||||
from matplotlib.patches import Patch
|
||||
|
||||
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
|
||||
from matplotlib.figure import Figure
|
||||
|
||||
graphFrame_enabled = True
|
||||
mplImported = True
|
||||
except ImportError:
|
||||
Patch = mpl = Canvas = Figure = None
|
||||
graphFrame_enabled = False
|
||||
mplImported = False
|
||||
|
||||
class GraphFrame(wx.Frame):
|
||||
def __init__(self, parent, style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE | wx.FRAME_FLOAT_ON_PARENT):
|
||||
|
||||
global graphFrame_enabled
|
||||
global mplImported
|
||||
|
||||
self.mpl_version = int(mpl.__version__[0])
|
||||
imp.find_module('matplotlib')
|
||||
graphFrame_enabled = True
|
||||
mplImported = True
|
||||
@@ -81,7 +107,7 @@ class GraphFrame(wx.Frame):
|
||||
except:
|
||||
cache_dir = os.path.expanduser(os.path.join("~", ".matplotlib"))
|
||||
|
||||
cache_file = parsePath(cache_dir, 'fontList.cache')
|
||||
cache_file = path = os.path.join(cache_dir, 'fontList.cache')
|
||||
|
||||
if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file):
|
||||
# remove matplotlib font cache, see #234
|
||||
@@ -283,7 +309,7 @@ class GraphFrame(wx.Frame):
|
||||
selected_color = legend_colors[i]
|
||||
except:
|
||||
selected_color = None
|
||||
legend2.append(self.Patch(color=selected_color, label=i_name), )
|
||||
legend2.append(Patch(color=selected_color, label=i_name), )
|
||||
|
||||
if len(legend2) > 0:
|
||||
leg = self.subplot.legend(handles=legend2)
|
||||
|
||||
@@ -849,7 +849,7 @@ class ItemEffects(wx.Panel):
|
||||
If effect file does not exist, create it
|
||||
"""
|
||||
|
||||
file_ = config.getPyfaPath(os.path.join("eos", "effects", "%s.py" % event.GetText().lower()))
|
||||
file_ = os.path.join(config.pyfaPath, "eos", "effects", "%s.py" % event.GetText().lower())
|
||||
|
||||
if not os.path.isfile(file_):
|
||||
open(file_, 'a').close()
|
||||
|
||||
@@ -85,14 +85,14 @@ if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION
|
||||
from service.crest import CrestModes
|
||||
from gui.crestFittings import CrestFittings, ExportToEve, CrestMgmt
|
||||
|
||||
try:
|
||||
from gui.propertyEditor import AttributeEditor
|
||||
disableOverrideEditor = False
|
||||
|
||||
disableOverrideEditor = False
|
||||
except ImportError as e:
|
||||
AttributeEditor = None
|
||||
print("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message)
|
||||
disableOverrideEditor = True
|
||||
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)
|
||||
disableOverrideEditor = True
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
@@ -356,7 +356,9 @@ class NavigationPanel(SFItem.SFBrowserItem):
|
||||
self.btnSwitch = self.toolbar.AddButton(self.switchBmpD, "Hide empty ship groups",
|
||||
clickCallback=self.ToggleEmptyGroupsView, hoverBitmap=self.switchBmpH,
|
||||
show=False)
|
||||
self.toolbar.AddButton(self.searchBmp, "Search fittings", clickCallback=self.ToggleSearchBox,
|
||||
|
||||
modifier = "CTRL" if 'wxMac' not in wx.PlatformInfo else "CMD"
|
||||
self.toolbar.AddButton(self.searchBmp, "Search fittings ({}+F)".format(modifier), clickCallback=self.ToggleSearchBox,
|
||||
hoverBitmap=self.searchBmpH)
|
||||
|
||||
self.padding = 4
|
||||
@@ -693,7 +695,8 @@ class ShipBrowser(wx.Panel):
|
||||
# set map & cache of fittings per category
|
||||
for cat in self.categoryList:
|
||||
itemIDs = [x.ID for x in cat.items]
|
||||
self.categoryFitCache[cat.ID] = sFit.countFitsWithShip(itemIDs) > 1
|
||||
num = sFit.countFitsWithShip(itemIDs)
|
||||
self.categoryFitCache[cat.ID] = num > 0
|
||||
|
||||
for ship in self.categoryList:
|
||||
if self.filterShipsWithNoFits and not self.categoryFitCache[ship.ID]:
|
||||
@@ -939,7 +942,7 @@ class ShipBrowser(wx.Panel):
|
||||
|
||||
if fits:
|
||||
for fit in fits:
|
||||
shipTrait = fit.ship.traits.traitText if (fit.ship.traits is not None) else ""
|
||||
shipTrait = fit.ship.item.traits.traitText if (fit.ship.item.traits is not None) else ""
|
||||
# empty string if no traits
|
||||
|
||||
self.lpane.AddWidget(FitItem(
|
||||
|
||||
@@ -4,10 +4,12 @@ import time
|
||||
import wx
|
||||
from service.settings import HTMLExportSettings
|
||||
from service.fit import Fit
|
||||
from service.port import Port
|
||||
from service.market import Market
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
from eos.db import getFit
|
||||
|
||||
|
||||
class exportHtml(object):
|
||||
@@ -187,6 +189,7 @@ class exportHtmlThread(threading.Thread):
|
||||
groupFits = 0
|
||||
for ship in ships:
|
||||
fits = sFit.getFitsWithShip(ship.ID)
|
||||
|
||||
if len(fits) > 0:
|
||||
groupFits += len(fits)
|
||||
|
||||
@@ -195,7 +198,7 @@ class exportHtmlThread(threading.Thread):
|
||||
return
|
||||
fit = fits[0]
|
||||
try:
|
||||
dnaFit = sFit.exportDna(fit[0])
|
||||
dnaFit = Port.exportDna(getFit(fit[0]))
|
||||
HTMLgroup += ' <li><a data-dna="' + dnaFit + '" target="_blank">' + ship.name + ": " + \
|
||||
fit[1] + '</a></li>\n'
|
||||
except:
|
||||
@@ -218,7 +221,8 @@ class exportHtmlThread(threading.Thread):
|
||||
if self.stopRunning:
|
||||
return
|
||||
try:
|
||||
dnaFit = sFit.exportDna(fit[0])
|
||||
dnaFit = Port.exportDna(getFit(fit[0]))
|
||||
print dnaFit
|
||||
HTMLship += ' <li><a data-dna="' + dnaFit + '" target="_blank">' + fit[
|
||||
1] + '</a></li>\n'
|
||||
except:
|
||||
@@ -271,7 +275,7 @@ class exportHtmlThread(threading.Thread):
|
||||
if self.stopRunning:
|
||||
return
|
||||
try:
|
||||
dnaFit = sFit.exportDna(fit[0])
|
||||
dnaFit = Port.exportDna(getFit(fit[0]))
|
||||
HTML += '<a class="outOfGameBrowserLink" target="_blank" href="' + dnaUrl + dnaFit + '">' + ship.name + ': ' + \
|
||||
fit[1] + '</a><br> \n'
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user