diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py
index 35f63769d..c9561ec66 100644
--- a/gui/utils/exportHtml.py
+++ b/gui/utils/exportHtml.py
@@ -10,10 +10,10 @@ class exportHtml():
cls._instance = exportHtml()
return cls._instance
-
+
def __init__(self):
self.thread = exportHtmlThread()
-
+
def refreshFittingHTMl(self):
settings = service.settings.HTMLExportSettings.getInstance()
@@ -23,73 +23,73 @@ class exportHtml():
self.thread.start()
class exportHtmlThread(threading.Thread):
-
+
def __init__(self):
threading.Thread.__init__(self)
self.stopRunning = False
def stop(self):
self.stopRunning = True
-
+
def run(self):
# wait 1 second just in case a lot of modifications get made
time.sleep(1);
- if self.stopRunning:
+ if self.stopRunning:
return;
sMarket = service.Market.getInstance()
sFit = service.Fit.getInstance()
settings = service.settings.HTMLExportSettings.getInstance()
-
+
HTML = """
-
-
-
- My Page
-
+
+
+
+ My Page
+
-
+
-
+
PyFa fits
-
- """
-
+
+ """
+
HTML += '
';
categoryList = [];
self.categoryList = list(sMarket.getShipRoot())
self.categoryList.sort(key=lambda ship: ship.name)
for shipType in self.categoryList:
- ships = sMarket.getShipList(shipType.ID)
- for ship in ships:
- HTMLship = '' + ship.name + '
'
- fits = sFit.getFitsWithShip(ship.ID)
- for fit in fits:
- if self.stopRunning:
- return;
- dnaFit = sFit.exportDna(fit[0])
- HTMLship += "- " + fit[1] + "
"
+ ships = sMarket.getShipList(shipType.ID)
+ for ship in ships:
+ HTMLship = '' + ship.name + '
'
+ fits = sFit.getFitsWithShip(ship.ID)
+ for fit in fits:
+ if self.stopRunning:
+ return;
+ dnaFit = sFit.exportDna(fit[0])
+ HTMLship += "- " + fit[1] + "
"
- HTMLship += "
"
- if len(fits) > 0:
- HTML += HTMLship
+ HTMLship += "
"
+ if len(fits) > 0:
+ HTML += HTMLship
HTML += """
-
+
"""
-
+
try:
FILE = open(settings.getPath(), "w")
- FILE.write(HTML);
+ FILE.write(HTML.encode('utf-8'));
FILE.close();
except IOError:
print "Failed to write to " + settings.getPath()
pass
-
+