Merge branch 'master' of https://github.com/pyfa-org/Pyfa into origin_master
This commit is contained in:
@@ -27,7 +27,8 @@ from logbook import Logger
|
||||
|
||||
import config
|
||||
|
||||
logging = Logger(__name__)
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class BitmapLoader(object):
|
||||
@@ -38,7 +39,7 @@ class BitmapLoader(object):
|
||||
# logging.info("Using local image files.")
|
||||
# archive = None
|
||||
|
||||
logging.info("Using local image files.")
|
||||
pyfalog.info("Using local image files.")
|
||||
archive = None
|
||||
|
||||
cached_bitmaps = OrderedDict()
|
||||
@@ -93,7 +94,7 @@ class BitmapLoader(object):
|
||||
filename, img = cls.loadScaledBitmap(name, location, scale)
|
||||
|
||||
if img is None:
|
||||
print(("Missing icon file: {0}/{1}".format(location, filename)))
|
||||
pyfalog.warning("Missing icon file: {0}/{1}".format(location, filename))
|
||||
return None
|
||||
|
||||
bmp: wx.Bitmap = img.ConvertToBitmap()
|
||||
@@ -130,7 +131,7 @@ class BitmapLoader(object):
|
||||
sbuf = io.StringIO(img_data)
|
||||
return wx.ImageFromStream(sbuf)
|
||||
except KeyError:
|
||||
print(("Missing icon file from zip: {0}".format(path)))
|
||||
pyfalog.warning("Missing icon file from zip: {0}".format(path))
|
||||
else:
|
||||
path = os.path.join(config.pyfaPath, 'imgs' + os.sep + location + os.sep + filename)
|
||||
|
||||
|
||||
@@ -108,10 +108,10 @@ class BoosterView(d.Display):
|
||||
event.Skip()
|
||||
return
|
||||
|
||||
self.origional = fit.boosters if fit is not None else None
|
||||
self.boosters = stuff = fit.boosters[:] if fit is not None else None
|
||||
if stuff is not None:
|
||||
stuff.sort(key=lambda booster: booster.slot or 0)
|
||||
self.original = fit.boosters if fit is not None else None
|
||||
self.boosters = fit.boosters[:] if fit is not None else None
|
||||
if self.boosters is not None:
|
||||
self.boosters.sort(key=lambda booster: booster.slot or 0)
|
||||
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
@@ -124,8 +124,8 @@ class BoosterView(d.Display):
|
||||
|
||||
self.deselectItems()
|
||||
|
||||
self.populate(stuff)
|
||||
self.refresh(stuff)
|
||||
self.populate(self.boosters)
|
||||
self.refresh(self.boosters)
|
||||
event.Skip()
|
||||
|
||||
def addItem(self, event):
|
||||
@@ -152,7 +152,7 @@ class BoosterView(d.Display):
|
||||
|
||||
def removeBooster(self, booster):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand(fitID, self.origional.index(booster)))
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand(fitID, self.original.index(booster)))
|
||||
|
||||
def click(self, event):
|
||||
event.Skip()
|
||||
@@ -172,8 +172,7 @@ class BoosterView(d.Display):
|
||||
sel = self.GetFirstSelected()
|
||||
if sel != -1:
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.mainFrame.getActiveFit())
|
||||
item = fit.boosters[sel]
|
||||
item = self.boosters[sel]
|
||||
|
||||
srcContext = "boosterItem"
|
||||
itemContext = "Booster"
|
||||
|
||||
@@ -162,8 +162,7 @@ class DroneView(Display):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
DRONE_ORDER = ('Light Scout Drones', 'Medium Scout Drones',
|
||||
'Heavy Attack Drones', 'Sentry Drones', 'Fighters',
|
||||
'Fighter Bombers', 'Combat Utility Drones',
|
||||
'Heavy Attack Drones', 'Sentry Drones', 'Combat Utility Drones',
|
||||
'Electronic Warfare Drones', 'Logistic Drones', 'Mining Drones', 'Salvage Drones')
|
||||
|
||||
def droneKey(self, drone):
|
||||
|
||||
@@ -220,20 +220,12 @@ class FighterDisplay(d.Display):
|
||||
def _merge(src, dst):
|
||||
return
|
||||
|
||||
'''
|
||||
DRONE_ORDER = ('Light Scout Drones', 'Medium Scout Drones',
|
||||
'Heavy Attack Drones', 'Sentry Drones', 'Fighters',
|
||||
'Fighter Bombers', 'Combat Utility Drones',
|
||||
'Electronic Warfare Drones', 'Logistic Drones', 'Mining Drones', 'Salvage Drones',
|
||||
'Light Fighters', 'Heavy Fighters', 'Support Fighters')
|
||||
def droneKey(self, drone):
|
||||
sMkt = Market.getInstance()
|
||||
FIGHTER_ORDER = ('Heavy Fighter', 'Light Fighter', 'Support Fighter')
|
||||
|
||||
groupName = sMkt.getMarketGroupByItem(drone.item).name
|
||||
print groupName
|
||||
return (self.DRONE_ORDER.index(groupName),
|
||||
drone.item.name)
|
||||
'''
|
||||
def fighterKey(self, fighter):
|
||||
sMkt = Market.getInstance()
|
||||
groupName = sMkt.getGroupByItem(fighter.item).name
|
||||
return (self.FIGHTER_ORDER.index(groupName), fighter.item.name)
|
||||
|
||||
def fitChanged(self, event):
|
||||
sFit = Fit.getInstance()
|
||||
@@ -249,12 +241,10 @@ class FighterDisplay(d.Display):
|
||||
return
|
||||
|
||||
self.original = fit.fighters if fit is not None else None
|
||||
self.fighters = stuff = fit.fighters[:] if fit is not None else None
|
||||
self.fighters = fit.fighters[:] if fit is not None else None
|
||||
|
||||
'''
|
||||
if stuff is not None:
|
||||
stuff.sort(key=self.droneKey)
|
||||
'''
|
||||
if self.fighters is not None:
|
||||
self.fighters.sort(key=self.fighterKey)
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
@@ -266,7 +256,7 @@ class FighterDisplay(d.Display):
|
||||
|
||||
self.deselectItems()
|
||||
|
||||
self.update(stuff)
|
||||
self.update(self.fighters)
|
||||
event.Skip()
|
||||
|
||||
def addItem(self, event):
|
||||
|
||||
@@ -21,8 +21,6 @@ class ItemEffects(wx.Panel):
|
||||
self.SetSizer(mainSizer)
|
||||
|
||||
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnClick, self.effectList)
|
||||
if config.debug:
|
||||
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick, self.effectList)
|
||||
|
||||
self.PopulateList()
|
||||
|
||||
@@ -100,26 +98,6 @@ class ItemEffects(wx.Panel):
|
||||
|
||||
self.RefreshValues(event)
|
||||
|
||||
def OnRightClick(self, event):
|
||||
"""
|
||||
Debug use: open effect file with default application.
|
||||
If effect file does not exist, create it
|
||||
"""
|
||||
|
||||
effect = self.effects[event.GetText()]
|
||||
|
||||
file_ = os.path.join(config.pyfaPath, "eos", "effects", "%s.py" % effect.handlerName)
|
||||
|
||||
if not os.path.isfile(file_):
|
||||
open(file_, 'a').close()
|
||||
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
os.startfile(file_)
|
||||
elif 'wxMac' in wx.PlatformInfo:
|
||||
os.system("open " + file_)
|
||||
else:
|
||||
subprocess.call(["xdg-open", file_])
|
||||
|
||||
def RefreshValues(self, event):
|
||||
self.Freeze()
|
||||
self.effectList.ClearAll()
|
||||
|
||||
@@ -202,7 +202,7 @@ class ItemView(Display):
|
||||
mktgrpid = sMkt.getMarketGroupByItem(item).ID
|
||||
except AttributeError:
|
||||
mktgrpid = -1
|
||||
print(("unable to find market group for", item.name))
|
||||
pyfalog.warning("unable to find market group for {}".format(item.name))
|
||||
parentname = sMkt.getParentItemByItem(item).name
|
||||
# Get position of market group
|
||||
metagrpid = sMkt.getMetaGroupIdByItem(item)
|
||||
|
||||
@@ -82,7 +82,7 @@ class FitSpawner(gui.multiSwitch.TabSpawner):
|
||||
|
||||
if not isinstance(view, FittingView):
|
||||
view = FittingView(self.multiSwitch)
|
||||
print("###################### Created new view:" + repr(view))
|
||||
pyfalog.debug("###################### Created new view:" + repr(view))
|
||||
self.multiSwitch.ReplaceActivePage(view)
|
||||
|
||||
view.fitSelected(event)
|
||||
@@ -174,8 +174,8 @@ class FittingView(d.Display):
|
||||
self.Bind(wx.EVT_MOTION, self.OnMouseMove)
|
||||
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
|
||||
self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged)
|
||||
print("------------------ new fitting view -------------------")
|
||||
print(self)
|
||||
pyfalog.debug("------------------ new fitting view -------------------")
|
||||
pyfalog.debug(self)
|
||||
|
||||
def OnLeaveWindow(self, event):
|
||||
self.SetToolTip(None)
|
||||
@@ -224,16 +224,7 @@ class FittingView(d.Display):
|
||||
wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID))
|
||||
|
||||
def Destroy(self):
|
||||
# @todo: when wxPython 4.0.2 is release, https://github.com/pyfa-org/Pyfa/issues/1586#issuecomment-390074915
|
||||
# Make sure to remove the shitty checks that I have to put in place for these handlers to ignore when self is None
|
||||
print("+++++ Destroy " + repr(self))
|
||||
|
||||
# print(self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED))
|
||||
# print(self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.fitChanged))
|
||||
# print(self.mainFrame.Unbind(EVT_FIT_RENAMED, handler=self.fitRenamed ))
|
||||
# print(self.mainFrame.Unbind(EVT_FIT_REMOVED, handler=self.fitRemoved))
|
||||
# print(self.mainFrame.Unbind(ITEM_SELECTED, handler=self.appendItem))
|
||||
|
||||
pyfalog.debug("+++++ Destroy " + repr(self))
|
||||
d.Display.Destroy(self)
|
||||
|
||||
def pageChanged(self, event):
|
||||
@@ -296,7 +287,6 @@ class FittingView(d.Display):
|
||||
delete fit caused change in stats (projected)
|
||||
todo: move this to the notebook, not the page. We don't want the page being responsible for deleting itself
|
||||
"""
|
||||
print('_+_+_+_+_+_ Fit Removed: {} {} activeFitID: {}, eventFitID: {}'.format(repr(self), str(bool(self)), self.activeFitID, event.fitID))
|
||||
pyfalog.debug("FittingView::fitRemoved")
|
||||
if not self:
|
||||
event.Skip()
|
||||
@@ -331,7 +321,7 @@ class FittingView(d.Display):
|
||||
event.Skip()
|
||||
|
||||
def fitSelected(self, event):
|
||||
print('====== Fit Selected: ' + repr(self) + str(bool(self)))
|
||||
pyfalog.debug('====== Fit Selected: ' + repr(self) + str(bool(self)))
|
||||
|
||||
if self.parent.IsActive(self):
|
||||
fitID = event.fitID
|
||||
|
||||
@@ -93,8 +93,8 @@ 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: Recommended minimum matplotlib version is 1.0.0")
|
||||
pyfalog.warning("pyfa: Found matplotlib version {} - activating OVER9000 workarounds".format(mpl.__version__))
|
||||
pyfalog.warning("pyfa: Recommended minimum matplotlib version is 1.0.0")
|
||||
self.legendFix = True
|
||||
|
||||
mplImported = True
|
||||
|
||||
@@ -73,17 +73,18 @@ from service.settings import HTMLExportSettings, SettingsProvider
|
||||
from service.update import Update
|
||||
import gui.fitCommands as cmd
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
disableOverrideEditor = False
|
||||
|
||||
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))
|
||||
pyfalog.warning("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message)
|
||||
disableOverrideEditor = True
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
pyfalog.debug("Done loading mainframe imports")
|
||||
|
||||
|
||||
@@ -421,7 +422,7 @@ class MainFrame(wx.Frame):
|
||||
if '.' not in os.path.basename(path):
|
||||
path += ".xml"
|
||||
else:
|
||||
print(("oops, invalid fit format %d" % format_))
|
||||
pyfalog.warning("oops, invalid fit format %d" % format_)
|
||||
try:
|
||||
dlg.Destroy()
|
||||
except RuntimeError:
|
||||
|
||||
@@ -68,7 +68,7 @@ class exportHtmlThread(threading.Thread):
|
||||
FILE.write(HTML)
|
||||
FILE.close()
|
||||
except IOError as ex:
|
||||
print(("Failed to write to " + settings.getPath()))
|
||||
pyfalog.warning("Failed to write to " + settings.getPath())
|
||||
pass
|
||||
except Exception as ex:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user