so many pep8 fixes
(cherry picked from commit bee125d)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,21 +15,24 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import os
|
||||
|
||||
import wx
|
||||
import os
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import gui.display
|
||||
import gui.globalEvents as GE
|
||||
|
||||
from gui.graph import Graph
|
||||
import gui.mainFrame
|
||||
from service.fit import Fit
|
||||
import gui.display
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from gui.graph import Graph
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
|
||||
|
||||
enabled = True
|
||||
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):
|
||||
|
||||
@@ -58,11 +61,11 @@ class GraphFrame(wx.Frame):
|
||||
from matplotlib.figure import Figure
|
||||
enabled = True
|
||||
if mpl.__version__[0] != "1":
|
||||
print "pyfa: Found matplotlib version ",mpl.__version__, " - activating OVER9000 workarounds"
|
||||
print "pyfa: Recommended minimum matplotlib version is 1.0.0"
|
||||
print("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds")
|
||||
print("pyfa: Recommended minimum matplotlib version is 1.0.0")
|
||||
self.legendFix = True
|
||||
except:
|
||||
print "Problems importing matplotlib; continuing without graphs"
|
||||
print("Problems importing matplotlib; continuing without graphs")
|
||||
enabled = False
|
||||
return
|
||||
|
||||
@@ -91,19 +94,19 @@ class GraphFrame(wx.Frame):
|
||||
|
||||
self.figure = Figure(figsize=(4, 3))
|
||||
|
||||
rgbtuple = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ).Get()
|
||||
clr = [c/255. for c in rgbtuple]
|
||||
self.figure.set_facecolor( clr )
|
||||
self.figure.set_edgecolor( clr )
|
||||
rgbtuple = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get()
|
||||
clr = [c / 255. for c in rgbtuple]
|
||||
self.figure.set_facecolor(clr)
|
||||
self.figure.set_edgecolor(clr)
|
||||
|
||||
self.canvas = Canvas(self, -1, self.figure)
|
||||
self.canvas.SetBackgroundColour( wx.Colour( *rgbtuple ) )
|
||||
self.canvas.SetBackgroundColour(wx.Colour(*rgbtuple))
|
||||
|
||||
self.subplot = self.figure.add_subplot(111)
|
||||
self.subplot.grid(True)
|
||||
|
||||
self.mainSizer.Add(self.canvas, 1, wx.EXPAND)
|
||||
self.mainSizer.Add(wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ), 0 , wx.EXPAND)
|
||||
self.mainSizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND)
|
||||
|
||||
self.gridPanel = wx.Panel(self)
|
||||
self.mainSizer.Add(self.gridPanel, 0, wx.EXPAND)
|
||||
@@ -122,8 +125,8 @@ class GraphFrame(wx.Frame):
|
||||
self.graphSelection.SetSelection(0)
|
||||
self.fields = {}
|
||||
self.select(0)
|
||||
self.sl1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
|
||||
self.mainSizer.Add(self.sl1,0, wx.EXPAND)
|
||||
self.sl1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
|
||||
self.mainSizer.Add(self.sl1, 0, wx.EXPAND)
|
||||
self.mainSizer.Add(self.fitList, 0, wx.EXPAND)
|
||||
|
||||
self.fitList.fitList.Bind(wx.EVT_LEFT_DCLICK, self.removeItem)
|
||||
@@ -160,13 +163,13 @@ class GraphFrame(wx.Frame):
|
||||
self.gridPanel.DestroyChildren()
|
||||
self.fields.clear()
|
||||
|
||||
#Setup textboxes
|
||||
# Setup textboxes
|
||||
for field, defaultVal in view.getFields().iteritems():
|
||||
|
||||
textBox = wx.TextCtrl(self.gridPanel, wx.ID_ANY, style=0)
|
||||
self.fields[field] = textBox
|
||||
textBox.Bind(wx.EVT_TEXT, self.onFieldChanged)
|
||||
sizer.Add(textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
|
||||
sizer.Add(textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
|
||||
if defaultVal is not None:
|
||||
if not isinstance(defaultVal, basestring):
|
||||
defaultVal = ("%f" % defaultVal).rstrip("0")
|
||||
@@ -204,7 +207,7 @@ class GraphFrame(wx.Frame):
|
||||
try:
|
||||
success, status = view.getPoints(fit, values)
|
||||
if not success:
|
||||
#TODO: Add a pwetty statys bar to report errors with
|
||||
# TODO: Add a pwetty statys bar to report errors with
|
||||
self.SetStatusText(status)
|
||||
return
|
||||
|
||||
@@ -218,15 +221,15 @@ class GraphFrame(wx.Frame):
|
||||
return
|
||||
|
||||
if self.legendFix and len(legend) > 0:
|
||||
leg = self.subplot.legend(tuple(legend), "upper right" , shadow = False)
|
||||
leg = self.subplot.legend(tuple(legend), "upper right", shadow=False)
|
||||
for t in leg.get_texts():
|
||||
t.set_fontsize('small')
|
||||
|
||||
for l in leg.get_lines():
|
||||
l.set_linewidth(1)
|
||||
|
||||
elif not self.legendFix and len(legend) >0:
|
||||
leg = self.subplot.legend(tuple(legend), "upper right" , shadow = False, frameon = False)
|
||||
elif not self.legendFix and len(legend) > 0:
|
||||
leg = self.subplot.legend(tuple(legend), "upper right", shadow=False, frameon=False)
|
||||
for t in leg.get_texts():
|
||||
t.set_fontsize('small')
|
||||
|
||||
@@ -269,10 +272,10 @@ class FitList(wx.Panel):
|
||||
fitToolTip = wx.ToolTip("Drag a fit into this list to graph it")
|
||||
self.fitList.SetToolTip(fitToolTip)
|
||||
|
||||
|
||||
class FitDisplay(gui.display.Display):
|
||||
DEFAULT_COLS = ["Base Icon",
|
||||
"Base Name"]
|
||||
|
||||
def __init__(self, parent):
|
||||
gui.display.Display.__init__(self, parent)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user