Set all strings to be unicode when referencing fit.name. This won't catch all conversion errors, but it should catch most. (#1168)

This commit is contained in:
Ryan Holmes
2017-05-14 20:52:06 -04:00
committed by GitHub
parent a0f5e4cbb3
commit da33a372cb
8 changed files with 10 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ class CommandFits(ContextMenu):
return "Command Fits"
def addFit(self, menu, fit, includeShip=False):
label = fit.name if not includeShip else "({}) {}".format(fit.ship.item.name, fit.name)
label = fit.name if not includeShip else u"({}) {}".format(fit.ship.item.name, fit.name)
id = ContextMenu.nextID()
self.fitMenuItemIds[id] = fit
menuItem = wx.MenuItem(menu, id, label)

View File

@@ -43,7 +43,7 @@ class TabbedFits(ContextMenu):
continue
fit = sFit.getFit(page.activeFitID, basic=True)
id = ContextMenu.nextID()
mitem = wx.MenuItem(rootMenu, id, '{}: {}'.format(fit.ship.item.name, fit.name))
mitem = wx.MenuItem(rootMenu, id, u"{}: {}".format(fit.ship.item.name, fit.name))
bindmenu.Bind(wx.EVT_MENU, self.handleSelection, mitem)
self.fitLookup[id] = fit
m.AppendItem(mitem)

View File

@@ -314,7 +314,7 @@ class FittingView(d.Display):
fit = sFit.getFit(self.getActiveFit(), basic=True)
bitmap = BitmapLoader.getImage("race_%s_small" % fit.ship.item.race, "gui")
text = "%s: %s" % (fit.ship.item.name, fit.name)
text = u"%s: %s" % (fit.ship.item.name, fit.name)
pageIndex = self.parent.GetPageIndex(self)
if pageIndex is not None:

View File

@@ -248,8 +248,8 @@ class GraphFrame(wx.Frame):
self.subplot.plot(x, y)
legend.append(fit.name)
except:
pyfalog.warning("Invalid values in '{0}'", fit.name)
self.SetStatusText("Invalid values in '%s'" % fit.name)
pyfalog.warning(u"Invalid values in '{0}'", fit.name)
self.SetStatusText(u"Invalid values in '%s'" % fit.name)
self.canvas.draw()
return

View File

@@ -411,7 +411,7 @@ class MainFrame(wx.Frame, IPortUser):
""" Export active fit """
sFit = Fit.getInstance()
fit = sFit.getFit(self.getActiveFit())
defaultFile = "%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None
defaultFile = u"%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None
dlg = wx.FileDialog(self, "Save Fitting As...",
wildcard="EVE XML fitting files (*.xml)|*.xml",