Eliminate export calling fit.py (no need)
Except for 1 (clipboardXML), same number of lines of code in mainFrame, lots of code gone from fit, and no more complicated. Also spotted an import reference that got missed.
This commit is contained in:
@@ -68,6 +68,9 @@ from service.update import Update
|
|||||||
# import this to access override setting
|
# import this to access override setting
|
||||||
from eos.modifiedAttributeDict import ModifiedAttributeDict
|
from eos.modifiedAttributeDict import ModifiedAttributeDict
|
||||||
from eos.db.saveddata.loadDefaultDatabaseValues import DefaultDatabaseValues
|
from eos.db.saveddata.loadDefaultDatabaseValues import DefaultDatabaseValues
|
||||||
|
from eos import db
|
||||||
|
from service.port import Port
|
||||||
|
from service.settings import HTMLExportSettings
|
||||||
|
|
||||||
from time import gmtime, strftime
|
from time import gmtime, strftime
|
||||||
|
|
||||||
@@ -665,28 +668,29 @@ class MainFrame(wx.Frame):
|
|||||||
self.marketBrowser.search.Focus()
|
self.marketBrowser.search.Focus()
|
||||||
|
|
||||||
def clipboardEft(self):
|
def clipboardEft(self):
|
||||||
sFit = Fit.getInstance()
|
fit = db.getFit(self.getActiveFit())
|
||||||
toClipboard(sFit.exportFit(self.getActiveFit()))
|
toClipboard(Port.exportEft(fit))
|
||||||
|
|
||||||
def clipboardEftImps(self):
|
def clipboardEftImps(self):
|
||||||
sFit = Fit.getInstance()
|
fit = db.getFit(self.getActiveFit())
|
||||||
toClipboard(sFit.exportEftImps(self.getActiveFit()))
|
toClipboard(Port.exportEftImps(fit))
|
||||||
|
|
||||||
def clipboardDna(self):
|
def clipboardDna(self):
|
||||||
sFit = Fit.getInstance()
|
fit = db.getFit(self.getActiveFit())
|
||||||
toClipboard(sFit.exportDna(self.getActiveFit()))
|
toClipboard(Port.exportDna(fit))
|
||||||
|
|
||||||
def clipboardCrest(self):
|
def clipboardCrest(self):
|
||||||
sFit = Fit.getInstance()
|
fit = db.getFit(self.getActiveFit())
|
||||||
toClipboard(sFit.exportCrest(self.getActiveFit()))
|
toClipboard(Port.exportCrest(fit))
|
||||||
|
|
||||||
def clipboardXml(self):
|
def clipboardXml(self):
|
||||||
sFit = Fit.getInstance()
|
fitIDs = self.getActiveFit()
|
||||||
toClipboard(sFit.exportXml(None, self.getActiveFit()))
|
fits = map(lambda fitID: db.getFit(fitID), fitIDs)
|
||||||
|
toClipboard(Port.exportXml(None, *fits))
|
||||||
|
|
||||||
def clipboardMultiBuy(self):
|
def clipboardMultiBuy(self):
|
||||||
sFit = Fit.getInstance()
|
fit = db.getFit(self.getActiveFit())
|
||||||
toClipboard(sFit.exportMultiBuy(self.getActiveFit()))
|
toClipboard(Port.exportMultiBuy(fit))
|
||||||
|
|
||||||
def importFromClipboard(self, event):
|
def importFromClipboard(self, event):
|
||||||
sFit = Fit.getInstance()
|
sFit = Fit.getInstance()
|
||||||
@@ -786,7 +790,7 @@ class MainFrame(wx.Frame):
|
|||||||
def exportHtml(self, event):
|
def exportHtml(self, event):
|
||||||
from gui.utils.exportHtml import exportHtml
|
from gui.utils.exportHtml import exportHtml
|
||||||
sFit = Fit.getInstance()
|
sFit = Fit.getInstance()
|
||||||
settings = service.settings.HTMLExportSettings.getInstance()
|
settings = HTMLExportSettings.getInstance()
|
||||||
|
|
||||||
max = sFit.countAllFits()
|
max = sFit.countAllFits()
|
||||||
path = settings.getPath()
|
path = settings.getPath()
|
||||||
|
|||||||
@@ -960,33 +960,7 @@ class Fit(object):
|
|||||||
fit.damagePattern = dp
|
fit.damagePattern = dp
|
||||||
self.recalc(fit)
|
self.recalc(fit)
|
||||||
|
|
||||||
# TODO: port this to port.py
|
# TODO: Should move all the backup/import stuff out of here
|
||||||
'''
|
|
||||||
def exportFit(self, fitID):
|
|
||||||
fit = eos.db.getFit(fitID)
|
|
||||||
return Port.exportEft(fit)
|
|
||||||
|
|
||||||
def exportEftImps(self, fitID):
|
|
||||||
fit = eos.db.getFit(fitID)
|
|
||||||
return Port.exportEftImps(fit)
|
|
||||||
|
|
||||||
def exportDna(self, fitID):
|
|
||||||
fit = eos.db.getFit(fitID)
|
|
||||||
return Port.exportDna(fit)
|
|
||||||
|
|
||||||
def exportCrest(self, fitID, callback=None):
|
|
||||||
fit = eos.db.getFit(fitID)
|
|
||||||
return Port.exportCrest(fit, callback)
|
|
||||||
|
|
||||||
def exportXml(self, callback=None, *fitIDs):
|
|
||||||
fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs)
|
|
||||||
return Port.exportXml(callback, *fits)
|
|
||||||
|
|
||||||
def exportMultiBuy(self, fitID):
|
|
||||||
fit = eos.db.getFit(fitID)
|
|
||||||
return Port.exportMultiBuy(fit)
|
|
||||||
'''
|
|
||||||
|
|
||||||
def backupFits(self, path, callback):
|
def backupFits(self, path, callback):
|
||||||
thread = FitBackupThread(path, callback)
|
thread = FitBackupThread(path, callback)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user