MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / __init__

Method __init__

graphs/gui/canvasPanel.py:69–102  ·  view source on GitHub ↗
(self, graphFrame, parent)

Source from the content-addressed store, hash-verified

67class GraphCanvasPanel(wx.Panel):
68
69 def __init__(self, graphFrame, parent):
70 super().__init__(parent)
71 self.graphFrame = graphFrame
72
73 # Remove matplotlib font cache, see #234
74 try:
75 cache_dir = mpl._get_cachedir()
76 except (KeyboardInterrupt, SystemExit):
77 raise
78 except:
79 cache_dir = os.path.expanduser(os.path.join('~', '.matplotlib'))
80 cache_file = os.path.join(cache_dir, 'fontList.cache')
81 if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file):
82 os.remove(cache_file)
83
84 mainSizer = wx.BoxSizer(wx.VERTICAL)
85
86 self.figure = Figure(figsize=(5, 3), tight_layout={'pad': 1.08})
87 rgbtuple = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get()
88 clr = [c / 255. for c in rgbtuple]
89 self.figure.set_facecolor(clr)
90 self.figure.set_edgecolor(clr)
91 self.canvas = Canvas(self, -1, self.figure)
92 self.canvas.SetBackgroundColour(wx.Colour(*rgbtuple))
93 self.canvas.mpl_connect('button_press_event', self.OnMplCanvasClick)
94 self.subplot = self.figure.add_subplot(111)
95 self.subplot.grid(True)
96 mainSizer.Add(self.canvas, 1, wx.EXPAND | wx.ALL, 0)
97
98 self.SetSizer(mainSizer)
99
100 self.xMark = None
101 self.mplOnDragHandler = None
102 self.mplOnReleaseHandler = None
103
104 def draw(self, accurateMarks=True):
105 self.subplot.clear()

Callers

nothing calls this directly

Calls 2

SetBackgroundColourMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected